From d73eca5c3099ee01e5e3c2257894ffeae420914e Mon Sep 17 00:00:00 2001 From: J <15862136+jjjpanda@users.noreply.github.com> Date: Wed, 29 Dec 2021 21:10:01 -0500 Subject: [PATCH] starting off with a database bonanza (#126) * starting off with a database bonanza * readme updates * Delete .eslintrc.js a test, yes * Create .eslintrc.js * Update .eslintrc.js * Delete .eslintrc.js * updates * updates for #127 and #130 * more of #130 changes * updates for #128 * removing graphs temporarily for #30 * more for #128, #129 new tests required * shrinkwraps v4.6.0 --- README.md | 30 +- chimera/generateEmptyPassFile.js | 19 - chimera/prepareDatabase.js | 36 + chimera/register.js | 19 +- chimera/splitAndValidateEnvVars.js | 19 +- command/__mocks__/pg.js | 20 + command/backend/routes/lib/auth.js | 18 +- command/frontend/app/FileStats.jsx | 4 +- command/npm-shrinkwrap.json | 266 ++++- command/package.json | 2 + command/test/authorization.test.js | 7 +- env.example | 13 +- gateway/npm-shrinkwrap.json | 331 +++++- gateway/package.json | 1 + lib/npm-shrinkwrap.json | 91 +- lib/utils/auth.js | 31 +- livestream/npm-shrinkwrap.json | 70 +- livestream/package.json | 1 + memory/npm-shrinkwrap.json | 28 +- memory/package.json | 1 + npm-shrinkwrap.json | 987 ++++++++++++++---- package.json | 11 +- schedule/npm-shrinkwrap.json | 70 +- schedule/package.json | 1 + storage/README.md | 5 +- storage/backend/routes/file.js | 29 +- storage/backend/routes/lib/deprecated-file.js | 335 ++++++ storage/backend/routes/lib/file.js | 453 ++------ storage/npm-shrinkwrap.json | 262 ++++- storage/package.json | 14 +- 30 files changed, 2288 insertions(+), 886 deletions(-) delete mode 100644 chimera/generateEmptyPassFile.js create mode 100644 chimera/prepareDatabase.js create mode 100644 command/__mocks__/pg.js create mode 100644 storage/backend/routes/lib/deprecated-file.js diff --git a/README.md b/README.md index 45739af..50d02ad 100644 --- a/README.md +++ b/README.md @@ -18,29 +18,24 @@ Massive Dependencies: 2. [ffmpeg](https://ffmpeg.org) - should be installed on same machine as [livestream](livestream) and [storage](storage). 3. [heartbeat](https://github.com/jjjpanda/heartbeat) - used to confirm server is still up. 4. [object](https://github.com/jjjpanda/object) - used to detect objects (still not implemented within start script). +5. [postgres](https://www.postgresql.org) - the database ## Quick Start -### 1. Install motion and ffmpeg +### 1. Install motion, ffmpeg, and postgres ``` -sudo apt-get install motion ffmpeg +sudo apt-get install motion ffmpeg postgresql ``` -Then, set up a conf for motion with all of your cameras. + +*Or however you need to download it on your machine* + +Then, set up a conf for **motion** with all of your cameras. Then, set up **postgres** with a database, port, user, and password of your choosing. **Motion** will also need postgres details in it's conf as well. [*See storage for details.*](storage) ### 2. Installing NPM dependencies -If running all services on one machine: ``` npm install --no-optional ``` -If splitting services, you can install each service with: -``` -npm run install: -``` -or -``` -cd && npm install -``` ### 3. Create Environment Variables File Copy the example env into an .env dotfile: @@ -50,17 +45,6 @@ cp env.example .env Fill in the .env with all the info listed ( for optional fields, leave blank after the "=" ). -Then, if running any service separate run: -``` -npm run validate:env && npm run validate:pass -``` -This is will split the .env into multiple .env's for the respective services, then create the hash file for passwords. - -If running gateway and using https run: -``` -npm run validate:acme -``` - ### 4. Start Chimera If running all or more than one service(s) diff --git a/chimera/generateEmptyPassFile.js b/chimera/generateEmptyPassFile.js deleted file mode 100644 index 48b0920..0000000 --- a/chimera/generateEmptyPassFile.js +++ /dev/null @@ -1,19 +0,0 @@ -require("dotenv").config() -const mkdirp = require('mkdirp') - -let made = true -try { - made = mkdirp.sync(process.env.password_FILEPATH) -} catch(e){ - if(e.code != "EEXIST"){ - made = false - console.log(`password hash file error`, e) - } -} finally { - if(made){ - process.exit(0) - } - else{ - process.exit(1) - } -} \ No newline at end of file diff --git a/chimera/prepareDatabase.js b/chimera/prepareDatabase.js new file mode 100644 index 0000000..afceaba --- /dev/null +++ b/chimera/prepareDatabase.js @@ -0,0 +1,36 @@ +require("dotenv").config() +const Pool = require('pg').Pool +const pool = new Pool({ + user: process.env.database_USER, + host: process.env.database_HOST, + database: process.env.database_NAME, + password: process.env.database_PASSWORD, + port: process.env.database_PORT, +}) + +const creationTasks = [ + { + query: `CREATE TABLE frame_files(ID SERIAL PRIMARY KEY, timestamp TIMESTAMP, camera NUMERIC(10), name VARCHAR, size NUMERIC);`, + description: "frame files table" + }, + { + query: `CREATE TABLE frame_deletes(ID SERIAL PRIMARY KEY, timestamp TIMESTAMP, camera NUMERIC(10), size NUMERIC, count NUMERIC);`, + description: "frame deletions table" + }, + { + query: `CREATE TABLE auth(ID SERIAL PRIMARY KEY, username VARCHAR(10) UNIQUE, hash VARCHAR);`, + description: "authorization table" + } +] + +Promise.allSettled(creationTasks.map(({query}) => { + return pool.query(query) +})).then(values => { + let issues = false + values.forEach((value, index) => { + const tableExists = value.status == "fulfilled" || (value.status == "rejected" && value.reason && value.reason.code == `42P07`) + if(!tableExists) issues = true + console.log(`${creationTasks[index].description} ${tableExists ? `✔️` : `❌`}`) + }) + process.exit(issues ? 1 : 0) +}) \ No newline at end of file diff --git a/chimera/register.js b/chimera/register.js index 2288528..eb93fa6 100644 --- a/chimera/register.js +++ b/chimera/register.js @@ -1,6 +1,15 @@ require("dotenv").config() const { auth } = require("lib") +const Pool = require('pg').Pool +const pool = new Pool({ + user: process.env.database_USER, + host: process.env.database_HOST, + database: process.env.database_NAME, + password: process.env.database_PASSWORD, + port: process.env.database_PORT, +}) + const stdout = process.stdout const stdin = process.stdin @@ -60,7 +69,7 @@ const exit = (retyped) => { } const closeOut = (bypass=false) => { - auth.register(bypass ? "" : input, () => { + auth.register(bypass ? "" : input, pool, () => { process.exit(0) }, (msg) => { console.log(msg) @@ -89,13 +98,7 @@ const backspace = (retyped) => { } } -const seconds = 30 -setInterval(() => { - enter(null, true) -}, seconds * 1000) - -stdout.write(`Proceeding with password file in ${seconds} seconds`) -stdout.write("\nPassword:") +stdout.write("\nCreate Chimera Password:") stdin.setRawMode(true) stdin.resume() stdin.setEncoding("utf-8") diff --git a/chimera/splitAndValidateEnvVars.js b/chimera/splitAndValidateEnvVars.js index 535f431..3373f2b 100644 --- a/chimera/splitAndValidateEnvVars.js +++ b/chimera/splitAndValidateEnvVars.js @@ -64,10 +64,6 @@ env.storage += writeVarLine("cameras") env.lib += writeVarLine("alert_URL") env.lib += writeVarLine("admin_alert_URL") -env.command += writeVarLine("password_FILEPATH") -env.lib += writeVarLine("password_FILEPATH") -confirmPath("password_FILEPATH") - env.command += writeVarLine("templink_PIN") env.lib += writeVarLine("templink_PIN") @@ -147,6 +143,21 @@ env.memory += writeVarLine("memory_PORT") env.memory += writeVarLine("memory_HOST") env.memory += writeVarLine("memory_AUTH_TOKEN") +env.storage += writeVarLine("database_NAME") +env.command += writeVarLine("database_NAME") + +env.storage += writeVarLine("database_USER") +env.command += writeVarLine("database_USER") + +env.storage += writeVarLine("database_PASSWORD") +env.command += writeVarLine("database_PASSWORD") + +env.storage += writeVarLine("database_HOST") +env.command += writeVarLine("database_HOST") + +env.storage += writeVarLine("database_PORT") +env.command += writeVarLine("database_PORT") + if(allEnvPresent){ Promise.all(Object.entries(env) .map(([key, value]) => new Promise((resolve, reject) => { diff --git a/command/__mocks__/pg.js b/command/__mocks__/pg.js new file mode 100644 index 0000000..1a64b4e --- /dev/null +++ b/command/__mocks__/pg.js @@ -0,0 +1,20 @@ +const bcrypt = jest.requireActual("bcryptjs") +const hashedMockedPassword = bcrypt.hashSync('mockedPassword', bcrypt.genSaltSync(10)) + +const queryObject = { + query: (str, callback) => callback(null, {rows: [{hash: hashedMockedPassword}]}) +} +const mockedPool = { + connect: () => { + return queryObject + }, + ...queryObject, + end: jest.fn(), + on: jest.fn() +} + +const pg = { + Pool: jest.fn(() => mockedPool) +} + +module.exports = pg \ No newline at end of file diff --git a/command/backend/routes/lib/auth.js b/command/backend/routes/lib/auth.js index cce97c0..c0e22e9 100644 --- a/command/backend/routes/lib/auth.js +++ b/command/backend/routes/lib/auth.js @@ -1,10 +1,17 @@ const secretKey = process.env.SECRETKEY const jwt = require("jsonwebtoken") const bcrypt = require("bcryptjs") -const fs = require("fs") -const path = require("path") const {randomID, webhookAlert} = require('lib') +const Pool = require('pg').Pool +const pool = new Pool({ + user: process.env.database_USER, + host: process.env.database_HOST, + database: process.env.database_NAME, + password: process.env.database_PASSWORD, + port: process.env.database_PORT, +}) + const client = require("memory").client("AUTHORIZATION") module.exports = { @@ -17,8 +24,9 @@ module.exports = { next() } else{ - fs.readFile(path.join(process.env.password_FILEPATH), {encoding:"utf8", flag:"r"}, (err, hash) => { - if(!err){ + pool.query(`SELECT hash FROM auth WHERE username = 'admin'`, (err, values) => { + if (!err && values.rows.length > 0 && values.rows[0].hash) { + const {hash} = values.rows[0] bcrypt.compare(password == undefined ? "" : password, hash, (err, success) => { if(!err && success){ next() @@ -29,7 +37,7 @@ module.exports = { }) } else{ - console.log(`NO HASH FILE AT ${process.env.password_FILEPATH}`) + console.log(`NO HASH`) res.status(400).json({ error: true, errors: "Password Unable to Be Verified" }) } }) diff --git a/command/frontend/app/FileStats.jsx b/command/frontend/app/FileStats.jsx index 2a98e98..01c712a 100644 --- a/command/frontend/app/FileStats.jsx +++ b/command/frontend/app/FileStats.jsx @@ -194,7 +194,7 @@ class FileStats extends React.Component { {/* */} - + {/* @@ -221,7 +221,7 @@ class FileStats extends React.Component { return })} - + */} {this.state.cameras.map(cam => { diff --git a/command/npm-shrinkwrap.json b/command/npm-shrinkwrap.json index a57d8a7..c0d5155 100644 --- a/command/npm-shrinkwrap.json +++ b/command/npm-shrinkwrap.json @@ -35,6 +35,7 @@ "moment": "^2.29.1", "nanoid": "^3.1.30", "path-browserify": "^1.0.1", + "pg": "^8.7.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-hls-player": "^3.0.7", @@ -1056,7 +1057,7 @@ } }, "../lib/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -1089,7 +1090,7 @@ } }, "../lib/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -1110,7 +1111,7 @@ } }, "../lib/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -1143,7 +1144,7 @@ "peer": true }, "../lib/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -1526,7 +1527,7 @@ } }, "../lib/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -1898,7 +1899,7 @@ } }, "../lib/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -2547,7 +2548,7 @@ } }, "../lib/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -7439,7 +7440,7 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -7529,7 +7530,7 @@ "license": "MIT" }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -7554,7 +7555,7 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT" }, "node_modules/@types/prettier": { @@ -7758,7 +7759,7 @@ } }, "node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -8459,6 +8460,13 @@ "version": "1.1.2", "license": "MIT" }, + "node_modules/buffer-writer": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/buffer-xor": { "version": "1.0.3", "license": "MIT" @@ -8506,7 +8514,7 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "funding": { "type": "opencollective", @@ -8756,7 +8764,7 @@ "license": "MIT" }, "node_modules/core-js-compat": { - "version": "3.20.0", + "version": "3.20.1", "dev": true, "license": "MIT", "dependencies": { @@ -9265,7 +9273,7 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC" }, "node_modules/elliptic": { @@ -10527,7 +10535,7 @@ } }, "node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -12838,6 +12846,10 @@ "node": ">=6" } }, + "node_modules/packet-reader": { + "version": "1.0.0", + "license": "MIT" + }, "node_modules/param-case": { "version": "3.0.4", "license": "MIT", @@ -12929,6 +12941,73 @@ "version": "2.1.0", "license": "MIT" }, + "node_modules/pg": { + "version": "8.7.1", + "license": "MIT", + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "pg-native": ">=2.0.0" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-connection-string": { + "version": "2.5.0", + "license": "MIT" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.4.1", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.5.0", + "license": "MIT" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, "node_modules/picocolors": { "version": "1.0.0", "license": "ISC" @@ -13095,6 +13174,37 @@ "node": ">=0.10.0" } }, + "node_modules/postgres-array": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/prelude-ls": { "version": "1.1.2", "peer": true, @@ -14189,6 +14299,13 @@ "node": ">=0.10.0" } }, + "node_modules/split2": { + "version": "4.1.0", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "license": "BSD-3-Clause", @@ -15124,6 +15241,13 @@ "license": "MIT", "peer": true }, + "node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "license": "ISC", @@ -16566,7 +16690,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -16642,7 +16766,7 @@ "version": "6.1.0" }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -16663,7 +16787,7 @@ "version": "7.0.9" }, "@types/node": { - "version": "17.0.0" + "version": "17.0.5" }, "@types/prettier": { "version": "2.4.2", @@ -16823,7 +16947,7 @@ } }, "acorn": { - "version": "8.6.0" + "version": "8.7.0" }, "acorn-globals": { "version": "6.0.0", @@ -17309,6 +17433,9 @@ "buffer-from": { "version": "1.1.2" }, + "buffer-writer": { + "version": "2.0.0" + }, "buffer-xor": { "version": "1.0.3" }, @@ -17338,7 +17465,7 @@ "version": "5.3.1" }, "caniuse-lite": { - "version": "1.0.30001291" + "version": "1.0.30001294" }, "chalk": { "version": "2.4.2", @@ -17500,7 +17627,7 @@ "version": "2.6.12" }, "core-js-compat": { - "version": "3.20.0", + "version": "3.20.1", "dev": true, "requires": { "browserslist": "^4.19.1", @@ -17856,7 +17983,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24" + "version": "1.4.30" }, "elliptic": { "version": "6.5.4", @@ -18645,7 +18772,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -20508,7 +20635,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -20537,7 +20664,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -20555,7 +20682,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -20582,7 +20709,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -20829,7 +20956,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -21072,7 +21199,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -21460,7 +21587,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -23866,7 +23993,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -23895,7 +24022,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -23913,7 +24040,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -23940,7 +24067,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -24187,7 +24314,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -24430,7 +24557,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -24818,7 +24945,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -26632,6 +26759,9 @@ "p-try": { "version": "2.2.0" }, + "packet-reader": { + "version": "1.0.0" + }, "param-case": { "version": "3.0.4", "requires": { @@ -26695,6 +26825,47 @@ "performance-now": { "version": "2.1.0" }, + "pg": { + "version": "8.7.1", + "requires": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + } + }, + "pg-connection-string": { + "version": "2.5.0" + }, + "pg-int8": { + "version": "1.0.1" + }, + "pg-pool": { + "version": "3.4.1", + "requires": {} + }, + "pg-protocol": { + "version": "1.5.0" + }, + "pg-types": { + "version": "2.2.0", + "requires": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + } + }, + "pgpass": { + "version": "1.0.5", + "requires": { + "split2": "^4.1.0" + } + }, "picocolors": { "version": "1.0.0" }, @@ -26798,6 +26969,21 @@ "postcss-value-parser": { "version": "4.2.0" }, + "postgres-array": { + "version": "2.0.0" + }, + "postgres-bytea": { + "version": "1.0.0" + }, + "postgres-date": { + "version": "1.0.7" + }, + "postgres-interval": { + "version": "1.2.0", + "requires": { + "xtend": "^4.0.0" + } + }, "prelude-ls": { "version": "1.1.2", "peer": true @@ -27647,6 +27833,9 @@ } } }, + "split2": { + "version": "4.1.0" + }, "sprintf-js": { "version": "1.0.3", "peer": true @@ -28204,6 +28393,9 @@ "version": "2.2.0", "peer": true }, + "xtend": { + "version": "4.0.2" + }, "y18n": { "version": "5.0.8", "peer": true diff --git a/command/package.json b/command/package.json index 0b44f7a..7cc87d9 100644 --- a/command/package.json +++ b/command/package.json @@ -2,6 +2,7 @@ "name": "command", "main": "server.js", "scripts": { + "prestart": "cd .. && npm-run-all -s --npm-path npm \"prepare:*\"", "start": "node start.js", "build": "webpack --progress", "buildCont": "webpack --progress --watch", @@ -38,6 +39,7 @@ "moment": "^2.29.1", "nanoid": "^3.1.30", "path-browserify": "^1.0.1", + "pg": "^8.7.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-hls-player": "^3.0.7", diff --git a/command/test/authorization.test.js b/command/test/authorization.test.js index 0e548e1..68b9dbc 100644 --- a/command/test/authorization.test.js +++ b/command/test/authorization.test.js @@ -1,14 +1,9 @@ const supertest = require('supertest'); const app = require('../backend/command.js') -const bcrypt = require("bcryptjs") const mockedPassword = 'mockedPassword' -const hashedMockedPassword = bcrypt.hashSync(mockedPassword, bcrypt.genSaltSync(10)) -let fs = require('fs'); -fs.readFile = jest.fn().mockImplementation((filePath, options, callback) => { - callback(false, hashedMockedPassword) -}) +jest.mock('pg') jest.mock('pm2') jest.mock('axios') jest.mock('memory') diff --git a/env.example b/env.example index f0e8613..b38bd43 100644 --- a/env.example +++ b/env.example @@ -24,7 +24,6 @@ admin_alert_URL = Admin alert webhook url ##### Authorization Info ##### -password_FILEPATH = Path for password text file (dont fret, it will be hashed) templink_PIN = PIN for alt login, sends temp link to webhook that expires PRINTPASSWORD = (true | false) (fret if you leave this on in prod) SECRETKEY = AUTH SECRET KEY FOR HASHING @@ -142,4 +141,16 @@ memory_HOST = https://memory.socket.example or http://127.0.0.1:8081 memory_AUTH_TOKEN = Header token to connect to memory socket +################################################################## +# +# Database +# +################################################################## + +database_NAME = postgres database name +database_USER = postgres user +database_PASSWORD = postgres password +database_HOST = postgresql://database.domain.example or http://127.0.0.1 (note: do not add the port) +database_PORT = postgres server port + ################################################################## \ No newline at end of file diff --git a/gateway/npm-shrinkwrap.json b/gateway/npm-shrinkwrap.json index d12d8fe..a4b3f4d 100644 --- a/gateway/npm-shrinkwrap.json +++ b/gateway/npm-shrinkwrap.json @@ -50,6 +50,7 @@ "moment": "^2.29.1", "nanoid": "^3.1.30", "path-browserify": "^1.0.1", + "pg": "^8.7.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-hls-player": "^3.0.7", @@ -1192,7 +1193,7 @@ } }, "../command/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -1292,7 +1293,7 @@ "peer": true }, "../command/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -1318,7 +1319,7 @@ "peer": true }, "../command/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -1509,7 +1510,7 @@ } }, "../command/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -2204,6 +2205,14 @@ "license": "MIT", "peer": true }, + "../command/node_modules/buffer-writer": { + "version": "2.0.0", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, "../command/node_modules/buffer-xor": { "version": "1.0.3", "license": "MIT", @@ -2243,7 +2252,7 @@ } }, "../command/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -3017,7 +3026,7 @@ "peer": true }, "../command/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -4279,7 +4288,7 @@ } }, "../command/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -6625,6 +6634,11 @@ "node": ">=6" } }, + "../command/node_modules/packet-reader": { + "version": "1.0.0", + "license": "MIT", + "peer": true + }, "../command/node_modules/param-case": { "version": "3.0.4", "license": "MIT", @@ -6727,6 +6741,80 @@ "license": "MIT", "peer": true }, + "../command/node_modules/pg": { + "version": "8.7.1", + "license": "MIT", + "peer": true, + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "pg-native": ">=2.0.0" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "../command/node_modules/pg-connection-string": { + "version": "2.5.0", + "license": "MIT", + "peer": true + }, + "../command/node_modules/pg-int8": { + "version": "1.0.1", + "license": "ISC", + "peer": true, + "engines": { + "node": ">=4.0.0" + } + }, + "../command/node_modules/pg-pool": { + "version": "3.4.1", + "license": "MIT", + "peer": true, + "peerDependencies": { + "pg": ">=8.0" + } + }, + "../command/node_modules/pg-protocol": { + "version": "1.5.0", + "license": "MIT", + "peer": true + }, + "../command/node_modules/pg-types": { + "version": "2.2.0", + "license": "MIT", + "peer": true, + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "../command/node_modules/pgpass": { + "version": "1.0.5", + "license": "MIT", + "peer": true, + "dependencies": { + "split2": "^4.1.0" + } + }, "../command/node_modules/picocolors": { "version": "1.0.0", "license": "ISC", @@ -6852,6 +6940,41 @@ "node": ">=0.10.0" } }, + "../command/node_modules/postgres-array": { + "version": "2.0.0", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "../command/node_modules/postgres-bytea": { + "version": "1.0.0", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "../command/node_modules/postgres-date": { + "version": "1.0.7", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "../command/node_modules/postgres-interval": { + "version": "1.2.0", + "license": "MIT", + "peer": true, + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "../command/node_modules/prelude-ls": { "version": "1.1.2", "peer": true, @@ -7965,6 +8088,14 @@ "node": ">=0.10.0" } }, + "../command/node_modules/split2": { + "version": "4.1.0", + "license": "ISC", + "peer": true, + "engines": { + "node": ">= 10.x" + } + }, "../command/node_modules/sprintf-js": { "version": "1.0.3", "license": "BSD-3-Clause", @@ -8832,6 +8963,14 @@ "license": "MIT", "peer": true }, + "../command/node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.4" + } + }, "../command/node_modules/y18n": { "version": "5.0.8", "license": "ISC", @@ -9876,7 +10015,7 @@ } }, "../lib/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -9909,7 +10048,7 @@ } }, "../lib/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -9930,7 +10069,7 @@ } }, "../lib/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -9963,7 +10102,7 @@ "peer": true }, "../lib/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -10346,7 +10485,7 @@ } }, "../lib/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -10718,7 +10857,7 @@ } }, "../lib/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -11367,7 +11506,7 @@ } }, "../lib/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -14867,7 +15006,7 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -14907,7 +15046,7 @@ } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -14971,7 +15110,7 @@ } }, "node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -15315,7 +15454,7 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -15610,7 +15749,7 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -16370,7 +16509,7 @@ "peer": true }, "node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -18903,7 +19042,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -18938,7 +19077,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -18989,7 +19128,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -19215,7 +19354,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -19311,6 +19450,7 @@ "moment": "^2.29.1", "nanoid": "^3.1.30", "path-browserify": "^1.0.1", + "pg": "^8.7.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-hls-player": "^3.0.7", @@ -20056,7 +20196,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -20142,7 +20282,7 @@ "peer": true }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -20164,7 +20304,7 @@ "peer": true }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -20327,7 +20467,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -20819,6 +20959,10 @@ "version": "1.1.2", "peer": true }, + "buffer-writer": { + "version": "2.0.0", + "peer": true + }, "buffer-xor": { "version": "1.0.3", "peer": true @@ -20844,7 +20988,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -21393,7 +21537,7 @@ "peer": true }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "elliptic": { @@ -22210,7 +22354,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -24088,7 +24232,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -24117,7 +24261,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -24135,7 +24279,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -24162,7 +24306,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -24409,7 +24553,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -24652,7 +24796,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -25040,7 +25184,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -27481,7 +27625,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -27510,7 +27654,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -27528,7 +27672,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -27555,7 +27699,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -27802,7 +27946,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -28045,7 +28189,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -28433,7 +28577,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -30277,6 +30421,10 @@ "version": "2.2.0", "peer": true }, + "packet-reader": { + "version": "1.0.0", + "peer": true + }, "param-case": { "version": "3.0.4", "peer": true, @@ -30351,6 +30499,54 @@ "version": "2.1.0", "peer": true }, + "pg": { + "version": "8.7.1", + "peer": true, + "requires": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + } + }, + "pg-connection-string": { + "version": "2.5.0", + "peer": true + }, + "pg-int8": { + "version": "1.0.1", + "peer": true + }, + "pg-pool": { + "version": "3.4.1", + "peer": true, + "requires": {} + }, + "pg-protocol": { + "version": "1.5.0", + "peer": true + }, + "pg-types": { + "version": "2.2.0", + "peer": true, + "requires": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + } + }, + "pgpass": { + "version": "1.0.5", + "peer": true, + "requires": { + "split2": "^4.1.0" + } + }, "picocolors": { "version": "1.0.0", "peer": true @@ -30431,6 +30627,25 @@ "version": "4.2.0", "peer": true }, + "postgres-array": { + "version": "2.0.0", + "peer": true + }, + "postgres-bytea": { + "version": "1.0.0", + "peer": true + }, + "postgres-date": { + "version": "1.0.7", + "peer": true + }, + "postgres-interval": { + "version": "1.2.0", + "peer": true, + "requires": { + "xtend": "^4.0.0" + } + }, "prelude-ls": { "version": "1.1.2", "peer": true @@ -31323,6 +31538,10 @@ } } }, + "split2": { + "version": "4.1.0", + "peer": true + }, "sprintf-js": { "version": "1.0.3", "peer": true @@ -31859,6 +32078,10 @@ "version": "2.2.0", "peer": true }, + "xtend": { + "version": "4.0.2", + "peer": true + }, "y18n": { "version": "5.0.8", "peer": true @@ -32028,7 +32251,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emittery": { @@ -32489,7 +32712,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -33689,7 +33912,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -33718,7 +33941,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -33736,7 +33959,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -33763,7 +33986,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -34010,7 +34233,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -34253,7 +34476,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -34641,7 +34864,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", diff --git a/gateway/package.json b/gateway/package.json index f8ec471..0424367 100644 --- a/gateway/package.json +++ b/gateway/package.json @@ -2,6 +2,7 @@ "name": "gateway", "main": "server.js", "scripts": { + "prestart": "cd .. && npm-run-all -s --npm-path npm prepare:acme prepare:env", "start": "node start.js", "test": "jest --verbose", "prunewrap": "npm shrinkwrap" diff --git a/lib/npm-shrinkwrap.json b/lib/npm-shrinkwrap.json index a92ccd0..5488e19 100644 --- a/lib/npm-shrinkwrap.json +++ b/lib/npm-shrinkwrap.json @@ -1063,9 +1063,9 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.3.tgz", - "integrity": "sha512-/GWCmzJWqV7diQW54smJZzWbSFf4QYtF71WCKhcx6Ru/tFyQIY2eiiITcCAeuPbNSvT9YCGkVMqqvSk2Z0mXiA==", + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", "peer": true, "dependencies": { "@babel/types": "^7.0.0" @@ -1100,9 +1100,9 @@ } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", - "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", "peer": true }, "node_modules/@types/istanbul-lib-report": { @@ -1124,9 +1124,9 @@ } }, "node_modules/@types/node": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", - "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==", + "version": "17.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.5.tgz", + "integrity": "sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==", "peer": true }, "node_modules/@types/prettier": { @@ -1163,9 +1163,9 @@ "peer": true }, "node_modules/acorn": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", - "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", "peer": true, "bin": { "acorn": "bin/acorn" @@ -1564,9 +1564,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001291", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001291.tgz", - "integrity": "sha512-roMV5V0HNGgJ88s42eE70sstqGW/gwFndosYrikHthw98N5tLnOTxFqMLQjZVRxTWFlJ4rn+MsgXrR7MDPY4jA==", + "version": "1.0.30001294", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001294.tgz", + "integrity": "sha512-LiMlrs1nSKZ8qkNhpUf5KD0Al1KCBE3zaT7OLOwEkagXMEDij98SiOovn9wxVGQpklk9vVC/pUSqgYmkmKOS8g==", "peer": true, "funding": { "type": "opencollective", @@ -1959,9 +1959,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.24", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.24.tgz", - "integrity": "sha512-erwx5r69B/WFfFuF2jcNN0817BfDBdC4765kQ6WltOMuwsimlQo3JTEq0Cle+wpHralwdeX3OfAtw/mHxPK0Wg==", + "version": "1.4.30", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.30.tgz", + "integrity": "sha512-609z9sIMxDHg+TcR/VB3MXwH+uwtrYyeAwWc/orhnr90ixs6WVGSrt85CDLGUdNnLqCA7liv426V20EecjvflQ==", "peer": true }, "node_modules/emitter-listener": { @@ -2643,9 +2643,9 @@ } }, "node_modules/istanbul-reports": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.1.tgz", - "integrity": "sha512-q1kvhAXWSsXfMjCdNHNPKZZv94OlspKnoGv+R9RGbnqOOQ0VbNfLFgQDVgi7hHenKsndGq3/o0OBdzDXthWcNw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz", + "integrity": "sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg==", "peer": true, "dependencies": { "html-escaper": "^2.0.0", @@ -4380,8 +4380,7 @@ }, "node_modules/safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "license": "MIT" }, "node_modules/safer-buffer": { "version": "2.1.2", @@ -5900,9 +5899,9 @@ } }, "@types/babel__generator": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.3.tgz", - "integrity": "sha512-/GWCmzJWqV7diQW54smJZzWbSFf4QYtF71WCKhcx6Ru/tFyQIY2eiiITcCAeuPbNSvT9YCGkVMqqvSk2Z0mXiA==", + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -5937,9 +5936,9 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", - "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", "peer": true }, "@types/istanbul-lib-report": { @@ -5961,9 +5960,9 @@ } }, "@types/node": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", - "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==", + "version": "17.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.5.tgz", + "integrity": "sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==", "peer": true }, "@types/prettier": { @@ -6000,9 +5999,9 @@ "peer": true }, "acorn": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", - "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", "peer": true }, "acorn-globals": { @@ -6283,9 +6282,9 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001291.tgz", - "integrity": "sha512-roMV5V0HNGgJ88s42eE70sstqGW/gwFndosYrikHthw98N5tLnOTxFqMLQjZVRxTWFlJ4rn+MsgXrR7MDPY4jA==", + "version": "1.0.30001294", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001294.tgz", + "integrity": "sha512-LiMlrs1nSKZ8qkNhpUf5KD0Al1KCBE3zaT7OLOwEkagXMEDij98SiOovn9wxVGQpklk9vVC/pUSqgYmkmKOS8g==", "peer": true }, "chalk": { @@ -6572,9 +6571,9 @@ } }, "electron-to-chromium": { - "version": "1.4.24", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.24.tgz", - "integrity": "sha512-erwx5r69B/WFfFuF2jcNN0817BfDBdC4765kQ6WltOMuwsimlQo3JTEq0Cle+wpHralwdeX3OfAtw/mHxPK0Wg==", + "version": "1.4.30", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.30.tgz", + "integrity": "sha512-609z9sIMxDHg+TcR/VB3MXwH+uwtrYyeAwWc/orhnr90ixs6WVGSrt85CDLGUdNnLqCA7liv426V20EecjvflQ==", "peer": true }, "emitter-listener": { @@ -7028,9 +7027,9 @@ } }, "istanbul-reports": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.1.tgz", - "integrity": "sha512-q1kvhAXWSsXfMjCdNHNPKZZv94OlspKnoGv+R9RGbnqOOQ0VbNfLFgQDVgi7hHenKsndGq3/o0OBdzDXthWcNw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz", + "integrity": "sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg==", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -8296,9 +8295,7 @@ "version": "1.1.9" }, "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "version": "5.1.2" }, "safer-buffer": { "version": "2.1.2" diff --git a/lib/utils/auth.js b/lib/utils/auth.js index 4aed61c..9728859 100644 --- a/lib/utils/auth.js +++ b/lib/utils/auth.js @@ -1,8 +1,6 @@ const secretKey = process.env.SECRETKEY const jwt = require("jsonwebtoken") const bcrypt = require("bcryptjs") -const fs = require("fs") -const path = require("path") const schedulableUrls = ["/convert/createVideo", "/convert/createZip", "/file/pathMetrics", "/file/pathDelete", "/file/pathClean"] @@ -32,27 +30,29 @@ module.exports = { } else method == "GET" ? res.redirect(303, "/?loginForm") : res.status(401).send({error: "unauthorized"}) }, - register: (input="", successCallback, errorCallback) => { + register: (input="", database, successCallback, errorCallback) => { if(input.length == 0){ - console.log("NO PASSWORD ENTERED, USING FILE") - fs.readFile(path.join(process.env.password_FILEPATH), {encoding:"utf8", flag:"r"}, (err, passwordFromFile) => { - if(!err){ - saltAndHash(passwordFromFile, successCallback, errorCallback) + database.query(`SELECT * FROM auth WHERE username = 'admin'`).then(values => { + if(values && values.rows && values.rows.length > 0){ + console.log('USING ALREADY EXISTING PASSWORD') + successCallback() } else{ - errorCallback(`NO PASSWORD FILE AT ${process.env.password_FILEPATH}`) + throw new Error(); } + }).catch(() => { + errorCallback('NO PASSWORD EXISTS, RERUN AND CREATE A PASSWORD') }) } else{ - saltAndHash(input, successCallback, errorCallback) + saltAndHash(input, database, successCallback, errorCallback) } }, schedulableUrls: schedulableUrls } -const saltAndHash = (password, successCallback, errorCallback) => { +const saltAndHash = (password, database, successCallback, errorCallback) => { if(process.env.PRINTPASSWORD === "true"){ console.log(`Password: ${password}`) console.log(`PIN: ${process.env.templink_PIN}`) @@ -61,15 +61,8 @@ const saltAndHash = (password, successCallback, errorCallback) => { if(!err){ bcrypt.hash(password, salt, (err, hash) => { if(!err){ - fs.writeFile(path.join(process.env.password_FILEPATH), hash, (err) => { - if(!err){ - successCallback() - } - else{ - - errorCallback(`NO PASSWORD FILE AT ${process.env.password_FILEPATH}`) - } - }) + database.query(`INSERT INTO auth(username, hash) VALUES('admin', '${hash}') ON CONFLICT (username) DO UPDATE SET hash = EXCLUDED.hash;`) + .then(successCallback).catch(errorCallback) } else{ errorCallback(`FAILED TO HASH PASSWORD`) diff --git a/livestream/npm-shrinkwrap.json b/livestream/npm-shrinkwrap.json index 67c2fd0..93016b5 100644 --- a/livestream/npm-shrinkwrap.json +++ b/livestream/npm-shrinkwrap.json @@ -1017,7 +1017,7 @@ } }, "../lib/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -1050,7 +1050,7 @@ } }, "../lib/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -1071,7 +1071,7 @@ } }, "../lib/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -1104,7 +1104,7 @@ "peer": true }, "../lib/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -1487,7 +1487,7 @@ } }, "../lib/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -1859,7 +1859,7 @@ } }, "../lib/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -2508,7 +2508,7 @@ } }, "../lib/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -5975,7 +5975,7 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -6008,7 +6008,7 @@ } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -6029,7 +6029,7 @@ } }, "node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -6073,7 +6073,7 @@ } }, "node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -6425,7 +6425,7 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -6724,7 +6724,7 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -7446,7 +7446,7 @@ "peer": true }, "node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -10016,7 +10016,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -10045,7 +10045,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -10063,7 +10063,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -10097,7 +10097,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -10331,7 +10331,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -10528,7 +10528,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emittery": { @@ -10969,7 +10969,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -12169,7 +12169,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -12198,7 +12198,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -12216,7 +12216,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -12243,7 +12243,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -12490,7 +12490,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -12733,7 +12733,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -13121,7 +13121,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -15462,7 +15462,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -15491,7 +15491,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -15509,7 +15509,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -15536,7 +15536,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -15783,7 +15783,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -16026,7 +16026,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -16414,7 +16414,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", diff --git a/livestream/package.json b/livestream/package.json index 2c07573..957084a 100644 --- a/livestream/package.json +++ b/livestream/package.json @@ -2,6 +2,7 @@ "name": "livestream", "main": "server.js", "scripts": { + "prestart": "cd .. && npm-run-all -s --npm-path npm prepare:env", "start": "node start.js", "test": "jest --verbose", "prunewrap": "npm shrinkwrap" diff --git a/memory/npm-shrinkwrap.json b/memory/npm-shrinkwrap.json index b1963fb..fdbc5fc 100644 --- a/memory/npm-shrinkwrap.json +++ b/memory/npm-shrinkwrap.json @@ -1011,7 +1011,7 @@ } }, "../lib/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -1044,7 +1044,7 @@ } }, "../lib/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -1065,7 +1065,7 @@ } }, "../lib/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -1098,7 +1098,7 @@ "peer": true }, "../lib/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -1481,7 +1481,7 @@ } }, "../lib/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -1853,7 +1853,7 @@ } }, "../lib/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -2502,7 +2502,7 @@ } }, "../lib/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -5890,7 +5890,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -5919,7 +5919,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -5937,7 +5937,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -5964,7 +5964,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -6211,7 +6211,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -6454,7 +6454,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -6842,7 +6842,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", diff --git a/memory/package.json b/memory/package.json index 78300b3..bba6ebb 100644 --- a/memory/package.json +++ b/memory/package.json @@ -2,6 +2,7 @@ "name": "memory", "main": "server.js", "scripts": { + "prestart": "cd .. && npm-run-all -s --npm-path npm prepare:env", "start": "node start.js", "test": "jest --verbose", "prunewrap": "npm shrinkwrap" diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index bd98c5d..c477750 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -18,6 +18,7 @@ "mkdirp": "^1.0.4", "npm-run-all": "^4.1.5", "object": "jjjpanda/object#v2.0.2", + "pg": "^8.7.1", "pm2": "^5.1.2", "rimraf": "^3.0.2", "schedule": "file:./schedule", @@ -65,6 +66,7 @@ "moment": "^2.29.1", "nanoid": "^3.1.30", "path-browserify": "^1.0.1", + "pg": "^8.7.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-hls-player": "^3.0.7", @@ -1181,7 +1183,7 @@ } }, "command/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -1271,7 +1273,7 @@ "license": "MIT" }, "command/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -1296,7 +1298,7 @@ "license": "MIT" }, "command/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT" }, "command/node_modules/@types/prettier": { @@ -1467,7 +1469,7 @@ } }, "command/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -2123,6 +2125,13 @@ "version": "1.1.2", "license": "MIT" }, + "command/node_modules/buffer-writer": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "command/node_modules/buffer-xor": { "version": "1.0.3", "license": "MIT" @@ -2158,7 +2167,7 @@ } }, "command/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "funding": { "type": "opencollective", @@ -2868,7 +2877,7 @@ "license": "MIT" }, "command/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC" }, "command/node_modules/elliptic": { @@ -4053,7 +4062,7 @@ } }, "command/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -6332,6 +6341,10 @@ "node": ">=6" } }, + "command/node_modules/packet-reader": { + "version": "1.0.0", + "license": "MIT" + }, "command/node_modules/param-case": { "version": "3.0.4", "license": "MIT", @@ -6425,6 +6438,73 @@ "version": "2.1.0", "license": "MIT" }, + "command/node_modules/pg": { + "version": "8.7.1", + "license": "MIT", + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "pg-native": ">=2.0.0" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "command/node_modules/pg-connection-string": { + "version": "2.5.0", + "license": "MIT" + }, + "command/node_modules/pg-int8": { + "version": "1.0.1", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "command/node_modules/pg-pool": { + "version": "3.4.1", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "command/node_modules/pg-protocol": { + "version": "1.5.0", + "license": "MIT" + }, + "command/node_modules/pg-types": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "command/node_modules/pgpass": { + "version": "1.0.5", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, "command/node_modules/picocolors": { "version": "1.0.0", "license": "ISC" @@ -6539,6 +6619,37 @@ "node": ">=0.10.0" } }, + "command/node_modules/postgres-array": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "command/node_modules/postgres-bytea": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "command/node_modules/postgres-date": { + "version": "1.0.7", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "command/node_modules/postgres-interval": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "command/node_modules/prelude-ls": { "version": "1.1.2", "peer": true, @@ -7554,6 +7665,13 @@ "node": ">=0.10.0" } }, + "command/node_modules/split2": { + "version": "4.1.0", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, "command/node_modules/sprintf-js": { "version": "1.0.3", "license": "BSD-3-Clause", @@ -8386,6 +8504,13 @@ "license": "MIT", "peer": true }, + "command/node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, "command/node_modules/y18n": { "version": "5.0.8", "license": "ISC", @@ -9290,7 +9415,7 @@ } }, "gateway/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -9330,7 +9455,7 @@ } }, "gateway/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -9394,7 +9519,7 @@ } }, "gateway/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -9738,7 +9863,7 @@ } }, "gateway/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -10033,7 +10158,7 @@ "license": "MIT" }, "gateway/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -10793,7 +10918,7 @@ "peer": true }, "gateway/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -13750,7 +13875,7 @@ } }, "lib/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -13783,7 +13908,7 @@ } }, "lib/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -13804,7 +13929,7 @@ } }, "lib/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -13837,7 +13962,7 @@ "peer": true }, "lib/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -14220,7 +14345,7 @@ } }, "lib/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -14592,7 +14717,7 @@ } }, "lib/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -15241,7 +15366,7 @@ } }, "lib/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -18438,7 +18563,7 @@ } }, "livestream/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -18471,7 +18596,7 @@ } }, "livestream/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -18492,7 +18617,7 @@ } }, "livestream/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -18536,7 +18661,7 @@ } }, "livestream/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -18887,7 +19012,7 @@ } }, "livestream/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -19186,7 +19311,7 @@ "license": "MIT" }, "livestream/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -19906,7 +20031,7 @@ "peer": true }, "livestream/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -23532,6 +23657,13 @@ "version": "1.1.2", "license": "MIT" }, + "node_modules/buffer-writer": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/bytes": { "version": "3.1.1", "license": "MIT", @@ -25705,6 +25837,10 @@ "node": ">= 8" } }, + "node_modules/packet-reader": { + "version": "1.0.0", + "license": "MIT" + }, "node_modules/pako": { "version": "0.2.9", "license": "MIT" @@ -25765,6 +25901,73 @@ "node": ">=4" } }, + "node_modules/pg": { + "version": "8.7.1", + "license": "MIT", + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "pg-native": ">=2.0.0" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-connection-string": { + "version": "2.5.0", + "license": "MIT" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.4.1", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.5.0", + "license": "MIT" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, "node_modules/phin": { "version": "2.9.3", "license": "MIT", @@ -26108,6 +26311,37 @@ "node": ">=4.0.0" } }, + "node_modules/postgres-array": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/prebuild-install": { "version": "6.1.4", "license": "MIT", @@ -26577,6 +26811,13 @@ "version": "3.0.11", "license": "CC0-1.0" }, + "node_modules/split2": { + "version": "4.1.0", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, "node_modules/sprintf-js": { "version": "1.1.2", "license": "BSD-3-Clause" @@ -27155,7 +27396,6 @@ "node_modules/xtend": { "version": "4.0.2", "license": "MIT", - "optional": true, "engines": { "node": ">=0.4" } @@ -28105,7 +28345,7 @@ } }, "schedule/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -28138,7 +28378,7 @@ } }, "schedule/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -28159,7 +28399,7 @@ } }, "schedule/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -28203,7 +28443,7 @@ } }, "schedule/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -28554,7 +28794,7 @@ } }, "schedule/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -28853,7 +29093,7 @@ "license": "MIT" }, "schedule/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -29573,7 +29813,7 @@ "peer": true }, "schedule/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -31578,6 +31818,7 @@ "memory": "file:../memory", "mkdirp": "^1.0.4", "moment": "^2.29.1", + "pg": "^8.7.1", "rimraf": "^3.0.2" }, "peerDependencies": { @@ -32431,7 +32672,7 @@ } }, "storage/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -32464,7 +32705,7 @@ } }, "storage/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -32485,7 +32726,7 @@ } }, "storage/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -32529,7 +32770,7 @@ } }, "storage/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -32923,6 +33164,13 @@ "license": "MIT", "peer": true }, + "storage/node_modules/buffer-writer": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "storage/node_modules/bytes": { "version": "3.1.1", "license": "MIT", @@ -32947,7 +33195,7 @@ } }, "storage/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -33336,7 +33584,7 @@ "license": "MIT" }, "storage/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -34060,7 +34308,7 @@ "peer": true }, "storage/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -35151,6 +35399,10 @@ "node": ">=6" } }, + "storage/node_modules/packet-reader": { + "version": "1.0.0", + "license": "MIT" + }, "storage/node_modules/parse5": { "version": "6.0.1", "license": "MIT", @@ -35195,6 +35447,73 @@ "version": "0.1.7", "license": "MIT" }, + "storage/node_modules/pg": { + "version": "8.7.1", + "license": "MIT", + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "pg-native": ">=2.0.0" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "storage/node_modules/pg-connection-string": { + "version": "2.5.0", + "license": "MIT" + }, + "storage/node_modules/pg-int8": { + "version": "1.0.1", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "storage/node_modules/pg-pool": { + "version": "3.4.1", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "storage/node_modules/pg-protocol": { + "version": "1.5.0", + "license": "MIT" + }, + "storage/node_modules/pg-types": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "storage/node_modules/pgpass": { + "version": "1.0.5", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, "storage/node_modules/picocolors": { "version": "1.0.0", "license": "ISC", @@ -35230,6 +35549,37 @@ "node": ">=8" } }, + "storage/node_modules/postgres-array": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "storage/node_modules/postgres-bytea": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "storage/node_modules/postgres-date": { + "version": "1.0.7", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "storage/node_modules/postgres-interval": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "storage/node_modules/prelude-ls": { "version": "1.1.2", "peer": true, @@ -35553,6 +35903,13 @@ "source-map": "^0.6.0" } }, + "storage/node_modules/split2": { + "version": "4.1.0", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, "storage/node_modules/sprintf-js": { "version": "1.0.3", "license": "BSD-3-Clause", @@ -36058,6 +36415,13 @@ "license": "MIT", "peer": true }, + "storage/node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, "storage/node_modules/y18n": { "version": "5.0.8", "license": "ISC", @@ -37027,6 +37391,9 @@ "buffer-from": { "version": "1.1.2" }, + "buffer-writer": { + "version": "2.0.0" + }, "bytes": { "version": "3.1.1" }, @@ -37169,6 +37536,7 @@ "moment": "^2.29.1", "nanoid": "^3.1.30", "path-browserify": "^1.0.1", + "pg": "^8.7.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-hls-player": "^3.0.7", @@ -37888,7 +38256,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -37964,7 +38332,7 @@ "version": "6.1.0" }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -37985,7 +38353,7 @@ "version": "7.0.9" }, "@types/node": { - "version": "17.0.0" + "version": "17.0.5" }, "@types/prettier": { "version": "2.4.2", @@ -38128,7 +38496,7 @@ } }, "acorn": { - "version": "8.6.0" + "version": "8.7.0" }, "acorn-globals": { "version": "6.0.0", @@ -38581,6 +38949,9 @@ "buffer-from": { "version": "1.1.2" }, + "buffer-writer": { + "version": "2.0.0" + }, "buffer-xor": { "version": "1.0.3" }, @@ -38602,7 +38973,7 @@ "version": "5.3.1" }, "caniuse-lite": { - "version": "1.0.30001291" + "version": "1.0.30001294" }, "chalk": { "version": "2.4.2", @@ -39087,7 +39458,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24" + "version": "1.4.30" }, "elliptic": { "version": "6.5.4", @@ -39827,7 +40198,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -41686,7 +42057,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -41715,7 +42086,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -41733,7 +42104,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -41760,7 +42131,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -42007,7 +42378,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -42250,7 +42621,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -42638,7 +43009,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -45044,7 +45415,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -45073,7 +45444,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -45091,7 +45462,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -45118,7 +45489,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -45365,7 +45736,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -45608,7 +45979,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -45996,7 +46367,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -47795,6 +48166,9 @@ "p-try": { "version": "2.2.0" }, + "packet-reader": { + "version": "1.0.0" + }, "param-case": { "version": "3.0.4", "requires": { @@ -47860,6 +48234,47 @@ "performance-now": { "version": "2.1.0" }, + "pg": { + "version": "8.7.1", + "requires": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + } + }, + "pg-connection-string": { + "version": "2.5.0" + }, + "pg-int8": { + "version": "1.0.1" + }, + "pg-pool": { + "version": "3.4.1", + "requires": {} + }, + "pg-protocol": { + "version": "1.5.0" + }, + "pg-types": { + "version": "2.2.0", + "requires": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + } + }, + "pgpass": { + "version": "1.0.5", + "requires": { + "split2": "^4.1.0" + } + }, "picocolors": { "version": "1.0.0" }, @@ -47929,6 +48344,21 @@ "postcss-value-parser": { "version": "4.2.0" }, + "postgres-array": { + "version": "2.0.0" + }, + "postgres-bytea": { + "version": "1.0.0" + }, + "postgres-date": { + "version": "1.0.7" + }, + "postgres-interval": { + "version": "1.2.0", + "requires": { + "xtend": "^4.0.0" + } + }, "prelude-ls": { "version": "1.1.2", "peer": true @@ -48723,6 +49153,9 @@ } } }, + "split2": { + "version": "4.1.0" + }, "sprintf-js": { "version": "1.0.3", "peer": true @@ -49224,6 +49657,9 @@ "version": "2.2.0", "peer": true }, + "xtend": { + "version": "4.0.2" + }, "y18n": { "version": "5.0.8", "peer": true @@ -50261,7 +50697,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -50296,7 +50732,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -50347,7 +50783,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -50573,7 +51009,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -50669,6 +51105,7 @@ "moment": "^2.29.1", "nanoid": "^3.1.30", "path-browserify": "^1.0.1", + "pg": "^8.7.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-hls-player": "^3.0.7", @@ -51388,7 +51825,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -51464,7 +51901,7 @@ "version": "6.1.0" }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -51485,7 +51922,7 @@ "version": "7.0.9" }, "@types/node": { - "version": "17.0.0" + "version": "17.0.5" }, "@types/prettier": { "version": "2.4.2", @@ -51628,7 +52065,7 @@ } }, "acorn": { - "version": "8.6.0" + "version": "8.7.0" }, "acorn-globals": { "version": "6.0.0", @@ -52081,6 +52518,9 @@ "buffer-from": { "version": "1.1.2" }, + "buffer-writer": { + "version": "2.0.0" + }, "buffer-xor": { "version": "1.0.3" }, @@ -52102,7 +52542,7 @@ "version": "5.3.1" }, "caniuse-lite": { - "version": "1.0.30001291" + "version": "1.0.30001294" }, "chalk": { "version": "2.4.2", @@ -52587,7 +53027,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24" + "version": "1.4.30" }, "elliptic": { "version": "6.5.4", @@ -53327,7 +53767,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -55186,7 +55626,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -55215,7 +55655,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -55233,7 +55673,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -55260,7 +55700,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -55507,7 +55947,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -55750,7 +56190,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -56138,7 +56578,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -58544,7 +58984,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -58573,7 +59013,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -58591,7 +59031,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -58618,7 +59058,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -58865,7 +59305,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -59108,7 +59548,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -59496,7 +59936,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -61295,6 +61735,9 @@ "p-try": { "version": "2.2.0" }, + "packet-reader": { + "version": "1.0.0" + }, "param-case": { "version": "3.0.4", "requires": { @@ -61360,6 +61803,47 @@ "performance-now": { "version": "2.1.0" }, + "pg": { + "version": "8.7.1", + "requires": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + } + }, + "pg-connection-string": { + "version": "2.5.0" + }, + "pg-int8": { + "version": "1.0.1" + }, + "pg-pool": { + "version": "3.4.1", + "requires": {} + }, + "pg-protocol": { + "version": "1.5.0" + }, + "pg-types": { + "version": "2.2.0", + "requires": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + } + }, + "pgpass": { + "version": "1.0.5", + "requires": { + "split2": "^4.1.0" + } + }, "picocolors": { "version": "1.0.0" }, @@ -61429,6 +61913,21 @@ "postcss-value-parser": { "version": "4.2.0" }, + "postgres-array": { + "version": "2.0.0" + }, + "postgres-bytea": { + "version": "1.0.0" + }, + "postgres-date": { + "version": "1.0.7" + }, + "postgres-interval": { + "version": "1.2.0", + "requires": { + "xtend": "^4.0.0" + } + }, "prelude-ls": { "version": "1.1.2", "peer": true @@ -62223,6 +62722,9 @@ } } }, + "split2": { + "version": "4.1.0" + }, "sprintf-js": { "version": "1.0.3", "peer": true @@ -62724,6 +63226,9 @@ "version": "2.2.0", "peer": true }, + "xtend": { + "version": "4.0.2" + }, "y18n": { "version": "5.0.8", "peer": true @@ -62892,7 +63397,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emittery": { @@ -63353,7 +63858,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -64553,7 +65058,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -64582,7 +65087,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -64600,7 +65105,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -64627,7 +65132,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -64874,7 +65379,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -65117,7 +65622,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -65505,7 +66010,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -68844,7 +69349,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -68873,7 +69378,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -68891,7 +69396,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -68918,7 +69423,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -69165,7 +69670,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -69408,7 +69913,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -69796,7 +70301,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -71902,7 +72407,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -71931,7 +72436,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -71949,7 +72454,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -71983,7 +72488,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -72215,7 +72720,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -72412,7 +72917,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emittery": { @@ -72850,7 +73355,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -74050,7 +74555,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -74079,7 +74584,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -74097,7 +74602,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -74124,7 +74629,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -74371,7 +74876,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -74614,7 +75119,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -75002,7 +75507,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -77343,7 +77848,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -77372,7 +77877,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -77390,7 +77895,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -77417,7 +77922,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -77664,7 +78169,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -77907,7 +78412,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -78295,7 +78800,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -81486,7 +81991,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -81515,7 +82020,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -81533,7 +82038,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -81560,7 +82065,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -81807,7 +82312,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -82050,7 +82555,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -82438,7 +82943,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -84449,6 +84954,9 @@ "netmask": "^2.0.1" } }, + "packet-reader": { + "version": "1.0.0" + }, "pako": { "version": "0.2.9" }, @@ -84491,6 +84999,47 @@ "pify": "^3.0.0" } }, + "pg": { + "version": "8.7.1", + "requires": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + } + }, + "pg-connection-string": { + "version": "2.5.0" + }, + "pg-int8": { + "version": "1.0.1" + }, + "pg-pool": { + "version": "3.4.1", + "requires": {} + }, + "pg-protocol": { + "version": "1.5.0" + }, + "pg-types": { + "version": "2.2.0", + "requires": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + } + }, + "pgpass": { + "version": "1.0.5", + "requires": { + "split2": "^4.1.0" + } + }, "phin": { "version": "2.9.3", "optional": true @@ -84715,6 +85264,21 @@ "version": "3.4.0", "optional": true }, + "postgres-array": { + "version": "2.0.0" + }, + "postgres-bytea": { + "version": "1.0.0" + }, + "postgres-date": { + "version": "1.0.7" + }, + "postgres-interval": { + "version": "1.2.0", + "requires": { + "xtend": "^4.0.0" + } + }, "prebuild-install": { "version": "6.1.4", "optional": true, @@ -85488,7 +86052,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -85517,7 +86081,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -85535,7 +86099,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -85569,7 +86133,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -85801,7 +86365,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -85998,7 +86562,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emittery": { @@ -86436,7 +87000,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -87636,7 +88200,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -87665,7 +88229,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -87683,7 +88247,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -87710,7 +88274,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -87957,7 +88521,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -88200,7 +88764,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -88588,7 +89152,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -90929,7 +91493,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -90958,7 +91522,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -90976,7 +91540,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -91003,7 +91567,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -91250,7 +91814,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -91493,7 +92057,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -91881,7 +92445,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -94328,6 +94892,9 @@ "spdx-license-ids": { "version": "3.0.11" }, + "split2": { + "version": "4.1.0" + }, "sprintf-js": { "version": "1.1.2" }, @@ -94349,6 +94916,7 @@ "memory": "file:../memory", "mkdirp": "^1.0.4", "moment": "^2.29.1", + "pg": "^8.7.1", "rimraf": "^3.0.2" }, "dependencies": { @@ -94924,7 +95492,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -94953,7 +95521,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -94971,7 +95539,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -95005,7 +95573,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -95278,6 +95846,9 @@ "version": "1.1.2", "peer": true }, + "buffer-writer": { + "version": "2.0.0" + }, "bytes": { "version": "3.1.1" }, @@ -95290,7 +95861,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -95553,7 +96124,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emittery": { @@ -95991,7 +96562,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -97220,7 +97791,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -97249,7 +97820,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -97267,7 +97838,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -97294,7 +97865,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -97541,7 +98112,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -97784,7 +98355,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -98172,7 +98743,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -100528,7 +101099,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -100557,7 +101128,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -100575,7 +101146,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -100602,7 +101173,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -100849,7 +101420,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -101092,7 +101663,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -101480,7 +102051,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -103230,6 +103801,9 @@ "version": "2.2.0", "peer": true }, + "packet-reader": { + "version": "1.0.0" + }, "parse5": { "version": "6.0.1", "peer": true @@ -103255,6 +103829,47 @@ "path-to-regexp": { "version": "0.1.7" }, + "pg": { + "version": "8.7.1", + "requires": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + } + }, + "pg-connection-string": { + "version": "2.5.0" + }, + "pg-int8": { + "version": "1.0.1" + }, + "pg-pool": { + "version": "3.4.1", + "requires": {} + }, + "pg-protocol": { + "version": "1.5.0" + }, + "pg-types": { + "version": "2.2.0", + "requires": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + } + }, + "pgpass": { + "version": "1.0.5", + "requires": { + "split2": "^4.1.0" + } + }, "picocolors": { "version": "1.0.0", "peer": true @@ -103274,6 +103889,21 @@ "find-up": "^4.0.0" } }, + "postgres-array": { + "version": "2.0.0" + }, + "postgres-bytea": { + "version": "1.0.0" + }, + "postgres-date": { + "version": "1.0.7" + }, + "postgres-interval": { + "version": "1.2.0", + "requires": { + "xtend": "^4.0.0" + } + }, "prelude-ls": { "version": "1.1.2", "peer": true @@ -103467,6 +104097,9 @@ "source-map": "^0.6.0" } }, + "split2": { + "version": "4.1.0" + }, "sprintf-js": { "version": "1.0.3", "peer": true @@ -103785,6 +104418,9 @@ "version": "2.2.0", "peer": true }, + "xtend": { + "version": "4.0.2" + }, "y18n": { "version": "5.0.8", "peer": true @@ -104168,8 +104804,7 @@ "version": "2.0.0" }, "xtend": { - "version": "4.0.2", - "optional": true + "version": "4.0.2" }, "y18n": { "version": "5.0.8", diff --git a/package.json b/package.json index 4f16bfa..39b0c35 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,12 @@ "scripts": { "build": "cd command && npm run build", "buildCont": "cd command && npm run buildCont", - "prestart": "npm-run-all -s --npm-path npm register \"validate:*\"", + "prestart": "npm-run-all -s --npm-path npm \"prepare:*\"", "start": "pm2 start pm2.config.js", - "register": "node chimera/register.js", - "validate:env": "node chimera/splitAndValidateEnvVars.js", - "validate:pass": "node chimera/generateEmptyPassFile.js", - "validate:acme": "mkdirp ./.well-known/acme-challenge", + "prepare:acme": "mkdirp ./.well-known/acme-challenge", + "prepare:env": "node chimera/splitAndValidateEnvVars.js", + "prepare:database": "node chimera/prepareDatabase.js", + "prepare:auth": "node chimera/register.js", "start:command": "cd command && npm start", "start:livestream": "cd livestream && npm start", "start:schedule": "cd schedule && npm start", @@ -72,6 +72,7 @@ "mkdirp": "^1.0.4", "npm-run-all": "^4.1.5", "object": "jjjpanda/object#v2.0.2", + "pg": "^8.7.1", "pm2": "^5.1.2", "rimraf": "^3.0.2", "schedule": "file:./schedule", diff --git a/schedule/npm-shrinkwrap.json b/schedule/npm-shrinkwrap.json index 4bdf96e..07bd53f 100644 --- a/schedule/npm-shrinkwrap.json +++ b/schedule/npm-shrinkwrap.json @@ -1020,7 +1020,7 @@ } }, "../lib/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -1053,7 +1053,7 @@ } }, "../lib/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -1074,7 +1074,7 @@ } }, "../lib/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -1107,7 +1107,7 @@ "peer": true }, "../lib/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -1490,7 +1490,7 @@ } }, "../lib/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -1862,7 +1862,7 @@ } }, "../lib/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -2511,7 +2511,7 @@ } }, "../lib/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -5978,7 +5978,7 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -6011,7 +6011,7 @@ } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -6032,7 +6032,7 @@ } }, "node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -6076,7 +6076,7 @@ } }, "node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -6427,7 +6427,7 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -6726,7 +6726,7 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -7447,7 +7447,7 @@ "peer": true }, "node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -10014,7 +10014,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -10043,7 +10043,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -10061,7 +10061,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -10095,7 +10095,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -10327,7 +10327,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -10524,7 +10524,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emittery": { @@ -10963,7 +10963,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -12163,7 +12163,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -12192,7 +12192,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -12210,7 +12210,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -12237,7 +12237,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -12484,7 +12484,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -12727,7 +12727,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -13115,7 +13115,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -15456,7 +15456,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -15485,7 +15485,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -15503,7 +15503,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -15530,7 +15530,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -15777,7 +15777,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -16020,7 +16020,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -16408,7 +16408,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", diff --git a/schedule/package.json b/schedule/package.json index b38bc01..b70036a 100644 --- a/schedule/package.json +++ b/schedule/package.json @@ -2,6 +2,7 @@ "name": "schedule", "main": "server.js", "scripts": { + "prestart": "cd .. && npm-run-all -s --npm-path npm prepare:env", "start": "node start.js", "test": "jest --verbose", "prunewrap": "npm shrinkwrap" diff --git a/storage/README.md b/storage/README.md index 4f0e194..16c1589 100644 --- a/storage/README.md +++ b/storage/README.md @@ -8,14 +8,15 @@ The storage server is the heartbeat of Chimera. It handles 4 main sections regar Because storage requires files generated by [motion](https://github.com/Motion-Project/motion), it's best to have storage running on same machine with motion. (Although theoretically you could use a network drive, but dubious performance would ensue.) -Motion config should save pictures from RTSP camera and have: +Motion config should save pictures from RTSP camera and have *at the very least*: ``` picture_type jpeg picture_filename %t/%Y%m%d-%H%M%S-%q +on_picture_save psql -c "COPY frame_files(timestamp, camera, name, size) FROM PROGRAM 'echo %Y-%m-%d %T,%t,%Y%m%d-%H%M%S-%q.jpg,$(wc -c %f | head -n1 | awk '{print $1;}')' WITH DELIMITER ',';" ``` -The rest of the config in terms of [motion](https://github.com/Motion-Project/motion) is pretty much irrelevant. +The rest of the config in terms of [motion](https://github.com/Motion-Project/motion) is up to you and your security needs. [ffmpeg](https://ffmpeg.org) is also required for generating videos. diff --git a/storage/backend/routes/file.js b/storage/backend/routes/file.js index 1a2d45d..1e3ebb7 100644 --- a/storage/backend/routes/file.js +++ b/storage/backend/routes/file.js @@ -4,23 +4,22 @@ var {validateBody} = require("lib") const app = express.Router() const { - validateCameraAndAppendToPath, - directoryList, - deleteFileDirectory, - validateDays, - filterList, + validateCameraAndAppendToPath, + validateDays, + getCameraMetricFromDatabase, + updateDeletionOfFiles, + deleteFileDirectory, + deleteFilesBeforeDateGlob, fileStats, - getCachedFileData, - deleteFilesBeforeDateGlob, -} = require("./lib/file.js") + cameraMetrics +} = require('./lib/file.js'); -app.get("/pathStats", fileStats) - -app.post("/pathSize", validateBody, validateCameraAndAppendToPath, getCachedFileData("size")) -app.post("/pathFileCount", validateBody, validateCameraAndAppendToPath, getCachedFileData("count")) -app.post("/pathDelete", validateBody, validateCameraAndAppendToPath, deleteFileDirectory) -app.post("/pathClean", validateBody, validateCameraAndAppendToPath, validateDays, directoryList, filterList("before"), deleteFilesBeforeDateGlob) +app.post("/pathSize", validateBody, validateCameraAndAppendToPath, getCameraMetricFromDatabase('size')) +app.post("/pathFileCount", validateBody, validateCameraAndAppendToPath, getCameraMetricFromDatabase('count')) +app.post("/pathDelete", validateBody, validateCameraAndAppendToPath, updateDeletionOfFiles('directory'), deleteFileDirectory) +app.post("/pathClean", validateBody, validateCameraAndAppendToPath, validateDays, updateDeletionOfFiles('files'), deleteFilesBeforeDateGlob) -app.post("/pathMetrics", getCachedFileData("all")) +app.get("/pathStats", fileStats) +app.post("/pathMetrics", cameraMetrics) module.exports = app \ No newline at end of file diff --git a/storage/backend/routes/lib/deprecated-file.js b/storage/backend/routes/lib/deprecated-file.js new file mode 100644 index 0000000..e579b1a --- /dev/null +++ b/storage/backend/routes/lib/deprecated-file.js @@ -0,0 +1,335 @@ +const path = require("path") +const fs = require("fs") +const rimraf = require("rimraf") +const moment = require("moment") +const mkdirp = require("mkdirp") +const { formatBytes, jsonFileHanding, isPrimeInstance } = require("lib") +const {readJSON, writeJSON} = jsonFileHanding + +const pathToAdditionStatsJSON = path.join(process.env.storage_FOLDERPATH, "./shared/additionStats.json") +const pathToDeletionStatsJSON = path.join(process.env.storage_FOLDERPATH, "./shared/deletionStats.json") +const pathToCumulativeStatsJSON = path.join(process.env.storage_FOLDERPATH, "./shared/cumulativeStats.json") +const cronMinutes = process.env.storage_fileStatsUpdateTime + +module.exports = { + summaryMetricsDirectoryList: (req, res, next) => { + req.body.appendedPath = path.join(process.env.storage_FOLDERPATH, "./shared/captures/") + let fileLists = {} + JSON.parse(process.env.cameras).map((name, index) => { + const camera = index + 1 + listFilesInDirectory( path.join(req.body.appendedPath, camera.toString()) ).then((fileList) => { + fileLists[camera] = fileList + }) + }) + req.body.directoryLists = fileLists + next() + }, + + summaryMetrics: (req, res) => { + let metricsObj = createTimestampedStatObject() + Promise.all(promiseMetricTasks(metricsObj)).then(() => { + res.send(metricsObj) + }, () => { + res.send({error: true}) + }) + }, + + directoryList: (req, res, next) => { + listFilesInDirectory(req.body.appendedPath).then((fileList) => { + req.body.directoryList = fileList + next() + }) + }, + + fileSize: (req, res) => { + const list = req.body.directoryList + getDirectorySize(list).then(({size, confidence, bytes}) => { + res.send({size, confidence, bytes}) + }) + }, + + fileCount: (req, res) => { + res.send({count: req.body.directoryList.length}) + }, + + getCachedFileData: (metric) => (req, res) => { + const cameras = JSON.parse(process.env.cameras) + const {camera} = req.body + readJSON(pathToCumulativeStatsJSON, (err, data) => { + if(metric === "all"){ + res.send(data) + } + else if(metric in data){ + res.send({[metric]: data[metric][cameras[camera-1]]}) + } + else{ + res.send({error: true}) + } + }, (err) => { + console.log("get cached file data", err) + res.send({error: true}) + }) + }, + + fileStats: (req, res) => { + res.redirect(303, "/shared/additionStats.json") + }, + + + filterList: (timeCheck) => (req, res, next) => { + const list = req.body.directoryList + const checkDate = moment().subtract(req.body.days, "days") + req.body.directoryListBeforeFilter = req.body.directoryList + req.body.directoryList = filterFilesByTime(list, checkDate, timeCheck) + next() + }, + + deleteFileList: (req, res) => { + const list = req.body.directoryList + if(list.length > 0){ + deleteFiles(list).then((stats) => { + res.send({deleted: list.length > 0, confidence: stats.successful}) + }) + } + else{ + res.send({error: true}) + } + }, +} + +const listFilesInDirectory = (pathToDir) => { + return new Promise((resolve) => fs.readdir(pathToDir, (err, files) => { + let list = [] + if(!err) { + list = files.map(file => path.join(pathToDir, file)) + } + resolve(list) + })) +} + +const updateCacheAfterDeletion = (res, cacheUpdatingFunction, percentageDeleted, cameraIndex) => { + Promise.all(deletionReadPromises()).then(([deletionData, cumulativeData]) => { + const {newDeletionData, newCumulativeData} = cacheUpdatingFunction(deletionData, cumulativeData, percentageDeleted, cameraIndex) + Promise.all(deletionWritePromises(newDeletionData, newCumulativeData)).then(() => { + res.send({deleted: true}) + }, (err) => { + res.send({deleted: true, msg: "JSON write failed"}) + }) + }, (err) => { + console.log("update cache", err) + res.send({deleted: true, msg: "JSON read failed"}) + }) +} + +const deleteStatsObjHandler = (deletionData, cumulativeData, percentageDeleted, cameraIndex) => { + const cameras = JSON.parse(process.env.cameras) + const deletionObj = {timestamp: moment().format("x"), camera: cameraIndex+1} + for(const metric in cumulativeData){ + const metricDeleted = Math.round(parseInt(cumulativeData[metric][cameras[cameraIndex]]) * percentageDeleted) + deletionObj[metric] = metricDeleted + cumulativeData[metric][cameras[cameraIndex]] = cumulativeData[metric][cameras[cameraIndex]] - metricDeleted + } + if("deletions" in deletionData){ + deletionData.deletions.push(deletionObj) + } + else{ + deletionData.deletions = [deletionObj] + } + return {newDeletionData: deletionData, newCumulativeData: cumulativeData} +} + +const deletionReadPromises = () => [pathToDeletionStatsJSON, pathToCumulativeStatsJSON].map(pathToStats => new Promise((resolve, reject) => { + readJSON(pathToStats, (err, data) => { + if(!err){ + resolve(data) + } + else{ + reject(err) + } + }) +})) + +const deletionWritePromises = (deletionData, cumulativeData) => { + return [{pathToStats: pathToDeletionStatsJSON, data: deletionData}, + {pathToStats: pathToCumulativeStatsJSON, data: cumulativeData}].map(({pathToStats, data}) => new Promise((resolve, reject) => { + writeJSON(pathToStats, data, (err) => { + if(!err){ + resolve() + } + else{ + reject(err) + } + }) + })) +} + +const getDirectorySize = (fileList) => { + return Promise.all(fileList.map(file => { + return new Promise((resolve) => { + fs.stat(file, (err, stats) => { + if(!err){ + resolve({size: stats.size, counted: true}) + } + else{ + resolve({size: 0, counted: false}) + } + }) + }) + })).then((reasons) => { + let size = 0 + let numberOfFilesCounted = 0 + reasons.forEach((reason) => { + size+=reason.size + numberOfFilesCounted+=reason.counted ? 1 : 0 + }) + return { + size: formatBytes(size), + confidence: 100*numberOfFilesCounted/fileList.length, + bytes: size + } + }) +} + +const deleteFiles = (fileList) => { + return Promise.all(fileList.map(file => + new Promise((resolve) => { + fs.unlink(file, (err) => { + if (!err) { + resolve(1) + } + else{ + resolve(0) + } + }) + }) + )).then((reasons) => { + let numberOfFilesDeleted = 0 + reasons.forEach((reason) => { + numberOfFilesDeleted+=reason + }) + return {successful: 100*numberOfFilesDeleted/fileList.length} + }) +} + +const filterFilesByTime = (fileList, checkDate, timeCheck="before") => { + return fileList.filter(timeCheck == "before" ? filterFileCreatedBefore(checkDate) : filterFileCreatedAfter(checkDate)) +} + +const filterFileCreatedBefore = (checkDate) => (file) => { + const fileName = path.parse(path.basename(file)).name + return moment(fileName, require("./dateFormat.js")).isBefore(checkDate) +} + +const filterFileCreatedAfter = (checkDate) => (file) => { + const fileName = path.parse(path.basename(file)).name + return moment(fileName, require("./dateFormat.js")).isAfter(checkDate) +} + +const createStatsJSON = (filePath) => { + readJSON(filePath, (err, data) => { + if(err){ + writeJSON(filePath, {}, ()=>{}, (err) => { + console.log("creation JSON write", err) + }) + } + }) +} + +const createTimestampedStatObject = () => { + const timestamp = moment().format("x") + let stats = { count: {timestamp}, size: {timestamp} } + JSON.parse(process.env.cameras).forEach((name) => { + stats.count[`${name}`] = 0 + stats.size[`${name}`] = 0 + }) + return stats +} + +const promiseMetricTasks = (statsObj, cronMinutes=undefined) => JSON.parse(process.env.cameras).map((name, i) => { + const camera = i+1 + return {name, pathToDir: path.join(process.env.storage_FOLDERPATH, "./shared/captures/", camera.toString())} +}).reduce(function (accumulator, {name, pathToDir}) { + return accumulator.concat([ + new Promise(resolve => { + listFilesInDirectory(pathToDir).then((fileList) => { + let filteredFileList = fileList + if(cronMinutes){ + filteredFileList = filterFilesByTime(filteredFileList, moment(statsObj.count.timestamp, "x").subtract(cronMinutes, "minutes"), "after") + filteredFileList = filterFilesByTime(filteredFileList, moment(statsObj.count.timestamp, "x"), "before") + } + statsObj.count[`${name}`] = filteredFileList.length + resolve() + }) + }), + new Promise((resolve, reject) => { + listFilesInDirectory(pathToDir).then((fileList) => { + let filteredFileList = fileList + if(cronMinutes){ + filteredFileList = filterFilesByTime(filteredFileList, moment(statsObj.count.timestamp, "x").subtract(cronMinutes, "minutes"), "after") + filteredFileList = filterFilesByTime(filteredFileList, moment(statsObj.count.timestamp, "x"), "before") + } + getDirectorySize(filteredFileList).then(({bytes}) => { + statsObj.size[`${name}`] = bytes + resolve() + }, () => { + reject() + }) + }) + }) + ]) +}, []) + +const cronTask = () => { + console.log("SCHEDULED FILE STATS") + let currentStats = createTimestampedStatObject() + Promise.all(promiseMetricTasks(currentStats, cronMinutes)).then(() => { + readJSON(pathToAdditionStatsJSON, (err, data) => { + for(const metric in currentStats){ + if(!(metric in data)){ + data[metric] = [] + } + data[metric].push(currentStats[metric]) + } + writeJSON(pathToAdditionStatsJSON, data, (err) => { + if(err){ + console.log("\twriting file stats to addition JSON | Error:", err) + } + }) + }) + readJSON(pathToCumulativeStatsJSON, (err, data) => { + for(const metric in currentStats){ + if(!(metric in data)){ + data[metric] = {} + } + for(const camera of JSON.parse(process.env.cameras)){ + if(data[metric][camera] != undefined){ + data[metric][camera] += currentStats[metric][camera] + } + else{ + data[metric][camera] = currentStats[metric][camera] + } + } + } + writeJSON(pathToCumulativeStatsJSON, data, (err) => { + if(err){ + console.log("\twriting file stats to cumulative JSON | Error:", err) + } + }) + }) + }, (err) => { + console.log("\tcouldn't write file stats to JSONs | Error:", err) + }) +} + +const cronString = `*/${cronMinutes} * * * *` + +if(isPrimeInstance){ + const client = require("memory").client("FILE STATS") + mkdirp(path.join(process.env.storage_FOLDERPATH, "./shared")).then(() => { + createStatsJSON(pathToAdditionStatsJSON) + createStatsJSON(pathToDeletionStatsJSON) + createStatsJSON(pathToCumulativeStatsJSON) + }) + client.on("file-stats-update", cronTask) + client.emit("cron", cronString, "file-stats-update") +} \ No newline at end of file diff --git a/storage/backend/routes/lib/file.js b/storage/backend/routes/lib/file.js index 48cfb9b..675507b 100644 --- a/storage/backend/routes/lib/file.js +++ b/storage/backend/routes/lib/file.js @@ -1,18 +1,18 @@ const path = require("path") -const fs = require("fs") const rimraf = require("rimraf") const moment = require("moment") -const mkdirp = require("mkdirp") -const { formatBytes, jsonFileHanding, isPrimeInstance } = require("lib") -const {readJSON, writeJSON} = jsonFileHanding -const pathToAdditionStatsJSON = path.join(process.env.storage_FOLDERPATH, "./shared/additionStats.json") -const pathToDeletionStatsJSON = path.join(process.env.storage_FOLDERPATH, "./shared/deletionStats.json") -const pathToCumulativeStatsJSON = path.join(process.env.storage_FOLDERPATH, "./shared/cumulativeStats.json") -const cronMinutes = process.env.storage_fileStatsUpdateTime +const Pool = require('pg').Pool +const pool = new Pool({ + user: process.env.database_USER, + host: process.env.database_HOST, + database: process.env.database_NAME, + password: process.env.database_PASSWORD, + port: process.env.database_PORT, +}) module.exports = { - validateCameraAndAppendToPath: (req, res, next) => { + validateCameraAndAppendToPath: (req, res, next) => { const {camera} = req.body if(parseInt(camera) == camera){ req.body.appendedPath = path.join(process.env.storage_FOLDERPATH, "./shared/captures/", camera.toString()) @@ -23,29 +23,7 @@ module.exports = { } }, - summaryMetricsDirectoryList: (req, res, next) => { - req.body.appendedPath = path.join(process.env.storage_FOLDERPATH, "./shared/captures/") - let fileLists = {} - JSON.parse(process.env.cameras).map((name, index) => { - const camera = index + 1 - listFilesInDirectory( path.join(req.body.appendedPath, camera.toString()) ).then((fileList) => { - fileLists[camera] = fileList - }) - }) - req.body.directoryLists = fileLists - next() - }, - - summaryMetrics: (req, res) => { - let metricsObj = createTimestampedStatObject() - Promise.all(promiseMetricTasks(metricsObj)).then(() => { - res.send(metricsObj) - }, () => { - res.send({error: true}) - }) - }, - - validateDays: (req, res, next) => { + validateDays: (req, res, next) => { const {days} = req.body if(days != null){ next() @@ -54,169 +32,139 @@ module.exports = { res.send({error: "number of days not provided"}) } }, - - directoryList: (req, res, next) => { - listFilesInDirectory(req.body.appendedPath).then((fileList) => { - req.body.directoryList = fileList - next() - }) - }, - - fileSize: (req, res) => { - const list = req.body.directoryList - getDirectorySize(list).then(({size, confidence, bytes}) => { - res.send({size, confidence, bytes}) - }) - }, - - fileCount: (req, res) => { - res.send({count: req.body.directoryList.length}) - }, - getCachedFileData: (metric) => (req, res) => { - const cameras = JSON.parse(process.env.cameras) + getCameraMetricFromDatabase: (metric) => (req, res) => { const {camera} = req.body - readJSON(pathToCumulativeStatsJSON, (err, data) => { - if(metric === "all"){ - res.send(data) - } - else if(metric in data){ - res.send({[metric]: data[metric][cameras[camera-1]]}) - } - else{ - res.send({error: true}) - } - }, (err) => { - console.log("get cached file data", err) - res.send({error: true}) - }) + queryForMetric(camera, metric) + .then(extractValueForMetric(metric)) + .then(extractedValue => { + res.send({[metric]: extractedValue}) + }) + .catch(err => { + res.status(400).send({error: true}) + }) }, - fileStats: (req, res) => { - res.redirect(303, "/shared/additionStats.json") - }, - - deleteFileDirectory: (req, res) => { - const {camera} = req.body + updateDeletionOfFiles: (filesOrDirectory) => (req, res, next) => { + const {camera} = req.body + let beforeDate = "" + if(filesOrDirectory == "files"){ + let {days} = req.body + beforeDate = moment().subtract(days, "days").format('YYYY-MM-DD HH:mm:ss'); + } + queryToUpdateDatabaseForDeletion(camera, filesOrDirectory, beforeDate).then(deletedValues => { + const sumSize = deletedValues.rows.reduce((sum, row) => { + return sum + parseInt(row.size) + }, 0); + return queryToAddToDeletionsTable(camera, sumSize, deletedValues.rows.length) + .then(insertedValues => { + req.numberOfFilesDeletedInDatabase = deletedValues.rows.length + next() + }) + }).catch(err => { + console.log(err) + }) + }, + + deleteFileDirectory: (req, res) => { rimraf(req.body.appendedPath, (err) => { - if(err){ - res.send({deleted: false, msg: "delete failed"}) - } - else{ - updateCacheAfterDeletion(res, deleteStatsObjHandler, 1, camera-1) - } + res.send({deleted: !err && req.numberOfFilesDeletedInDatabase > 0}) }) }, - filterList: (timeCheck) => (req, res, next) => { - const list = req.body.directoryList - const checkDate = moment().subtract(req.body.days, "days") - req.body.directoryListBeforeFilter = req.body.directoryList - req.body.directoryList = filterFilesByTime(list, checkDate, timeCheck) - next() - }, - - deleteFileList: (req, res) => { - const list = req.body.directoryList - if(list.length > 0){ - deleteFiles(list).then((stats) => { - res.send({deleted: list.length > 0, confidence: stats.successful}) - }) - } - else{ - res.send({error: true}) - } - }, - - deleteFilesBeforeDateGlob: (req, res) => { - const {days, camera} = req.body + deleteFilesBeforeDateGlob: (req, res) => { + const {days} = req.body const now = moment() const beforeDate = moment().subtract(days, "days") const clobArr = generateBeforeDateGlobNotPatternsArray(now, beforeDate) - if(clobArr.length == 0){ + if(clobArr.length == 0 || req.numberOfFilesDeletedInDatabase == 0){ res.send({deleted: false}) } else{ const glob = `./!(${clobArr.join("|")})*.jpg` - const percentageDeleted = req.body.directoryList.length/req.body.directoryListBeforeFilter.length rimraf(path.join(req.body.appendedPath, glob), (err) => { - if(err){ - res.send({deleted: false}) - } - else{ - updateCacheAfterDeletion(res, deleteStatsObjHandler, percentageDeleted, camera-1) - } + res.send({deleted: !err}) }) } - } -} + }, -const listFilesInDirectory = (pathToDir) => { - return new Promise((resolve) => fs.readdir(pathToDir, (err, files) => { - let list = [] - if(!err) { - list = files.map(file => path.join(pathToDir, file)) - } - resolve(list) - })) + fileStats: (req, res) => { + const cameras = JSON.parse(process.env.cameras) + Promise.all(cameras.map((camera, index) => { + return queryForGroupedStats(index+1) + })).then(values => { + let stats = {} + cameras.forEach((camera, index) => { + stats[camera] = values[index].rows + }) + res.send(stats) + }).catch(err => { + console.log("err", err) + }) + }, + + cameraMetrics: (req, res) => { + const cameras = JSON.parse(process.env.cameras) + + const sizePromises = Promise.all(cameras.map((camera, index) => { + return queryForMetric(index+1, "size").then(extractValueForMetric("size")) + })); + + const countPromises = Promise.all(cameras.map((camera, index) => { + return queryForMetric(index+1, "count").then(extractValueForMetric("count")) + })); + + Promise.all([sizePromises, countPromises]).then(values => { + let sizes = values[0] + let counts = values[1] + let metrics = { size: {}, count: {} } + cameras.forEach((camera, index) => { + metrics.size[camera] = sizes[index] ? sizes[index] : 0 + metrics.count[camera] = counts[index] ? counts[index] : 0 + }) + res.send(metrics) + }).catch(err => { + console.log("err", err) + }) + } } -const updateCacheAfterDeletion = (res, cacheUpdatingFunction, percentageDeleted, cameraIndex) => { - Promise.all(deletionReadPromises()).then(([deletionData, cumulativeData]) => { - const {newDeletionData, newCumulativeData} = cacheUpdatingFunction(deletionData, cumulativeData, percentageDeleted, cameraIndex) - Promise.all(deletionWritePromises(newDeletionData, newCumulativeData)).then(() => { - res.send({deleted: true}) - }, (err) => { - res.send({deleted: true, msg: "JSON write failed"}) - }) - }, (err) => { - console.log("update cache", err) - res.send({deleted: true, msg: "JSON read failed"}) - }) +const queryForMetric = (camera, metric) => { + return pool.query(`SELECT ${metric == "count" ? "COUNT(*)" : "SUM(size)"} FROM frame_files WHERE camera=${camera};`) } -const deleteStatsObjHandler = (deletionData, cumulativeData, percentageDeleted, cameraIndex) => { - const cameras = JSON.parse(process.env.cameras) - const deletionObj = {timestamp: moment().format("x"), camera: cameraIndex+1} - for(const metric in cumulativeData){ - const metricDeleted = Math.round(parseInt(cumulativeData[metric][cameras[cameraIndex]]) * percentageDeleted) - deletionObj[metric] = metricDeleted - cumulativeData[metric][cameras[cameraIndex]] = cumulativeData[metric][cameras[cameraIndex]] - metricDeleted - } - if("deletions" in deletionData){ - deletionData.deletions.push(deletionObj) - } - else{ - deletionData.deletions = [deletionObj] - } - return {newDeletionData: deletionData, newCumulativeData: cumulativeData} +const queryToUpdateDatabaseForDeletion = (camera, deleting, before="") => { + const timestampCondition = deleting=="files" ? `AND timestamp<=timestamp '${before}'` : "" + return pool.query(`DELETE FROM frame_files WHERE camera=${camera} ${timestampCondition} RETURNING *;`) } -const deletionReadPromises = () => [pathToDeletionStatsJSON, pathToCumulativeStatsJSON].map(pathToStats => new Promise((resolve, reject) => { - readJSON(pathToStats, (err, data) => { - if(!err){ - resolve(data) - } - else{ - reject(err) - } - }) -})) +const queryToAddToDeletionsTable = (camera, size, count) => { + const now = moment().format('YYYY-MM-DD HH:mm:ss') + return pool.query(`INSERT INTO frame_deletes(timestamp, camera, size, count) VALUES('${now}', ${camera}, ${size}, ${count});`) +} -const deletionWritePromises = (deletionData, cumulativeData) => { - return [{pathToStats: pathToDeletionStatsJSON, data: deletionData}, - {pathToStats: pathToCumulativeStatsJSON, data: cumulativeData}].map(({pathToStats, data}) => new Promise((resolve, reject) => { - writeJSON(pathToStats, data, (err) => { - if(!err){ - resolve() - } - else{ - reject(err) - } - }) - })) +const queryForGroupedStats = (camera) => { + return pool.query(`SELECT timestamp,SUM(size), COUNT(*) FROM frame_files WHERE camera=${camera} GROUP BY timestamp ORDER BY timestamp ASC;`) } +const extractValueForMetric = (metric) => (values) => { + let metricName + switch (metric) { + case "size": + metricName = "sum"; + break; + default: + metricName = metric; + break; + } + if(values.rows && values.rows.length > 0){ + return values.rows[0][metricName] ? values.rows[0][metricName] : 0 + } + else{ + throw new Error() + } +} + const generateBeforeDateGlobNotPatternsArray = (now, beforeDate, arr=[]) => { const units = [ {unit: "y", format: "YYYY"}, @@ -233,175 +181,4 @@ const generateBeforeDateGlobNotPatternsArray = (now, beforeDate, arr=[]) => { } } return arr -} - -const getDirectorySize = (fileList) => { - return Promise.all(fileList.map(file => { - return new Promise((resolve) => { - fs.stat(file, (err, stats) => { - if(!err){ - resolve({size: stats.size, counted: true}) - } - else{ - resolve({size: 0, counted: false}) - } - }) - }) - })).then((reasons) => { - let size = 0 - let numberOfFilesCounted = 0 - reasons.forEach((reason) => { - size+=reason.size - numberOfFilesCounted+=reason.counted ? 1 : 0 - }) - return { - size: formatBytes(size), - confidence: 100*numberOfFilesCounted/fileList.length, - bytes: size - } - }) -} - -const deleteFiles = (fileList) => { - return Promise.all(fileList.map(file => - new Promise((resolve) => { - fs.unlink(file, (err) => { - if (!err) { - resolve(1) - } - else{ - resolve(0) - } - }) - }) - )).then((reasons) => { - let numberOfFilesDeleted = 0 - reasons.forEach((reason) => { - numberOfFilesDeleted+=reason - }) - return {successful: 100*numberOfFilesDeleted/fileList.length} - }) -} - -const filterFilesByTime = (fileList, checkDate, timeCheck="before") => { - return fileList.filter(timeCheck == "before" ? filterFileCreatedBefore(checkDate) : filterFileCreatedAfter(checkDate)) -} - -const filterFileCreatedBefore = (checkDate) => (file) => { - const fileName = path.parse(path.basename(file)).name - return moment(fileName, require("./dateFormat.js")).isBefore(checkDate) -} - -const filterFileCreatedAfter = (checkDate) => (file) => { - const fileName = path.parse(path.basename(file)).name - return moment(fileName, require("./dateFormat.js")).isAfter(checkDate) -} - -const createStatsJSON = (filePath) => { - readJSON(filePath, (err, data) => { - if(err){ - writeJSON(filePath, {}, ()=>{}, (err) => { - console.log("creation JSON write", err) - }) - } - }) -} - -const createTimestampedStatObject = () => { - const timestamp = moment().format("x") - let stats = { count: {timestamp}, size: {timestamp} } - JSON.parse(process.env.cameras).forEach((name) => { - stats.count[`${name}`] = 0 - stats.size[`${name}`] = 0 - }) - return stats -} - -const promiseMetricTasks = (statsObj, cronMinutes=undefined) => JSON.parse(process.env.cameras).map((name, i) => { - const camera = i+1 - return {name, pathToDir: path.join(process.env.storage_FOLDERPATH, "./shared/captures/", camera.toString())} -}).reduce(function (accumulator, {name, pathToDir}) { - return accumulator.concat([ - new Promise(resolve => { - listFilesInDirectory(pathToDir).then((fileList) => { - let filteredFileList = fileList - if(cronMinutes){ - filteredFileList = filterFilesByTime(filteredFileList, moment(statsObj.count.timestamp, "x").subtract(cronMinutes, "minutes"), "after") - filteredFileList = filterFilesByTime(filteredFileList, moment(statsObj.count.timestamp, "x"), "before") - } - statsObj.count[`${name}`] = filteredFileList.length - resolve() - }) - }), - new Promise((resolve, reject) => { - listFilesInDirectory(pathToDir).then((fileList) => { - let filteredFileList = fileList - if(cronMinutes){ - filteredFileList = filterFilesByTime(filteredFileList, moment(statsObj.count.timestamp, "x").subtract(cronMinutes, "minutes"), "after") - filteredFileList = filterFilesByTime(filteredFileList, moment(statsObj.count.timestamp, "x"), "before") - } - getDirectorySize(filteredFileList).then(({bytes}) => { - statsObj.size[`${name}`] = bytes - resolve() - }, () => { - reject() - }) - }) - }) - ]) -}, []) - -const cronTask = () => { - console.log("SCHEDULED FILE STATS") - let currentStats = createTimestampedStatObject() - Promise.all(promiseMetricTasks(currentStats, cronMinutes)).then(() => { - readJSON(pathToAdditionStatsJSON, (err, data) => { - for(const metric in currentStats){ - if(!(metric in data)){ - data[metric] = [] - } - data[metric].push(currentStats[metric]) - } - writeJSON(pathToAdditionStatsJSON, data, (err) => { - if(err){ - console.log("\twriting file stats to addition JSON | Error:", err) - } - }) - }) - readJSON(pathToCumulativeStatsJSON, (err, data) => { - for(const metric in currentStats){ - if(!(metric in data)){ - data[metric] = {} - } - for(const camera of JSON.parse(process.env.cameras)){ - if(data[metric][camera] != undefined){ - data[metric][camera] += currentStats[metric][camera] - } - else{ - data[metric][camera] = currentStats[metric][camera] - } - } - } - writeJSON(pathToCumulativeStatsJSON, data, (err) => { - if(err){ - console.log("\twriting file stats to cumulative JSON | Error:", err) - } - }) - }) - }, (err) => { - console.log("\tcouldn't write file stats to JSONs | Error:", err) - }) -} - -const cronString = `*/${cronMinutes} * * * *` - -if(isPrimeInstance){ - const client = require("memory").client("FILE STATS") - mkdirp(path.join(process.env.storage_FOLDERPATH, "./shared")).then(() => { - createStatsJSON(pathToAdditionStatsJSON) - createStatsJSON(pathToDeletionStatsJSON) - createStatsJSON(pathToCumulativeStatsJSON) - }) - client.on("file-stats-update", cronTask) - client.emit("cron", cronString, "file-stats-update") } \ No newline at end of file diff --git a/storage/npm-shrinkwrap.json b/storage/npm-shrinkwrap.json index 7f170c1..2079d8c 100644 --- a/storage/npm-shrinkwrap.json +++ b/storage/npm-shrinkwrap.json @@ -18,6 +18,7 @@ "memory": "file:../memory", "mkdirp": "^1.0.4", "moment": "^2.29.1", + "pg": "^8.7.1", "rimraf": "^3.0.2" }, "peerDependencies": { @@ -1023,7 +1024,7 @@ } }, "../lib/node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -1056,7 +1057,7 @@ } }, "../lib/node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -1077,7 +1078,7 @@ } }, "../lib/node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -1110,7 +1111,7 @@ "peer": true }, "../lib/node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -1493,7 +1494,7 @@ } }, "../lib/node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -1865,7 +1866,7 @@ } }, "../lib/node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -2514,7 +2515,7 @@ } }, "../lib/node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -5981,7 +5982,7 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "license": "MIT", "peer": true, "dependencies": { @@ -6014,7 +6015,7 @@ } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "peer": true }, @@ -6035,7 +6036,7 @@ } }, "node_modules/@types/node": { - "version": "17.0.0", + "version": "17.0.5", "license": "MIT", "peer": true }, @@ -6079,7 +6080,7 @@ } }, "node_modules/acorn": { - "version": "8.6.0", + "version": "8.7.0", "license": "MIT", "peer": true, "bin": { @@ -6474,6 +6475,13 @@ "license": "MIT", "peer": true }, + "node_modules/buffer-writer": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/bytes": { "version": "3.1.1", "license": "MIT", @@ -6498,7 +6506,7 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "license": "CC-BY-4.0", "peer": true, "funding": { @@ -6887,7 +6895,7 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "license": "ISC", "peer": true }, @@ -7613,7 +7621,7 @@ "peer": true }, "node_modules/istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "license": "BSD-3-Clause", "peer": true, "dependencies": { @@ -8706,6 +8714,10 @@ "node": ">=6" } }, + "node_modules/packet-reader": { + "version": "1.0.0", + "license": "MIT" + }, "node_modules/parse5": { "version": "6.0.1", "license": "MIT", @@ -8750,6 +8762,73 @@ "version": "0.1.7", "license": "MIT" }, + "node_modules/pg": { + "version": "8.7.1", + "license": "MIT", + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "pg-native": ">=2.0.0" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-connection-string": { + "version": "2.5.0", + "license": "MIT" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.4.1", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.5.0", + "license": "MIT" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, "node_modules/picocolors": { "version": "1.0.0", "license": "ISC", @@ -8785,6 +8864,37 @@ "node": ">=8" } }, + "node_modules/postgres-array": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/prelude-ls": { "version": "1.1.2", "peer": true, @@ -9108,6 +9218,13 @@ "source-map": "^0.6.0" } }, + "node_modules/split2": { + "version": "4.1.0", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "license": "BSD-3-Clause", @@ -9615,6 +9732,13 @@ "license": "MIT", "peer": true }, + "node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "license": "ISC", @@ -10239,7 +10363,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -10268,7 +10392,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -10286,7 +10410,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -10320,7 +10444,7 @@ } }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -10595,6 +10719,9 @@ "version": "1.1.2", "peer": true }, + "buffer-writer": { + "version": "2.0.0" + }, "bytes": { "version": "3.1.1" }, @@ -10607,7 +10734,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -10870,7 +10997,7 @@ "version": "1.1.1" }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emittery": { @@ -11311,7 +11438,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -12540,7 +12667,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -12569,7 +12696,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -12587,7 +12714,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -12614,7 +12741,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -12861,7 +12988,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -13104,7 +13231,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -13492,7 +13619,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -15848,7 +15975,7 @@ } }, "@types/babel__generator": { - "version": "7.6.3", + "version": "7.6.4", "peer": true, "requires": { "@babel/types": "^7.0.0" @@ -15877,7 +16004,7 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", + "version": "2.0.4", "peer": true }, "@types/istanbul-lib-report": { @@ -15895,7 +16022,7 @@ } }, "@types/node": { - "version": "17.0.0", + "version": "17.0.5", "peer": true }, "@types/prettier": { @@ -15922,7 +16049,7 @@ "peer": true }, "acorn": { - "version": "8.6.0", + "version": "8.7.0", "peer": true }, "acorn-globals": { @@ -16169,7 +16296,7 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001291", + "version": "1.0.30001294", "peer": true }, "chalk": { @@ -16412,7 +16539,7 @@ } }, "electron-to-chromium": { - "version": "1.4.24", + "version": "1.4.30", "peer": true }, "emitter-listener": { @@ -16800,7 +16927,7 @@ } }, "istanbul-reports": { - "version": "3.1.1", + "version": "3.1.3", "peer": true, "requires": { "html-escaper": "^2.0.0", @@ -18554,6 +18681,9 @@ "version": "2.2.0", "peer": true }, + "packet-reader": { + "version": "1.0.0" + }, "parse5": { "version": "6.0.1", "peer": true @@ -18579,6 +18709,47 @@ "path-to-regexp": { "version": "0.1.7" }, + "pg": { + "version": "8.7.1", + "requires": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.4.1", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + } + }, + "pg-connection-string": { + "version": "2.5.0" + }, + "pg-int8": { + "version": "1.0.1" + }, + "pg-pool": { + "version": "3.4.1", + "requires": {} + }, + "pg-protocol": { + "version": "1.5.0" + }, + "pg-types": { + "version": "2.2.0", + "requires": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + } + }, + "pgpass": { + "version": "1.0.5", + "requires": { + "split2": "^4.1.0" + } + }, "picocolors": { "version": "1.0.0", "peer": true @@ -18598,6 +18769,21 @@ "find-up": "^4.0.0" } }, + "postgres-array": { + "version": "2.0.0" + }, + "postgres-bytea": { + "version": "1.0.0" + }, + "postgres-date": { + "version": "1.0.7" + }, + "postgres-interval": { + "version": "1.2.0", + "requires": { + "xtend": "^4.0.0" + } + }, "prelude-ls": { "version": "1.1.2", "peer": true @@ -18791,6 +18977,9 @@ "source-map": "^0.6.0" } }, + "split2": { + "version": "4.1.0" + }, "sprintf-js": { "version": "1.0.3", "peer": true @@ -19111,6 +19300,9 @@ "version": "2.2.0", "peer": true }, + "xtend": { + "version": "4.0.2" + }, "y18n": { "version": "5.0.8", "peer": true diff --git a/storage/package.json b/storage/package.json index 61f2fed..ae4d81f 100644 --- a/storage/package.json +++ b/storage/package.json @@ -2,6 +2,7 @@ "name": "storage", "main": "server.js", "scripts": { + "prestart": "cd .. && npm-run-all -s --npm-path npm prepare:acme prepare:env prepare:database", "start": "node start.js", "test": "jest --verbose", "prunewrap": "npm shrinkwrap" @@ -9,17 +10,18 @@ "dependencies": { "archiver": "^4.0.2", "cli-progress": "^3.9.1", - "fluent-ffmpeg": "^2.1.2", - "memory": "file:../memory", - "heartbeat": "jjjpanda/heartbeat#v1.3.0", "cookie-parser": "^1.4.5", + "dotenv": "^10.0.0", "express": "^4.17.1", + "fluent-ffmpeg": "^2.1.2", + "heartbeat": "jjjpanda/heartbeat#v1.3.0", "helmet": "^4.6.0", + "lib": "file:../lib", + "memory": "file:../memory", "mkdirp": "^1.0.4", "moment": "^2.29.1", - "lib": "file:../lib", - "rimraf": "^3.0.2", - "dotenv": "^10.0.0" + "pg": "^8.7.1", + "rimraf": "^3.0.2" }, "peerDependencies": { "jest": "^27.3.1",