From 08350dbf55fff58b846f510427df642c12c1bced Mon Sep 17 00:00:00 2001 From: Glydric Date: Wed, 10 Jan 2024 11:11:59 +0100 Subject: [PATCH 1/6] minors --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 83b94ce..b0dbcc7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,5 +25,4 @@ services: - ./Backend:/home/node env_file: - .secrets.yml -# command: npm start - command: npm run start -- --watch +§ command: npm run start From 1931fce357b929a7e5955d6c56278de87cd745bb Mon Sep 17 00:00:00 2001 From: Glydric Date: Tue, 16 Jan 2024 17:55:37 +0100 Subject: [PATCH 2/6] minor fixes and improvements --- Backend/package-lock.json | 739 ++++++++++---------------------------- Backend/package.json | 15 +- docker-compose.yml | 2 +- 3 files changed, 201 insertions(+), 555 deletions(-) diff --git a/Backend/package-lock.json b/Backend/package-lock.json index 2f62807..a42c272 100644 --- a/Backend/package-lock.json +++ b/Backend/package-lock.json @@ -14,7 +14,6 @@ "@nestjs/jwt": "^10.2.0", "@nestjs/platform-express": "^10.0.0", "@nestjs/platform-socket.io": "^10.2.10", - "@nestjs/platform-ws": "^10.2.10", "@nestjs/swagger": "^7.1.16", "@nestjs/websockets": "^10.2.10", "bcrypt": "^5.1.1", @@ -24,26 +23,18 @@ "mongodb": "^6.3.0", "node-telegram-bot-api": "^0.64.0", "reflect-metadata": "^0.1.13", - "rxjs": "^7.8.1", - "simple-peer": "^9.11.1", - "ws": "^8.14.2" + "rxjs": "^7.8.1" }, "devDependencies": { "@nestjs/cli": "^10.0.0", - "@nestjs/schematics": "^10.0.0", "@nestjs/testing": "^10.0.0", "@types/bcrypt": "^10.0.28-alpha", "@types/eslint": "^8.44.7", - "@types/eslint-config-prettier": "^6.11.3", "@types/express": "^4.17.17", "@types/jest": "^29.5.2", "@types/multer": "^1.4.10", "@types/node": "^20.3.1", "@types/node-telegram-bot-api": "^0.63.3", - "@types/simple-peer": "^9.11.8", - "@types/source-map-support": "^0.5.10", - "@types/supertest": "^2.0.12", - "@types/ws": "^8.5.10", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.42.0", @@ -51,12 +42,8 @@ "eslint-plugin-prettier": "^5.0.0", "jest": "^29.5.0", "prettier": "^3.0.0", - "source-map-support": "^0.5.21", - "supertest": "^6.3.3", "ts-jest": "^29.1.0", - "ts-loader": "^9.4.3", "ts-node": "^10.9.1", - "tsconfig-paths": "^4.2.0", "typescript": "^5.1.3" } }, @@ -83,20 +70,20 @@ } }, "node_modules/@angular-devkit/core": { - "version": "16.2.8", - "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-16.2.8.tgz", - "integrity": "sha512-PTGozYvh1Bin5lB15PwcXa26Ayd17bWGLS3H8Rs0s+04mUDvfNofmweaX1LgumWWy3nCUTDuwHxX10M3G0wE2g==", + "version": "17.0.9", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.0.9.tgz", + "integrity": "sha512-r5jqwpWOgowqe9KSDqJ3iSbmsEt2XPjSvRG4DSI2T9s31bReoMtreo8b7wkRa2B3hbcDnstFbn8q27VvJDqRaQ==", "dev": true, "dependencies": { "ajv": "8.12.0", "ajv-formats": "2.1.1", "jsonc-parser": "3.2.0", - "picomatch": "2.3.1", + "picomatch": "3.0.1", "rxjs": "7.8.1", "source-map": "0.7.4" }, "engines": { - "node": "^16.14.0 || >=18.10.0", + "node": "^18.13.0 || >=20.9.0", "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", "yarn": ">= 1.13.0" }, @@ -109,34 +96,46 @@ } } }, + "node_modules/@angular-devkit/core/node_modules/picomatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz", + "integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@angular-devkit/schematics": { - "version": "16.2.8", - "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-16.2.8.tgz", - "integrity": "sha512-MBiKZOlR9/YMdflALr7/7w/BGAfo/BGTrlkqsIB6rDWV1dYiCgxI+033HsiNssLS6RQyCFx/e7JA2aBBzu9zEg==", + "version": "17.0.9", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-17.0.9.tgz", + "integrity": "sha512-5ti7g45F2KjDJS0DbgnOGI1GyKxGpn4XsKTYJFJrSAWj6VpuvPy/DINRrXNuRVo09VPEkqA+IW7QwaG9icptQg==", "dev": true, "dependencies": { - "@angular-devkit/core": "16.2.8", + "@angular-devkit/core": "17.0.9", "jsonc-parser": "3.2.0", - "magic-string": "0.30.1", + "magic-string": "0.30.5", "ora": "5.4.1", "rxjs": "7.8.1" }, "engines": { - "node": "^16.14.0 || >=18.10.0", + "node": "^18.13.0 || >=20.9.0", "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", "yarn": ">= 1.13.0" } }, "node_modules/@angular-devkit/schematics-cli": { - "version": "16.2.8", - "resolved": "https://registry.npmjs.org/@angular-devkit/schematics-cli/-/schematics-cli-16.2.8.tgz", - "integrity": "sha512-EXURJCzWTVYCipiTT4vxQQOrF63asOUDbeOy3OtiSh7EwIUvxm3BPG6hquJqngEnI/N6bA75NJ1fBhU6Hrh7eA==", + "version": "17.0.9", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics-cli/-/schematics-cli-17.0.9.tgz", + "integrity": "sha512-tznzzB26sy8jVUlV9HhXcbFYZcIIFMAiDMOuyLko2LZFjfoqW+OPvwa1mwAQwvVVSQZVAKvdndFhzwyl/axwFQ==", "dev": true, "dependencies": { - "@angular-devkit/core": "16.2.8", - "@angular-devkit/schematics": "16.2.8", + "@angular-devkit/core": "17.0.9", + "@angular-devkit/schematics": "17.0.9", "ansi-colors": "4.1.3", - "inquirer": "8.2.4", + "inquirer": "9.2.11", "symbol-observable": "4.0.0", "yargs-parser": "21.1.1" }, @@ -144,52 +143,114 @@ "schematics": "bin/schematics.js" }, "engines": { - "node": "^16.14.0 || >=18.10.0", + "node": "^18.13.0 || >=20.9.0", "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", "yarn": ">= 1.13.0" } }, + "node_modules/@angular-devkit/schematics-cli/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@angular-devkit/schematics-cli/node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@angular-devkit/schematics-cli/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@angular-devkit/schematics-cli/node_modules/figures": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@angular-devkit/schematics-cli/node_modules/inquirer": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.4.tgz", - "integrity": "sha512-nn4F01dxU8VeKfq192IjLsxu0/OmMZ4Lg3xKAns148rCaXP6ntAoEkVYZThWjwON8AlzdZZi6oqnhNbxUG9hVg==", + "version": "9.2.11", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.11.tgz", + "integrity": "sha512-B2LafrnnhbRzCWfAdOXisUzL89Kg8cVJlYmhqoi3flSiV/TveO+nsXwgKr9h9PIo+J1hz7nBSk6gegRIMBBf7g==", "dev": true, "dependencies": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.1", + "@ljharb/through": "^2.3.9", + "ansi-escapes": "^4.3.2", + "chalk": "^5.3.0", "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", + "cli-width": "^4.1.0", + "external-editor": "^3.1.0", + "figures": "^5.0.0", "lodash": "^4.17.21", - "mute-stream": "0.0.8", + "mute-stream": "1.0.0", "ora": "^5.4.1", - "run-async": "^2.4.0", - "rxjs": "^7.5.5", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6", - "wrap-ansi": "^7.0.0" + "run-async": "^3.0.0", + "rxjs": "^7.8.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.2.0" }, "engines": { - "node": ">=12.0.0" + "node": ">=14.18.0" } }, - "node_modules/@angular-devkit/schematics-cli/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "node_modules/@angular-devkit/schematics-cli/node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@angular-devkit/schematics-cli/node_modules/mute-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@angular-devkit/schematics-cli/node_modules/run-async": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==", + "dev": true, + "engines": { + "node": ">=0.12.0" } }, "node_modules/@babel/code-frame": { @@ -1616,6 +1677,18 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@ljharb/through": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.11.tgz", + "integrity": "sha512-ccfcIDlogiXNq5KcbAwbaO7lMh3Tm1i3khMPYpxlK8hH/W53zN81KM9coerRLOnTGu3nfXIniAmQbRI9OxbC0w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/@lukeed/csprng": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", @@ -1707,14 +1780,14 @@ } }, "node_modules/@nestjs/cli": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@nestjs/cli/-/cli-10.2.1.tgz", - "integrity": "sha512-CAJAQwmxFZfB3RTvqz/eaXXWpyU+mZ4QSqfBYzjneTsPgF+uyOAW3yQpaLNn9Dfcv39R9UxSuAhayv6yuFd+Jg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@nestjs/cli/-/cli-10.3.0.tgz", + "integrity": "sha512-37h+wSDItY0NE/x3a/M9yb2cXzfsD4qoE26rHgFn592XXLelDN12wdnfn7dTIaiRZT7WOCdQ+BYP9mQikR4AsA==", "dev": true, "dependencies": { - "@angular-devkit/core": "16.2.8", - "@angular-devkit/schematics": "16.2.8", - "@angular-devkit/schematics-cli": "16.2.8", + "@angular-devkit/core": "17.0.9", + "@angular-devkit/schematics": "17.0.9", + "@angular-devkit/schematics-cli": "17.0.9", "@nestjs/schematics": "^10.0.1", "chalk": "4.1.2", "chokidar": "3.5.3", @@ -1725,14 +1798,13 @@ "inquirer": "8.2.6", "node-emoji": "1.11.0", "ora": "5.4.1", - "os-name": "4.0.1", "rimraf": "4.4.1", "shelljs": "0.8.5", "source-map-support": "0.5.21", "tree-kill": "1.2.2", "tsconfig-paths": "4.2.0", "tsconfig-paths-webpack-plugin": "4.1.0", - "typescript": "5.2.2", + "typescript": "5.3.3", "webpack": "5.89.0", "webpack-node-externals": "3.0.0" }, @@ -1889,32 +1961,14 @@ "rxjs": "^7.1.0" } }, - "node_modules/@nestjs/platform-ws": { - "version": "10.2.10", - "resolved": "https://registry.npmjs.org/@nestjs/platform-ws/-/platform-ws-10.2.10.tgz", - "integrity": "sha512-x9L7jixAEtbNjP9hIm9Fmx+kL9ruFQLu2cUb0EdSNtwK/efAJZ3+Taz9T8g/Nm5DG4k0356X6hmRk74ChJHg9g==", - "dependencies": { - "tslib": "2.6.2", - "ws": "8.14.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nest" - }, - "peerDependencies": { - "@nestjs/common": "^10.0.0", - "@nestjs/websockets": "^10.0.0", - "rxjs": "^7.1.0" - } - }, "node_modules/@nestjs/schematics": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/@nestjs/schematics/-/schematics-10.0.3.tgz", - "integrity": "sha512-2BRujK0GqGQ7j1Zpz+obVfskDnnOeVKt5aXoSaVngKo8Oczy8uYCY+R547TQB+Kf35epdfFER2pVnQrX3/It5A==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/@nestjs/schematics/-/schematics-10.1.0.tgz", + "integrity": "sha512-HQWvD3F7O0Sv3qHS2jineWxPLmBTLlyjT6VdSw2EAIXulitmV+ErxB3TCVQQORlNkl5p5cwRYWyBaOblDbNFIQ==", "dev": true, "dependencies": { - "@angular-devkit/core": "16.2.8", - "@angular-devkit/schematics": "16.2.8", + "@angular-devkit/core": "17.0.9", + "@angular-devkit/schematics": "17.0.9", "comment-json": "4.2.3", "jsonc-parser": "3.2.0", "pluralize": "8.0.0" @@ -2186,9 +2240,9 @@ "dev": true }, "node_modules/@types/body-parser": { - "version": "1.19.4", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.4.tgz", - "integrity": "sha512-N7UDG0/xiPQa2D/XrVJXjkWbpqHCd2sBaB32ggRF2l83RhPfamgKGF8gwwqyksS95qUS5ZYF9aF+lLPRlwI2UA==", + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", "dev": true, "dependencies": { "@types/connect": "*", @@ -2202,9 +2256,9 @@ "dev": true }, "node_modules/@types/connect": { - "version": "3.4.37", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.37.tgz", - "integrity": "sha512-zBUSRqkfZ59OcwXon4HVxhx5oWCJmc0OtBTK05M+p0dYjgN6iTwIL2T/WbsQZrEsdnwaF9cWQ+azOnpPvIqY3Q==", + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", "dev": true, "dependencies": { "@types/node": "*" @@ -2215,12 +2269,6 @@ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" }, - "node_modules/@types/cookiejar": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.3.tgz", - "integrity": "sha512-LZ8SD3LpNmLMDLkG2oCBjZg+ETnx6XdCjydUE0HwojDmnDfDUnhMKKbtth1TZh+hzcqb03azrYWoXLS8sMXdqg==", - "dev": true - }, "node_modules/@types/cors": { "version": "2.8.17", "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz", @@ -2239,12 +2287,6 @@ "@types/json-schema": "*" } }, - "node_modules/@types/eslint-config-prettier": { - "version": "6.11.3", - "resolved": "https://registry.npmjs.org/@types/eslint-config-prettier/-/eslint-config-prettier-6.11.3.tgz", - "integrity": "sha512-3wXCiM8croUnhg9LdtZUJQwNcQYGWxxdOWDjPe1ykCqJFPVpzAKfs/2dgSoCtAvdPeaponcWPI7mPcGGp9dkKQ==", - "dev": true - }, "node_modules/@types/eslint-scope": { "version": "3.7.6", "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.6.tgz", @@ -2262,9 +2304,9 @@ "dev": true }, "node_modules/@types/express": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.20.tgz", - "integrity": "sha512-rOaqlkgEvOW495xErXMsmyX3WKBInbhG5eqojXYi3cGUaLoRDlXa5d52fkfWZT963AZ3v2eZ4MbKE6WpDAGVsw==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", "dev": true, "dependencies": { "@types/body-parser": "*", @@ -2274,9 +2316,9 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "4.17.39", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.39.tgz", - "integrity": "sha512-BiEUfAiGCOllomsRAZOiMFP7LAnrifHpt56pc4Z7l9K6ACyN06Ns1JLMBxwkfLOjJRlSf06NwWsT7yzfpaVpyQ==", + "version": "4.17.41", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz", + "integrity": "sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA==", "dev": true, "dependencies": { "@types/node": "*", @@ -2295,9 +2337,9 @@ } }, "node_modules/@types/http-errors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.3.tgz", - "integrity": "sha512-pP0P/9BnCj1OVvQR2lF41EkDG/lWWnDyA203b/4Fmi2eTyORnBtcDoKDwjWQthELrBvWkMOrvSOnZ8OVlW6tXA==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", "dev": true }, "node_modules/@types/istanbul-lib-coverage": { @@ -2325,9 +2367,9 @@ } }, "node_modules/@types/jest": { - "version": "29.5.6", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.6.tgz", - "integrity": "sha512-/t9NnzkOpXb4Nfvg17ieHE6EeSjDS2SGSpNYfoLbUAeL/EOueU/RSdOWFpfQTXBEM7BguYW1XQ0EbM+6RlIh6w==", + "version": "29.5.11", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", + "integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", "dev": true, "dependencies": { "expect": "^29.0.0", @@ -2349,15 +2391,15 @@ } }, "node_modules/@types/mime": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.4.tgz", - "integrity": "sha512-1Gjee59G25MrQGk8bsNvC6fxNiRgUlGn2wlhGf95a59DrprnnHk80FIMMFG9XHMdrfsuA119ht06QPDXA1Z7tw==", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", "dev": true }, "node_modules/@types/multer": { - "version": "1.4.10", - "resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.10.tgz", - "integrity": "sha512-6l9mYMhUe8wbnz/67YIjc7ZJyQNZoKq7fRXVf7nMdgWgalD0KyzJ2ywI7hoATUSXSbTu9q2HBiEwzy0tNN1v2w==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.11.tgz", + "integrity": "sha512-svK240gr6LVWvv3YGyhLlA+6LRRWA4mnGIU7RcNmgjBYFl6665wcXrRfxGp5tEPVHUNm5FMcmq7too9bxCwX/w==", "dev": true, "dependencies": { "@types/express": "*" @@ -2382,15 +2424,15 @@ } }, "node_modules/@types/qs": { - "version": "6.9.9", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.9.tgz", - "integrity": "sha512-wYLxw35euwqGvTDx6zfY1vokBFnsK0HNrzc6xNHchxfO2hpuRg74GbkEW7e3sSmPvj0TjCDT1VCa6OtHXnubsg==", + "version": "6.9.11", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.11.tgz", + "integrity": "sha512-oGk0gmhnEJK4Yyk+oI7EfXsLayXatCWPHary1MtcmbAifkobT9cM9yutG/hZKIseOU0MqbIwQ/u2nn/Gb+ltuQ==", "dev": true }, "node_modules/@types/range-parser": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.6.tgz", - "integrity": "sha512-+0autS93xyXizIYiyL02FCY8N+KkKPhILhcUSA276HxzreZ16kl+cmwvV2qAM/PuCCwPXzOXOWhiPcw20uSFcA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", "dev": true }, "node_modules/@types/request": { @@ -2426,9 +2468,9 @@ "dev": true }, "node_modules/@types/send": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.3.tgz", - "integrity": "sha512-/7fKxvKUoETxjFUsuFlPB9YndePpxxRAOfGC/yJdc9kTjTeP5kRCTzfnE8kPUKCeyiyIZu0YQ76s50hCedI1ug==", + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", "dev": true, "dependencies": { "@types/mime": "^1", @@ -2436,9 +2478,9 @@ } }, "node_modules/@types/serve-static": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.4.tgz", - "integrity": "sha512-aqqNfs1XTF0HDrFdlY//+SGUxmdSUbjeRXb5iaZc3x0/vMbYmdw9qvOgHWOyyLFxSSRnUuP5+724zBgfw8/WAw==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.5.tgz", + "integrity": "sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==", "dev": true, "dependencies": { "@types/http-errors": "*", @@ -2446,58 +2488,12 @@ "@types/node": "*" } }, - "node_modules/@types/simple-peer": { - "version": "9.11.8", - "resolved": "https://registry.npmjs.org/@types/simple-peer/-/simple-peer-9.11.8.tgz", - "integrity": "sha512-rvqefdp2rvIA6wiomMgKWd2UZNPe6LM2EV5AuY3CPQJF+8TbdrL5TjYdMf0VAjGczzlkH4l1NjDkihwbj3Xodw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/source-map-support": { - "version": "0.5.10", - "resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.5.10.tgz", - "integrity": "sha512-tgVP2H469x9zq34Z0m/fgPewGhg/MLClalNOiPIzQlXrSS2YrKu/xCdSCKnEDwkFha51VKEKB6A9wW26/ZNwzA==", - "dev": true, - "dependencies": { - "source-map": "^0.6.0" - } - }, - "node_modules/@types/source-map-support/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/@types/stack-utils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.2.tgz", "integrity": "sha512-g7CK9nHdwjK2n0ymT2CW698FuWJRIx+RP6embAzZ2Qi8/ilIrA1Imt2LVSeHUzKvpoi7BhmmQcXz95eS0f2JXw==", "dev": true }, - "node_modules/@types/superagent": { - "version": "4.1.20", - "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-4.1.20.tgz", - "integrity": "sha512-GfpwJgYSr3yO+nArFkmyqv3i0vZavyEG5xPd/o95RwpKYpsOKJYI5XLdxLpdRbZI3YiGKKdIOFIf/jlP7A0Jxg==", - "dev": true, - "dependencies": { - "@types/cookiejar": "*", - "@types/node": "*" - } - }, - "node_modules/@types/supertest": { - "version": "2.0.15", - "resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-2.0.15.tgz", - "integrity": "sha512-jUCZZ/TMcpGzoSaed9Gjr8HCf3HehExdibyw3OHHEL1als1KmyzcOZZH4MjbObI8TkWsEr7bc7gsW0WTDni+qQ==", - "dev": true, - "dependencies": { - "@types/superagent": "*" - } - }, "node_modules/@types/tough-cookie": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", @@ -2522,15 +2518,6 @@ "@types/webidl-conversions": "*" } }, - "node_modules/@types/ws": { - "version": "8.5.10", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", - "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/yargs": { "version": "17.0.29", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.29.tgz", @@ -3179,12 +3166,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", - "dev": true - }, "node_modules/asn1": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", @@ -3355,6 +3336,7 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, "funding": [ { "type": "github", @@ -3824,9 +3806,9 @@ } }, "node_modules/cli-spinners": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.1.tgz", - "integrity": "sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", "dev": true, "engines": { "node": ">=6" @@ -3975,12 +3957,6 @@ "node": ">= 6" } }, - "node_modules/component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -4048,12 +4024,6 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, - "node_modules/cookiejar": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", - "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", - "dev": true - }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -4444,16 +4414,6 @@ "node": ">=8" } }, - "node_modules/dezalgo": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", - "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", - "dev": true, - "dependencies": { - "asap": "^2.0.0", - "wrappy": "1" - } - }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -4643,11 +4603,6 @@ "node": ">=10.13.0" } }, - "node_modules/err-code": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", - "integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==" - }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -5485,35 +5440,6 @@ "webpack": "^5.11.0" } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/formidable": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz", - "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==", - "dev": true, - "dependencies": { - "dezalgo": "^1.0.4", - "hexoid": "^1.0.0", - "once": "^1.4.0", - "qs": "^6.11.0" - }, - "funding": { - "url": "https://ko-fi.com/tunnckoCore/commissions" - } - }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -5662,11 +5588,6 @@ "node": ">=6.9.0" } }, - "node_modules/get-browser-rtc": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz", - "integrity": "sha512-MghbMJ61EJrRsDe7w1Bvqt3ZsBuqhce5nrn/XAwgwOXhcsz53/ltdxOse1h/8eKXj5slzxdsz56g5rzOFSGwfQ==" - }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -6003,15 +5924,6 @@ "node": ">= 0.4" } }, - "node_modules/hexoid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", - "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -6082,6 +5994,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, "funding": [ { "type": "github", @@ -7607,22 +7520,10 @@ "yallist": "^3.0.2" } }, - "node_modules/macos-release": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.5.1.tgz", - "integrity": "sha512-DXqXhEM7gW59OjZO8NIjBCz9AQ1BEMrfiOAl4AYByHCtVHRF4KoGNO8mqQeM8lRCtQe/UnJ4imO/d2HdkKsd+A==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/magic-string": { - "version": "0.30.1", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.1.tgz", - "integrity": "sha512-mbVKXPmS0z0G4XqFDCTllmDQ6coZzn94aMlb0o/A4HEHJCKcanlDZwYJgwnkmgD3jyWhUgj9VsPrfd972yPffA==", + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", "dev": true, "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" @@ -8258,22 +8159,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/os-name": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/os-name/-/os-name-4.0.1.tgz", - "integrity": "sha512-xl9MAoU97MH1Xt5K9ERft2YfCAoaO6msy1OBA0ozxEC0x0TmIoE6K3QvgJMMZA9yKGLmHXNY/YZoDbiGDj4zYw==", - "dev": true, - "dependencies": { - "macos-release": "^2.5.0", - "windows-release": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -8409,9 +8294,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", + "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", "dev": true, "engines": { "node": "14 || >=16.14" @@ -8633,16 +8518,6 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -8690,6 +8565,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, "funding": [ { "type": "github", @@ -8709,6 +8585,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, "dependencies": { "safe-buffer": "^5.1.0" } @@ -9490,70 +9367,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/simple-peer": { - "version": "9.11.1", - "resolved": "https://registry.npmjs.org/simple-peer/-/simple-peer-9.11.1.tgz", - "integrity": "sha512-D1SaWpOW8afq1CZGWB8xTfrT3FekjQmPValrqncJMX7QFl8YwhrPTZvMCANLtgBwwdS+7zURyqxDDEmY558tTw==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "buffer": "^6.0.3", - "debug": "^4.3.2", - "err-code": "^3.0.1", - "get-browser-rtc": "^1.1.0", - "queue-microtask": "^1.2.3", - "randombytes": "^2.1.0", - "readable-stream": "^3.6.0" - } - }, - "node_modules/simple-peer/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/simple-peer/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -9887,52 +9700,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/superagent": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-8.1.2.tgz", - "integrity": "sha512-6WTxW1EB6yCxV5VFOIPQruWGHqc3yI7hEmZK6h+pyk69Lk/Ut7rLUY6W/ONF2MjBuGjvmMiIpsrVJ2vjrHlslA==", - "dev": true, - "dependencies": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.4", - "debug": "^4.3.4", - "fast-safe-stringify": "^2.1.1", - "form-data": "^4.0.0", - "formidable": "^2.1.2", - "methods": "^1.1.2", - "mime": "2.6.0", - "qs": "^6.11.0", - "semver": "^7.3.8" - }, - "engines": { - "node": ">=6.4.0 <13 || >=14" - } - }, - "node_modules/superagent/node_modules/mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", - "dev": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/supertest": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/supertest/-/supertest-6.3.3.tgz", - "integrity": "sha512-EMCG6G8gDu5qEqRQ3JjjPs6+FYT1a7Hv5ApHvtSghmOFJYtsU5S+pSb6Y2EUeCEY3CmEL3mmQ8YWlPOzQomabA==", - "dev": true, - "dependencies": { - "methods": "^1.1.2", - "superagent": "^8.0.5" - }, - "engines": { - "node": ">=6.4.0" - } - }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -10318,26 +10085,6 @@ } } }, - "node_modules/ts-loader": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.0.tgz", - "integrity": "sha512-LLlB/pkB4q9mW2yLdFMnK3dEHbrBjeZTYguaaIfusyojBgAGf5kF+O6KcWqiGzWqHk0LBsoolrp4VftEURhybg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, "node_modules/ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -10551,9 +10298,9 @@ "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -10594,9 +10341,9 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, "engines": { "node": ">= 10.0.0" @@ -10929,74 +10676,6 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, - "node_modules/windows-release": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-4.0.0.tgz", - "integrity": "sha512-OxmV4wzDKB1x7AZaZgXMVsdJ1qER1ed83ZrTYd5Bwq2HfJVg3DJS8nqlAG4sMoJ7mu8cuRmLEYyU13BKwctRAg==", - "dev": true, - "dependencies": { - "execa": "^4.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/windows-release/node_modules/execa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", - "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/windows-release/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/windows-release/node_modules/human-signals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", - "dev": true, - "engines": { - "node": ">=8.12.0" - } - }, - "node_modules/windows-release/node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -11053,26 +10732,6 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "node_modules/ws": { - "version": "8.14.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", - "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/Backend/package.json b/Backend/package.json index d91e4c2..660482d 100644 --- a/Backend/package.json +++ b/Backend/package.json @@ -26,7 +26,6 @@ "@nestjs/jwt": "^10.2.0", "@nestjs/platform-express": "^10.0.0", "@nestjs/platform-socket.io": "^10.2.10", - "@nestjs/platform-ws": "^10.2.10", "@nestjs/swagger": "^7.1.16", "@nestjs/websockets": "^10.2.10", "bcrypt": "^5.1.1", @@ -36,26 +35,18 @@ "mongodb": "^6.3.0", "node-telegram-bot-api": "^0.64.0", "reflect-metadata": "^0.1.13", - "rxjs": "^7.8.1", - "simple-peer": "^9.11.1", - "ws": "^8.14.2" + "rxjs": "^7.8.1" }, "devDependencies": { "@nestjs/cli": "^10.0.0", - "@nestjs/schematics": "^10.0.0", "@nestjs/testing": "^10.0.0", "@types/bcrypt": "^10.0.28-alpha", "@types/eslint": "^8.44.7", - "@types/eslint-config-prettier": "^6.11.3", "@types/express": "^4.17.17", "@types/jest": "^29.5.2", "@types/multer": "^1.4.10", "@types/node": "^20.3.1", "@types/node-telegram-bot-api": "^0.63.3", - "@types/simple-peer": "^9.11.8", - "@types/source-map-support": "^0.5.10", - "@types/supertest": "^2.0.12", - "@types/ws": "^8.5.10", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.42.0", @@ -63,12 +54,8 @@ "eslint-plugin-prettier": "^5.0.0", "jest": "^29.5.0", "prettier": "^3.0.0", - "source-map-support": "^0.5.21", - "supertest": "^6.3.3", "ts-jest": "^29.1.0", - "ts-loader": "^9.4.3", "ts-node": "^10.9.1", - "tsconfig-paths": "^4.2.0", "typescript": "^5.1.3" } } diff --git a/docker-compose.yml b/docker-compose.yml index b0dbcc7..08b9f77 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,4 +25,4 @@ services: - ./Backend:/home/node env_file: - .secrets.yml -§ command: npm run start + command: npm run start From 9a62f3f1c9654e167a213dab532b58d5ab936a95 Mon Sep 17 00:00:00 2001 From: Glydric Date: Sat, 20 Jan 2024 11:36:18 +0100 Subject: [PATCH 3/6] implemented nvr data in database, and implemented camera id and name change and retrieval --- Backend/src/app.module.ts | 2 + .../src/app/frontend/frontend.controller.ts | 32 +++- .../machineLearning.controller.ts | 9 +- .../app/mediaServer/mediaServer.controller.ts | 21 +-- .../src/app/shared/shared.controller.spec.ts | 18 +++ Backend/src/app/shared/shared.controller.ts | 39 +++++ Backend/src/cameraStream/cameraData.ts | 28 ---- .../src/cameraStream/cameraStream.gateway.ts | 12 +- Backend/src/database/database.service.ts | 148 ++++++++++++++---- .../validators/camera-id/camera.pipe.spec.ts | 4 +- .../src/validators/camera-id/camera.pipe.ts | 26 ++- 11 files changed, 229 insertions(+), 110 deletions(-) create mode 100644 Backend/src/app/shared/shared.controller.spec.ts create mode 100644 Backend/src/app/shared/shared.controller.ts diff --git a/Backend/src/app.module.ts b/Backend/src/app.module.ts index 58b036b..165ee71 100644 --- a/Backend/src/app.module.ts +++ b/Backend/src/app.module.ts @@ -14,6 +14,7 @@ import { CameraStreamGateway } from './cameraStream/cameraStream.gateway'; import { LoginService } from './login/login.service'; import { MediaServerController } from './app/mediaServer/mediaServer.controller'; import { CSSOpenVidu } from './cameraStream/open-vidu.service'; +import { SharedController } from './app/shared/shared.controller'; @Module({ imports: [ @@ -30,6 +31,7 @@ import { CSSOpenVidu } from './cameraStream/open-vidu.service'; FrontendController, LoginController, MediaServerController, + SharedController, ], providers: [ DatabaseService, diff --git a/Backend/src/app/frontend/frontend.controller.ts b/Backend/src/app/frontend/frontend.controller.ts index 863a0c1..24f6748 100644 --- a/Backend/src/app/frontend/frontend.controller.ts +++ b/Backend/src/app/frontend/frontend.controller.ts @@ -3,6 +3,7 @@ import { Get, Header, Param, + Post, StreamableFile, UseGuards, } from '@nestjs/common'; @@ -20,10 +21,7 @@ import { FiltersAvailable, FiltersValidator, } from '../../validators/filters/filters.pipe'; -import { - CameraIds, - CameraValidator, -} from '../../validators/camera-id/camera.pipe'; +import { PositiveNumberValidator } from '../../validators/camera-id/camera.pipe'; import { AuthGuard } from '../../auth/auth.guard'; const filterParams = { @@ -87,7 +85,7 @@ export class FrontendController { @Header('Content-Type', 'image/jpeg') @Get('/:id(\\d+)/:timestamp') async getImage( - @Param('id', CameraValidator) cameraId: CameraIds, + @Param('id', PositiveNumberValidator) cameraId: number, @Param('timestamp') timestamp: string, ) { const array = await this.databaseService.getRawDataArray('cameras', { @@ -97,4 +95,28 @@ export class FrontendController { return new StreamableFile(array[0].intrusionDetection.buffer); } + + @Post('/:id(\\d+)/:name') + @ApiParam({ + name: 'id', + type: 'number', + example: 1, + }) + @ApiParam({ + name: 'name', + type: 'string', + example: 'Kitchen', + }) + async setChannelName( + @Param('id', PositiveNumberValidator) id: number, + @Param('name') name: string, + ) { + try { + await this.databaseService.setChannelName(id, name); + return 'OK'; + } catch (e) { + console.error(e); + return 'ERROR' + e; + } + } } diff --git a/Backend/src/app/machineLearning/machineLearning.controller.ts b/Backend/src/app/machineLearning/machineLearning.controller.ts index a4f3171..c20b669 100644 --- a/Backend/src/app/machineLearning/machineLearning.controller.ts +++ b/Backend/src/app/machineLearning/machineLearning.controller.ts @@ -28,10 +28,7 @@ import { ApiProperty, ApiTags, } from '@nestjs/swagger'; -import { - CameraIds, - CameraValidator, -} from '../../validators/camera-id/camera.pipe'; +import { PositiveNumberValidator } from '../../validators/camera-id/camera.pipe'; import { AuthGuard } from '../../auth/auth.guard'; import { TelegramService } from '../../telegram/telegram.service'; @@ -80,7 +77,7 @@ export class MachineLearningController { @UseGuards(AuthGuard) @Post(`:status(online|offline)`) saveStatus( - @Param('id', CameraValidator) cameraId: CameraIds, + @Param('id', PositiveNumberValidator) cameraId: number, @Param('status') status: string, ) { // Following condition could be removed as the path can only be online or offline @@ -112,7 +109,7 @@ export class MachineLearningController { @UseInterceptors(FileInterceptor('file')) @Post() async uploadImage( - @Param('id', CameraValidator) cameraId: CameraIds, + @Param('id', PositiveNumberValidator) cameraId: number, @UploadedFile( new ParseFilePipeBuilder() .addFileTypeValidator({ fileType: 'image/jpeg' }) diff --git a/Backend/src/app/mediaServer/mediaServer.controller.ts b/Backend/src/app/mediaServer/mediaServer.controller.ts index f7844a3..55fd822 100644 --- a/Backend/src/app/mediaServer/mediaServer.controller.ts +++ b/Backend/src/app/mediaServer/mediaServer.controller.ts @@ -1,32 +1,15 @@ -import { Body, Controller, Get, Header, Post, UseGuards } from '@nestjs/common'; +import { Body, Controller, Header, Post } from '@nestjs/common'; import { ApiBadRequestResponse, ApiBearerAuth, ApiCreatedResponse, ApiNotFoundResponse, ApiOkResponse, - ApiParam, ApiTags, ApiUnauthorizedResponse, } from '@nestjs/swagger'; -import { AuthGuard } from '../../auth/auth.guard'; import { CameraStreamGateway } from 'src/cameraStream/cameraStream.gateway'; -type ParticipantLeft = { - event: 'participantLeft'; - timestamp: number; - sessionId: string; - startTime: number; - duration: number; - reason: string; - connectionId: string; - location: string; - ip: string; - platform: string; - clientData: string; - serverData: string; -}; - @ApiTags('Media Server') @ApiBearerAuth('CSS-Auth') @ApiOkResponse() @@ -45,7 +28,7 @@ export class MediaServerController { @ApiCreatedResponse() @ApiNotFoundResponse() @Header('Content-Type', 'application/json') - @Post('media-server') + @Post('/media-server') async getMediaServerEvents(@Body() event: any) { console.log(event); this.cameraStreamGateway.broadcastEvent(event); diff --git a/Backend/src/app/shared/shared.controller.spec.ts b/Backend/src/app/shared/shared.controller.spec.ts new file mode 100644 index 0000000..e7744c3 --- /dev/null +++ b/Backend/src/app/shared/shared.controller.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { SharedController } from './shared.controller'; + +describe('SharedController', () => { + let controller: SharedController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [SharedController], + }).compile(); + + controller = module.get(SharedController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/Backend/src/app/shared/shared.controller.ts b/Backend/src/app/shared/shared.controller.ts new file mode 100644 index 0000000..eb28628 --- /dev/null +++ b/Backend/src/app/shared/shared.controller.ts @@ -0,0 +1,39 @@ +import { Controller, Get, Param } from '@nestjs/common'; +import { DatabaseService } from '../../database/database.service'; +import { PositiveNumberValidator } from '../../validators/camera-id/camera.pipe'; +import { ApiParam, ApiTags } from '@nestjs/swagger'; + +// This defines a shared controller between Frontend and Machine Learning +@ApiTags('Shared') +@Controller('shared') +export class SharedController { + constructor(private readonly databaseService: DatabaseService) {} + + @Get('/nvr') + async getNVR() { + return await this.databaseService.getNVRData(); + } + + // @Get('/channel') + // async getChannel() { + // return await this.databaseService.getChannelName(); + // } + + @ApiParam({ + name: 'id', + type: 'string', + required: false, + examples: { + undefined: { + description: 'sends an undefined value', + }, + camera: { + value: '1', + }, + }, + }) + @Get('/channel/:id(\\d+|,)?') + async getChannelId(@Param('id', PositiveNumberValidator) id?: number) { + return await this.databaseService.getChannelName(id); + } +} diff --git a/Backend/src/cameraStream/cameraData.ts b/Backend/src/cameraStream/cameraData.ts index b6ca116..c983f69 100644 --- a/Backend/src/cameraStream/cameraData.ts +++ b/Backend/src/cameraStream/cameraData.ts @@ -3,31 +3,3 @@ export type Camera = { name: string; rtspUrl: string; }; - -export const cameraData: Camera[] = [ - { - id: '1', - name: 'Mainroad', - rtspUrl: 'rtsp://192.168.129.244:554', - }, - /* { - id: 2, - name: 'Pet room', - rtspUrl: 'rtsp://192.168.252.244:554', - }, - { - id: 3, - name: 'Main road', - rtspUrl: 'rtsp://192.168.252.244:554', - }, - { - id: 4, - name: 'Parking', - rtspUrl: 'rtsp://192.168.252.244:554', - }, - { - id: 1, - name: 'Backyard', - rtspUrl: 'rtsp://192.168.252.244:554', - }, */ -]; diff --git a/Backend/src/cameraStream/cameraStream.gateway.ts b/Backend/src/cameraStream/cameraStream.gateway.ts index edf0f3b..e4c4069 100644 --- a/Backend/src/cameraStream/cameraStream.gateway.ts +++ b/Backend/src/cameraStream/cameraStream.gateway.ts @@ -18,9 +18,10 @@ import { UseGuards, } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; -import { cameraData } from './cameraData'; import { CSSOpenVidu } from './open-vidu.service'; import { ConnectionProperties, ConnectionType } from 'openvidu-node-client'; +import { DatabaseService } from '../database/database.service'; +import * as console from 'console'; @Catch(WsException, HttpException) export class WsExceptionFilter implements WsExceptionFilter { @@ -50,6 +51,7 @@ export class CameraStreamGateway implements OnGatewayConnection { constructor( private readonly jwtService: JwtService, private readonly openvidu: CSSOpenVidu, + private readonly database: DatabaseService, ) {} async afterInit() { @@ -57,15 +59,17 @@ export class CameraStreamGateway implements OnGatewayConnection { const session = await this.openvidu.instance.createSession({}); this.sessionId = session.sessionId; - cameraData.forEach((camera) => { + const nvr = await this.database.getNVRData(); + nvr.channels.forEach((id: number) => { const connectionProperties: ConnectionProperties = { type: ConnectionType.IPCAM, - rtspUri: camera.rtspUrl, + rtspUri: `${nvr.ip}/ch${id}_0.264`, adaptativeBitrate: true, onlyPlayWithSubscribers: false, networkCache: 1000, - data: camera.id, + data: id.toString(), }; + console.log(connectionProperties); session .createConnection(connectionProperties) diff --git a/Backend/src/database/database.service.ts b/Backend/src/database/database.service.ts index 68df352..78a7cf2 100644 --- a/Backend/src/database/database.service.ts +++ b/Backend/src/database/database.service.ts @@ -7,13 +7,18 @@ import { NotAcceptableException, NotFoundException, } from '@nestjs/common'; -import { Db, Document, Filter, MatchKeysAndValues, MongoClient } from 'mongodb'; +import { + Db, + Document, + Filter, + MatchKeysAndValues, + MongoClient, + WithId, +} from 'mongodb'; import 'dotenv/config'; import DataType from '../DataType'; -import { CameraIds } from '../validators/camera-id/camera.pipe'; import { FiltersAvailable } from '../validators/filters/filters.pipe'; import * as process from 'process'; -import UserDTO from '../user.dto'; import * as bcrypt from 'bcrypt'; const url = `${process.env.MONGO_PROTOCOL ?? 'mongodb'}://${ @@ -24,26 +29,21 @@ const url = `${process.env.MONGO_PROTOCOL ?? 'mongodb'}://${ export class DatabaseService { private DB: Db; - constructor() { - const client = new MongoClient(url); - - this.DB = client.db('csd'); - // If no user exists it automatically creates one with the default credentials in env file - this.DB.collection('users') - .countDocuments() - .then((size) => { - if (size == 0) { - this.DB.collection(`users`).insertOne({ - name: process.env.CSD_USER, - password: bcrypt.hashSync( - process.env.CSD_PASSWORD, - process.env.BCRYPT_SALT, - ), - }); - } + // If no user exists it automatically creates one with the default credentials in env file + async initDBUser() { + const size = await this.DB.collection('users').countDocuments(); + if (size == 0) { + await this.DB.collection(`users`).insertOne({ + name: process.env.CSD_USER, + password: bcrypt.hashSync( + process.env.CSD_PASSWORD, + process.env.BCRYPT_SALT, + ), }); + } // If the user exists but the password is not hashed it will hash it - this.DB.collection('users').findOneAndUpdate( + // This should not be needed but for safety we keep it + await this.DB.collection('users').findOneAndUpdate( { name: process.env.CSD_USER, password: process.env.CSD_PASSWORD, @@ -59,7 +59,14 @@ export class DatabaseService { ); } - async addData(data: DataType) { + constructor() { + const client = new MongoClient(url); + + this.DB = client.db('csd'); + this.initDBUser(); + } + + async addData(data: DataType) { const col = this.DB.collection(`cameras`); return await col.insertOne(data); } @@ -112,7 +119,7 @@ export class DatabaseService { errorString0: string = 'Data Not found', limit: number = 1, errorStringExceed: string = 'Too much data found', - ) { + ): Promise[]> { const array = await this.DB.collection(collection).find(filter).toArray(); if (array.length == 0) throw new NotFoundException(errorString0); @@ -133,11 +140,6 @@ export class DatabaseService { }); } - // This will also check if the user exists - async checkUserAndUpdateTelegramId(telegramId: number, userData: UserDTO) { - return await this.checkAndUpdateUser(userData, { telegramId: telegramId }); - } - private getFilter(filter?: FiltersAvailable) { switch (filter) { case 'intrusionDetection': @@ -157,4 +159,92 @@ export class DatabaseService { return {}; } } -} \ No newline at end of file + + async setChannelName(id: number, name: string) { + const col = this.DB.collection(`camera_names`); + return await col.updateOne( + { id: id }, + { + $set: { + id: id, + name: name, + }, + }, + { + upsert: true, + }, + ); + } + + async getChannelName(id?: number) { + const filter = id == undefined ? {} : { id: id }; + + const arrayRes = await this.DB.collection('camera_names') + .find(filter) + .toArray(); + + if (arrayRes.length == 0) + throw new NotFoundException('Camera name not found'); + + const array = arrayRes.map((value) => ({ + id: value.id, + name: value.name, + })); + + return id == undefined ? array : array[0].name; + } + + // TODO TESTME + // Returns NVR info such as IP address and available channels + async getNVRData(): Promise { + const array = await this.getOtherwiseInsert( + 'General', + { + name: 'NVR', + }, + { + name: 'NVR', + ip: process.env.NVR_IP_ADDRESS, + channels: [0, 1, 2, 3, 4, 5, 6, 7], + }, + ); + return { + ip: array[0].ip, + channels: array[0].channels, + }; + + // try { + // const array = await this.getRawDataArray('General', { + // name: 'NVR', + // }); + // return array[0]; + // } catch (e) { + // if (e instanceof NotFoundException) { + // const data = { + // name: 'NVR', + // ip: process.env.NVR_IP_ADDRESS, + // channels: [0, 1, 2, 3, 4, 5, 6, 7], + // }; + // + // await this.DB.collection(`General`).insertOne(data); + // return data; + // } else { + // console.error(e); + // } + // } + } + + async getOtherwiseInsert( + name: string, + filter: Filter, + data: Document, + ): Promise[]> { + const size = await this.DB.collection(name).countDocuments(filter); + + if (size == 0) { + await this.DB.collection(name).insertOne(data); + } + + return await this.getRawDataArray(name, filter); + } +} diff --git a/Backend/src/validators/camera-id/camera.pipe.spec.ts b/Backend/src/validators/camera-id/camera.pipe.spec.ts index 4dbd627..df0a3cb 100644 --- a/Backend/src/validators/camera-id/camera.pipe.spec.ts +++ b/Backend/src/validators/camera-id/camera.pipe.spec.ts @@ -1,7 +1,7 @@ -import { cameraIds, CameraValidator } from './camera.pipe'; +import { cameraIds, PositiveNumberValidator } from './camera.pipe'; describe('CameraIdPipe', () => { - const validator = new CameraValidator(); + const validator = new PositiveNumberValidator(); it('should throw as not correct value', () => { expect(() => validator.transform('200')).toThrow(); }); diff --git a/Backend/src/validators/camera-id/camera.pipe.ts b/Backend/src/validators/camera-id/camera.pipe.ts index 5570e6c..d76db79 100644 --- a/Backend/src/validators/camera-id/camera.pipe.ts +++ b/Backend/src/validators/camera-id/camera.pipe.ts @@ -1,25 +1,17 @@ -import { - HttpException, - HttpStatus, - Injectable, - PipeTransform, -} from '@nestjs/common'; +import { BadRequestException, Injectable, PipeTransform } from '@nestjs/common'; @Injectable() -export class CameraValidator implements PipeTransform { - transform(value: string): CameraIds { - const cameraId = parseInt(value) as CameraIds; +export class PositiveNumberValidator implements PipeTransform { + transform(value?: string): number | undefined { + console.log(value); + if (value === undefined || value == ',') return undefined; - if (!cameraIds.includes(cameraId)) { - throw new HttpException( - 'Invalid camera Id ' + cameraId, - HttpStatus.BAD_REQUEST, - ); + const cameraId = parseInt(value); + + if (cameraId < 0) { + throw new BadRequestException('Camera id must be positive'); } return cameraId; } } - -export const cameraIds = [1, 2, 3, 4, 5, 6, 7, 8, 9] as const; -export type CameraIds = (typeof cameraIds)[number]; From 7628a7a1dbd0265dfd6545b2cc6ed8b27fe061c5 Mon Sep 17 00:00:00 2001 From: Glydric Date: Sat, 20 Jan 2024 13:47:15 +0100 Subject: [PATCH 4/6] tests fixes and improvements --- Backend/src/app/shared/shared.controller.ts | 1 + Backend/src/validators/camera-id/camera.pipe.spec.ts | 11 +++++------ Backend/src/validators/camera-id/camera.pipe.ts | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Backend/src/app/shared/shared.controller.ts b/Backend/src/app/shared/shared.controller.ts index eb28628..fcaae15 100644 --- a/Backend/src/app/shared/shared.controller.ts +++ b/Backend/src/app/shared/shared.controller.ts @@ -26,6 +26,7 @@ export class SharedController { examples: { undefined: { description: 'sends an undefined value', + value: undefined, }, camera: { value: '1', diff --git a/Backend/src/validators/camera-id/camera.pipe.spec.ts b/Backend/src/validators/camera-id/camera.pipe.spec.ts index df0a3cb..1ecba0c 100644 --- a/Backend/src/validators/camera-id/camera.pipe.spec.ts +++ b/Backend/src/validators/camera-id/camera.pipe.spec.ts @@ -1,12 +1,11 @@ -import { cameraIds, PositiveNumberValidator } from './camera.pipe'; +import { PositiveNumberValidator } from './camera.pipe'; describe('CameraIdPipe', () => { const validator = new PositiveNumberValidator(); it('should throw as not correct value', () => { - expect(() => validator.transform('200')).toThrow(); - }); - - it('should accept all the values', () => { - cameraIds.forEach((i) => expect(validator.transform(`${i}`)).toBe(i)); + expect(() => validator.transform('-200')).toThrow(); + expect(() => validator.transform('200')).toEqual(200); + expect(() => validator.transform(',')).toEqual(undefined); + expect(() => validator.transform(undefined)).toEqual(undefined); }); }); diff --git a/Backend/src/validators/camera-id/camera.pipe.ts b/Backend/src/validators/camera-id/camera.pipe.ts index d76db79..fe4456a 100644 --- a/Backend/src/validators/camera-id/camera.pipe.ts +++ b/Backend/src/validators/camera-id/camera.pipe.ts @@ -3,7 +3,6 @@ import { BadRequestException, Injectable, PipeTransform } from '@nestjs/common'; @Injectable() export class PositiveNumberValidator implements PipeTransform { transform(value?: string): number | undefined { - console.log(value); if (value === undefined || value == ',') return undefined; const cameraId = parseInt(value); From f8900c42106e2b12a053749f110a43519438c41f Mon Sep 17 00:00:00 2001 From: Glydric Date: Sat, 20 Jan 2024 14:53:04 +0100 Subject: [PATCH 5/6] fixed tests --- Backend/src/app/shared/shared.controller.spec.ts | 2 ++ Backend/src/cameraStream/cameraStream.gateway.spec.ts | 3 ++- Backend/src/validators/camera-id/camera.pipe.spec.ts | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Backend/src/app/shared/shared.controller.spec.ts b/Backend/src/app/shared/shared.controller.spec.ts index e7744c3..d1f0c0b 100644 --- a/Backend/src/app/shared/shared.controller.spec.ts +++ b/Backend/src/app/shared/shared.controller.spec.ts @@ -1,5 +1,6 @@ import { Test, TestingModule } from '@nestjs/testing'; import { SharedController } from './shared.controller'; +import { DatabaseService } from '../../database/database.service'; describe('SharedController', () => { let controller: SharedController; @@ -7,6 +8,7 @@ describe('SharedController', () => { beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ controllers: [SharedController], + providers: [DatabaseService], }).compile(); controller = module.get(SharedController); diff --git a/Backend/src/cameraStream/cameraStream.gateway.spec.ts b/Backend/src/cameraStream/cameraStream.gateway.spec.ts index 67ad93b..1158e50 100644 --- a/Backend/src/cameraStream/cameraStream.gateway.spec.ts +++ b/Backend/src/cameraStream/cameraStream.gateway.spec.ts @@ -4,13 +4,14 @@ import { JwtModule } from '@nestjs/jwt'; import { OpenVidu } from 'openvidu-node-client'; import { CSSOpenVidu } from './open-vidu.service'; +import { DatabaseService } from '../database/database.service'; describe('WebStreamGateway', () => { let gateway: CameraStreamGateway; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ - providers: [CameraStreamGateway, CSSOpenVidu], + providers: [CameraStreamGateway, CSSOpenVidu, DatabaseService], imports: [ JwtModule.register({ global: true, diff --git a/Backend/src/validators/camera-id/camera.pipe.spec.ts b/Backend/src/validators/camera-id/camera.pipe.spec.ts index 1ecba0c..faeae7f 100644 --- a/Backend/src/validators/camera-id/camera.pipe.spec.ts +++ b/Backend/src/validators/camera-id/camera.pipe.spec.ts @@ -4,8 +4,8 @@ describe('CameraIdPipe', () => { const validator = new PositiveNumberValidator(); it('should throw as not correct value', () => { expect(() => validator.transform('-200')).toThrow(); - expect(() => validator.transform('200')).toEqual(200); - expect(() => validator.transform(',')).toEqual(undefined); - expect(() => validator.transform(undefined)).toEqual(undefined); + expect(validator.transform('200')).toBe(200); + expect(validator.transform(',')).toEqual(undefined); + expect(validator.transform(undefined)).toEqual(undefined); }); }); From 42985da24487a79d7b21d46d1626c16b6cff8e8c Mon Sep 17 00:00:00 2001 From: Glydric Date: Mon, 22 Jan 2024 16:52:38 +0100 Subject: [PATCH 6/6] added limit to filtering --- .../src/app/frontend/frontend.controller.ts | 14 ++++++++ Backend/src/database/database.service.ts | 33 ++++++++++--------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Backend/src/app/frontend/frontend.controller.ts b/Backend/src/app/frontend/frontend.controller.ts index 24f6748..e0b5e50 100644 --- a/Backend/src/app/frontend/frontend.controller.ts +++ b/Backend/src/app/frontend/frontend.controller.ts @@ -71,6 +71,20 @@ export class FrontendController { return this.databaseService.getData(filter); } + @ApiParam(filterParams) + @ApiParam({ + name: 'limit', + type: 'number', + example: 10, + }) + @Get(`:filter(${filters.join('|')})/:limit(\\d+)`) + getValuesLimit( + @Param('filter', FiltersValidator) filter: FiltersAvailable, + @Param('limit', PositiveNumberValidator) limit: number, + ) { + return this.databaseService.getData(filter, limit); + } + @ApiParam({ name: 'id', type: 'number', diff --git a/Backend/src/database/database.service.ts b/Backend/src/database/database.service.ts index 78a7cf2..4be9756 100644 --- a/Backend/src/database/database.service.ts +++ b/Backend/src/database/database.service.ts @@ -71,25 +71,28 @@ export class DatabaseService { return await col.insertOne(data); } - getData(filter?: FiltersAvailable): Promise { - return this.DB.collection('cameras') - .aggregate([ - { - $addFields: { - intrusionDetection: { - $cond: { - if: { - $ifNull: ['$intrusionDetection', false], - }, - then: true, - else: false, + getData( + filter: FiltersAvailable, + limit: number = undefined, + ): Promise { + const res = this.DB.collection('cameras').aggregate([ + { + $addFields: { + intrusionDetection: { + $cond: { + if: { + $ifNull: ['$intrusionDetection', false], }, + then: true, + else: false, }, }, }, - ]) - .match(this.getFilter(filter)) - .toArray(); + }, + ]); + if (limit != undefined) + return res.limit(limit).match(this.getFilter(filter)).toArray(); + else return res.match(this.getFilter(filter)).toArray(); } aggregateCamera(filter?: FiltersAvailable): Promise {