From d8b78116c85d9cd863b3350770f9971d86fcbdc5 Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 15:24:21 +0100 Subject: [PATCH 01/12] tidy up rating algs --- server/pnpm-lock.yaml | 240 +----------------- .../_userID/games/_game/_playtype/router.ts | 9 +- server/src/utils/user.ts | 33 +-- 3 files changed, 20 insertions(+), 262 deletions(-) diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml index 8593b5ff6..ae69896c3 100644 --- a/server/pnpm-lock.yaml +++ b/server/pnpm-lock.yaml @@ -80,7 +80,7 @@ dependencies: rate-limit-redis: 2.1.0 redis: 3.1.2 rimraf: 3.0.2 - tachi-common: github.com/zkldi/tachi-common/2d08b017113980de9d8240586d7acf0690a81662 + tachi-common: github.com/zkldi/tachi-common/79a087c22d6fae0882b42f55e4e8a66535f6c1a9_ts-node@10.0.0+typescript@4.3.2 typescript: 4.3.2 winston: 3.3.3 @@ -126,11 +126,9 @@ packages: resolution: {integrity: sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==} dependencies: '@babel/highlight': 7.14.0 - dev: true /@babel/compat-data/7.14.4: resolution: {integrity: sha512-i2wXrWQNkH6JplJQGn3Rd2I4Pij8GdHkXwHMxm+zV5YG/Jci+bCNrWZEWC4o+umiDkRrRs4dVzH3X4GP7vyjQQ==} - dev: true /@babel/core/7.14.3: resolution: {integrity: sha512-jB5AmTKOCSJIZ72sd78ECEhuPiDMKlQdDI/4QRI6lzYATx5SSogS1oQA2AoPecRCknm30gHi2l+QVvNUu3wZAg==} @@ -153,7 +151,6 @@ packages: source-map: 0.5.7 transitivePeerDependencies: - supports-color - dev: true /@babel/generator/7.14.3: resolution: {integrity: sha512-bn0S6flG/j0xtQdz3hsjJ624h3W0r3llttBMfyHX3YrZ/KtLYr15bjA0FXkgW7FpvrDuTuElXeVjiKlYRpnOFA==} @@ -161,13 +158,11 @@ packages: '@babel/types': 7.14.4 jsesc: 2.5.2 source-map: 0.5.7 - dev: true /@babel/helper-annotate-as-pure/7.12.13: resolution: {integrity: sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw==} dependencies: '@babel/types': 7.14.4 - dev: true /@babel/helper-compilation-targets/7.14.4_@babel+core@7.14.3: resolution: {integrity: sha512-JgdzOYZ/qGaKTVkn5qEDV/SXAh8KcyUVkCoSWGN8T3bwrgd6m+/dJa2kVGi6RJYJgEYPBdZ84BZp9dUjNWkBaA==} @@ -179,7 +174,6 @@ packages: '@babel/helper-validator-option': 7.12.17 browserslist: 4.16.6 semver: 6.3.0 - dev: true /@babel/helper-function-name/7.14.2: resolution: {integrity: sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ==} @@ -187,25 +181,21 @@ packages: '@babel/helper-get-function-arity': 7.12.13 '@babel/template': 7.12.13 '@babel/types': 7.14.4 - dev: true /@babel/helper-get-function-arity/7.12.13: resolution: {integrity: sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==} dependencies: '@babel/types': 7.14.4 - dev: true /@babel/helper-member-expression-to-functions/7.13.12: resolution: {integrity: sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw==} dependencies: '@babel/types': 7.14.4 - dev: true /@babel/helper-module-imports/7.13.12: resolution: {integrity: sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==} dependencies: '@babel/types': 7.14.4 - dev: true /@babel/helper-module-transforms/7.14.2: resolution: {integrity: sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA==} @@ -220,17 +210,14 @@ packages: '@babel/types': 7.14.4 transitivePeerDependencies: - supports-color - dev: true /@babel/helper-optimise-call-expression/7.12.13: resolution: {integrity: sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA==} dependencies: '@babel/types': 7.14.4 - dev: true /@babel/helper-plugin-utils/7.13.0: resolution: {integrity: sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==} - dev: true /@babel/helper-replace-supers/7.14.4: resolution: {integrity: sha512-zZ7uHCWlxfEAAOVDYQpEf/uyi1dmeC7fX4nCf2iz9drnCwi1zvwXL3HwWWNXUQEJ1k23yVn3VbddiI9iJEXaTQ==} @@ -241,27 +228,22 @@ packages: '@babel/types': 7.14.4 transitivePeerDependencies: - supports-color - dev: true /@babel/helper-simple-access/7.13.12: resolution: {integrity: sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==} dependencies: '@babel/types': 7.14.4 - dev: true /@babel/helper-split-export-declaration/7.12.13: resolution: {integrity: sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==} dependencies: '@babel/types': 7.14.4 - dev: true /@babel/helper-validator-identifier/7.14.0: resolution: {integrity: sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==} - dev: true /@babel/helper-validator-option/7.12.17: resolution: {integrity: sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==} - dev: true /@babel/helpers/7.14.0: resolution: {integrity: sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg==} @@ -271,7 +253,6 @@ packages: '@babel/types': 7.14.4 transitivePeerDependencies: - supports-color - dev: true /@babel/highlight/7.14.0: resolution: {integrity: sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==} @@ -279,13 +260,11 @@ packages: '@babel/helper-validator-identifier': 7.14.0 chalk: 2.4.2 js-tokens: 4.0.0 - dev: true /@babel/parser/7.14.4: resolution: {integrity: sha512-ArliyUsWDUqEGfWcmzpGUzNfLxTdTp6WU4IuP6QFSp9gGfWS6boxFCkJSJ/L4+RG8z/FnIU3WxCk6hPL9SSWeA==} engines: {node: '>=6.0.0'} hasBin: true - dev: true /@babel/plugin-proposal-object-rest-spread/7.14.4_@babel+core@7.14.3: resolution: {integrity: sha512-AYosOWBlyyXEagrPRfLJ1enStufsr7D1+ddpj8OLi9k7B6+NdZ0t/9V7Fh+wJ4g2Jol8z2JkgczYqtWrZd4vbA==} @@ -298,7 +277,6 @@ packages: '@babel/helper-plugin-utils': 7.13.0 '@babel/plugin-syntax-object-rest-spread': 7.8.3_@babel+core@7.14.3 '@babel/plugin-transform-parameters': 7.14.2_@babel+core@7.14.3 - dev: true /@babel/plugin-syntax-jsx/7.12.13_@babel+core@7.14.3: resolution: {integrity: sha512-d4HM23Q1K7oq/SLNmG6mRt85l2csmQ0cHRaxRXjKW0YFdEXqlZ5kzFQKH5Uc3rDJECgu+yCRgPkG04Mm98R/1g==} @@ -307,7 +285,6 @@ packages: dependencies: '@babel/core': 7.14.3 '@babel/helper-plugin-utils': 7.13.0 - dev: true /@babel/plugin-syntax-object-rest-spread/7.8.3_@babel+core@7.14.3: resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} @@ -316,7 +293,6 @@ packages: dependencies: '@babel/core': 7.14.3 '@babel/helper-plugin-utils': 7.13.0 - dev: true /@babel/plugin-transform-destructuring/7.14.4_@babel+core@7.14.3: resolution: {integrity: sha512-JyywKreTCGTUsL1OKu1A3ms/R1sTP0WxbpXlALeGzF53eB3bxtNkYdMj9SDgK7g6ImPy76J5oYYKoTtQImlhQA==} @@ -325,7 +301,6 @@ packages: dependencies: '@babel/core': 7.14.3 '@babel/helper-plugin-utils': 7.13.0 - dev: true /@babel/plugin-transform-parameters/7.14.2_@babel+core@7.14.3: resolution: {integrity: sha512-NxoVmA3APNCC1JdMXkdYXuQS+EMdqy0vIwyDHeKHiJKRxmp1qGSdb0JLEIoPRhkx6H/8Qi3RJ3uqOCYw8giy9A==} @@ -334,7 +309,6 @@ packages: dependencies: '@babel/core': 7.14.3 '@babel/helper-plugin-utils': 7.13.0 - dev: true /@babel/plugin-transform-react-jsx/7.14.3_@babel+core@7.14.3: resolution: {integrity: sha512-uuxuoUNVhdgYzERiHHFkE4dWoJx+UFVyuAl0aqN8P2/AKFHwqgUC5w2+4/PjpKXJsFgBlYAFXlUmDQ3k3DUkXw==} @@ -347,7 +321,6 @@ packages: '@babel/helper-plugin-utils': 7.13.0 '@babel/plugin-syntax-jsx': 7.12.13_@babel+core@7.14.3 '@babel/types': 7.14.4 - dev: true /@babel/runtime/7.14.0: resolution: {integrity: sha512-JELkvo/DlpNdJ7dlyw/eY7E0suy5i5GQH+Vlxaq1nsNJ+H7f4Vtv3jMeCEgRhZZQFXTjldYfQgv2qmM6M1v5wA==} @@ -361,7 +334,6 @@ packages: '@babel/code-frame': 7.12.13 '@babel/parser': 7.14.4 '@babel/types': 7.14.4 - dev: true /@babel/traverse/7.14.2: resolution: {integrity: sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA==} @@ -376,14 +348,12 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color - dev: true /@babel/types/7.14.4: resolution: {integrity: sha512-lCj4aIs0xUefJFQnwwQv2Bxg7Omd6bgquZ6LGC+gGMh6/s5qDVfjuCMlDmYQ15SLsWHd9n+X3E75lKIhl5Lkiw==} dependencies: '@babel/helper-validator-identifier': 7.14.0 to-fast-properties: 2.0.0 - dev: true /@dabh/diagnostics/2.0.2: resolution: {integrity: sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==} @@ -419,12 +389,10 @@ packages: get-package-type: 0.1.0 js-yaml: 3.14.1 resolve-from: 5.0.0 - dev: true /@istanbuljs/schema/0.1.3: resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} engines: {node: '>=8'} - dev: true /@mapbox/node-pre-gyp/1.0.5: resolution: {integrity: sha512-4srsKPXWlIxp5Vbqz5uLfBN+du2fJChBoYn/f2h991WLdk7jUvcSk/McVLSv/X+xQIPI8eGD5GjrnygdyHnhPA==} @@ -818,7 +786,6 @@ packages: dependencies: clean-stack: 2.2.0 indent-string: 4.0.0 - dev: true /ajv/6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -827,7 +794,6 @@ packages: fast-json-stable-stringify: 2.1.0 json-schema-traverse: 0.4.1 uri-js: 4.4.1 - dev: true /ajv/8.5.0: resolution: {integrity: sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==} @@ -850,26 +816,22 @@ packages: /ansi-regex/3.0.0: resolution: {integrity: sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=} engines: {node: '>=4'} - dev: true /ansi-regex/5.0.0: resolution: {integrity: sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==} engines: {node: '>=8'} - dev: true /ansi-styles/3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} dependencies: color-convert: 1.9.3 - dev: true /ansi-styles/4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} dependencies: color-convert: 2.0.1 - dev: true /anymatch/3.1.2: resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==} @@ -877,7 +839,6 @@ packages: dependencies: normalize-path: 3.0.0 picomatch: 2.3.0 - dev: true /append-field/1.0.0: resolution: {integrity: sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY=} @@ -888,7 +849,6 @@ packages: engines: {node: '>=8'} dependencies: default-require-extensions: 3.0.0 - dev: true /aproba/1.2.0: resolution: {integrity: sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==} @@ -896,7 +856,6 @@ packages: /archy/1.0.0: resolution: {integrity: sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=} - dev: true /are-we-there-yet/1.1.5: resolution: {integrity: sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==} @@ -913,7 +872,6 @@ packages: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: sprintf-js: 1.0.3 - dev: true /array-flatten/1.1.1: resolution: {integrity: sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=} @@ -948,12 +906,10 @@ packages: resolution: {integrity: sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==} dependencies: safer-buffer: 2.1.2 - dev: true /assert-plus/1.0.0: resolution: {integrity: sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=} engines: {node: '>=0.8'} - dev: true /astral-regex/2.0.0: resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} @@ -963,7 +919,6 @@ packages: /async-hook-domain/2.0.3: resolution: {integrity: sha512-MadiLLDEZRZzZwcm0dgS+K99qXZ4H2saAUwUgwzFulbAkXrKi3AX5FvWS3FFTQtLMwrqcGqAJe6o12KrObejQA==} engines: {node: '>=10'} - dev: true /async/3.2.0: resolution: {integrity: sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==} @@ -971,15 +926,12 @@ packages: /asynckit/0.4.0: resolution: {integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=} - dev: true /aws-sign2/0.7.0: resolution: {integrity: sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=} - dev: true /aws4/1.11.0: resolution: {integrity: sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==} - dev: true /balanced-match/1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -988,7 +940,6 @@ packages: resolution: {integrity: sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=} dependencies: tweetnacl: 0.14.5 - dev: true /bcrypt/5.0.1: resolution: {integrity: sha512-9BTgmrhZM2t1bNuDtrtIMVSmmxZBrJ71n8Wg+YgdjHuIWYF7SjjmCPZFB+/5i/o/PIeRpwVJR3P+NrpIItUjqw==} @@ -1013,12 +964,10 @@ packages: /binary-extensions/2.2.0: resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} engines: {node: '>=8'} - dev: true /bind-obj-methods/3.0.0: resolution: {integrity: sha512-nLEaaz3/sEzNSyPWRsN9HNsqwk1AUyECtGj+XwGdIi3xABnEqecvXtIJ0wehQXuuER5uZ/5fTs2usONgYjG+iw==} engines: {node: '>=10'} - dev: true /bl/2.2.1: resolution: {integrity: sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==} @@ -1054,7 +1003,6 @@ packages: engines: {node: '>=8'} dependencies: fill-range: 7.0.1 - dev: true /browserslist/4.16.6: resolution: {integrity: sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==} @@ -1066,7 +1014,6 @@ packages: electron-to-chromium: 1.3.748 escalade: 3.1.1 node-releases: 1.1.72 - dev: true /bson/1.1.6: resolution: {integrity: sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==} @@ -1097,7 +1044,6 @@ packages: make-dir: 3.1.0 package-hash: 4.0.0 write-file-atomic: 3.0.3 - dev: true /call-bind/1.0.2: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} @@ -1110,19 +1056,16 @@ packages: engines: {node: '>=4'} dependencies: callsites: 2.0.0 - dev: true /caller-path/2.0.0: resolution: {integrity: sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=} engines: {node: '>=4'} dependencies: caller-callsite: 2.0.0 - dev: true /callsites/2.0.0: resolution: {integrity: sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=} engines: {node: '>=4'} - dev: true /callsites/3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} @@ -1132,15 +1075,12 @@ packages: /camelcase/5.3.1: resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} engines: {node: '>=6'} - dev: true /caniuse-lite/1.0.30001234: resolution: {integrity: sha512-a3gjUVKkmwLdNysa1xkUAwN2VfJUJyVW47rsi3aCbkRCtbHAfo+rOsCqVw29G6coQ8gzAPb5XBXwiGHwme3isA==} - dev: true /caseless/0.12.0: resolution: {integrity: sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=} - dev: true /chalk/2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} @@ -1149,7 +1089,6 @@ packages: ansi-styles: 3.2.1 escape-string-regexp: 1.0.5 supports-color: 5.5.0 - dev: true /chalk/4.1.1: resolution: {integrity: sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==} @@ -1172,7 +1111,6 @@ packages: readdirp: 3.5.0 optionalDependencies: fsevents: 2.3.2 - dev: true /chownr/2.0.0: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} @@ -1182,7 +1120,6 @@ packages: /clean-stack/2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} - dev: true /cliui/4.1.0: resolution: {integrity: sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==} @@ -1190,7 +1127,6 @@ packages: string-width: 2.1.1 strip-ansi: 4.0.0 wrap-ansi: 2.1.0 - dev: true /cliui/6.0.0: resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==} @@ -1198,7 +1134,6 @@ packages: string-width: 4.2.2 strip-ansi: 6.0.0 wrap-ansi: 6.2.0 - dev: true /clone/1.0.4: resolution: {integrity: sha1-2jCcwmPfFZlMaIypAheco8fNfH4=} @@ -1219,7 +1154,6 @@ packages: engines: {node: '>=7.0.0'} dependencies: color-name: 1.1.4 - dev: true /color-name/1.1.3: resolution: {integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=} @@ -1237,7 +1171,6 @@ packages: /color-support/1.1.3: resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} hasBin: true - dev: true /color/3.0.0: resolution: {integrity: sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==} @@ -1248,7 +1181,6 @@ packages: /colorette/1.2.2: resolution: {integrity: sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==} - dev: true /colors/1.4.0: resolution: {integrity: sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==} @@ -1267,7 +1199,6 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 - dev: true /commander/7.2.0: resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==} @@ -1276,7 +1207,6 @@ packages: /commondir/1.0.1: resolution: {integrity: sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=} - dev: true /component-emitter/1.3.0: resolution: {integrity: sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==} @@ -1320,7 +1250,6 @@ packages: resolution: {integrity: sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==} dependencies: safe-buffer: 5.1.2 - dev: true /cookie-signature/1.0.6: resolution: {integrity: sha1-4wOogrNCzD7oylE6eZmXNNqzriw=} @@ -1353,7 +1282,6 @@ packages: log-driver: 1.2.7 minimist: 1.2.5 request: 2.88.2 - dev: true /create-require/1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} @@ -1366,7 +1294,6 @@ packages: path-key: 3.1.1 shebang-command: 2.0.0 which: 2.0.2 - dev: true /csv-parse/4.15.4: resolution: {integrity: sha512-OdBbFc0yZhOm17lSxqkirrHlFFVpKRT0wp4DAGoJelsP3LbGzV9LNr7XmM/lrr0uGkCtaqac9UhP8PDHXOAbMg==} @@ -1377,7 +1304,6 @@ packages: engines: {node: '>=0.10'} dependencies: assert-plus: 1.0.0 - dev: true /debug/2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} @@ -1404,7 +1330,6 @@ packages: /decamelize/1.2.0: resolution: {integrity: sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=} engines: {node: '>=0.10.0'} - dev: true /deep-is/0.1.3: resolution: {integrity: sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=} @@ -1420,7 +1345,6 @@ packages: engines: {node: '>=8'} dependencies: strip-bom: 4.0.0 - dev: true /defaults/1.0.3: resolution: {integrity: sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=} @@ -1437,7 +1361,6 @@ packages: /delayed-stream/1.0.0: resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=} engines: {node: '>=0.4.0'} - dev: true /delegates/1.0.0: resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=} @@ -1478,7 +1401,6 @@ packages: /diff/4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} - dev: true /dir-glob/3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} @@ -1515,7 +1437,6 @@ packages: dependencies: jsbn: 0.1.1 safer-buffer: 2.1.2 - dev: true /ee-first/1.1.1: resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} @@ -1523,11 +1444,9 @@ packages: /electron-to-chromium/1.3.748: resolution: {integrity: sha512-fmIKfYALVeEybk/L2ucdgt7jN3JsbGtg3K9pmF/MRWgkeADBI1VSAa5IzdG2gZwTxsnsrFtdMpOTSM5mrBRKVQ==} - dev: true /emoji-regex/8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - dev: true /enabled/2.0.0: resolution: {integrity: sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==} @@ -1582,12 +1501,10 @@ packages: /es6-error/4.1.1: resolution: {integrity: sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==} - dev: true /escalade/3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} - dev: true /escape-html/1.0.3: resolution: {integrity: sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=} @@ -1596,12 +1513,10 @@ packages: /escape-string-regexp/1.0.5: resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=} engines: {node: '>=0.8.0'} - dev: true /escape-string-regexp/2.0.0: resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} engines: {node: '>=8'} - dev: true /escape-string-regexp/4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} @@ -1769,7 +1684,6 @@ packages: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} hasBin: true - dev: true /esquery/1.4.0: resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} @@ -1807,7 +1721,6 @@ packages: /events-to-array/1.1.2: resolution: {integrity: sha1-LUH1Y+H+QA7Uli/hpNXGp1Od9/Y=} - dev: true /express-async-errors/3.1.1_express@4.17.1: resolution: {integrity: sha512-h6aK1da4tpqWSbyCa3FxB/V6Ehd4EEB15zyQq9qe75OZBp0krinNKuH4rAY+S/U/2I36vdLAUFSjQJ+TFmODng==} @@ -1879,16 +1792,13 @@ packages: /extend/3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} - dev: true /extsprintf/1.3.0: resolution: {integrity: sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=} engines: {'0': node >=0.6.0} - dev: true /fast-deep-equal/3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - dev: true /fast-diff/1.2.0: resolution: {integrity: sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==} @@ -1912,7 +1822,6 @@ packages: /fast-json-stable-stringify/2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - dev: true /fast-levenshtein/2.0.6: resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=} @@ -1948,7 +1857,6 @@ packages: engines: {node: '>=8'} dependencies: to-regex-range: 5.0.1 - dev: true /finalhandler/1.1.2: resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} @@ -1970,7 +1878,6 @@ packages: commondir: 1.0.1 make-dir: 3.1.0 pkg-dir: 4.2.0 - dev: true /find-up/2.1.0: resolution: {integrity: sha1-RdG35QbHF93UgndaK3eSCjwMV6c=} @@ -1985,11 +1892,9 @@ packages: dependencies: locate-path: 5.0.0 path-exists: 4.0.0 - dev: true /findit/2.0.0: resolution: {integrity: sha1-ZQnwEmr0wXhVHPqZOU4DLhOk1W4=} - dev: true /flat-cache/3.0.4: resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==} @@ -2013,11 +1918,9 @@ packages: dependencies: cross-spawn: 7.0.3 signal-exit: 3.0.3 - dev: true /forever-agent/0.6.1: resolution: {integrity: sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=} - dev: true /form-data/2.3.3: resolution: {integrity: sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==} @@ -2026,7 +1929,6 @@ packages: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.31 - dev: true /form-data/3.0.1: resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} @@ -2052,11 +1954,9 @@ packages: /fromentries/1.3.2: resolution: {integrity: sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==} - dev: true /fs-exists-cached/1.0.0: resolution: {integrity: sha1-zyVVTKBQ3EmuZla0HeQiWJidy84=} - dev: true /fs-minipass/2.1.0: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} @@ -2072,7 +1972,6 @@ packages: resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] - dev: true optional: true /function-bind/1.1.1: @@ -2080,7 +1979,6 @@ packages: /function-loop/2.0.1: resolution: {integrity: sha512-ktIR+O6i/4h+j/ZhZJNdzeI4i9lEPeEK6UPR2EVyTVBqOwcU3Za9xYKLH64ZR9HmcROyRrOkizNyjjtWJzDDkQ==} - dev: true /functional-red-black-tree/1.0.1: resolution: {integrity: sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=} @@ -2102,12 +2000,10 @@ packages: /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} - dev: true /get-caller-file/2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} - dev: true /get-intrinsic/1.1.1: resolution: {integrity: sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==} @@ -2119,20 +2015,17 @@ packages: /get-package-type/0.1.0: resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} engines: {node: '>=8.0.0'} - dev: true /getpass/0.1.7: resolution: {integrity: sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=} dependencies: assert-plus: 1.0.0 - dev: true /glob-parent/5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} dependencies: is-glob: 4.0.1 - dev: true /glob/7.1.7: resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} @@ -2147,7 +2040,6 @@ packages: /globals/11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} - dev: true /globals/12.4.0: resolution: {integrity: sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==} @@ -2177,12 +2069,10 @@ packages: /graceful-fs/4.2.6: resolution: {integrity: sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==} - dev: true /har-schema/2.0.0: resolution: {integrity: sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=} engines: {node: '>=4'} - dev: true /har-validator/5.1.5: resolution: {integrity: sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==} @@ -2191,7 +2081,6 @@ packages: dependencies: ajv: 6.12.6 har-schema: 2.0.0 - dev: true /has-bigints/1.0.1: resolution: {integrity: sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==} @@ -2199,12 +2088,10 @@ packages: /has-flag/3.0.0: resolution: {integrity: sha1-tdRU3CGZriJWmfNGfloH87lVuv0=} engines: {node: '>=4'} - dev: true /has-flag/4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} - dev: true /has-symbols/1.0.2: resolution: {integrity: sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==} @@ -2226,7 +2113,6 @@ packages: dependencies: is-stream: 2.0.0 type-fest: 0.8.1 - dev: true /hosted-git-info/2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} @@ -2234,7 +2120,6 @@ packages: /html-escaper/2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} - dev: true /http-errors/1.7.2: resolution: {integrity: sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==} @@ -2265,7 +2150,6 @@ packages: assert-plus: 1.0.0 jsprim: 1.4.1 sshpk: 1.16.1 - dev: true /https-proxy-agent/5.0.0: resolution: {integrity: sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==} @@ -2317,17 +2201,14 @@ packages: rimraf: 3.0.2 transitivePeerDependencies: - supports-color - dev: true /imurmurhash/0.1.4: resolution: {integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o=} engines: {node: '>=0.8.19'} - dev: true /indent-string/4.0.0: resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} engines: {node: '>=8'} - dev: true /inflight/1.0.6: resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=} @@ -2363,7 +2244,6 @@ packages: engines: {node: '>=8'} dependencies: binary-extensions: 2.2.0 - dev: true /is-boolean-object/1.1.1: resolution: {integrity: sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng==} @@ -2388,7 +2268,6 @@ packages: /is-extglob/2.1.1: resolution: {integrity: sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=} engines: {node: '>=0.10.0'} - dev: true /is-fullwidth-code-point/1.0.0: resolution: {integrity: sha1-754xOG8DGn8NZDr4L95QxFfvAMs=} @@ -2399,19 +2278,16 @@ packages: /is-fullwidth-code-point/2.0.0: resolution: {integrity: sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=} engines: {node: '>=4'} - dev: true /is-fullwidth-code-point/3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} - dev: true /is-glob/4.0.1: resolution: {integrity: sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==} engines: {node: '>=0.10.0'} dependencies: is-extglob: 2.1.1 - dev: true /is-negative-zero/2.0.1: resolution: {integrity: sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==} @@ -2424,7 +2300,6 @@ packages: /is-number/7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} - dev: true /is-regex/1.1.3: resolution: {integrity: sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==} @@ -2449,12 +2324,10 @@ packages: /is-typedarray/1.0.0: resolution: {integrity: sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=} - dev: true /is-windows/1.0.2: resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} engines: {node: '>=0.10.0'} - dev: true /isarray/0.0.1: resolution: {integrity: sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=} @@ -2466,23 +2339,19 @@ packages: /isexe/2.0.0: resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} - dev: true /isstream/0.1.2: resolution: {integrity: sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=} - dev: true /istanbul-lib-coverage/3.0.0: resolution: {integrity: sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==} engines: {node: '>=8'} - dev: true /istanbul-lib-hook/3.0.0: resolution: {integrity: sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==} engines: {node: '>=8'} dependencies: append-transform: 2.0.0 - dev: true /istanbul-lib-instrument/4.0.3: resolution: {integrity: sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==} @@ -2494,7 +2363,6 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color - dev: true /istanbul-lib-processinfo/2.0.2: resolution: {integrity: sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==} @@ -2507,7 +2375,6 @@ packages: p-map: 3.0.0 rimraf: 3.0.2 uuid: 3.4.0 - dev: true /istanbul-lib-report/3.0.0: resolution: {integrity: sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==} @@ -2516,7 +2383,6 @@ packages: istanbul-lib-coverage: 3.0.0 make-dir: 3.1.0 supports-color: 7.2.0 - dev: true /istanbul-lib-source-maps/4.0.0: resolution: {integrity: sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==} @@ -2527,7 +2393,6 @@ packages: source-map: 0.6.1 transitivePeerDependencies: - supports-color - dev: true /istanbul-reports/3.0.2: resolution: {integrity: sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==} @@ -2535,18 +2400,15 @@ packages: dependencies: html-escaper: 2.0.2 istanbul-lib-report: 3.0.0 - dev: true /jackspeak/1.4.0: resolution: {integrity: sha512-VDcSunT+wcccoG46FtzuBAyQKlzhHjli4q31e1fIHGOsRspqNUFjVzGb+7eIFDlTvqLygxapDHPHS0ouT2o/tw==} engines: {node: '>=8'} dependencies: cliui: 4.1.0 - dev: true /js-tokens/4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - dev: true /js-yaml/3.14.1: resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} @@ -2554,17 +2416,14 @@ packages: dependencies: argparse: 1.0.10 esprima: 4.0.1 - dev: true /jsbn/0.1.1: resolution: {integrity: sha1-peZUwuWi3rXyAdls77yoDA7y9RM=} - dev: true /jsesc/2.5.2: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} engines: {node: '>=4'} hasBin: true - dev: true /json-parse-better-errors/1.0.2: resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==} @@ -2572,7 +2431,6 @@ packages: /json-schema-traverse/0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} - dev: true /json-schema-traverse/1.0.0: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} @@ -2580,7 +2438,6 @@ packages: /json-schema/0.2.3: resolution: {integrity: sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=} - dev: true /json-stable-stringify-without-jsonify/1.0.1: resolution: {integrity: sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=} @@ -2588,7 +2445,6 @@ packages: /json-stringify-safe/5.0.1: resolution: {integrity: sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=} - dev: true /json5/1.0.1: resolution: {integrity: sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==} @@ -2612,7 +2468,6 @@ packages: extsprintf: 1.3.0 json-schema: 0.2.3 verror: 1.10.0 - dev: true /kuler/2.0.0: resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==} @@ -2621,7 +2476,6 @@ packages: /lcov-parse/1.0.0: resolution: {integrity: sha1-6w1GtUER68VhrLTECO+TY73I9+A=} hasBin: true - dev: true /levn/0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} @@ -2649,7 +2503,6 @@ packages: tcompare: 5.0.6 trivial-deferred: 1.0.1 yapool: 1.0.0 - dev: true /load-json-file/4.0.0: resolution: {integrity: sha1-L19Fq5HjMhYjT9U62rZo607AmTs=} @@ -2674,7 +2527,6 @@ packages: engines: {node: '>=8'} dependencies: p-locate: 4.1.0 - dev: true /lodash.clonedeep/4.5.0: resolution: {integrity: sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=} @@ -2682,7 +2534,6 @@ packages: /lodash.flattendeep/4.4.0: resolution: {integrity: sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=} - dev: true /lodash.merge/4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} @@ -2699,7 +2550,6 @@ packages: /log-driver/1.2.7: resolution: {integrity: sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==} engines: {node: '>=0.8.6'} - dev: true /logform/2.2.0: resolution: {integrity: sha512-N0qPlqfypFx7UHNn4B3lzS/b0uLqt2hmuoa+PpuXNYgozdJYAyauF5Ky0BWVjrxDlMWiT3qN4zPq3vVAfZy7Yg==} @@ -2716,7 +2566,6 @@ packages: hasBin: true dependencies: js-tokens: 4.0.0 - dev: true /lru-cache/6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} @@ -2962,11 +2811,9 @@ packages: engines: {node: '>=8'} dependencies: process-on-spawn: 1.0.0 - dev: true /node-releases/1.1.72: resolution: {integrity: sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw==} - dev: true /nopt/5.0.0: resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} @@ -2988,7 +2835,6 @@ packages: /normalize-path/3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} - dev: true /npmlog/4.1.2: resolution: {integrity: sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==} @@ -3037,11 +2883,9 @@ packages: yargs: 15.4.1 transitivePeerDependencies: - supports-color - dev: true /oauth-sign/0.9.0: resolution: {integrity: sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==} - dev: true /object-assign/4.1.1: resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=} @@ -3106,7 +2950,6 @@ packages: /opener/1.5.2: resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==} hasBin: true - dev: true /optionator/0.9.1: resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} @@ -3124,11 +2967,9 @@ packages: resolution: {integrity: sha512-y8qULRbRAlL6x2+M0vIe7jJbJx/kmUTzYonRAa2ayesR2qWLswninkVyeJe4x3IEXhdgoNodzjQRKAoEs6Fmrw==} dependencies: own-or: 1.0.0 - dev: true /own-or/1.0.0: resolution: {integrity: sha1-Tod/vtqaLsgAD7wLyuOWRe6L+Nw=} - dev: true /p-finally/1.0.0: resolution: {integrity: sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=} @@ -3147,7 +2988,6 @@ packages: engines: {node: '>=6'} dependencies: p-try: 2.2.0 - dev: true /p-locate/2.0.0: resolution: {integrity: sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=} @@ -3161,14 +3001,12 @@ packages: engines: {node: '>=8'} dependencies: p-limit: 2.3.0 - dev: true /p-map/3.0.0: resolution: {integrity: sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==} engines: {node: '>=8'} dependencies: aggregate-error: 3.1.0 - dev: true /p-try/1.0.0: resolution: {integrity: sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=} @@ -3178,7 +3016,6 @@ packages: /p-try/2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} - dev: true /package-hash/4.0.0: resolution: {integrity: sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==} @@ -3188,7 +3025,6 @@ packages: hasha: 5.2.2 lodash.flattendeep: 4.4.0 release-zalgo: 1.0.0 - dev: true /parent-module/1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} @@ -3217,7 +3053,6 @@ packages: /path-exists/4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} - dev: true /path-is-absolute/1.0.1: resolution: {integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=} @@ -3226,7 +3061,6 @@ packages: /path-key/3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} - dev: true /path-parse/1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} @@ -3250,12 +3084,10 @@ packages: /performance-now/2.1.0: resolution: {integrity: sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=} - dev: true /picomatch/2.3.0: resolution: {integrity: sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==} engines: {node: '>=8.6'} - dev: true /pify/3.0.0: resolution: {integrity: sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=} @@ -3274,7 +3106,6 @@ packages: engines: {node: '>=8'} dependencies: find-up: 4.1.0 - dev: true /pkg-up/2.0.0: resolution: {integrity: sha1-yBmscoBZpGHKscOImivjxJoATX8=} @@ -3310,7 +3141,6 @@ packages: engines: {node: '>=8'} dependencies: fromentries: 1.3.2 - dev: true /progress/2.0.3: resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} @@ -3331,7 +3161,6 @@ packages: loose-envify: 1.4.0 object-assign: 4.1.1 react-is: 16.13.1 - dev: true /proxy-addr/2.0.7: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} @@ -3347,12 +3176,10 @@ packages: /psl/1.8.0: resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==} - dev: true /punycode/2.1.1: resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} engines: {node: '>=6'} - dev: true /qs/6.10.1: resolution: {integrity: sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==} @@ -3364,7 +3191,6 @@ packages: /qs/6.5.2: resolution: {integrity: sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==} engines: {node: '>=0.6'} - dev: true /qs/6.7.0: resolution: {integrity: sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==} @@ -3403,7 +3229,6 @@ packages: /react-is/16.13.1: resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} - dev: true /react/16.14.0: resolution: {integrity: sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==} @@ -3412,7 +3237,6 @@ packages: loose-envify: 1.4.0 object-assign: 4.1.1 prop-types: 15.7.2 - dev: true /read-pkg-up/3.0.0: resolution: {integrity: sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=} @@ -3465,7 +3289,6 @@ packages: engines: {node: '>=8.10.0'} dependencies: picomatch: 2.3.0 - dev: true /redis-commands/1.7.0: resolution: {integrity: sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==} @@ -3521,7 +3344,6 @@ packages: engines: {node: '>=4'} dependencies: es6-error: 4.1.1 - dev: true /request/2.88.2: resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==} @@ -3548,12 +3370,10 @@ packages: tough-cookie: 2.5.0 tunnel-agent: 0.6.0 uuid: 3.4.0 - dev: true /require-directory/2.1.1: resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=} engines: {node: '>=0.10.0'} - dev: true /require-from-string/2.0.2: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} @@ -3562,7 +3382,6 @@ packages: /require-main-filename/2.0.0: resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==} - dev: true /require_optional/1.0.1: resolution: {integrity: sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==} @@ -3579,7 +3398,6 @@ packages: /resolve-from/3.0.0: resolution: {integrity: sha1-six699nWiBvItuZTM17rywoYh0g=} engines: {node: '>=4'} - dev: true /resolve-from/4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} @@ -3589,7 +3407,6 @@ packages: /resolve-from/5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} - dev: true /resolve/1.20.0: resolution: {integrity: sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==} @@ -3688,12 +3505,10 @@ packages: engines: {node: '>=8'} dependencies: shebang-regex: 3.0.0 - dev: true /shebang-regex/3.0.0: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - dev: true /side-channel/1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} @@ -3735,17 +3550,14 @@ packages: dependencies: buffer-from: 1.1.1 source-map: 0.6.1 - dev: true /source-map/0.5.7: resolution: {integrity: sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=} engines: {node: '>=0.10.0'} - dev: true /source-map/0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} - dev: true /sparse-bitfield/3.0.3: resolution: {integrity: sha1-/0rm5oZWBWuks+eSqzM004JzyhE=} @@ -3764,7 +3576,6 @@ packages: rimraf: 3.0.2 signal-exit: 3.0.3 which: 2.0.2 - dev: true /spdx-correct/3.1.1: resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==} @@ -3790,7 +3601,6 @@ packages: /sprintf-js/1.0.3: resolution: {integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=} - dev: true /sshpk/1.16.1: resolution: {integrity: sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==} @@ -3806,7 +3616,6 @@ packages: jsbn: 0.1.1 safer-buffer: 2.1.2 tweetnacl: 0.14.5 - dev: true /stack-trace/0.0.10: resolution: {integrity: sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=} @@ -3817,7 +3626,6 @@ packages: engines: {node: '>=10'} dependencies: escape-string-regexp: 2.0.0 - dev: true /stackback/0.0.2: resolution: {integrity: sha1-Gsig2Ug4SNFpXkGLbQMaPDzmjjs=} @@ -3847,7 +3655,6 @@ packages: dependencies: is-fullwidth-code-point: 2.0.0 strip-ansi: 4.0.0 - dev: true /string-width/4.2.2: resolution: {integrity: sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==} @@ -3856,7 +3663,6 @@ packages: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.0 - dev: true /string.prototype.trimend/1.0.4: resolution: {integrity: sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==} @@ -3896,14 +3702,12 @@ packages: engines: {node: '>=4'} dependencies: ansi-regex: 3.0.0 - dev: true /strip-ansi/6.0.0: resolution: {integrity: sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==} engines: {node: '>=8'} dependencies: ansi-regex: 5.0.0 - dev: true /strip-bom/3.0.0: resolution: {integrity: sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=} @@ -3913,7 +3717,6 @@ packages: /strip-bom/4.0.0: resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} engines: {node: '>=8'} - dev: true /strip-json-comments/3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} @@ -3954,14 +3757,12 @@ packages: engines: {node: '>=4'} dependencies: has-flag: 3.0.0 - dev: true /supports-color/7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} dependencies: has-flag: 4.0.0 - dev: true /table/6.7.1: resolution: {integrity: sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==} @@ -3990,7 +3791,6 @@ packages: unicode-length: 2.0.2 transitivePeerDependencies: - supports-color - dev: true /tap-parser/10.1.0: resolution: {integrity: sha512-FujQeciDaOiOvaIVGS1Rpb0v4R6XkOjvWCWowlz5oKuhPkEJ8U6pxgqt38xuzYhPt8dWEnfHn2jqpZdJEkW7pA==} @@ -4000,13 +3800,11 @@ packages: events-to-array: 1.1.2 minipass: 3.1.3 tap-yaml: 1.0.0 - dev: true /tap-yaml/1.0.0: resolution: {integrity: sha512-Rxbx4EnrWkYk0/ztcm5u3/VznbyFJpyXO12dDBHKWiDVxy7O2Qw6MRrwO5H6Ww0U5YhRY/4C/VzWmFPhBQc4qQ==} dependencies: yaml: 1.10.2 - dev: true /tap/15.0.9_ts-node@10.0.0+typescript@4.3.2: resolution: {integrity: sha512-bqY5SxEqYKRd37PIUfKBf9HMs/hklyl/fGXkuStr9rYTIGa0/icpSLsm6IVOmx2qT0/TliPNJ6OvS5kddJYHdg==} @@ -4052,7 +3850,6 @@ packages: which: 2.0.2 transitivePeerDependencies: - supports-color - dev: true bundledDependencies: - ink - treport @@ -4075,7 +3872,6 @@ packages: engines: {node: '>=10'} dependencies: diff: 4.0.2 - dev: true /test-exclude/6.0.0: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} @@ -4084,7 +3880,6 @@ packages: '@istanbuljs/schema': 0.1.3 glob: 7.1.7 minimatch: 3.0.4 - dev: true /text-hex/1.0.0: resolution: {integrity: sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==} @@ -4097,14 +3892,12 @@ packages: /to-fast-properties/2.0.0: resolution: {integrity: sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=} engines: {node: '>=4'} - dev: true /to-regex-range/5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} dependencies: is-number: 7.0.0 - dev: true /toidentifier/1.0.0: resolution: {integrity: sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==} @@ -4117,7 +3910,6 @@ packages: dependencies: psl: 1.8.0 punycode: 2.1.1 - dev: true /triple-beam/1.3.0: resolution: {integrity: sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==} @@ -4125,7 +3917,6 @@ packages: /trivial-deferred/1.0.1: resolution: {integrity: sha1-N21NKdlR1jaKb3oK6FwvTV4GWPM=} - dev: true /ts-node/10.0.0_4188109388a02e43abe22b47ebba7a11: resolution: {integrity: sha512-ROWeOIUvfFbPZkoDis0L/55Fk+6gFQNZwwKPLinacRl6tsxstTF1DbAcLKkovwnpKMVvOMHP1TIbnwXwtLg1gg==} @@ -4183,11 +3974,9 @@ packages: resolution: {integrity: sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=} dependencies: safe-buffer: 5.2.1 - dev: true /tweetnacl/0.14.5: resolution: {integrity: sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=} - dev: true /type-check/0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} @@ -4204,7 +3993,6 @@ packages: /type-fest/0.8.1: resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} engines: {node: '>=8'} - dev: true /type-is/1.6.18: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} @@ -4217,7 +4005,6 @@ packages: resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==} dependencies: is-typedarray: 1.0.0 - dev: true /typedarray/0.0.6: resolution: {integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=} @@ -4249,7 +4036,6 @@ packages: dependencies: punycode: 2.1.1 strip-ansi: 3.0.1 - dev: true /unpipe/1.0.0: resolution: {integrity: sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=} @@ -4260,7 +4046,6 @@ packages: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: punycode: 2.1.1 - dev: true /util-deprecate/1.0.2: resolution: {integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=} @@ -4274,7 +4059,6 @@ packages: resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. hasBin: true - dev: true /v8-compile-cache/2.3.0: resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==} @@ -4299,7 +4083,6 @@ packages: assert-plus: 1.0.0 core-util-is: 1.0.2 extsprintf: 1.3.0 - dev: true /which-boxed-primitive/1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} @@ -4312,7 +4095,6 @@ packages: /which-module/2.0.0: resolution: {integrity: sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=} - dev: true /which/2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} @@ -4320,7 +4102,6 @@ packages: hasBin: true dependencies: isexe: 2.0.0 - dev: true /why-is-node-running/2.2.0: resolution: {integrity: sha512-rxtN9D0lJaYyP92BR5yoyWecK2txBKmBIuS7GRbOPP5bXsT37/hBqcmTrlrt25DBr9p4WJb6c9LuYSJd89vHRQ==} @@ -4371,7 +4152,6 @@ packages: dependencies: string-width: 1.0.2 strip-ansi: 3.0.1 - dev: true /wrap-ansi/6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} @@ -4380,7 +4160,6 @@ packages: ansi-styles: 4.3.0 string-width: 4.2.2 strip-ansi: 6.0.0 - dev: true /wrappy/1.0.2: resolution: {integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=} @@ -4392,7 +4171,6 @@ packages: is-typedarray: 1.0.0 signal-exit: 3.0.3 typedarray-to-buffer: 3.1.5 - dev: true /xtend/4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} @@ -4401,7 +4179,6 @@ packages: /y18n/4.0.3: resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} - dev: true /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} @@ -4409,11 +4186,9 @@ packages: /yaml/1.10.2: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} - dev: true /yapool/1.0.0: resolution: {integrity: sha1-9pPymjFbUNmp2iZGp6ZkXJaYW2o=} - dev: true /yargs-parser/18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} @@ -4421,7 +4196,6 @@ packages: dependencies: camelcase: 5.3.1 decamelize: 1.2.0 - dev: true /yargs/15.4.1: resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==} @@ -4438,25 +4212,29 @@ packages: which-module: 2.0.0 y18n: 4.0.3 yargs-parser: 18.1.3 - dev: true /yn/3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} dev: true - github.com/zkldi/tachi-common/2d08b017113980de9d8240586d7acf0690a81662: - resolution: {tarball: https://codeload.github.com/zkldi/tachi-common/tar.gz/2d08b017113980de9d8240586d7acf0690a81662} - name: kamaitachi-common + github.com/zkldi/tachi-common/79a087c22d6fae0882b42f55e4e8a66535f6c1a9_ts-node@10.0.0+typescript@4.3.2: + resolution: {tarball: https://codeload.github.com/zkldi/tachi-common/tar.gz/79a087c22d6fae0882b42f55e4e8a66535f6c1a9} + id: github.com/zkldi/tachi-common/79a087c22d6fae0882b42f55e4e8a66535f6c1a9 + name: tachi-common version: 0.1.0 dependencies: monk: 7.3.4 + tap: 15.0.9_ts-node@10.0.0+typescript@4.3.2 transitivePeerDependencies: - aws4 - bson-ext + - flow-remove-types - kerberos - mongodb-client-encryption - mongodb-extjson - snappy - supports-color + - ts-node + - typescript dev: false diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts index eea3d7194..36f507a8d 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts @@ -9,13 +9,12 @@ import { } from "../../../../../../../../../utils/user"; import { CheckUserPlayedGamePlaytype } from "./middleware"; import { FilterQuery } from "mongodb"; -import { UserGoalDocument, UserMilestoneDocument } from "tachi-common"; +import { UserGoalDocument, UserMilestoneDocument, GetGamePTConfig } from "tachi-common"; import { SearchGameSongsAndCharts, SearchSessions, } from "../../../../../../../../../lib/search/search"; import { FilterChartsAndSongs } from "../../../../../../../../../utils/scores"; - const router: Router = Router({ mergeParams: true }); router.use(CheckUserPlayedGamePlaytype); @@ -298,6 +297,7 @@ router.get("/pbs/best", async (req, res) => { const user = req[SYMBOL_TachiData]!.requestedUser!; const game = req[SYMBOL_TachiData]!.game!; const playtype = req[SYMBOL_TachiData]!.playtype!; + const gptConfig = GetGamePTConfig(game, playtype); const pbs = await db["personal-bests"].find( { @@ -309,7 +309,7 @@ router.get("/pbs/best", async (req, res) => { { limit: 100, sort: { - [`calculatedData.${GetDefaultScoreRatingAlg(game, playtype)}`]: -1, + [`calculatedData.${gptConfig.defaultScoreRatingAlg}`]: -1, }, } ); @@ -365,6 +365,7 @@ router.get("/sessions/best", async (req, res) => { const user = req[SYMBOL_TachiData]!.requestedUser!; const game = req[SYMBOL_TachiData]!.game!; const playtype = req[SYMBOL_TachiData]!.playtype!; + const gptConfig = GetGamePTConfig(game, playtype); const sessions = await db.sessions.find( { @@ -375,7 +376,7 @@ router.get("/sessions/best", async (req, res) => { { limit: 100, sort: { - [`calculatedData.${GetDefaultSessionRatingAlg(game, playtype)}`]: -1, + [`calculatedData.${gptConfig.defaultSessionRatingAlg}`]: -1, }, } ); diff --git a/server/src/utils/user.ts b/server/src/utils/user.ts index 49ab1e03c..bef24f007 100644 --- a/server/src/utils/user.ts +++ b/server/src/utils/user.ts @@ -1,13 +1,7 @@ -import { integer, PublicUserDocument, UserGameStats, Game, Playtypes } from "tachi-common"; +import { integer, PublicUserDocument, UserGameStats, GetGamePTConfig } from "tachi-common"; import { FindOneResult } from "monk"; import db from "../external/mongo/db"; import CreateLogCtx from "../lib/logger/logger"; -import { - defaultRatingAlgorithm, - defaultScoreRatingAlgorithm, - defaultSessionRatingAlgorithm, -} from "tachi-common/js/config"; - const logger = CreateLogCtx(__filename); const OMIT_PRIVATE_USER_RETURNS = { @@ -144,25 +138,8 @@ export function FormatUserDoc(userdoc: PublicUserDocument) { return `${userdoc.username} (#${userdoc.id})`; } -// temp function, to be removed with #186 -export function GetDefaultProfileRatingAlg(game: Game, playtype: Playtypes[Game]) { - // @ts-expect-error garbage... - return defaultRatingAlgorithm[game][playtype]; -} - -// temp function, to be removed with #186 -export function GetDefaultScoreRatingAlg(game: Game, playtype: Playtypes[Game]) { - // @ts-expect-error garbage... - return defaultScoreRatingAlgorithm[game][playtype]; -} - -export function GetDefaultSessionRatingAlg(game: Game, playtype: Playtypes[Game]) { - // @ts-expect-error garbage... - return defaultSessionRatingAlgorithm[game][playtype]; -} - export async function GetUsersRanking(stats: UserGameStats) { - const ratingKey = GetDefaultProfileRatingAlg(stats.game, stats.playtype); + const gptConfig = GetGamePTConfig(stats.game, stats.playtype); const aggRes = await db["game-stats"].aggregate([ { @@ -179,8 +156,10 @@ export async function GetUsersRanking(stats: UserGameStats) { $sum: { $cond: { if: { - // @ts-expect-error garbage... - $gte: [`$ratings.${ratingKey}`, stats.ratings[ratingKey]], + $gte: [ + `$ratings.${gptConfig.defaultProfileRatingAlg}`, + stats.ratings[gptConfig.defaultProfileRatingAlg], + ], }, then: 1, else: 0, From cb8300b7ca7c49e23734e2ab5e5ab34b9c67ff67 Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 15:32:51 +0100 Subject: [PATCH 02/12] fix goal config stuff --- server/src/external/mongo/schemas.ts | 8 ------- server/src/lib/achievables/goals.ts | 21 ++++++++++++++----- .../_userID/games/_game/_playtype/router.ts | 6 +----- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/server/src/external/mongo/schemas.ts b/server/src/external/mongo/schemas.ts index 9c2d44dcb..6b040b0b3 100644 --- a/server/src/external/mongo/schemas.ts +++ b/server/src/external/mongo/schemas.ts @@ -1,13 +1,5 @@ import deepmerge from "deepmerge"; import { Game, Playtypes } from "tachi-common"; -import { - grades, - importTypes, - lamps, - validHitData, - validDifficulties, - validPlaytypes, -} from "tachi-common/js/config"; import p, { PrudenceSchema, ValidSchemaValue } from "prudence"; import { CONF_INFO } from "../../lib/setup/config"; diff --git a/server/src/lib/achievables/goals.ts b/server/src/lib/achievables/goals.ts index 7dbdf6151..ed674b90e 100644 --- a/server/src/lib/achievables/goals.ts +++ b/server/src/lib/achievables/goals.ts @@ -1,5 +1,11 @@ -import { GoalDocument, integer, PBScoreDocument, Game } from "tachi-common"; -import { grades, lamps } from "tachi-common/js/config"; +import { + GoalDocument, + integer, + PBScoreDocument, + Game, + GetGamePTConfig, + Playtypes, +} from "tachi-common"; import db from "../../external/mongo/db"; import { KtLogger } from "../logger/logger"; import { GetFolderChartIDs } from "../../utils/folder"; @@ -69,6 +75,7 @@ export async function EvaluateGoalForUser( const outOfHuman = HumaniseGoalProgress( goal.game, + goal.playtype, goal.criteria.key, goal.criteria.value, null @@ -82,6 +89,7 @@ export async function EvaluateGoalForUser( outOfHuman, progressHuman: HumaniseGoalProgress( goal.game, + goal.playtype, goal.criteria.key, res.scoreData[scoreDataKey], res @@ -120,6 +128,7 @@ export async function EvaluateGoalForUser( progress: nextBestScore.scoreData[scoreDataKey], progressHuman: HumaniseGoalProgress( goal.game, + goal.playtype, goal.criteria.key, nextBestScore.scoreData[scoreDataKey], nextBestScore @@ -192,20 +201,22 @@ type IIDXOrBMSPB = PBScoreDocument<"iidx:SP" | "iidx:DP" | "bms:7K" | "bms:14K"> // @todo, #100 improve this (add things like BP for iidx, maybe, percents for scores?) export function HumaniseGoalProgress( game: Game, + playtype: Playtypes[Game], key: GoalKeys, value: number, userPB: PBScoreDocument | null ): string { + const gptConfig = GetGamePTConfig(game, playtype); switch (key) { case "scoreData.gradeIndex": - return grades[game][value]; + return gptConfig.grades[value]; case "scoreData.lampIndex": if (userPB && (game === "iidx" || game === "bms")) { - return `${lamps[game][value]} (BP: ${ + return `${gptConfig.lamps[value]} (BP: ${ (userPB as IIDXOrBMSPB).scoreData.hitMeta.bp ?? "N/A" })`; } - return lamps[game][value]; + return gptConfig.lamps[value]; case "scoreData.percent": return `${value.toFixed(2)}%`; case "scoreData.score": diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts index 36f507a8d..3eab3a035 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts @@ -2,11 +2,7 @@ import { Router } from "express"; import db from "../../../../../../../../../external/mongo/db"; import { SYMBOL_TachiData } from "../../../../../../../../../lib/constants/tachi"; import { GetRelevantSongsAndCharts } from "../../../../../../../../../utils/db"; -import { - GetDefaultScoreRatingAlg, - GetDefaultSessionRatingAlg, - GetUsersRanking, -} from "../../../../../../../../../utils/user"; +import { GetUsersRanking } from "../../../../../../../../../utils/user"; import { CheckUserPlayedGamePlaytype } from "./middleware"; import { FilterQuery } from "mongodb"; import { UserGoalDocument, UserMilestoneDocument, GetGamePTConfig } from "tachi-common"; From 08a511cfd1304a124bbf77ecdd74dfd4c207a4a2 Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 15:34:04 +0100 Subject: [PATCH 03/12] fix utils/misc.ts to use new config --- server/src/utils/misc.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/utils/misc.ts b/server/src/utils/misc.ts index 091ca3db9..f8db1efcc 100644 --- a/server/src/utils/misc.ts +++ b/server/src/utils/misc.ts @@ -1,7 +1,6 @@ import crypto from "crypto"; import { CONF_INFO } from "../lib/setup/config"; -import { Game, Playtypes } from "tachi-common"; -import { validPlaytypes } from "tachi-common/js/config"; +import { Game, Playtypes, GetGameConfig } from "tachi-common"; // https://github.com/sindresorhus/escape-string-regexp/blob/main/index.js // the developer of this has migrated everything to Force ES6 style modules, @@ -67,5 +66,5 @@ export function IsValidGame(str: string): str is Game { } export function IsValidPlaytype(game: Game, str: string): str is Playtypes[Game] { - return validPlaytypes[game].includes(str as Playtypes[Game]); + return GetGameConfig(game).validPlaytypes.includes(str as Playtypes[Game]); } From 4382ad6c6d42ad7cb4e3626ea6578e5874e97a05 Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 15:37:39 +0100 Subject: [PATCH 04/12] update conf control --- server/pnpm-lock.yaml | 8 ++-- server/src/lib/setup/config.ts | 40 +++---------------- .../src/server/router/api/v1/import/router.ts | 1 - 3 files changed, 9 insertions(+), 40 deletions(-) diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml index ae69896c3..f40c72f73 100644 --- a/server/pnpm-lock.yaml +++ b/server/pnpm-lock.yaml @@ -80,7 +80,7 @@ dependencies: rate-limit-redis: 2.1.0 redis: 3.1.2 rimraf: 3.0.2 - tachi-common: github.com/zkldi/tachi-common/79a087c22d6fae0882b42f55e4e8a66535f6c1a9_ts-node@10.0.0+typescript@4.3.2 + tachi-common: github.com/zkldi/tachi-common/a439ca5e457707d3f5b7de195dc15c774a38f4ae_ts-node@10.0.0+typescript@4.3.2 typescript: 4.3.2 winston: 3.3.3 @@ -4218,9 +4218,9 @@ packages: engines: {node: '>=6'} dev: true - github.com/zkldi/tachi-common/79a087c22d6fae0882b42f55e4e8a66535f6c1a9_ts-node@10.0.0+typescript@4.3.2: - resolution: {tarball: https://codeload.github.com/zkldi/tachi-common/tar.gz/79a087c22d6fae0882b42f55e4e8a66535f6c1a9} - id: github.com/zkldi/tachi-common/79a087c22d6fae0882b42f55e4e8a66535f6c1a9 + github.com/zkldi/tachi-common/a439ca5e457707d3f5b7de195dc15c774a38f4ae_ts-node@10.0.0+typescript@4.3.2: + resolution: {tarball: https://codeload.github.com/zkldi/tachi-common/tar.gz/a439ca5e457707d3f5b7de195dc15c774a38f4ae} + id: github.com/zkldi/tachi-common/a439ca5e457707d3f5b7de195dc15c774a38f4ae name: tachi-common version: 0.1.0 dependencies: diff --git a/server/src/lib/setup/config.ts b/server/src/lib/setup/config.ts index 5049a20cb..379ddc05f 100644 --- a/server/src/lib/setup/config.ts +++ b/server/src/lib/setup/config.ts @@ -4,7 +4,7 @@ import JSON5 from "json5"; import fs from "fs"; import p from "prudence"; import { FormatPrError } from "../../utils/prudence"; -import { integer, Game } from "tachi-common"; +import { integer, Game, StaticConfig } from "tachi-common"; dotenv.config(); // imports things like NODE_ENV from a local .env file if one is present. // reads from $pwd/conf.json5 @@ -38,10 +38,7 @@ export interface TachiConfig { CDN_ROOT: string; TYPE: "ktchi" | "btchi" | "omni"; PORT: integer; - TYPE_INFO: { - NAME: string; - SUPPORTED_GAMES: Game[]; - }; + TYPE_INFO: StaticConfig.ServerConfig; } const err = p(config, { @@ -63,39 +60,12 @@ if (err) { throw FormatPrError(err, "Invalid conf.json5 file."); } -/** - * KTCHI | Kamaitachi is the arcade build of Tachi. - */ -const KTCHI_INFO: TachiConfig["TYPE_INFO"] = { - NAME: "Kamaitachi", - SUPPORTED_GAMES: ["iidx", "gitadora", "chunithm", "maimai", "museca", "sdvx"], -}; - -/** - * BTCHI | Bokutachi is the home-simulator build of Tachi. - */ -const BTCHI_INFO: TachiConfig["TYPE_INFO"] = { - NAME: "Bokutachi", - SUPPORTED_GAMES: ["usc", "bms"], -}; - -/** - * OMNI | Omnitachi is a local development/testing build of Tachi, which enables all endpoints. - * - * If you're one of those nerds who is reading this to figure out how to steal and rerun - * this codebase this is what you're looking for. - */ -const OMNI_INFO: TachiConfig["TYPE_INFO"] = { - NAME: "Omnitachi", - SUPPORTED_GAMES: [...KTCHI_INFO.SUPPORTED_GAMES, ...BTCHI_INFO.SUPPORTED_GAMES], -}; - if (config.TYPE === "ktchi") { - config.TYPE_INFO = KTCHI_INFO; + config.TYPE_INFO = StaticConfig.KTCHI_CONFIG; } else if (config.TYPE === "btchi") { - config.TYPE_INFO = BTCHI_INFO; + config.TYPE_INFO = StaticConfig.BTCHI_CONFIG; } else if (config.TYPE === "omni") { - config.TYPE_INFO = OMNI_INFO; + config.TYPE_INFO = StaticConfig.OMNI_CONFIG; } const tachiConfig = config as TachiConfig; diff --git a/server/src/server/router/api/v1/import/router.ts b/server/src/server/router/api/v1/import/router.ts index a3a759e32..10e68b327 100644 --- a/server/src/server/router/api/v1/import/router.ts +++ b/server/src/server/router/api/v1/import/router.ts @@ -1,6 +1,5 @@ import { Router } from "express"; import { FileUploadImportTypes } from "tachi-common"; -import { fileImportTypes } from "tachi-common/js/config"; import Prudence from "prudence"; import { GetUserWithIDGuaranteed } from "../../../../../utils/user"; import CreateLogCtx, { KtLogger } from "../../../../../lib/logger/logger"; From cb9e7f66983c3da1ab3c936653754bdc9b3c5458 Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 16:07:41 +0100 Subject: [PATCH 05/12] fix batch manual --- server/pnpm-lock.yaml | 8 +- .../common/batch-manual/converter.ts | 34 ++--- .../common/batch-manual/parser.ts | 126 ++++++++++-------- .../import-types/common/batch-manual/types.ts | 4 +- 4 files changed, 93 insertions(+), 79 deletions(-) diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml index f40c72f73..cc13976dd 100644 --- a/server/pnpm-lock.yaml +++ b/server/pnpm-lock.yaml @@ -80,7 +80,7 @@ dependencies: rate-limit-redis: 2.1.0 redis: 3.1.2 rimraf: 3.0.2 - tachi-common: github.com/zkldi/tachi-common/a439ca5e457707d3f5b7de195dc15c774a38f4ae_ts-node@10.0.0+typescript@4.3.2 + tachi-common: github.com/zkldi/tachi-common/689f2cbf2d3e3f9b44caab9aa64b4fb3d7a96ae5_ts-node@10.0.0+typescript@4.3.2 typescript: 4.3.2 winston: 3.3.3 @@ -4218,9 +4218,9 @@ packages: engines: {node: '>=6'} dev: true - github.com/zkldi/tachi-common/a439ca5e457707d3f5b7de195dc15c774a38f4ae_ts-node@10.0.0+typescript@4.3.2: - resolution: {tarball: https://codeload.github.com/zkldi/tachi-common/tar.gz/a439ca5e457707d3f5b7de195dc15c774a38f4ae} - id: github.com/zkldi/tachi-common/a439ca5e457707d3f5b7de195dc15c774a38f4ae + github.com/zkldi/tachi-common/689f2cbf2d3e3f9b44caab9aa64b4fb3d7a96ae5_ts-node@10.0.0+typescript@4.3.2: + resolution: {tarball: https://codeload.github.com/zkldi/tachi-common/tar.gz/689f2cbf2d3e3f9b44caab9aa64b4fb3d7a96ae5} + id: github.com/zkldi/tachi-common/689f2cbf2d3e3f9b44caab9aa64b4fb3d7a96ae5 name: tachi-common version: 0.1.0 dependencies: diff --git a/server/src/lib/score-import/import-types/common/batch-manual/converter.ts b/server/src/lib/score-import/import-types/common/batch-manual/converter.ts index 062ce5366..9255561e7 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/converter.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/converter.ts @@ -58,7 +58,7 @@ export const ConverterBatchManual: ConverterFunction { gaugeHistory: optNull([p.isBoundedInteger(0, 100)]), comboBreak: optNull(p.isPositiveInteger), }; - } else if (game === "popn" || game === "sdvx" || game === "usc") { + } else if (/* game === "popn" || */ game === "sdvx" || game === "usc") { return { gauge: optNull(p.isBoundedInteger(0, 100)), }; @@ -50,61 +49,66 @@ const PR_HitMeta = (game: Game): PrudenceSchema => { return {}; }; -const PR_BatchManualScore = (game: Game): PrudenceSchema => ({ - score: "number", - lamp: p.isIn(lamps[game]), - matchType: p.isIn( - "songTitle", - "ddrSongHash", - "kamaitachiSongID", - "bmsChartHash", - "title", - "songHash", - "songID", - "hash" - ), - identifier: "string", - comment: optNull(p.isBoundedString(3, 240)), - playtype: optNull(p.isIn(validPlaytypes[game])), - difficulty: "*?string", // this is checked in converting instead - // september 9th 2001 - this saves people not - // reading the documentation. - timeAchieved: optNull( - (self) => - (typeof self === "number" && self > 1_000_000_000_000) || - "Expected a number greater than 1 Trillion - did you pass unix seconds instead of miliseconds?" - ), - hitData: optNull((self) => { - if (typeof self !== "object" || self === null) { - return "Not a valid object."; - } - - for (const key in self) { - if (!validHitData[game].includes(key)) { - return `Invalid Key ${key}. Expected any of ${validHitData[game].join(", ")}`; +const PR_BatchManualScore = (game: Game, playtype: Playtypes[Game]): PrudenceSchema => { + const gptConfig = GetGamePTConfig(game, playtype); + return { + score: "number", + lamp: p.isIn(gptConfig.lamps), + matchType: p.isIn( + "songTitle", + "ddrSongHash", + "kamaitachiSongID", + "bmsChartHash", + "title", + "songHash", + "songID", + "hash" + ), + identifier: "string", + comment: optNull(p.isBoundedString(3, 240)), + difficulty: "*?string", // this is checked in converting instead + // september 9th 2001 - this saves people not + // reading the documentation. + timeAchieved: optNull( + (self) => + (typeof self === "number" && self > 1_000_000_000_000) || + "Expected a number greater than 1 Trillion - did you pass unix seconds instead of miliseconds?" + ), + hitData: optNull((self) => { + if (typeof self !== "object" || self === null) { + return "Not a valid object."; } - // @ts-expect-error shush - const v = self[key]; - if ((!Number.isSafeInteger(v) || v < 0) && v !== null) { - return `Key ${key} had an invalid value of ${v} [${typeof v}]`; + for (const key in self) { + if (!gptConfig.judgements.includes(key)) { + return `Invalid Key ${key}. Expected any of ${gptConfig.judgements.join(", ")}`; + } + + // @ts-expect-error shush + const v = self[key]; + if ((!Number.isSafeInteger(v) || v < 0) && v !== null) { + return `Key ${key} had an invalid value of ${v} [${typeof v}]`; + } } - } - return true; - }), - hitMeta: optNull(deepmerge(BaseValidHitMeta, PR_HitMeta(game)) as unknown as ValidSchemaValue), - // scoreMeta: @todo #74 - // more game specific props, maybe? -}); + return true; + }), + hitMeta: optNull( + deepmerge(BaseValidHitMeta, PR_HitMeta(game)) as unknown as ValidSchemaValue + ), + // scoreMeta: @todo #74 + // more game specific props, maybe? + }; +}; -const PR_BatchManual = (game: Game): PrudenceSchema => ({ +const PR_BatchManual = (game: Game, playtype: Playtypes[Game]): PrudenceSchema => ({ head: { service: p.isBoundedString(3, 15), - game: p.isIn(CONF_INFO.SUPPORTED_GAMES), + game: p.isIn(CONF_INFO.supportedGames), + playtype: p.is(playtype), version: "*?string", }, - body: [PR_BatchManualScore(game)], + body: [PR_BatchManualScore(game, playtype)], }); /** @@ -132,29 +136,44 @@ export function ParseBatchManualFromObject( // attempt to retrieve game // @ts-expect-error man. const possiblyGame = object?.head?.game; + // @ts-expect-error man. + const possiblyPlaytype = object?.head?.playtype; - if (!possiblyGame) { + if (!possiblyGame || !possiblyPlaytype) { throw new ScoreImportFatalError( 400, `Could not retrieve head.game - is this valid BATCH-MANUAL?` ); } - if (!CONF_INFO.SUPPORTED_GAMES.includes(possiblyGame)) { + if (!CONF_INFO.supportedGames.includes(possiblyGame)) { throw new ScoreImportFatalError( 400, - `Invalid game ${possiblyGame} - expected any of ${CONF_INFO.SUPPORTED_GAMES.join(", ")}` + `Invalid game ${possiblyGame} - expected any of ${CONF_INFO.supportedGames.join(", ")}.` ); } const game: Game = possiblyGame; + const gameConfig = GetGameConfig(game); + + if (!gameConfig.validPlaytypes.includes(possiblyPlaytype)) { + throw new ScoreImportFatalError( + 400, + `Invalid playtype ${possiblyPlaytype} - expected any of ${gameConfig.validPlaytypes.join( + ", " + )}.` + ); + } + + const playtype: Playtypes[Game] = possiblyPlaytype; + // now that we have the game, we can validate this against // the prudence schema for batch-manual. // This mostly works as a sanity check, and doesn't // check things like whether a score is > 100% // or something. - const err = p(object, PR_BatchManual(game)); + const err = p(object, PR_BatchManual(game, playtype)); if (err) { throw new ScoreImportFatalError(400, FormatPrError(err, "Invalid BATCH-MANUAL")); @@ -167,6 +186,7 @@ export function ParseBatchManualFromObject( context: { service: batchManual.head.service, game, + playtype, version: batchManual.head.version ?? null, }, iterable: batchManual.body, diff --git a/server/src/lib/score-import/import-types/common/batch-manual/types.ts b/server/src/lib/score-import/import-types/common/batch-manual/types.ts index 96ce1203b..ac4b2c509 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/types.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/types.ts @@ -5,7 +5,7 @@ export type BatchManualScore = { lamp: Lamps[IDStrings]; timeAchieved?: number | null; comment?: string | null; - hitData?: Record | null; + judgements?: Record | null; hitMeta?: Record | null; identifier: string; matchType: @@ -18,7 +18,6 @@ export type BatchManualScore = { | "songID" // songID is legacy - use kamaitachiSongID | "hash"; // hash is legacy - use bmsChartHash - playtype?: Playtypes[Game] | null; difficulty?: string | null; // lazy... }; @@ -33,6 +32,7 @@ export interface BatchManual { export interface BatchManualContext { game: Game; + playtype: Playtypes[Game]; service: string; version: string | null; } From 386cf558619930b9a02b222fd8c96b5530922b0a Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 16:10:05 +0100 Subject: [PATCH 06/12] update lamps reference in tests --- .../score-import/framework/pb/create-pb-doc.test.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server/src/lib/score-import/framework/pb/create-pb-doc.test.ts b/server/src/lib/score-import/framework/pb/create-pb-doc.test.ts index 806b30f52..997e74c11 100644 --- a/server/src/lib/score-import/framework/pb/create-pb-doc.test.ts +++ b/server/src/lib/score-import/framework/pb/create-pb-doc.test.ts @@ -5,14 +5,15 @@ import { GetKTDataJSON, Testing511SPA, TestingIIDXSPScore } from "../../../../te import { CreatePBDoc } from "./create-pb-doc"; import deepmerge from "deepmerge"; import CreateLogCtx, { KtLogger } from "../../../logger/logger"; - -import { lamps } from "tachi-common/js/config"; +import { GetGamePTConfig } from "tachi-common"; import { CloseAllConnections } from "../../../../test-utils/close-connections"; let IIDXScore = TestingIIDXSPScore; const logger = CreateLogCtx(__filename); +const lamps = GetGamePTConfig("iidx", "SP").lamps; + t.test("#CreatePBDoc", (t) => { t.beforeEach(ResetDBState); t.beforeEach(() => { @@ -45,7 +46,7 @@ t.test("#CreatePBDoc", (t) => { gradeIndex: IIDXScore.scoreData.gradeIndex, hitData: IIDXScore.scoreData.hitData, lamp: "FULL COMBO", - lampIndex: lamps.iidx.indexOf("FULL COMBO"), + lampIndex: lamps.indexOf("FULL COMBO"), hitMeta: { bp: 1 }, }, calculatedData: { @@ -63,7 +64,7 @@ t.test("#CreatePBDoc", (t) => { deepmerge(IIDXScore, { scoreData: { lamp: "FULL COMBO", - lampIndex: lamps.iidx.indexOf("FULL COMBO"), + lampIndex: lamps.indexOf("FULL COMBO"), score: 0, percent: 0, hitMeta: { @@ -78,7 +79,7 @@ t.test("#CreatePBDoc", (t) => { deepmerge(IIDXScore, { scoreData: { lamp: "CLEAR", - lampIndex: lamps.iidx.indexOf("CLEAR"), + lampIndex: lamps.indexOf("CLEAR"), score: 1, percent: 1, hitMeta: { @@ -122,7 +123,7 @@ t.test("#CreatePBDoc", (t) => { const d = deepmerge(IIDXScore, { scoreData: { lamp: "FULL COMBO", - lampIndex: lamps.iidx.indexOf("FULL COMBO"), + lampIndex: lamps.indexOf("FULL COMBO"), score: 0, percent: 0, hitMeta: { From f28f9f0b20ba2142e7810fa26c7f96a9c64321f1 Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 17:30:12 +0100 Subject: [PATCH 07/12] clear all references to config --- .../framework/calculated-data/stats.ts | 74 ++++++++++++++++--- .../framework/common/score-utils.ts | 52 ++++++------- .../framework/common/string-asserts.ts | 14 ++-- 3 files changed, 95 insertions(+), 45 deletions(-) diff --git a/server/src/lib/score-import/framework/calculated-data/stats.ts b/server/src/lib/score-import/framework/calculated-data/stats.ts index b17312872..9b6c0806d 100644 --- a/server/src/lib/score-import/framework/calculated-data/stats.ts +++ b/server/src/lib/score-import/framework/calculated-data/stats.ts @@ -1,9 +1,18 @@ -import { AnyChartDocument, ESDCore, integer, Grades, Lamps, Game, Playtypes } from "tachi-common"; +import { + AnyChartDocument, + ESDCore, + integer, + Grades, + Lamps, + Game, + Playtypes, + GetGamePTConfig, + IDStrings, +} from "tachi-common"; import db from "../../../../external/mongo/db"; import { GetAllTierlistDataOfType, GetOneTierlistData } from "../../../../utils/tierlist"; import { KtLogger } from "../../../logger/logger"; import { DryScore } from "../common/types"; -import { lamps, clearLamp, ratingParameters } from "tachi-common/js/config"; /** * Calculates the in-game CHUNITHM rating for a score. @@ -305,9 +314,37 @@ function RatingCalcV0Fail(percentDiv100: number, levelNum: number, parameters: R ); } +const ratingParameters = { + iidx: { + failHarshnessMultiplier: 0.3, + pivotPercent: 0.7777, // Grade: AA + clearExpMultiplier: 1, + }, + bms: { + failHarshnessMultiplier: 0.5, + pivotPercent: 0.7777, // Grade: AA + clearExpMultiplier: 0.75, + }, + museca: { + failHarshnessMultiplier: 1, + pivotPercent: 0.8, // grade: not fail + clearExpMultiplier: 1, // no real reason + }, + maimai: { + failHarshnessMultiplier: 1, + pivotPercent: 0.8, + clearExpMultiplier: 1, + }, + ddr: { + failHarshnessMultiplier: 0.9, + pivotPercent: 0.9, + clearExpMultiplier: 1, + }, +}; + export async function CalculateKTRating( dryScore: DryScore, - game: Game, + game: "iidx" | "bms" | "ddr" | "maimai" | "museca", playtype: Playtypes[Game], chart: AnyChartDocument, logger: KtLogger, @@ -316,7 +353,7 @@ export async function CalculateKTRating( // If this game doesn't have a specific rating function declared, fall back to the default "generic" rating function. // This is just a function that is guaranteed to work for all input - and therefore not result in lower-skilled users // always seeing 0. - const parameters = ratingParameters[dryScore.game]; + const parameters = ratingParameters[game]; let levelNum = chart.levelNum; @@ -346,21 +383,25 @@ export async function CalculateKTLampRating( ) { // if no tierlist data if (!defaultTierlistID) { - return LampRatingNoTierlistInfo(dryScore, game, chart); + return LampRatingNoTierlistInfo(dryScore, game, playtype, chart); } const lampTierlistInfo = await GetAllTierlistDataOfType(game, chart, "lamp", defaultTierlistID); // if no tierlist info if (lampTierlistInfo.length === 0) { - return LampRatingNoTierlistInfo(dryScore, game, chart); + return LampRatingNoTierlistInfo(dryScore, game, playtype, chart); } - const userLampIndex = lamps[game].indexOf(dryScore.scoreData.lamp); + const gptConfig = GetGamePTConfig(game, playtype); + + const lamps = gptConfig.lamps; + + const userLampIndex = lamps.indexOf(dryScore.scoreData.lamp); // if this score is a clear, the lowest we should go is the levelNum of the chart. // Else, the lowest we can go is 0. - let lampRating = userLampIndex >= lamps[game].indexOf(clearLamp[game]) ? chart.levelNum : 0; + let lampRating = userLampIndex >= lamps.indexOf(gptConfig.clearLamp) ? chart.levelNum : 0; // why is this like this and not a lookup table? // Some charts have higher values for *lower* lamps, such as @@ -371,7 +412,7 @@ export async function CalculateKTLampRating( // this tierlistData has higher value than the current lampRating tierlistData.data.value > lampRating && // and your clear is better than the lamp its for - lamps[game].indexOf(tierlistData.key!) <= userLampIndex + lamps.indexOf(tierlistData.key as Lamps[IDStrings]) <= userLampIndex ) { lampRating = tierlistData.data.value; } @@ -380,11 +421,20 @@ export async function CalculateKTLampRating( return lampRating; } -function LampRatingNoTierlistInfo(dryScore: DryScore, game: Game, chart: AnyChartDocument) { - const CLEAR_LAMP_INDEX = lamps[game].indexOf(clearLamp[game]); +function LampRatingNoTierlistInfo( + dryScore: DryScore, + game: Game, + playtype: Playtypes[Game], + chart: AnyChartDocument +) { + const gptConfig = GetGamePTConfig(game, playtype); + + const lamps = gptConfig.lamps; + + const CLEAR_LAMP_INDEX = lamps.indexOf(gptConfig.clearLamp); // if this is a clear - if (lamps[game].indexOf(dryScore.scoreData.lamp) >= CLEAR_LAMP_INDEX) { + if (lamps.indexOf(dryScore.scoreData.lamp) >= CLEAR_LAMP_INDEX) { // return this chart's numeric level as the lamp rating return chart.levelNum; } diff --git a/server/src/lib/score-import/framework/common/score-utils.ts b/server/src/lib/score-import/framework/common/score-utils.ts index 3e0d40fc8..5f279b12e 100644 --- a/server/src/lib/score-import/framework/common/score-utils.ts +++ b/server/src/lib/score-import/framework/common/score-utils.ts @@ -1,5 +1,4 @@ import { - config, Game, Grades, IDStrings, @@ -8,8 +7,8 @@ import { GameToIDStrings, ESDCore, Playtypes, + GetGamePTConfig, } from "tachi-common"; -import { judgementWindows, gamePercentMax } from "tachi-common/js/config"; import CreateLogCtx from "../../../logger/logger"; import { InternalFailure, InvalidScoreFailure } from "./converter-failures"; @@ -20,13 +19,14 @@ const logger = CreateLogCtx(__filename); */ export function GetGradeFromPercent( game: Game, + playtype: Playtypes[Game], percent: number ): Grades[I] { - // @todo #102 update config to use game->pt - const boundaries = config.gradeBoundaries[game]; - const grades = config.grades[game]; + const gptConfig = GetGamePTConfig(game, playtype); + const boundaries = gptConfig.gradeBoundaries; + const grades = gptConfig.grades; - // eslint doesn't like backwards for loops (hey, this for loop is backwards!) + // (hey, this for loop is backwards!) for (let i = boundaries.length; i >= 0; i--) { if (percent >= boundaries[i]) { return grades[i] as Grades[I]; @@ -49,14 +49,13 @@ export function GenericCalculatePercent( switch (game) { case "ddr": case "museca": - case "jubeat": case "chunithm": return (score / 1_000_000) * 100; case "sdvx": case "usc": return (score / 10_000_000) * 100; - case "popn": - return (score / 100_000) * 100; + // case "popn": + // return (score / 100_000) * 100; case "gitadora": case "maimai": return score; @@ -88,7 +87,12 @@ export function GenericCalculatePercent( * * This exists to support maimai, as it has a dynamic "max percent". */ -export function ValidatePercent(game: Game, percent: number, chart: AnyChartDocument) { +export function ValidatePercent( + game: Game, + playtype: Playtypes[Game], + percent: number, + chart: AnyChartDocument +) { // i love needing a helper function for *ONE* game. if (game === "maimai") { const mmChart = chart as ChartDocument<"maimai:Single">; @@ -99,9 +103,11 @@ export function ValidatePercent(game: Game, percent: number, chart: AnyChartDocu } } - if (percent > gamePercentMax[game]) { + const gptConfig = GetGamePTConfig(game, playtype); + + if (percent > gptConfig.percentMax) { throw new InvalidScoreFailure( - `Invalid percent of ${percent} - expected a value less than ${gamePercentMax[game]}% (${chart.songID} ${chart.playtype} ${chart.difficulty}).` + `Invalid percent of ${percent} - expected a value less than ${gptConfig.percentMax}% (${chart.songID} ${chart.playtype} ${chart.difficulty}).` ); } } @@ -113,14 +119,15 @@ export function ValidatePercent(game: Game, percent: number, chart: AnyChartDocu */ export function GenericGetGradeAndPercent( game: G, + playtype: Playtypes[G], score: number, chart: AnyChartDocument ) { const percent = GenericCalculatePercent(game, score, chart); - ValidatePercent(game, percent, chart); + ValidatePercent(game, playtype, percent, chart); - const grade = GetGradeFromPercent(game, percent) as Grades[GameToIDStrings[G]]; + const grade = GetGradeFromPercent(game, playtype, percent) as Grades[GameToIDStrings[G]]; return { percent, grade }; } @@ -134,20 +141,13 @@ export function CalculateESDForGame( playtype: Playtypes[Game], percent: number ): number | null { - if ( - Object.prototype.hasOwnProperty.call(judgementWindows, game) && - // @ts-expect-error i know better - Object.prototype.hasOwnProperty.call(judgementWindows[game], playtype) - ) { - if (percent > 0.1) { - // @ts-expect-error i know better - return ESDCore.CalculateESD(judgementWindows[game][playtype], percent); - } else { - return 200; - } + const gptConfig = GetGamePTConfig(game, playtype); + + if (!gptConfig.supportsESD) { + return null; } - return null; + return ESDCore.CalculateESD(gptConfig.judgementWindows, percent); } /** diff --git a/server/src/lib/score-import/framework/common/string-asserts.ts b/server/src/lib/score-import/framework/common/string-asserts.ts index 45c434abf..db7e004a7 100644 --- a/server/src/lib/score-import/framework/common/string-asserts.ts +++ b/server/src/lib/score-import/framework/common/string-asserts.ts @@ -1,17 +1,17 @@ import { InvalidScoreFailure } from "./converter-failures"; -import { Difficulties, Game, IDStrings, Playtypes } from "tachi-common"; -import { validDifficulties } from "tachi-common/js/config"; - +import { Difficulties, Game, IDStrings, Playtypes, GetGamePTConfig } from "tachi-common"; export function AssertStrAsDifficulty( strVal: string, game: Game, playtype: Playtypes[Game] ): Difficulties[IDStrings] { - if (!validDifficulties[game].includes(strVal)) { + const validDifficulties = GetGamePTConfig(game, playtype).difficulties; + + if (!validDifficulties.includes(strVal as Difficulties[IDStrings])) { throw new InvalidScoreFailure( - `Invalid Difficulty for ${game} ${playtype} - Expected any of ${validDifficulties[ - game - ].join(", ")}` + `Invalid Difficulty for ${game} ${playtype} - Expected any of ${validDifficulties.join( + ", " + )}` ); } From b9bc226a0252cc0d8ffdb4f54d026295ff1a00c3 Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 17:30:58 +0100 Subject: [PATCH 08/12] replace all instances of hitData with judgements --- .../scripts/__KT_DATABASE_MIGRATION/scores.ts | 214 +++++++++--------- server/src/external/mongo/schemas.ts | 4 +- .../framework/orphans/orphans.test.ts | 2 +- .../framework/pb/create-pb-doc.test.ts | 2 +- .../framework/pb/create-pb-doc.ts | 2 +- .../api/arc-ddr/converter.test.ts | 2 +- .../import-types/api/arc-ddr/converter.ts | 2 +- .../api/arc-iidx/converter.test.ts | 2 +- .../import-types/api/arc-iidx/converter.ts | 2 +- .../api/arc-sdvx/converter.test.ts | 2 +- .../import-types/api/arc-sdvx/converter.ts | 2 +- .../common/api-kai/iidx/converter.test.ts | 2 +- .../common/api-kai/iidx/converter.ts | 2 +- .../common/api-kai/sdvx/converter.test.ts | 2 +- .../common/api-kai/sdvx/converter.ts | 2 +- .../common/batch-manual/converter.test.ts | 2 +- .../common/batch-manual/parser.test.ts | 16 +- .../common/batch-manual/parser.ts | 2 +- .../common/eamusement-iidx-csv/converter.ts | 2 +- .../file/mer-iidx/converter.test.ts | 4 +- .../import-types/file/mer-iidx/converter.ts | 2 +- .../file/solid-state-squad/converter.test.ts | 2 +- .../file/solid-state-squad/converter.ts | 6 +- .../ir/barbatos/converter.test.ts | 2 +- .../import-types/ir/barbatos/converter.ts | 2 +- .../import-types/ir/beatoraja/converter.ts | 6 +- .../ir/fervidex-static/converter.ts | 2 +- .../ir/fervidex/converter.test.ts | 2 +- .../import-types/ir/fervidex/converter.ts | 2 +- .../import-types/ir/usc/converter.ts | 2 +- .../src/server/router/ir/usc/router.test.ts | 2 +- server/src/server/router/ir/usc/usc.test.ts | 2 +- server/src/server/router/ir/usc/usc.ts | 6 +- server/src/test-utils/mock-db/scores.json | 2 +- .../test-data/tachi/gitadora-dryscore.json | 2 +- .../test-data/tachi/iidx-dryscore.json | 2 +- .../test-data/tachi/iidx-score.json | 2 +- .../test-data/tachi/iidx-scorepb.json | 2 +- .../test-data/tachi/sdvx-dryscore.json | 2 +- 39 files changed, 160 insertions(+), 160 deletions(-) diff --git a/server/scripts/__KT_DATABASE_MIGRATION/scores.ts b/server/scripts/__KT_DATABASE_MIGRATION/scores.ts index b9f844093..b058ccfd4 100644 --- a/server/scripts/__KT_DATABASE_MIGRATION/scores.ts +++ b/server/scripts/__KT_DATABASE_MIGRATION/scores.ts @@ -12,133 +12,133 @@ const logger = CreateLogCtx(__filename); // HERE. WE. GO! function ConditionalAssign(base: any, baseProp: string, other: any, otherProp: string) { - if (Object.prototype.hasOwnProperty.call(other, otherProp)) { - base[baseProp] = other[otherProp]; - } + if (Object.prototype.hasOwnProperty.call(other, otherProp)) { + base[baseProp] = other[otherProp]; + } } function ConvertFn(c: any): ScoreDocument | null { - if (!supportedGames.includes(c.game)) { - logger.warn(`Ignored game ${c.game}`); - return null; - } + if (!supportedGames.includes(c.game)) { + logger.warn(`Ignored game ${c.game}`); + return null; + } - if (["popn", "jubeat", "gitadora", "usc"].includes(c.game)) { - return null; - } + if (["popn", "jubeat", "gitadora", "usc"].includes(c.game)) { + return null; + } - if (validPlaytypes[c.game].includes(c.playtype)) { - logger.warn(`Ignored game pt ${c.game}, ${c.playtype}`); - } + if (validPlaytypes[c.game].includes(c.playtype)) { + logger.warn(`Ignored game pt ${c.game}, ${c.playtype}`); + } - const base: Omit = { - userID: c.userID, - songID: c.songID, - playtype: c.scoreData.playtype, - chartID: c.chartID, - game: c.game, - timeAdded: c.timeAdded, - timeAchieved: Number.isNaN(c.timeAchieved) ? null : c.timeAchieved, - comment: c.comment ?? null, - highlight: c.highlight ?? false, - service: c.service, - importType: null, - calculatedData: c.calculatedData, - scoreData: { - esd: c.scoreData.esd ?? null, - grade: c.scoreData.grade, - gradeIndex: grades[c.game].indexOf(c.scoreData.grade), - lamp: c.scoreData.lamp, - lampIndex: lamps[c.game].indexOf(c.scoreData.lamp), - percent: c.scoreData.percent, - score: c.scoreData.score, - hitData: c.scoreData.hitData, - hitMeta: c.scoreData.hitMeta, - }, - scoreMeta: {}, - }; + const base: Omit = { + userID: c.userID, + songID: c.songID, + playtype: c.scoreData.playtype, + chartID: c.chartID, + game: c.game, + timeAdded: c.timeAdded, + timeAchieved: Number.isNaN(c.timeAchieved) ? null : c.timeAchieved, + comment: c.comment ?? null, + highlight: c.highlight ?? false, + service: c.service, + importType: null, + calculatedData: c.calculatedData, + scoreData: { + esd: c.scoreData.esd ?? null, + grade: c.scoreData.grade, + gradeIndex: grades[c.game].indexOf(c.scoreData.grade), + lamp: c.scoreData.lamp, + lampIndex: lamps[c.game].indexOf(c.scoreData.lamp), + percent: c.scoreData.percent, + score: c.scoreData.score, + judgements: c.scoreData.judgements, + hitMeta: c.scoreData.hitMeta, + }, + scoreMeta: {}, + }; - if (c.scoreMeta) { - if (base.game === "iidx") { - ConditionalAssign(base.scoreMeta, "random", c.scoreMeta, "optionsRandom"); - ConditionalAssign(base.scoreMeta, "gauge", c.scoreMeta, "optionsGauge"); - ConditionalAssign(base.scoreMeta, "assist", c.scoreMeta, "optionsAssist"); - ConditionalAssign(base.scoreMeta, "range", c.scoreMeta, "optionsRange"); - ConditionalAssign(base.scoreMeta, "pacemaker", c.scoreMeta, "pacemaker"); - ConditionalAssign(base.scoreMeta, "pacemakerName", c.scoreMeta, "pacemakerName"); - ConditionalAssign(base.scoreMeta, "pacemakerTarget", c.scoreMeta, "pacemakerTarget"); + if (c.scoreMeta) { + if (base.game === "iidx") { + ConditionalAssign(base.scoreMeta, "random", c.scoreMeta, "optionsRandom"); + ConditionalAssign(base.scoreMeta, "gauge", c.scoreMeta, "optionsGauge"); + ConditionalAssign(base.scoreMeta, "assist", c.scoreMeta, "optionsAssist"); + ConditionalAssign(base.scoreMeta, "range", c.scoreMeta, "optionsRange"); + ConditionalAssign(base.scoreMeta, "pacemaker", c.scoreMeta, "pacemaker"); + ConditionalAssign(base.scoreMeta, "pacemakerName", c.scoreMeta, "pacemakerName"); + ConditionalAssign(base.scoreMeta, "pacemakerTarget", c.scoreMeta, "pacemakerTarget"); - if (base.playtype === "DP" && !Array.isArray(base.scoreMeta.random)) { - base.scoreMeta.random = null; - } + if (base.playtype === "DP" && !Array.isArray(base.scoreMeta.random)) { + base.scoreMeta.random = null; + } - // @ts-expect-error asdf - if (base.scoreMeta.range === "") { - // @ts-expect-error asdf - base.scoreMeta.range = "NONE"; - } - } else if (base.game === "bms") { - ConditionalAssign(base.scoreMeta, "random", c.scoreMeta, "optionsRandom"); - ConditionalAssign(base.scoreMeta, "inputDevice", c.scoreData.hitMeta, "inputDevice"); - } - } + // @ts-expect-error asdf + if (base.scoreMeta.range === "") { + // @ts-expect-error asdf + base.scoreMeta.range = "NONE"; + } + } else if (base.game === "bms") { + ConditionalAssign(base.scoreMeta, "random", c.scoreMeta, "optionsRandom"); + ConditionalAssign(base.scoreMeta, "inputDevice", c.scoreData.hitMeta, "inputDevice"); + } + } - // @ts-expect-error shut - if (base.scoreData.hitMeta.bp === -1 || Number.isNaN(base.scoreData.hitMeta.bp)) { - // @ts-expect-error shut - base.scoreData.hitMeta.bp = null; - } + // @ts-expect-error shut + if (base.scoreData.hitMeta.bp === -1 || Number.isNaN(base.scoreData.hitMeta.bp)) { + // @ts-expect-error shut + base.scoreData.hitMeta.bp = null; + } - if (base.game === "iidx") { - // @ts-expect-error nope - if (base.scoreData.hitMeta.gauge > 200) { - // @ts-expect-error nope - base.scoreData.hitMeta.gauge = null; - } + if (base.game === "iidx") { + // @ts-expect-error nope + if (base.scoreData.hitMeta.gauge > 200) { + // @ts-expect-error nope + base.scoreData.hitMeta.gauge = null; + } - // @ts-expect-error nope - if (base.scoreData.hitMeta.gaugeHistory) { - // @ts-expect-error nope - base.scoreData.hitMeta.gaugeHistory = base.scoreData.hitMeta.gaugeHistory.map((e) => - e > 200 ? null : e - ); - } - } else if (base.game === "bms") { - // @ts-expect-error shut - if (base.scoreData.hitMeta.gauge === -1) { - // @ts-expect-error shut - base.scoreData.hitMeta.gauge = null; - } + // @ts-expect-error nope + if (base.scoreData.hitMeta.gaugeHistory) { + // @ts-expect-error nope + base.scoreData.hitMeta.gaugeHistory = base.scoreData.hitMeta.gaugeHistory.map((e) => + e > 200 ? null : e + ); + } + } else if (base.game === "bms") { + // @ts-expect-error shut + if (base.scoreData.hitMeta.gauge === -1) { + // @ts-expect-error shut + base.scoreData.hitMeta.gauge = null; + } - // @ts-expect-error shut - delete base.scoreData.hitMeta.inputDevice; - } else if (base.game === "sdvx" || base.game === "usc") { - ConditionalAssign(base.scoreData.hitData, "miss", base.scoreData.hitData, "error"); + // @ts-expect-error shut + delete base.scoreData.hitMeta.inputDevice; + } else if (base.game === "sdvx" || base.game === "usc") { + ConditionalAssign(base.scoreData.judgements, "miss", base.scoreData.judgements, "error"); - //@ts-expect-error yea - delete base.scoreData.hitData.error; - } else if (base.game === "chunithm") { - if (base.scoreData.percent === 101) { - base.scoreData.grade === "SSS"; - } - } + //@ts-expect-error yea + delete base.scoreData.judgements.error; + } else if (base.game === "chunithm") { + if (base.scoreData.percent === 101) { + base.scoreData.grade === "SSS"; + } + } - if (base.service === "mm") { - base.service = "maimagic"; - } + if (base.service === "mm") { + base.service = "maimagic"; + } - const scoreID = CreateScoreID(base.userID, base, base.chartID); + const scoreID = CreateScoreID(base.userID, base, base.chartID); - const score: ScoreDocument = { - ...base, - scoreID, - }; + const score: ScoreDocument = { + ...base, + scoreID, + }; - return score; + return score; } (async () => { - await MigrateRecords(db.scores, "scores", ConvertFn); + await MigrateRecords(db.scores, "scores", ConvertFn); - process.exit(0); + process.exit(0); })(); diff --git a/server/src/external/mongo/schemas.ts b/server/src/external/mongo/schemas.ts index 6b040b0b3..eebace3d6 100644 --- a/server/src/external/mongo/schemas.ts +++ b/server/src/external/mongo/schemas.ts @@ -67,7 +67,7 @@ export const PR_SCORE_GENERIC = { grade: "string", lampIndex: p.isPositiveInteger, gradeIndex: p.isPositiveInteger, - hitData: {}, + judgements: {}, hitMeta: {}, }, scoreMeta: {}, @@ -118,7 +118,7 @@ const CreateGameScoreData = (game: Game, hitMetaMerge: PrudenceSchema) => ({ p.isPositiveInteger, (self, parent) => grades[game][self as number] === parent.grade ), - hitData: Object.fromEntries(validHitData[game].map((e) => [e, optionalPositiveInt])), + judgements: Object.fromEntries(validjudgements[game].map((e) => [e, optionalPositiveInt])), hitMeta: deepmerge( { fast: nullableAndOptionalPosInt, diff --git a/server/src/lib/score-import/framework/orphans/orphans.test.ts b/server/src/lib/score-import/framework/orphans/orphans.test.ts index d3109ddd5..72f3a1efb 100644 --- a/server/src/lib/score-import/framework/orphans/orphans.test.ts +++ b/server/src/lib/score-import/framework/orphans/orphans.test.ts @@ -141,7 +141,7 @@ t.test("#ReprocessOrphan", (t) => { score: 500, grade: "E", percent: 31.806615776081426, - hitData: {}, + judgements: {}, hitMeta: {}, }, highlight: false, diff --git a/server/src/lib/score-import/framework/pb/create-pb-doc.test.ts b/server/src/lib/score-import/framework/pb/create-pb-doc.test.ts index 997e74c11..503b665d1 100644 --- a/server/src/lib/score-import/framework/pb/create-pb-doc.test.ts +++ b/server/src/lib/score-import/framework/pb/create-pb-doc.test.ts @@ -44,7 +44,7 @@ t.test("#CreatePBDoc", (t) => { esd: IIDXScore.scoreData.esd, grade: IIDXScore.scoreData.grade, gradeIndex: IIDXScore.scoreData.gradeIndex, - hitData: IIDXScore.scoreData.hitData, + judgements: IIDXScore.scoreData.judgements, lamp: "FULL COMBO", lampIndex: lamps.indexOf("FULL COMBO"), hitMeta: { bp: 1 }, diff --git a/server/src/lib/score-import/framework/pb/create-pb-doc.ts b/server/src/lib/score-import/framework/pb/create-pb-doc.ts index 6359230d4..ad5ba8938 100644 --- a/server/src/lib/score-import/framework/pb/create-pb-doc.ts +++ b/server/src/lib/score-import/framework/pb/create-pb-doc.ts @@ -141,7 +141,7 @@ async function MergeScoreLampIntoPB( gradeIndex: scorePB.scoreData.gradeIndex, lamp: lampPB.scoreData.lamp, lampIndex: lampPB.scoreData.lampIndex, - hitData: scorePB.scoreData.hitData, + judgements: scorePB.scoreData.judgements, hitMeta: scorePB.scoreData.hitMeta, // this will probably be overrode by game-specific fns }, calculatedData: scorePB.calculatedData, diff --git a/server/src/lib/score-import/import-types/api/arc-ddr/converter.test.ts b/server/src/lib/score-import/import-types/api/arc-ddr/converter.test.ts index 2d8964c03..700ff70a9 100644 --- a/server/src/lib/score-import/import-types/api/arc-ddr/converter.test.ts +++ b/server/src/lib/score-import/import-types/api/arc-ddr/converter.test.ts @@ -32,7 +32,7 @@ t.test("#ConvertAPIArcDDR", (t) => { grade: "AAA", percent: 99.976, score: 807, - hitData: { + judgements: { marvelous: 236, perfect: 24, great: 0, diff --git a/server/src/lib/score-import/import-types/api/arc-ddr/converter.ts b/server/src/lib/score-import/import-types/api/arc-ddr/converter.ts index dceb130eb..f8415b1b1 100644 --- a/server/src/lib/score-import/import-types/api/arc-ddr/converter.ts +++ b/server/src/lib/score-import/import-types/api/arc-ddr/converter.ts @@ -90,7 +90,7 @@ export const ConvertAPIArcDDR: ConverterFunction = async ( grade, percent, score: score.ex_score, - hitData: { + judgements: { marvelous: score.judgments.marvelous, perfect: score.judgments.perfect, great: score.judgments.great, diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/converter.test.ts b/server/src/lib/score-import/import-types/api/arc-iidx/converter.test.ts index dbf5385ac..c03e31aac 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/converter.test.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/converter.test.ts @@ -29,7 +29,7 @@ t.test("#ConvertAPIArcIIDX", (t) => { scoreData: { grade: "A", score: 1200, - hitData: {}, + judgements: {}, hitMeta: { bp: 43, }, diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts b/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts index e0eb8cf05..998baa8fe 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts @@ -78,7 +78,7 @@ export const ConvertAPIArcIIDX: ConverterFunction = async grade, percent, score: score.ex_score, - hitData: {}, + judgements: {}, hitMeta: { bp: score.miss_count, }, diff --git a/server/src/lib/score-import/import-types/api/arc-sdvx/converter.test.ts b/server/src/lib/score-import/import-types/api/arc-sdvx/converter.test.ts index 12ddcb639..4e7040a65 100644 --- a/server/src/lib/score-import/import-types/api/arc-sdvx/converter.test.ts +++ b/server/src/lib/score-import/import-types/api/arc-sdvx/converter.test.ts @@ -34,7 +34,7 @@ t.test("#ConvertAPIArcSDVX", (t) => { grade: "AA", percent: 93.125, score: 9312500, - hitData: { + judgements: { critical: 946, near: 45, miss: 49, diff --git a/server/src/lib/score-import/import-types/api/arc-sdvx/converter.ts b/server/src/lib/score-import/import-types/api/arc-sdvx/converter.ts index 446ce1782..504fd34e6 100644 --- a/server/src/lib/score-import/import-types/api/arc-sdvx/converter.ts +++ b/server/src/lib/score-import/import-types/api/arc-sdvx/converter.ts @@ -74,7 +74,7 @@ export const ConvertAPIArcSDVX: ConverterFunction = async grade, percent, score: score.score, - hitData: { + judgements: { critical: score.critical, near: score.near, miss: score.error, diff --git a/server/src/lib/score-import/import-types/common/api-kai/iidx/converter.test.ts b/server/src/lib/score-import/import-types/common/api-kai/iidx/converter.test.ts index 6f9a7ae08..48104f40b 100644 --- a/server/src/lib/score-import/import-types/common/api-kai/iidx/converter.test.ts +++ b/server/src/lib/score-import/import-types/common/api-kai/iidx/converter.test.ts @@ -35,7 +35,7 @@ t.test("#ConvertAPIKaiIIDX", (t) => { // percent: 99.87277353689568 floating point, score: 1570, lamp: "HARD CLEAR", - hitData: {}, + judgements: {}, hitMeta: { fast: null, slow: null, diff --git a/server/src/lib/score-import/import-types/common/api-kai/iidx/converter.ts b/server/src/lib/score-import/import-types/common/api-kai/iidx/converter.ts index ed1f5c698..fb9e8a813 100644 --- a/server/src/lib/score-import/import-types/common/api-kai/iidx/converter.ts +++ b/server/src/lib/score-import/import-types/common/api-kai/iidx/converter.ts @@ -108,7 +108,7 @@ export const ConvertAPIKaiIIDX: ConverterFunction = async ( percent, score: score.ex_score, lamp, - hitData: {}, + judgements: {}, hitMeta: { fast: score.fast_count, slow: score.slow_count, diff --git a/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.test.ts b/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.test.ts index 2604280cb..2632d1475 100644 --- a/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.test.ts +++ b/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.test.ts @@ -35,7 +35,7 @@ t.test("#ConvertAPIKaiSDVX", (t) => { // percent: 93.10699, floating point score: 9310699, lamp: "EXCESSIVE CLEAR", - hitData: {}, + judgements: {}, hitMeta: { fast: 70, slow: 42, diff --git a/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.ts b/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.ts index cab33607d..25f8074b6 100644 --- a/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.ts +++ b/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.ts @@ -85,7 +85,7 @@ export const ConvertAPIKaiSDVX: ConverterFunction = async ( percent, score: score.score, lamp, - hitData: {}, + judgements: {}, hitMeta: { fast: score.early, slow: score.late, diff --git a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts index 0414a0a27..09b2b19e1 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts @@ -364,7 +364,7 @@ t.test("#ConverterFn", (t) => { score: 500, grade: "E", // percent: 31.5, -- ish, FPA is hard. - hitData: {}, + judgements: {}, hitMeta: {}, }, scoreMeta: {}, diff --git a/server/src/lib/score-import/import-types/common/batch-manual/parser.test.ts b/server/src/lib/score-import/import-types/common/batch-manual/parser.test.ts index d5628844d..451a31d84 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/parser.test.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/parser.test.ts @@ -272,9 +272,9 @@ t.test("#ParserFn", (t) => { t.end(); }); - t.test("Valid HitData", (t) => { + t.test("Valid judgements", (t) => { const res = ParserFn( - dm({ hitData: { pgreat: 1, great: null, bad: 0 } }), + dm({ judgements: { pgreat: 1, great: null, bad: 0 } }), "file/batch-manual", logger ); @@ -294,7 +294,7 @@ t.test("#ParserFn", (t) => { identifier: "123", playtype: "SP", difficulty: "ANOTHER", - hitData: { + judgements: { pgreat: 1, great: null, bad: 0, @@ -424,18 +424,18 @@ t.test("#ParserFn", (t) => { t.end(); }); - t.test("Invalid HitData", (t) => { + t.test("Invalid judgements", (t) => { const fn = () => - ParserFn(dm({ hitData: { not_key: 123 } }), "file/batch-manual", logger); + ParserFn(dm({ judgements: { not_key: 123 } }), "file/batch-manual", logger); - t.throws(fn, mockErr("body[0].hitData | Invalid Key not_key")); + t.throws(fn, mockErr("body[0].judgements | Invalid Key not_key")); const fn2 = () => - ParserFn(dm({ hitData: { pgreat: "123" } }), "file/batch-manual", logger); + ParserFn(dm({ judgements: { pgreat: "123" } }), "file/batch-manual", logger); t.throws( fn2, - mockErr("body[0].hitData | Key pgreat had an invalid value of 123 [string]") + mockErr("body[0].judgements | Key pgreat had an invalid value of 123 [string]") ); t.end(); diff --git a/server/src/lib/score-import/import-types/common/batch-manual/parser.ts b/server/src/lib/score-import/import-types/common/batch-manual/parser.ts index f97e49ffa..bafe2a095 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/parser.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/parser.ts @@ -74,7 +74,7 @@ const PR_BatchManualScore = (game: Game, playtype: Playtypes[Game]): PrudenceSch (typeof self === "number" && self > 1_000_000_000_000) || "Expected a number greater than 1 Trillion - did you pass unix seconds instead of miliseconds?" ), - hitData: optNull((self) => { + judgements: optNull((self) => { if (typeof self !== "object" || self === null) { return "Not a valid object."; } diff --git a/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/converter.ts b/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/converter.ts index e5047db44..67374b09a 100644 --- a/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/converter.ts +++ b/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/converter.ts @@ -141,7 +141,7 @@ const ConvertEamIIDXCSV: ConverterFunction { // percent: 63.61, approximately, fpa impossible. grade: "B", lamp: "CLEAR", - hitData: {}, + judgements: {}, hitMeta: { bp: 21, }, @@ -76,7 +76,7 @@ t.test("#ConvertFileMerIIDX", (t) => { // percent: 63.61, approximately, fpa impossible. grade: "B", lamp: "CLEAR", - hitData: {}, + judgements: {}, hitMeta: { bp: 21, }, diff --git a/server/src/lib/score-import/import-types/file/mer-iidx/converter.ts b/server/src/lib/score-import/import-types/file/mer-iidx/converter.ts index 86c868939..51a45bab6 100644 --- a/server/src/lib/score-import/import-types/file/mer-iidx/converter.ts +++ b/server/src/lib/score-import/import-types/file/mer-iidx/converter.ts @@ -64,7 +64,7 @@ export const ConvertFileMerIIDX: ConverterFunction = asyn percent, grade, lamp, - hitData: {}, + judgements: {}, hitMeta: { bp: data.miss_count === -1 ? null : data.miss_count, }, diff --git a/server/src/lib/score-import/import-types/file/solid-state-squad/converter.test.ts b/server/src/lib/score-import/import-types/file/solid-state-squad/converter.test.ts index fe42228b0..dfd530b46 100644 --- a/server/src/lib/score-import/import-types/file/solid-state-squad/converter.test.ts +++ b/server/src/lib/score-import/import-types/file/solid-state-squad/converter.test.ts @@ -38,7 +38,7 @@ t.test("#ConvertFileS3", (t) => { grade: "F", score: 100, lamp: "FULL COMBO", - hitData: { + judgements: { pgreat: 25, great: 50, good: 0, diff --git a/server/src/lib/score-import/import-types/file/solid-state-squad/converter.ts b/server/src/lib/score-import/import-types/file/solid-state-squad/converter.ts index 772dff01d..8e4ef9a2a 100644 --- a/server/src/lib/score-import/import-types/file/solid-state-squad/converter.ts +++ b/server/src/lib/score-import/import-types/file/solid-state-squad/converter.ts @@ -142,9 +142,9 @@ export const ConvertFileS3: ConverterFunction = async ( const timeAchieved = ParseDateFromString(data.date); - let hitData = {}; + let judgements = {}; if (data.scorebreakdown) { - hitData = { + judgements = { pgreat: data.scorebreakdown.justgreats, great: data.scorebreakdown.greats, good: data.scorebreakdown.good, @@ -163,7 +163,7 @@ export const ConvertFileS3: ConverterFunction = async ( grade: grade as Grades["iidx:SP" | "iidx:DP"], score: data.exscore, lamp, - hitData, + judgements, hitMeta: {}, }, scoreMeta: {}, diff --git a/server/src/lib/score-import/import-types/ir/barbatos/converter.test.ts b/server/src/lib/score-import/import-types/ir/barbatos/converter.test.ts index 1b8f67be1..680a359f5 100644 --- a/server/src/lib/score-import/import-types/ir/barbatos/converter.test.ts +++ b/server/src/lib/score-import/import-types/ir/barbatos/converter.test.ts @@ -61,7 +61,7 @@ t.test("#ConverterIRBarbatos", (t) => { percent: 90, grade: "A+", lamp: "CLEAR", - hitData: { + judgements: { critical: 100, near: 50, miss: 5, diff --git a/server/src/lib/score-import/import-types/ir/barbatos/converter.ts b/server/src/lib/score-import/import-types/ir/barbatos/converter.ts index 4266d0423..a78080c1c 100644 --- a/server/src/lib/score-import/import-types/ir/barbatos/converter.ts +++ b/server/src/lib/score-import/import-types/ir/barbatos/converter.ts @@ -71,7 +71,7 @@ export const ConverterIRBarbatos: ConverterFunction percent, grade, lamp: LAMP_LOOKUP[data.clear_type] as Lamps["sdvx:Single"], - hitData: { + judgements: { critical: data.critical, near: data.near_total, miss: data.error, diff --git a/server/src/lib/score-import/import-types/ir/beatoraja/converter.ts b/server/src/lib/score-import/import-types/ir/beatoraja/converter.ts index 1cd7cb289..990d0675a 100644 --- a/server/src/lib/score-import/import-types/ir/beatoraja/converter.ts +++ b/server/src/lib/score-import/import-types/ir/beatoraja/converter.ts @@ -73,7 +73,7 @@ export const ConverterIRBeatoraja: ConverterFunction["scoreData"]["hitData"] = {}; + let judgements: DryScore<"bms:7K" | "bms:14K">["scoreData"]["judgements"] = {}; // if NOT CN mode we can assign judgements properly if (data.lntype === 0) { @@ -95,7 +95,7 @@ export const ConverterIRBeatoraja: ConverterFunction = a percent, score: data.score, lamp: DeriveLamp(data, logger), - hitData: { + judgements: { critical: data.crit, near: data.near, miss: data.error, diff --git a/server/src/server/router/ir/usc/router.test.ts b/server/src/server/router/ir/usc/router.test.ts index f733311d0..9bae5d32a 100644 --- a/server/src/server/router/ir/usc/router.test.ts +++ b/server/src/server/router/ir/usc/router.test.ts @@ -124,7 +124,7 @@ const USC_SCORE_PB: PBScoreDocument = { lamp: "EXCESSIVE CLEAR", lampIndex: 2, gradeIndex: 4, // idk, lazy - hitData: { + judgements: { critical: 50, near: 30, miss: 10, diff --git a/server/src/server/router/ir/usc/usc.test.ts b/server/src/server/router/ir/usc/usc.test.ts index 8adc5cfa8..0dde1289d 100644 --- a/server/src/server/router/ir/usc/usc.test.ts +++ b/server/src/server/router/ir/usc/usc.test.ts @@ -28,7 +28,7 @@ const mockScorePB: PBScoreDocument<"usc:Single"> = { esd: null, grade: "AAA+", gradeIndex: 7, - hitData: { + judgements: { critical: 100, miss: 15, }, diff --git a/server/src/server/router/ir/usc/usc.ts b/server/src/server/router/ir/usc/usc.ts index b3eda4903..0baac54b3 100644 --- a/server/src/server/router/ir/usc/usc.ts +++ b/server/src/server/router/ir/usc/usc.ts @@ -69,9 +69,9 @@ export async function TachiScoreToServerScore( return { score: tachiScore.scoreData.score, timestamp: MStoS(tachiScore.timeAchieved ?? 0), - crit: tachiScore.scoreData.hitData.critical ?? 0, - near: tachiScore.scoreData.hitData.near ?? 0, - error: tachiScore.scoreData.hitData.miss ?? 0, + crit: tachiScore.scoreData.judgements.critical ?? 0, + near: tachiScore.scoreData.judgements.near ?? 0, + error: tachiScore.scoreData.judgements.miss ?? 0, ranking: tachiScore.rankingData.rank, lamp: TACHI_LAMP_TO_USC[tachiScore.scoreData.lamp], username: userDoc.username, diff --git a/server/src/test-utils/mock-db/scores.json b/server/src/test-utils/mock-db/scores.json index 98d2e0094..5df71a616 100644 --- a/server/src/test-utils/mock-db/scores.json +++ b/server/src/test-utils/mock-db/scores.json @@ -13,7 +13,7 @@ "esd": 30, "gradeIndex": 3, "lampIndex": 4, - "hitData": { + "judgements": { "pgreat": 50, "great": 10 }, diff --git a/server/src/test-utils/test-data/tachi/gitadora-dryscore.json b/server/src/test-utils/test-data/tachi/gitadora-dryscore.json index 9bf73ef72..d251c2f49 100644 --- a/server/src/test-utils/test-data/tachi/gitadora-dryscore.json +++ b/server/src/test-utils/test-data/tachi/gitadora-dryscore.json @@ -7,7 +7,7 @@ "percent": 70.76, "grade": "B", "esd": 30, - "hitData": {}, + "judgements": {}, "hitMeta": {} }, "scoreMeta": {}, diff --git a/server/src/test-utils/test-data/tachi/iidx-dryscore.json b/server/src/test-utils/test-data/tachi/iidx-dryscore.json index 301f58b1b..0749d176a 100644 --- a/server/src/test-utils/test-data/tachi/iidx-dryscore.json +++ b/server/src/test-utils/test-data/tachi/iidx-dryscore.json @@ -6,7 +6,7 @@ "lamp": "CLEAR", "percent": 50, "grade": "C", - "hitData": { + "judgements": { "pgreat": 50, "great": 10 }, diff --git a/server/src/test-utils/test-data/tachi/iidx-score.json b/server/src/test-utils/test-data/tachi/iidx-score.json index fec2287db..9737097c4 100644 --- a/server/src/test-utils/test-data/tachi/iidx-score.json +++ b/server/src/test-utils/test-data/tachi/iidx-score.json @@ -12,7 +12,7 @@ "esd": 30, "gradeIndex": 3, "lampIndex": 4, - "hitData": { + "judgements": { "pgreat": 50, "great": 10 }, diff --git a/server/src/test-utils/test-data/tachi/iidx-scorepb.json b/server/src/test-utils/test-data/tachi/iidx-scorepb.json index 1a7b42dcd..749bda24d 100644 --- a/server/src/test-utils/test-data/tachi/iidx-scorepb.json +++ b/server/src/test-utils/test-data/tachi/iidx-scorepb.json @@ -24,7 +24,7 @@ "gradeIndex": -1, "lamp": "EX HARD CLEAR", "lampIndex": 6, - "hitData": { + "judgements": { "pgreat": 697, "great": 85 }, diff --git a/server/src/test-utils/test-data/tachi/sdvx-dryscore.json b/server/src/test-utils/test-data/tachi/sdvx-dryscore.json index 18631e476..d8ae04cb3 100644 --- a/server/src/test-utils/test-data/tachi/sdvx-dryscore.json +++ b/server/src/test-utils/test-data/tachi/sdvx-dryscore.json @@ -7,7 +7,7 @@ "percent": 95, "grade": "AA+", "esd": null, - "hitData": {}, + "judgements": {}, "hitMeta": {} }, "scoreMeta": {}, From 5a2278dbb9ed7af9c955345f14fa81685886b62b Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 18:03:36 +0100 Subject: [PATCH 09/12] fix redundant argument in genericgetgradenadpercent --- server/src/lib/score-import/framework/common/score-utils.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/lib/score-import/framework/common/score-utils.ts b/server/src/lib/score-import/framework/common/score-utils.ts index 5f279b12e..b419272cd 100644 --- a/server/src/lib/score-import/framework/common/score-utils.ts +++ b/server/src/lib/score-import/framework/common/score-utils.ts @@ -119,15 +119,14 @@ export function ValidatePercent( */ export function GenericGetGradeAndPercent( game: G, - playtype: Playtypes[G], score: number, chart: AnyChartDocument ) { const percent = GenericCalculatePercent(game, score, chart); - ValidatePercent(game, playtype, percent, chart); + ValidatePercent(game, chart.playtype, percent, chart); - const grade = GetGradeFromPercent(game, playtype, percent) as Grades[GameToIDStrings[G]]; + const grade = GetGradeFromPercent(game, chart.playtype, percent) as Grades[GameToIDStrings[G]]; return { percent, grade }; } From f4c32aa201140087dabaa786f7340dd4a5f838ac Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 18:36:10 +0100 Subject: [PATCH 10/12] Various cleanup for new type refactors --- server/scripts/validate-database.ts | 284 +++++++++--------- server/src/external/mongo/indexes.ts | 2 +- server/src/external/mongo/schemas.ts | 92 +++--- .../calculated-data/calculated-data.ts | 32 +- .../score-importing/hydrate-score.ts | 15 +- .../framework/sessions/calculated-data.ts | 16 +- .../user-game-stats/builtin-class-handlers.ts | 16 +- .../framework/user-game-stats/classes.ts | 14 +- .../framework/user-game-stats/rating.ts | 88 +++--- .../common/api-kai/traverse-api.ts | 2 +- server/src/main.ts | 2 +- .../src/server/router/api/v1/import/router.ts | 5 +- server/src/utils/misc.ts | 2 +- 13 files changed, 293 insertions(+), 277 deletions(-) diff --git a/server/scripts/validate-database.ts b/server/scripts/validate-database.ts index 778b41149..be15c2ec3 100644 --- a/server/scripts/validate-database.ts +++ b/server/scripts/validate-database.ts @@ -16,180 +16,180 @@ const BASE_DIR = path.join(__dirname, "./validate-database-errs"); const logger = CreateLogCtx(__filename); async function ValidateStaticSchemas(): Promise { - for (const x in STATIC_SCHEMAS) { - const c = x as keyof typeof STATIC_SCHEMAS; + for (const x in STATIC_SCHEMAS) { + const c = x as keyof typeof STATIC_SCHEMAS; - const schema = STATIC_SCHEMAS[c] as PrudenceSchema; + const schema = STATIC_SCHEMAS[c] as PrudenceSchema; - logger.info(`=== Validating Collection ${c}... ===`); + logger.info(`=== Validating Collection ${c}... ===`); - let successCount = 0; - let total = 0; - const fails: { err: PrudenceError; doc: unknown }[] = []; + let successCount = 0; + let total = 0; + const fails: { err: PrudenceError; doc: unknown }[] = []; - const start = process.hrtime.bigint(); + const start = process.hrtime.bigint(); - // @ts-expect-error shut UP - // eslint-disable-next-line no-await-in-loop - await db[c].find({}, { projection: { _id: 0 } }).each((c: unknown) => { - total++; - const res = Prudence(c, schema); + // @ts-expect-error shut UP + // eslint-disable-next-line no-await-in-loop + await db[c].find({}, { projection: { _id: 0 } }).each((c: unknown) => { + total++; + const res = Prudence(c, schema); - if (res === null) { - successCount++; - } else { - logger.error(res); - fails.push({ err: res, doc: c }); - } - }); + if (res === null) { + successCount++; + } else { + logger.error(res); + fails.push({ err: res, doc: c }); + } + }); - const end = process.hrtime.bigint(); - logger.info(`Validated ${total} objects. Took ${Number(end - start) / 1e9} seconds.`); - logger.info(`Success: ${successCount} (${((successCount * 100) / total).toFixed(2)}%)`); - logger.info(`Fail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)`); + const end = process.hrtime.bigint(); + logger.info(`Validated ${total} objects. Took ${Number(end - start) / 1e9} seconds.`); + logger.info(`Success: ${successCount} (${((successCount * 100) / total).toFixed(2)}%)`); + logger.info(`Fail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)`); - if (fails.length !== 0) { - logger.severe(`Invalid documents found! Please resolve them.`); - fs.writeFileSync(path.join(BASE_DIR, `${c}.json`), JSON.stringify(fails)); - } - } + if (fails.length !== 0) { + logger.severe(`Invalid documents found! Please resolve them.`); + fs.writeFileSync(path.join(BASE_DIR, `${c}.json`), JSON.stringify(fails)); + } + } - logger.info("Done!"); - process.exit(0); + logger.info("Done!"); + process.exit(0); } async function ValidateScores(): Promise { - const globalStart = process.hrtime.bigint(); - let globalTotal = 0; - let globalSuccess = 0; - let globalFail = 0; - for (const game of CONF_INFO.SUPPORTED_GAMES) { - for (const playtype of validPlaytypes[game]) { - // @ts-expect-error shut up - const schema = PRUDENCE_SCORE_SCHEMAS[game][playtype]; + const globalStart = process.hrtime.bigint(); + let globalTotal = 0; + let globalSuccess = 0; + let globalFail = 0; + for (const game of CONF_INFO.supportedGames) { + for (const playtype of validPlaytypes[game]) { + // @ts-expect-error shut up + const schema = PRUDENCE_SCORE_SCHEMAS[game][playtype]; - let successCount = 0; - let total = 0; - const fails: { err: PrudenceError; doc: unknown }[] = []; + let successCount = 0; + let total = 0; + const fails: { err: PrudenceError; doc: unknown }[] = []; - logger.info(`=== Validating Collection scores (${game} ${playtype}) ... ===`); - const start = process.hrtime.bigint(); + logger.info(`=== Validating Collection scores (${game} ${playtype}) ... ===`); + const start = process.hrtime.bigint(); - // eslint-disable-next-line no-await-in-loop - await db.scores - .find({ playtype, game }, { projection: { _id: 0 } }) - // @ts-expect-error shut UP - .each((c: unknown) => { - total++; - const res = Prudence(c, schema); + // eslint-disable-next-line no-await-in-loop + await db.scores + .find({ playtype, game }, { projection: { _id: 0 } }) + // @ts-expect-error shut UP + .each((c: unknown) => { + total++; + const res = Prudence(c, schema); - if (res === null) { - successCount++; - } else { - logger.error( - `[${game} ${playtype}] [${res.keychain}] ${res.message}: ${res.userVal}` - ); - fails.push({ err: res, doc: c }); - } - }); + if (res === null) { + successCount++; + } else { + logger.error( + `[${game} ${playtype}] [${res.keychain}] ${res.message}: ${res.userVal}` + ); + fails.push({ err: res, doc: c }); + } + }); - const end = process.hrtime.bigint(); - logger.info(`Validated ${total} objects. Took ${Number(end - start) / 1e9} seconds.`); - logger.info(`Success: ${successCount} (${((successCount * 100) / total).toFixed(2)}%)`); - logger.info(`Fail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)`); + const end = process.hrtime.bigint(); + logger.info(`Validated ${total} objects. Took ${Number(end - start) / 1e9} seconds.`); + logger.info(`Success: ${successCount} (${((successCount * 100) / total).toFixed(2)}%)`); + logger.info(`Fail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)`); - if (fails.length !== 0) { - logger.severe(`Invalid documents found! Please resolve them.`); - fs.writeFileSync( - path.join(BASE_DIR, `scores-${game}-${playtype}.json`), - JSON.stringify(fails) - ); - fs.writeFileSync( - path.join(BASE_DIR, `scores-${game}-${playtype}.log`), - `Validated ${total} objects. Took ${ - Number(end - start) / 1e9 - } seconds.\nSuccess: ${successCount} (${((successCount * 100) / total).toFixed( - 2 - )}%)\nFail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)` - ); - } + if (fails.length !== 0) { + logger.severe(`Invalid documents found! Please resolve them.`); + fs.writeFileSync( + path.join(BASE_DIR, `scores-${game}-${playtype}.json`), + JSON.stringify(fails) + ); + fs.writeFileSync( + path.join(BASE_DIR, `scores-${game}-${playtype}.log`), + `Validated ${total} objects. Took ${ + Number(end - start) / 1e9 + } seconds.\nSuccess: ${successCount} (${((successCount * 100) / total).toFixed( + 2 + )}%)\nFail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)` + ); + } - globalTotal += total; - globalFail += fails.length; - globalSuccess += successCount; - } - } + globalTotal += total; + globalFail += fails.length; + globalSuccess += successCount; + } + } - const globalEnd = process.hrtime.bigint(); - logger.info( - `Validated ${globalTotal} objects. Took ${Number(globalEnd - globalStart) / 1e9} seconds.` - ); - logger.info(`Success: ${globalSuccess} (${((globalSuccess * 100) / globalTotal).toFixed(2)}%)`); - logger.info(`Fail: ${globalFail} (${((globalFail * 100) / globalTotal).toFixed(2)}%)`); + const globalEnd = process.hrtime.bigint(); + logger.info( + `Validated ${globalTotal} objects. Took ${Number(globalEnd - globalStart) / 1e9} seconds.` + ); + logger.info(`Success: ${globalSuccess} (${((globalSuccess * 100) / globalTotal).toFixed(2)}%)`); + logger.info(`Fail: ${globalFail} (${((globalFail * 100) / globalTotal).toFixed(2)}%)`); - // process.exit(1); + // process.exit(1); } async function ValidateChartsOrSongs(type: "songs" | "charts"): Promise { - const globalStart = process.hrtime.bigint(); - let globalTotal = 0; - let globalSuccess = 0; - let globalFail = 0; - for (const game of CONF_INFO.SUPPORTED_GAMES) { - const schema = STATIC_SCHEMAS[type]![game]; + const globalStart = process.hrtime.bigint(); + let globalTotal = 0; + let globalSuccess = 0; + let globalFail = 0; + for (const game of CONF_INFO.supportedGames) { + const schema = STATIC_SCHEMAS[type]![game]; - let successCount = 0; - let total = 0; - const fails: { err: PrudenceError; doc: unknown }[] = []; + let successCount = 0; + let total = 0; + const fails: { err: PrudenceError; doc: unknown }[] = []; - logger.info(`=== Validating Collection ${type} (${game}) ... ===`); - const start = process.hrtime.bigint(); + logger.info(`=== Validating Collection ${type} (${game}) ... ===`); + const start = process.hrtime.bigint(); - // eslint-disable-next-line no-await-in-loop - await db[type][game] - // @ts-expect-error whatever bro - .find({}, { projection: { _id: 0 } }) - .each((c: unknown) => { - total++; - const res = Prudence(c, schema); + // eslint-disable-next-line no-await-in-loop + await db[type][game] + // @ts-expect-error whatever bro + .find({}, { projection: { _id: 0 } }) + .each((c: unknown) => { + total++; + const res = Prudence(c, schema); - if (res === null) { - successCount++; - } else { - logger.error(`[${game}] [${res.keychain}] ${res.message}: ${res.userVal}`); - fails.push({ err: res, doc: c }); - } - }); + if (res === null) { + successCount++; + } else { + logger.error(`[${game}] [${res.keychain}] ${res.message}: ${res.userVal}`); + fails.push({ err: res, doc: c }); + } + }); - const end = process.hrtime.bigint(); - logger.info(`Validated ${total} objects. Took ${Number(end - start) / 1e9} seconds.`); - logger.info(`Success: ${successCount} (${((successCount * 100) / total).toFixed(2)}%)`); - logger.info(`Fail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)`); + const end = process.hrtime.bigint(); + logger.info(`Validated ${total} objects. Took ${Number(end - start) / 1e9} seconds.`); + logger.info(`Success: ${successCount} (${((successCount * 100) / total).toFixed(2)}%)`); + logger.info(`Fail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)`); - if (fails.length !== 0) { - logger.severe(`Invalid documents found! Please resolve them.`); - fs.writeFileSync(path.join(BASE_DIR, `${type}-${game}.json`), JSON.stringify(fails)); - fs.writeFileSync( - path.join(BASE_DIR, `${type}-${game}.log`), - `Validated ${total} objects. Took ${ - Number(end - start) / 1e9 - } seconds.\nSuccess: ${successCount} (${((successCount * 100) / total).toFixed( - 2 - )}%)\nFail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)` - ); - } + if (fails.length !== 0) { + logger.severe(`Invalid documents found! Please resolve them.`); + fs.writeFileSync(path.join(BASE_DIR, `${type}-${game}.json`), JSON.stringify(fails)); + fs.writeFileSync( + path.join(BASE_DIR, `${type}-${game}.log`), + `Validated ${total} objects. Took ${ + Number(end - start) / 1e9 + } seconds.\nSuccess: ${successCount} (${((successCount * 100) / total).toFixed( + 2 + )}%)\nFail: ${fails.length} (${((fails.length * 100) / total).toFixed(2)}%)` + ); + } - globalTotal += total; - globalFail += fails.length; - globalSuccess += successCount; - } + globalTotal += total; + globalFail += fails.length; + globalSuccess += successCount; + } - const globalEnd = process.hrtime.bigint(); - logger.info( - `Validated ${globalTotal} objects. Took ${Number(globalEnd - globalStart) / 1e9} seconds.` - ); - logger.info(`Success: ${globalSuccess} (${((globalSuccess * 100) / globalTotal).toFixed(2)}%)`); - logger.info(`Fail: ${globalFail} (${((globalFail * 100) / globalTotal).toFixed(2)}%)`); + const globalEnd = process.hrtime.bigint(); + logger.info( + `Validated ${globalTotal} objects. Took ${Number(globalEnd - globalStart) / 1e9} seconds.` + ); + logger.info(`Success: ${globalSuccess} (${((globalSuccess * 100) / globalTotal).toFixed(2)}%)`); + logger.info(`Fail: ${globalFail} (${((globalFail * 100) / globalTotal).toFixed(2)}%)`); } // ValidateStaticSchemas(); diff --git a/server/src/external/mongo/indexes.ts b/server/src/external/mongo/indexes.ts index 23f3de4c9..6e6b19725 100644 --- a/server/src/external/mongo/indexes.ts +++ b/server/src/external/mongo/indexes.ts @@ -75,7 +75,7 @@ const staticIndexes: Partial> = { const indexes: Partial> = staticIndexes; -for (const game of CONF_INFO.SUPPORTED_GAMES) { +for (const game of CONF_INFO.supportedGames) { if (indexes[`charts-${game}` as ValidDatabases]) { indexes[`charts-${game}` as ValidDatabases]!.push( index({ chartID: 1 }, UNIQUE), diff --git a/server/src/external/mongo/schemas.ts b/server/src/external/mongo/schemas.ts index eebace3d6..05499c490 100644 --- a/server/src/external/mongo/schemas.ts +++ b/server/src/external/mongo/schemas.ts @@ -1,5 +1,5 @@ import deepmerge from "deepmerge"; -import { Game, Playtypes } from "tachi-common"; +import { Game, Playtypes, GetGameConfig, GetGamePTConfig } from "tachi-common"; import p, { PrudenceSchema, ValidSchemaValue } from "prudence"; import { CONF_INFO } from "../../lib/setup/config"; @@ -92,7 +92,7 @@ export const PR_SCORE_GENERIC = { comment: p.nullable(p.isBoundedString(1, 240)), timeAdded: p.isPositive, scoreID: "string", // temp - importType: p.nullable(p.isIn(importTypes)), + importType: p.nullable(p.isIn(CONF_INFO.supportedImportTypes)), }; type ScoreSchemas = { @@ -107,28 +107,35 @@ const nullableAndOptional = (fn: ValidSchemaValue) => p.optional(p.nullable(fn)) const nullableAndOptionalPosInt = nullableAndOptional(p.isPositiveInteger); -const CreateGameScoreData = (game: Game, hitMetaMerge: PrudenceSchema) => ({ - lamp: p.isIn(lamps[game]), - lampIndex: p.and( - p.isPositiveInteger, - (self, parent) => lamps[game][self as number] === parent.lamp - ), - grade: p.isIn(grades[game]), - gradeIndex: p.and( - p.isPositiveInteger, - (self, parent) => grades[game][self as number] === parent.grade - ), - judgements: Object.fromEntries(validjudgements[game].map((e) => [e, optionalPositiveInt])), - hitMeta: deepmerge( - { - fast: nullableAndOptionalPosInt, - slow: nullableAndOptionalPosInt, - maxCombo: nullableAndOptionalPosInt, - }, - hitMetaMerge - ), - esd: p.nullable(p.isPositive), -}); +const CreateGameScoreData = ( + game: Game, + playtype: Playtypes[Game], + hitMetaMerge: PrudenceSchema +) => { + const gptConfig = GetGamePTConfig(game, playtype); + return { + lamp: p.isIn(gptConfig.lamps), + lampIndex: p.and( + p.isPositiveInteger, + (self, parent) => gptConfig.lamps[self as number] === parent.lamp + ), + grade: p.isIn(gptConfig.grades), + gradeIndex: p.and( + p.isPositiveInteger, + (self, parent) => gptConfig.grades[self as number] === parent.grade + ), + judgements: Object.fromEntries(gptConfig.judgements.map((e) => [e, optionalPositiveInt])), + hitMeta: deepmerge( + { + fast: nullableAndOptionalPosInt, + slow: nullableAndOptionalPosInt, + maxCombo: nullableAndOptionalPosInt, + }, + hitMetaMerge + ), + esd: p.nullable(p.isPositive), + }; +}; const PR_SCORE_IIDX_SP: PrudenceSchema = CreatePRScore( "iidx", @@ -194,7 +201,7 @@ function CreatePRScore( return deepmerge(PR_SCORE_GENERIC, { game: p.equalTo(game), playtype: p.equalTo(playtype), - scoreData: CreateGameScoreData(game, mergeHitMeta), + scoreData: CreateGameScoreData(game, playtype, mergeHitMeta), scoreMeta: mergeScoreMeta, calculatedData: { gameSpecific: mergeGameSpecific, @@ -292,9 +299,9 @@ export const PRUDENCE_SCORE_SCHEMAS: ScoreSchemas = { Gita: CreatePRScore("gitadora", "Gita"), Dora: CreatePRScore("gitadora", "Dora"), }, - jubeat: { - Single: CreatePRScore("jubeat", "Single"), - }, + // jubeat: { + // Single: CreatePRScore("jubeat", "Single"), + // }, maimai: { Single: deepmerge(CreatePRScore("maimai", "Single"), { scoreData: { percent: p.isBetween(0, 150) }, @@ -303,9 +310,9 @@ export const PRUDENCE_SCORE_SCHEMAS: ScoreSchemas = { museca: { Single: CreatePRScore("museca", "Single"), }, - popn: { - "9B": CreatePRScore("popn", "9B", { gauge: p.optional(p.isBetween(0, 100)) }), - }, + // popn: { + // "9B": CreatePRScore("popn", "9B", { gauge: p.optional(p.isBetween(0, 100)) }), + // }, usc: { Single: CreatePRScore("usc", "Single", { gauge: p.optional(p.isBetween(0, 100)) }), }, @@ -322,9 +329,16 @@ const PRUDENCE_CHART_BASE: PrudenceSchema = { }; function CreatePrChart(game: Game, flags: string[], data: PrudenceSchema) { + const gameConfig = GetGameConfig(game); + + const validDifficulties = []; + for (const playtype of gameConfig.validPlaytypes) { + validDifficulties.push(...GetGamePTConfig(game, playtype).difficulties); + } + return deepmerge(PRUDENCE_CHART_BASE, { - difficulty: p.isIn(validDifficulties[game]), - playtype: p.isIn(validPlaytypes[game]), + difficulty: p.isIn(validDifficulties), + playtype: p.isIn(gameConfig.validPlaytypes), flags: Object.fromEntries(flags.map((e) => [e, "boolean"])), data, }); @@ -347,13 +361,13 @@ export const PRUDENCE_CHART_SCHEMAS: Record = { gitadora: CreatePrChart("gitadora", ["IN BASE GAME", "OMNIMIX", "HOT N-1", "HOT"], { inGameID: p.isPositiveInteger, }), - jubeat: CreatePrChart("jubeat", ["IN BASE GAME"], {}), + // jubeat: CreatePrChart("jubeat", ["IN BASE GAME"], {}), maimai: CreatePrChart("maimai", ["IN BASE GAME"], { maxPercent: p.gte(100), inGameID: "string", }), museca: CreatePrChart("museca", ["IN BASE GAME", "OMNIMIX"], {}), - popn: CreatePrChart("popn", ["IN BASE GAME", "OMNIMIX"], {}), + // popn: CreatePrChart("popn", ["IN BASE GAME", "OMNIMIX"], {}), sdvx: CreatePrChart("sdvx", ["IN BASE GAME", "OMNIMIX", "N-1"], { inGameID: p.isPositiveInteger, }), @@ -385,10 +399,10 @@ export const PRUDENCE_SONG_SCHEMAS: Record = { chunithm: PRUDENCE_SONG_WITH_GENRE, ddr: CreatePrSong({}), gitadora: CreatePrSong({}), - jubeat: CreatePrSong({}), + // jubeat: CreatePrSong({}), maimai: CreatePrSong({ titleJP: "string", artistJP: "string", genre: "string" }), museca: CreatePrSong({ titleJP: "string", artistJP: "string" }), - popn: PRUDENCE_SONG_WITH_GENRE, + // popn: PRUDENCE_SONG_WITH_GENRE, sdvx: CreatePrSong({ uscEquiv: p.nullable(p.isPositiveInteger) }), usc: CreatePrSong({ sdvxEquiv: p.nullable(p.isPositiveInteger) }), }; @@ -400,8 +414,8 @@ const PRUDENCE_FOLDER_CHART_LOOKUP: PrudenceSchema = { const PRUDENCE_FOLDER: PrudenceSchema = { title: "string", - game: p.isIn(CONF_INFO.SUPPORTED_GAMES), - playtype: (self, parent) => p.isIn(validPlaytypes[parent.game as Game])(self), + game: p.isIn(CONF_INFO.supportedGames), + playtype: (self, parent) => p.isIn(GetGameConfig(parent.game as Game).validPlaytypes)(self), folderID: "string", table: "string", tableIndex: "number", diff --git a/server/src/lib/score-import/framework/calculated-data/calculated-data.ts b/server/src/lib/score-import/framework/calculated-data/calculated-data.ts index bd177ba1a..321049770 100644 --- a/server/src/lib/score-import/framework/calculated-data/calculated-data.ts +++ b/server/src/lib/score-import/framework/calculated-data/calculated-data.ts @@ -69,9 +69,9 @@ const CalculatedDataFunctions: CalculatedDataFunctions = { sdvx: { Single: CalculateDataSDVXorUSC, }, - popn: { - "9B": () => ({}), - }, + // popn: { + // "9B": () => ({}), + // }, museca: { Single: CalculateDataMuseca, }, @@ -93,9 +93,9 @@ const CalculatedDataFunctions: CalculatedDataFunctions = { SP: CalculateDataDDR, DP: CalculateDataDDR, }, - jubeat: { - Single: CalculateDataJubeat, - }, + // jubeat: { + // Single: CalculateDataJubeat, + // }, usc: { Single: CalculateDataSDVXorUSC, }, @@ -310,13 +310,13 @@ async function CalculateDataBMS7K( }; } -async function CalculateDataJubeat( - dryScore: DryScore, - chart: AnyChartDocument, - defaultTierlistID: string | undefined, - logger: KtLogger -): Promise> { - return { - jubility: 0, // @todo #163 Jubeat Jubility - }; -} +// async function CalculateDataJubeat( +// dryScore: DryScore, +// chart: AnyChartDocument, +// defaultTierlistID: string | undefined, +// logger: KtLogger +// ): Promise> { +// return { +// jubility: 0, // @todo #163 Jubeat Jubility +// }; +// } diff --git a/server/src/lib/score-import/framework/score-importing/hydrate-score.ts b/server/src/lib/score-import/framework/score-importing/hydrate-score.ts index ebac51a87..372f60fe9 100644 --- a/server/src/lib/score-import/framework/score-importing/hydrate-score.ts +++ b/server/src/lib/score-import/framework/score-importing/hydrate-score.ts @@ -1,4 +1,10 @@ -import { AnyChartDocument, config, integer, ScoreDocument, AnySongDocument } from "tachi-common"; +import { + AnyChartDocument, + integer, + ScoreDocument, + AnySongDocument, + GetGamePTConfig, +} from "tachi-common"; import { KtLogger } from "../../../logger/logger"; import { CreateCalculatedData } from "../calculated-data/calculated-data"; import { CalculateESDForGame } from "../common/score-utils"; @@ -27,12 +33,13 @@ export async function HydrateScore( const { scoreData: dryScoreData, ...rest } = dryScore; + const gptConfig = GetGamePTConfig(dryScore.game, chart.playtype); + // Fill out the rest of the fields we want for scoreData const scoreData = Object.assign( { - // @todo #103 lamps may need to be separate upon game:playtype someday. Maybe. We need to check this out - lampIndex: config.lamps[dryScore.game].indexOf(dryScore.scoreData.lamp as string), - gradeIndex: config.grades[dryScore.game].indexOf(dryScore.scoreData.grade as string), + lampIndex: gptConfig.lamps.indexOf(dryScore.scoreData.lamp), + gradeIndex: gptConfig.grades.indexOf(dryScore.scoreData.grade), esd, }, dryScoreData diff --git a/server/src/lib/score-import/framework/sessions/calculated-data.ts b/server/src/lib/score-import/framework/sessions/calculated-data.ts index bf1547dbd..338c66fec 100644 --- a/server/src/lib/score-import/framework/sessions/calculated-data.ts +++ b/server/src/lib/score-import/framework/sessions/calculated-data.ts @@ -64,9 +64,9 @@ const CalculatedDataFunctions: CalculatedDataFunctions = { }; }, }, - popn: { - "9B": () => ({}), - }, + // popn: { + // "9B": () => ({}), + // }, museca: { Single: (scd) => ({ ktRating: AvgBest10Map(scd, "ktRating"), @@ -108,11 +108,11 @@ const CalculatedDataFunctions: CalculatedDataFunctions = { ktRating: AvgBest10Map(scd, "ktRating"), }), }, - jubeat: { - Single: (scd) => ({ - jubility: AvgBest10Map(scd, "jubility"), - }), - }, + // jubeat: { + // Single: (scd) => ({ + // jubility: AvgBest10Map(scd, "jubility"), + // }), + // }, usc: { Single: (scd) => { const VF6 = AvgBest10Map(scd, "VF6"); diff --git a/server/src/lib/score-import/framework/user-game-stats/builtin-class-handlers.ts b/server/src/lib/score-import/framework/user-game-stats/builtin-class-handlers.ts index d99e469df..08e3d4882 100644 --- a/server/src/lib/score-import/framework/user-game-stats/builtin-class-handlers.ts +++ b/server/src/lib/score-import/framework/user-game-stats/builtin-class-handlers.ts @@ -94,13 +94,13 @@ export function GitadoraSkillToColour(sk: number) { return GitadoraColours.WHITE; } -export function CalculateJubeatColour( - game: Game, - playtype: Playtypes[Game], - userID: integer, - ratings: Record -): GameClasses<"jubeat:Single"> { - throw new Error("Not implemented."); -} +// export function CalculateJubeatColour( +// game: Game, +// playtype: Playtypes[Game], +// userID: integer, +// ratings: Record +// ): GameClasses<"jubeat:Single"> { +// throw new Error("Not implemented."); +// } // function JubilityToColour(jb: number) {} diff --git a/server/src/lib/score-import/framework/user-game-stats/classes.ts b/server/src/lib/score-import/framework/user-game-stats/classes.ts index 720d86b69..4a48518bc 100644 --- a/server/src/lib/score-import/framework/user-game-stats/classes.ts +++ b/server/src/lib/score-import/framework/user-game-stats/classes.ts @@ -2,11 +2,7 @@ import { Game, Playtypes, integer, UserGameStats, ClassDelta, IDStrings } from " import { GameClasses } from "tachi-common/js/game-classes"; import deepmerge from "deepmerge"; import { KtLogger } from "../../../logger/logger"; -import { - CalculateGitadoraColour, - CalculateJubeatColour, - CalculateSDVXClass, -} from "./builtin-class-handlers"; +import { CalculateGitadoraColour, CalculateSDVXClass } from "./builtin-class-handlers"; import { ReturnClassIfGreater } from "../../../../utils/class"; import { RedisPub } from "../../../../external/redis/redis-IPC"; import { ClassHandler, ScoreClasses } from "./types"; @@ -37,12 +33,12 @@ const STATIC_CLASS_HANDLERS: ClassHandlerMap = { Gita: CalculateGitadoraColour, Dora: CalculateGitadoraColour, }, - jubeat: { - Single: CalculateJubeatColour, - }, + // jubeat: { + // Single: CalculateJubeatColour, + // }, maimai: null, museca: null, - popn: null, + // popn: null, sdvx: { Single: CalculateSDVXClass, }, diff --git a/server/src/lib/score-import/framework/user-game-stats/rating.ts b/server/src/lib/score-import/framework/user-game-stats/rating.ts index 8d8cfef05..aa37ed410 100644 --- a/server/src/lib/score-import/framework/user-game-stats/rating.ts +++ b/server/src/lib/score-import/framework/user-game-stats/rating.ts @@ -117,9 +117,9 @@ const RatingFunctions: RatingFunctions = { naiveRating: await LazyMeanN("rating", 20)(g, p, u), }), }, - popn: { - "9B": async () => ({}), - }, + // popn: { + // "9B": async () => ({}), + // }, museca: { Single: async (g, p, u) => ({ ktRating: await LazyMeanN("ktRating", 20)(g, p, u), @@ -130,11 +130,11 @@ const RatingFunctions: RatingFunctions = { ktRating: await LazyMeanN("ktRating", 20)(g, p, u), }), }, - jubeat: { - Single: async (g, p, u, l) => ({ - jubility: await CalculateJubility(g, p, u, l), - }), - }, + // jubeat: { + // Single: async (g, p, u, l) => ({ + // jubility: await CalculateJubility(g, p, u, l), + // }), + // }, }; export function CalculateRatings( @@ -188,43 +188,43 @@ async function CalculateGitadoraSkill( return skill; } -async function CalculateJubility( - game: Game, - playtype: Playtypes[Game], - userID: integer, - logger: KtLogger -): Promise { - const hotCharts = await db.charts.jubeat.find( - { "flags.HOT N-1": true }, - { projection: { chartID: 1 } } - ); +// async function CalculateJubility( +// game: Game, +// playtype: Playtypes[Game], +// userID: integer, +// logger: KtLogger +// ): Promise { +// const hotCharts = await db.charts.jubeat.find( +// { "flags.HOT N-1": true }, +// { projection: { chartID: 1 } } +// ); - const hotChartIDs = hotCharts.map((e) => e.chartID); +// const hotChartIDs = hotCharts.map((e) => e.chartID); - const [bestHotScores, bestScores] = await Promise.all([ - db["personal-bests"].find( - { userID, chartID: { $in: hotChartIDs } }, - { - sort: { "calculatedData.jubility": -1 }, - limit: 25, - projection: { "calculatedData.jubility": 1 }, - } - ), - // @inefficient - // see gitadoraskillcalc - db["personal-bests"].find( - { userID, chartID: { $nin: hotChartIDs } }, - { - sort: { "calculatedData.jubility": -1 }, - limit: 25, - projection: { "calculatedData.jubility": 1 }, - } - ), - ]); +// const [bestHotScores, bestScores] = await Promise.all([ +// db["personal-bests"].find( +// { userID, chartID: { $in: hotChartIDs } }, +// { +// sort: { "calculatedData.jubility": -1 }, +// limit: 25, +// projection: { "calculatedData.jubility": 1 }, +// } +// ), +// // @inefficient +// // see gitadoraskillcalc +// db["personal-bests"].find( +// { userID, chartID: { $nin: hotChartIDs } }, +// { +// sort: { "calculatedData.jubility": -1 }, +// limit: 25, +// projection: { "calculatedData.jubility": 1 }, +// } +// ), +// ]); - let skill = 0; - skill += bestHotScores.reduce((a, r) => a + r.calculatedData.jubility!, 0); - skill += bestScores.reduce((a, r) => a + r.calculatedData.jubility!, 0); +// let skill = 0; +// skill += bestHotScores.reduce((a, r) => a + r.calculatedData.jubility!, 0); +// skill += bestScores.reduce((a, r) => a + r.calculatedData.jubility!, 0); - return skill; -} +// return skill; +// } diff --git a/server/src/lib/score-import/import-types/common/api-kai/traverse-api.ts b/server/src/lib/score-import/import-types/common/api-kai/traverse-api.ts index 68a52bf41..ad5d2d515 100644 --- a/server/src/lib/score-import/import-types/common/api-kai/traverse-api.ts +++ b/server/src/lib/score-import/import-types/common/api-kai/traverse-api.ts @@ -41,7 +41,7 @@ export async function* TraverseKaiAPI( const res = await fetch(url, { headers: { Authorization: `Bearer ${token}`, - "User-Agent": `${CONF_INFO.NAME}/${VERSION_STR}`, + "User-Agent": `${CONF_INFO.name}/${VERSION_STR}`, }, }); diff --git a/server/src/main.ts b/server/src/main.ts index 54ebe4028..5b1c461e2 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -6,7 +6,7 @@ import { FormatVersion } from "./lib/constants/version"; const logger = CreateLogCtx(__filename); -logger.info(`Booting ${CONF_INFO.NAME} - ${FormatVersion()} [ENV: ${process.env.NODE_ENV}]`); +logger.info(`Booting ${CONF_INFO.name} - ${FormatVersion()} [ENV: ${process.env.NODE_ENV}]`); logger.info(`Log level is set to ${LOG_LEVEL}.`); server.listen(PORT); diff --git a/server/src/server/router/api/v1/import/router.ts b/server/src/server/router/api/v1/import/router.ts index 10e68b327..dceb11bd1 100644 --- a/server/src/server/router/api/v1/import/router.ts +++ b/server/src/server/router/api/v1/import/router.ts @@ -15,7 +15,7 @@ import ParseBatchManual from "../../../../../lib/score-import/import-types/file/ import { ParseSolidStateXML } from "../../../../../lib/score-import/import-types/file/solid-state-squad/parser"; import { ParseMerIIDX } from "../../../../../lib/score-import/import-types/file/mer-iidx/parser"; import ParsePLIIIDXCSV from "../../../../../lib/score-import/import-types/file/pli-iidx-csv/parser"; -import { RequireKamaitachi } from "../../../../middleware/type-require"; +import { CONF_INFO } from "../../../../../lib/setup/config"; const logger = CreateLogCtx(__filename); @@ -34,11 +34,10 @@ const ParseMultipartScoredata = CreateMulterSingleUploadMiddleware( router.post( "/file", RequireLoggedInSession, - RequireKamaitachi, // This is only useful for Kamaitachi, so. ParseMultipartScoredata, prValidate( { - importType: Prudence.isIn(fileImportTypes), + importType: Prudence.isIn(CONF_INFO.supportedImportTypes), }, {}, { allowExcessKeys: true } diff --git a/server/src/utils/misc.ts b/server/src/utils/misc.ts index f8db1efcc..783519ff6 100644 --- a/server/src/utils/misc.ts +++ b/server/src/utils/misc.ts @@ -62,7 +62,7 @@ export function HasOwnProperty(obj: T, key: string | number | symbol): key is } export function IsValidGame(str: string): str is Game { - return !!CONF_INFO.SUPPORTED_GAMES.includes(str as Game); + return !!CONF_INFO.supportedGames.includes(str as Game); } export function IsValidPlaytype(game: Game, str: string): str is Playtypes[Game] { From 650e0bf65a131eae5b25c156cd29cf35a083f6af Mon Sep 17 00:00:00 2001 From: zkldi Date: Sun, 20 Jun 2021 20:43:19 +0100 Subject: [PATCH 11/12] fix everything --- server/.eslintrc | 1 - server/src/lib/achievables/goals.test.ts | 17 +++-- .../calculated-data/calculated-data.test.ts | 64 +++++++++--------- .../framework/orphans/orphans.test.ts | 8 ++- .../framework/user-game-stats/rating.test.ts | 8 --- .../common/batch-manual/converter.test.ts | 33 +++------ .../common/batch-manual/parser.test.ts | 67 ++++++++++--------- .../common/batch-manual/parser.ts | 9 ++- .../server/router/ir/fervidex/router.test.ts | 2 - .../test-data/batch-manual/chunitachi.json | 2 +- .../test-data/batch-manual/empty-file.json | 1 + .../test-data/batch-manual/small-file.json | 2 +- 12 files changed, 104 insertions(+), 110 deletions(-) diff --git a/server/.eslintrc b/server/.eslintrc index 84ba24b17..52b6e79bd 100644 --- a/server/.eslintrc +++ b/server/.eslintrc @@ -65,7 +65,6 @@ "default-param-last": "error", "no-new-func": "error", "arrow-body-style": "error", - // "arrow-parens": ["error", "as-needed"] prettier hates this "no-useless-constructor": "error", "no-duplicate-imports": "error", "dot-notation": "error", diff --git a/server/src/lib/achievables/goals.test.ts b/server/src/lib/achievables/goals.test.ts index e3c889d55..5e6c0b89a 100644 --- a/server/src/lib/achievables/goals.test.ts +++ b/server/src/lib/achievables/goals.test.ts @@ -13,6 +13,7 @@ import { } from "../../test-utils/test-data"; import { CreateFolderChartLookup } from "../../utils/folder"; import { CloseAllConnections } from "../../test-utils/close-connections"; +import { Random20Hex } from "../../utils/misc"; const logger = CreateLogCtx(__filename); @@ -208,17 +209,21 @@ t.test("#EvaluateGoalForUser", (t) => { delete Testing511SPA._id; await db.charts.iidx.insert([ - // @ts-expect-error ??? deepmerge(Testing511SPA, { songID: 123, level: "9", chartID: "not_sp10", + data: { + arcChartID: Random20Hex(), + }, }), - // @ts-expect-error ??? deepmerge(Testing511SPA, { songID: 124, level: "10", chartID: "other_sp10", + data: { + arcChartID: Random20Hex(), + }, }), ]); @@ -298,10 +303,10 @@ t.test("#EvaluateGoalForUser", (t) => { }); t.test("#HumaniseGoalProgress", (t) => { - t.equal(HumaniseGoalProgress("iidx", "scoreData.gradeIndex", 4, null), "B"); - t.equal(HumaniseGoalProgress("iidx", "scoreData.lampIndex", 4, null), "CLEAR"); - t.equal(HumaniseGoalProgress("iidx", "scoreData.percent", 90.1142, null), "90.11%"); - t.equal(HumaniseGoalProgress("iidx", "scoreData.score", 2240, null), "2240"); + t.equal(HumaniseGoalProgress("iidx", "SP", "scoreData.gradeIndex", 4, null), "B"); + t.equal(HumaniseGoalProgress("iidx", "SP", "scoreData.lampIndex", 4, null), "CLEAR"); + t.equal(HumaniseGoalProgress("iidx", "SP", "scoreData.percent", 90.1142, null), "90.11%"); + t.equal(HumaniseGoalProgress("iidx", "SP", "scoreData.score", 2240, null), "2240"); t.end(); }); diff --git a/server/src/lib/score-import/framework/calculated-data/calculated-data.test.ts b/server/src/lib/score-import/framework/calculated-data/calculated-data.test.ts index 859154bbe..5aaed71c7 100644 --- a/server/src/lib/score-import/framework/calculated-data/calculated-data.test.ts +++ b/server/src/lib/score-import/framework/calculated-data/calculated-data.test.ts @@ -347,43 +347,43 @@ t.test("#CalculateDataForGamePT", (t) => { t.end(); }); - t.test("jubeat:Single", async (t) => { - const res = await CalculateDataForGamePT( - "jubeat", - "Single", - Testing511SPA, - TestingIIDXSPDryScore, // fake! this is an iidx score. but we're testing - null, - defaultTierlistID, - logger - ); + // t.test("jubeat:Single", async (t) => { + // const res = await CalculateDataForGamePT( + // "jubeat", + // "Single", + // Testing511SPA, + // TestingIIDXSPDryScore, // fake! this is an iidx score. but we're testing + // null, + // defaultTierlistID, + // logger + // ); - prAssert( - res, - { - jubility: "?number", - }, - "Response should contain nulled keys for jubeat:Single" - ); + // prAssert( + // res, + // { + // jubility: "?number", + // }, + // "Response should contain nulled keys for jubeat:Single" + // ); - t.end(); - }); + // t.end(); + // }); - t.test("popn:9B", async (t) => { - const res = await CalculateDataForGamePT( - "popn", - "9B", - Testing511SPA, - TestingIIDXSPDryScore, // fake! this is an iidx score. but we're testing - null, - defaultTierlistID, - logger - ); + // t.test("popn:9B", async (t) => { + // const res = await CalculateDataForGamePT( + // "popn", + // "9B", + // Testing511SPA, + // TestingIIDXSPDryScore, // fake! this is an iidx score. but we're testing + // null, + // defaultTierlistID, + // logger + // ); - prAssert(res, {}, "Response should contain nulled keys for popn:9B"); + // prAssert(res, {}, "Response should contain nulled keys for popn:9B"); - t.end(); - }); + // t.end(); + // }); t.end(); }); diff --git a/server/src/lib/score-import/framework/orphans/orphans.test.ts b/server/src/lib/score-import/framework/orphans/orphans.test.ts index 72f3a1efb..638daa01c 100644 --- a/server/src/lib/score-import/framework/orphans/orphans.test.ts +++ b/server/src/lib/score-import/framework/orphans/orphans.test.ts @@ -16,11 +16,15 @@ const batchManualScore: BatchManualScore = { lamp: "HARD CLEAR", matchType: "songTitle", identifier: "5.1.1.", - playtype: "SP", difficulty: "ANOTHER", }; -const batchManualContext: BatchManualContext = { game: "iidx", service: "foo", version: "27" }; +const batchManualContext: BatchManualContext = { + game: "iidx", + playtype: "SP", + service: "foo", + version: "27", +}; t.test("#OrphanScore", (t) => { t.beforeEach(ResetDBState); diff --git a/server/src/lib/score-import/framework/user-game-stats/rating.test.ts b/server/src/lib/score-import/framework/user-game-stats/rating.test.ts index 4446ca27d..dabecdaa5 100644 --- a/server/src/lib/score-import/framework/user-game-stats/rating.test.ts +++ b/server/src/lib/score-import/framework/user-game-stats/rating.test.ts @@ -9,14 +9,6 @@ const logger = CreateLogCtx(__filename); t.test("#CalculateRatings", (t) => { t.beforeEach(ResetDBState); - t.test("Should work for games with no custom ratings", async (t) => { - const res = await CalculateRatings("popn", "9B", 1, logger); - - t.strictSame(res, {}, "Should return an empty object."); - - t.end(); - }); - t.test("Should return BPI for IIDX", async (t) => { const res = await CalculateRatings("iidx", "SP", 1, logger); diff --git a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts index 09b2b19e1..2b4cdb92d 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts @@ -20,6 +20,7 @@ const baseBatchManualScore = { const context = { game: "iidx" as const, + playtype: "SP" as const, service: "foo", version: null, }; @@ -105,7 +106,7 @@ t.test("#ResolveMatchTypeToKTData", (t) => { const gazerSong = GetKTDataJSON("./tachi/bms-gazer-song.json"); const gazerChart = GetKTDataJSON("./tachi/bms-gazer-chart.json"); - const bmsContext: any = deepmerge(context, { game: "bms" }); + const bmsContext: any = deepmerge(context, { game: "bms", playtype: "7K" }); const resMD5 = await ResolveMatchTypeToKTData( deepmerge(baseBatchManualScore, { @@ -244,7 +245,7 @@ t.test("#ResolveChartFromSong", (t) => { const res = await ResolveChartFromSong( Testing511Song, baseBatchManualScore, // has playtype + diff - { game: "iidx", service: "foo", version: null }, + { game: "iidx", service: "foo", playtype: "SP", version: null }, importType ); @@ -253,30 +254,13 @@ t.test("#ResolveChartFromSong", (t) => { t.end(); }); - t.test("Should throw an error if no playtype is provided.", (t) => { - t.rejects( - () => - ResolveChartFromSong( - Testing511Song, - deepmerge(baseBatchManualScore, { playtype: null }), - { game: "iidx", service: "foo", version: null }, - importType - ), - new InvalidScoreFailure( - `Missing 'playtype' field, but was necessary for this lookup.` - ) as any - ); - - t.end(); - }); - t.test("Should throw an error if no difficulty is provided.", (t) => { t.rejects( () => ResolveChartFromSong( Testing511Song, deepmerge(baseBatchManualScore, { difficulty: null }), - { game: "iidx", service: "foo", version: null }, + { game: "iidx", service: "foo", playtype: "SP", version: null }, importType ), new InvalidScoreFailure( @@ -294,7 +278,7 @@ t.test("#ResolveChartFromSong", (t) => { Testing511Song, // @ts-expect-error faulty deepmerge types deepmerge(baseBatchManualScore, { difficulty: "NOT_VALID_DIFFICULTY" }), - { game: "iidx", service: "foo", version: null }, + { game: "iidx", service: "foo", playtype: "SP", version: null }, importType ), new InvalidScoreFailure( @@ -312,7 +296,7 @@ t.test("#ResolveChartFromSong", (t) => { Testing511Song, // @ts-expect-error faulty deepmerge types deepmerge(baseBatchManualScore, { difficulty: "LEGGENDARIA" }), // 511 has no legg (yet, lol) - { game: "iidx", service: "foo", version: null }, + { game: "iidx", service: "foo", version: null, playtype: "SP" }, importType ), ktdWrap("Cannot find chart for 5.1.1. (SP LEGGENDARIA)") @@ -328,6 +312,7 @@ t.test("#ResolveChartFromSong", (t) => { { game: "iidx", service: "foo", + playtype: "SP", version: "27", }, importType @@ -345,7 +330,7 @@ t.test("#ConverterFn", (t) => { t.test("Should produce a DryScore", async (t) => { const res = await ConverterBatchManual( baseBatchManualScore, - { game: "iidx", service: "foo", version: null }, + { game: "iidx", service: "foo", playtype: "SP", version: null }, importType, logger ); @@ -380,7 +365,7 @@ t.test("#ConverterFn", (t) => { ConverterBatchManual( // @ts-expect-error broken deepmerge deepmerge(baseBatchManualScore, { score: 2000 }), - { game: "iidx", service: "foo", version: null }, + { game: "iidx", service: "foo", playtype: "SP", version: null }, importType, logger ), diff --git a/server/src/lib/score-import/import-types/common/batch-manual/parser.test.ts b/server/src/lib/score-import/import-types/common/batch-manual/parser.test.ts index 451a31d84..0970354c9 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/parser.test.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/parser.test.ts @@ -18,7 +18,7 @@ const logger = CreateLogCtx(__filename); const baseBatchManual = { body: [], - head: { service: "foo", game: "iidx" }, + head: { service: "foo", game: "iidx", playtype: "SP" }, }; const baseBatchManualScore = { @@ -26,7 +26,6 @@ const baseBatchManualScore = { lamp: "HARD CLEAR", matchType: "songID", identifier: "123", - playtype: "SP", difficulty: "ANOTHER", }; @@ -68,7 +67,12 @@ t.test("#ParserFn", (t) => { t.test("No Game", (t) => { t.throws( - () => ParserFn({ body: [], head: { service: "foo" } }, "file/batch-manual", logger), + () => + ParserFn( + { body: [], head: { service: "foo", playtype: "SP" } }, + "file/batch-manual", + logger + ), new ScoreImportFatalError( 400, "Could not retrieve head.game - is this valid BATCH-MANUAL?" @@ -79,11 +83,29 @@ t.test("#ParserFn", (t) => { t.end(); }); + t.test("No Playtype", (t) => { + t.throws( + () => + ParserFn( + { body: [], head: { service: "foo", game: "iidx" } }, + "file/batch-manual", + logger + ), + new ScoreImportFatalError( + 400, + "Could not retrieve head.playtype - is this valid BATCH-MANUAL?" + ), + "Should throw an error." + ); + + t.end(); + }); + t.test("Invalid Game", (t) => { t.throws( () => ParserFn( - { body: [], head: { service: "foo", game: "invalid_game" } }, + { body: [], head: { service: "foo", game: "invalid_game", playtype: "SP" } }, "file/batch-manual", logger ), @@ -93,7 +115,7 @@ t.test("#ParserFn", (t) => { t.throws( () => ParserFn( - { body: [], head: { service: "foo", game: 123 } }, + { body: [], head: { service: "foo", game: 123, playtype: "SP" } }, "file/batch-manual", logger ), @@ -107,7 +129,7 @@ t.test("#ParserFn", (t) => { t.throws( () => ParserFn( - { body: [], head: { service: "1", game: "iidx" } }, + { body: [], head: { service: "1", game: "iidx", playtype: "SP" } }, "file/batch-manual", logger ), @@ -121,7 +143,7 @@ t.test("#ParserFn", (t) => { t.throws( () => ParserFn( - { body: [], head: { service: 1, game: "iidx" } }, + { body: [], head: { service: 1, game: "iidx", playtype: "SP" } }, "file/batch-manual", logger ), @@ -137,7 +159,7 @@ t.test("#ParserFn", (t) => { t.test("Valid Empty BATCH-MANUAL", (t) => { const res = ParserFn( - { body: [], head: { service: "foo", game: "iidx" } }, + { body: [], head: { service: "foo", game: "iidx", playtype: "SP" } }, "file/batch-manual", logger ); @@ -165,7 +187,6 @@ t.test("#ParserFn", (t) => { lamp: "HARD CLEAR", matchType: "songID", identifier: "123", - playtype: "SP", difficulty: "ANOTHER", }, { @@ -173,7 +194,6 @@ t.test("#ParserFn", (t) => { lamp: "HARD CLEAR", matchType: "kamaitachiSongID", identifier: "123", - playtype: "DP", difficulty: "HYPER", }, { @@ -189,7 +209,7 @@ t.test("#ParserFn", (t) => { identifier: "5.1.1.", }, ], - head: { service: "foo", game: "iidx" }, + head: { service: "foo", game: "iidx", playtype: "SP" }, } as BatchManual, "file/batch-manual", logger @@ -200,6 +220,7 @@ t.test("#ParserFn", (t) => { context: { service: "foo", game: "iidx", + playtype: "SP", version: null, }, iterable: [ @@ -208,7 +229,6 @@ t.test("#ParserFn", (t) => { lamp: "HARD CLEAR", matchType: "songID", identifier: "123", - playtype: "SP", difficulty: "ANOTHER", }, { @@ -216,7 +236,6 @@ t.test("#ParserFn", (t) => { lamp: "HARD CLEAR", matchType: "kamaitachiSongID", identifier: "123", - playtype: "DP", difficulty: "HYPER", }, { @@ -249,6 +268,7 @@ t.test("#ParserFn", (t) => { context: { service: "foo", game: "iidx", + playtype: "SP", version: null, }, iterable: [ @@ -257,7 +277,6 @@ t.test("#ParserFn", (t) => { lamp: "HARD CLEAR", matchType: "songID", identifier: "123", - playtype: "SP", difficulty: "ANOTHER", hitMeta: { bp: 10, @@ -284,6 +303,7 @@ t.test("#ParserFn", (t) => { context: { service: "foo", game: "iidx", + playtype: "SP", version: null, }, iterable: [ @@ -292,7 +312,6 @@ t.test("#ParserFn", (t) => { lamp: "HARD CLEAR", matchType: "songID", identifier: "123", - playtype: "SP", difficulty: "ANOTHER", judgements: { pgreat: 1, @@ -320,11 +339,10 @@ t.test("#ParserFn", (t) => { lamp: "ALL JUSTICE", // not an iidx lamp matchType: "songID", identifier: "123", - playtype: "SP", difficulty: "ANOTHER", }, ], - head: { service: "foo", game: "iidx" }, + head: { service: "foo", game: "iidx", playtype: "SP" }, }, "file/batch-manual", logger @@ -385,21 +403,6 @@ t.test("#ParserFn", (t) => { t.end(); }); - t.test("Invalid Playtype", (t) => { - // this is not a valid playtype for IIDX - const fn = () => ParserFn(dm({ playtype: "Single" }), "file/batch-manual", logger); - - t.throws( - fn, - new ScoreImportFatalError( - 400, - "Invalid BATCH-MANUAL: body[0].playtype | Expected any of SP, DP. | Received Single [string]." - ) - ); - - t.end(); - }); - t.test("Invalid Identifier", (t) => { // this is not a valid playtype for IIDX const fn = () => ParserFn(dm({ identifier: null }), "file/batch-manual", logger); diff --git a/server/src/lib/score-import/import-types/common/batch-manual/parser.ts b/server/src/lib/score-import/import-types/common/batch-manual/parser.ts index bafe2a095..c0e387894 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/parser.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/parser.ts @@ -139,13 +139,20 @@ export function ParseBatchManualFromObject( // @ts-expect-error man. const possiblyPlaytype = object?.head?.playtype; - if (!possiblyGame || !possiblyPlaytype) { + if (!possiblyGame) { throw new ScoreImportFatalError( 400, `Could not retrieve head.game - is this valid BATCH-MANUAL?` ); } + if (!possiblyPlaytype) { + throw new ScoreImportFatalError( + 400, + `Could not retrieve head.playtype - is this valid BATCH-MANUAL?` + ); + } + if (!CONF_INFO.supportedGames.includes(possiblyGame)) { throw new ScoreImportFatalError( 400, diff --git a/server/src/server/router/ir/fervidex/router.test.ts b/server/src/server/router/ir/fervidex/router.test.ts index 4e4d4171c..8944549e5 100644 --- a/server/src/server/router/ir/fervidex/router.test.ts +++ b/server/src/server/router/ir/fervidex/router.test.ts @@ -8,8 +8,6 @@ import { GetKTDataJSON } from "../../../../test-utils/test-data"; // eslint-disable-next-line @typescript-eslint/no-explicit-any function TestHeaders(url: string, data: any) { - t.beforeEach(InsertFakeTokenWithAllPerms("mock_token")); - t.test("Should reject invalid X-Software-Models", async (t) => { let res = await mockApi .post(url) diff --git a/server/src/test-utils/test-data/batch-manual/chunitachi.json b/server/src/test-utils/test-data/batch-manual/chunitachi.json index 7a76514b7..11eb92e8b 100644 --- a/server/src/test-utils/test-data/batch-manual/chunitachi.json +++ b/server/src/test-utils/test-data/batch-manual/chunitachi.json @@ -1,6 +1,7 @@ { "head": { "game": "chunithm", + "playtype": "Single", "service": "Chunitachi" }, "body": [{ @@ -8,7 +9,6 @@ "lamp": "CLEAR", "matchType": "songTitle", "identifier": "B.B.K.K.B.K.K.", - "playtype": "Single", "difficulty": "BASIC" }] } \ No newline at end of file diff --git a/server/src/test-utils/test-data/batch-manual/empty-file.json b/server/src/test-utils/test-data/batch-manual/empty-file.json index fc6ef94b5..4b88c2b5d 100644 --- a/server/src/test-utils/test-data/batch-manual/empty-file.json +++ b/server/src/test-utils/test-data/batch-manual/empty-file.json @@ -1,6 +1,7 @@ { "head": { "game": "iidx", + "playtype": "SP", "service": "foobar" }, "body": [] diff --git a/server/src/test-utils/test-data/batch-manual/small-file.json b/server/src/test-utils/test-data/batch-manual/small-file.json index eaac4b4f0..3b0c74b7c 100644 --- a/server/src/test-utils/test-data/batch-manual/small-file.json +++ b/server/src/test-utils/test-data/batch-manual/small-file.json @@ -1,6 +1,7 @@ { "head": { "game": "iidx", + "playtype": "SP", "service": "foobar" }, "body": [{ @@ -8,7 +9,6 @@ "lamp": "HARD CLEAR", "matchType": "songTitle", "identifier": "5.1.1.", - "playtype": "SP", "difficulty": "ANOTHER" }] } \ No newline at end of file From afb3c61873b28723b8f2bebd1764aae30d9c6cfa Mon Sep 17 00:00:00 2001 From: zkldi Date: Mon, 21 Jun 2021 00:59:46 +0100 Subject: [PATCH 12/12] should be everything --- server/src/lib/score-import/framework/orphans/orphans.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/lib/score-import/framework/orphans/orphans.test.ts b/server/src/lib/score-import/framework/orphans/orphans.test.ts index 638daa01c..b70513dc0 100644 --- a/server/src/lib/score-import/framework/orphans/orphans.test.ts +++ b/server/src/lib/score-import/framework/orphans/orphans.test.ts @@ -232,6 +232,7 @@ t.test("#ReprocessOrphan", (t) => { deepmerge(orphanDoc, { context: { game: "bms", + playtype: "7K", }, data: { matchType: "bmsChartHash",