From 6f634c3f13e352fda1d0b3b389f4ec02adddf4b2 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 8 Oct 2023 19:10:17 +0530 Subject: [PATCH 01/10] Add mock server module --- mock-backend/package-lock.json | 1287 ++++++++++++++++++++++++++++ mock-backend/package.json | 20 + mock-backend/src/mocks/db.json | 231 +++++ mock-backend/src/mocks/routes.json | 4 + mock-backend/src/server.js | 17 + 5 files changed, 1559 insertions(+) create mode 100644 mock-backend/package-lock.json create mode 100644 mock-backend/package.json create mode 100644 mock-backend/src/mocks/db.json create mode 100644 mock-backend/src/mocks/routes.json create mode 100644 mock-backend/src/server.js diff --git a/mock-backend/package-lock.json b/mock-backend/package-lock.json new file mode 100644 index 00000000..55e49560 --- /dev/null +++ b/mock-backend/package-lock.json @@ -0,0 +1,1287 @@ +{ + "name": "mock-backend", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "mock-backend", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "json-server": "^0.17.4" + }, + "devDependencies": { + "@types/json-server": "^0.14.5" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.3", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.3.tgz", + "integrity": "sha512-oyl4jvAfTGX9Bt6Or4H9ni1Z447/tQuxnZsytsCaExKlmJiU8sFgnIBRzJUpKwB5eWn9HuBYlUlVA74q/yN0eQ==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.36", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.36.tgz", + "integrity": "sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.18", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.18.tgz", + "integrity": "sha512-Sxv8BSLLgsBYmcnGdGjjEjqET2U+AKAdCRODmMiq02FgjwuV75Ut85DRpvFjyw/Mk0vgUOliGRU0UUmuuZHByQ==", + "dev": true, + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.37", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.37.tgz", + "integrity": "sha512-ZohaCYTgGFcOP7u6aJOhY9uIZQgZ2vxC2yWoArY+FeDXlqeH66ZVBjgvg+RLVAS/DWNq4Ap9ZXu1+SUQiiWYMg==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.2.tgz", + "integrity": "sha512-lPG6KlZs88gef6aD85z3HNkztpj7w2R7HmR3gygjfXCQmsLloWNARFkMuzKiiY8FGdh1XDpgBdrSf4aKDiA7Kg==", + "dev": true + }, + "node_modules/@types/json-server": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/@types/json-server/-/json-server-0.14.5.tgz", + "integrity": "sha512-Eck8yX5a0PPPV5MhYg/1Xbklz0/BJ2ir874CReGiKsj22ZWD+XYP3ZXK6cTZ9Mqi099GmtIml/1X5aQJTcZr/Q==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/express": "*", + "@types/lowdb": "*" + } + }, + "node_modules/@types/lodash": { + "version": "4.14.199", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.199.tgz", + "integrity": "sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg==", + "dev": true + }, + "node_modules/@types/lowdb": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@types/lowdb/-/lowdb-1.0.12.tgz", + "integrity": "sha512-m/hOfY7nuwo9V3yApvR6aJ3uZP6iNC74S7Bx5BWz0L7IrzjKyzUur/jEdlYWBWWVjmkCz+ECK9nk8UJoQa8aZw==", + "dev": true, + "dependencies": { + "@types/lodash": "*" + } + }, + "node_modules/@types/mime": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.3.tgz", + "integrity": "sha512-Ys+/St+2VF4+xuY6+kDIXGxbNRO0mesVg0bbxEfB97Od1Vjpjx9KD1qxs64Gcb3CWPirk9Xe+PT4YiiHQ9T+eg==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.8.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.3.tgz", + "integrity": "sha512-jxiZQFpb+NlH5kjW49vXxvxTjeeqlbsnTAdBTKpzEdPs9itay7MscYXz3Fo9VYFEsfQ6LJFitHad3faerLAjCw==", + "dev": true + }, + "node_modules/@types/qs": { + "version": "6.9.8", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.8.tgz", + "integrity": "sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg==", + "dev": true + }, + "node_modules/@types/range-parser": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.5.tgz", + "integrity": "sha512-xrO9OoVPqFuYyR/loIHjnbvvyRZREYKLjxV4+dY6v3FQR3stQ9ZxIGkaclF7YhI9hfjpuTbu14hZEy94qKLtOA==", + "dev": true + }, + "node_modules/@types/send": { + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.2.tgz", + "integrity": "sha512-aAG6yRf6r0wQ29bkS+x97BIs64ZLxeE/ARwyS6wrldMm3C1MdKwCcnnEwMC1slI8wuxJOpiUH9MioC0A0i+GJw==", + "dev": true, + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.3.tgz", + "integrity": "sha512-yVRvFsEMrv7s0lGhzrggJjNOSmZCdgCjw9xWrPr/kNNLp6FaDfMC1KaYl3TSJ0c58bECwNBMoQrZJ8hA8E1eFg==", + "dev": true, + "dependencies": { + "@types/http-errors": "*", + "@types/mime": "*", + "@types/node": "*" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "dependencies": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/connect-pause": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/connect-pause/-/connect-pause-0.1.1.tgz", + "integrity": "sha512-a1gSWQBQD73krFXdUEYJom2RTFrWUL3YvXDCRkyv//GVXc79cdW9MngtRuN9ih4FDKBtfJAJId+BbDuX+1rh2w==", + "engines": { + "node": "*" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-disposition/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/errorhandler": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/errorhandler/-/errorhandler-1.5.1.tgz", + "integrity": "sha512-rcOwbfvP1WTViVoUjcfZicVzjhjTuhSMntHh6mW3IrEiyE6mJyXvsToJUJGlGlw/2xU9P5whlWNGlIDVeCiT4A==", + "dependencies": { + "accepts": "~1.3.7", + "escape-html": "~1.0.3" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/express-urlrewrite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/express-urlrewrite/-/express-urlrewrite-1.4.0.tgz", + "integrity": "sha512-PI5h8JuzoweS26vFizwQl6UTF25CAHSggNv0J25Dn/IKZscJHWZzPrI5z2Y2jgOzIaw2qh8l6+/jUcig23Z2SA==", + "dependencies": { + "debug": "*", + "path-to-regexp": "^1.0.3" + } + }, + "node_modules/express-urlrewrite/node_modules/path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "dependencies": { + "isarray": "0.0.1" + } + }, + "node_modules/express/node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/express/node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/express/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/has": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", + "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-promise": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", + "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==" + }, + "node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" + }, + "node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==" + }, + "node_modules/json-parse-helpfulerror": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/json-parse-helpfulerror/-/json-parse-helpfulerror-1.0.3.tgz", + "integrity": "sha512-XgP0FGR77+QhUxjXkwOMkC94k3WtqEBfcnjWqhRd82qTat4SWKRE+9kUnynz/shm3I4ea2+qISvTIeGTNU7kJg==", + "dependencies": { + "jju": "^1.1.0" + } + }, + "node_modules/json-server": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/json-server/-/json-server-0.17.4.tgz", + "integrity": "sha512-bGBb0WtFuAKbgI7JV3A864irWnMZSvBYRJbohaOuatHwKSRFUfqtQlrYMrB6WbalXy/cJabyjlb7JkHli6dYjQ==", + "dependencies": { + "body-parser": "^1.19.0", + "chalk": "^4.1.2", + "compression": "^1.7.4", + "connect-pause": "^0.1.1", + "cors": "^2.8.5", + "errorhandler": "^1.5.1", + "express": "^4.17.1", + "express-urlrewrite": "^1.4.0", + "json-parse-helpfulerror": "^1.0.3", + "lodash": "^4.17.21", + "lodash-id": "^0.14.1", + "lowdb": "^1.0.0", + "method-override": "^3.0.0", + "morgan": "^1.10.0", + "nanoid": "^3.1.23", + "please-upgrade-node": "^3.2.0", + "pluralize": "^8.0.0", + "server-destroy": "^1.0.1", + "yargs": "^17.0.1" + }, + "bin": { + "json-server": "lib/cli/bin.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash-id": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/lodash-id/-/lodash-id-0.14.1.tgz", + "integrity": "sha512-ikQPBTiq/d5m6dfKQlFdIXFzvThPi2Be9/AHxktOnDSfSxE1j9ICbBT5Elk1ke7HSTgM38LHTpmJovo9/klnLg==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/lowdb": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowdb/-/lowdb-1.0.0.tgz", + "integrity": "sha512-2+x8esE/Wb9SQ1F9IHaYWfsC9FIecLOPrK4g17FGEayjUWH172H6nwicRovGvSE2CPZouc2MCIqCI7h9d+GftQ==", + "dependencies": { + "graceful-fs": "^4.1.3", + "is-promise": "^2.1.0", + "lodash": "4", + "pify": "^3.0.0", + "steno": "^0.4.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/method-override": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/method-override/-/method-override-3.0.0.tgz", + "integrity": "sha512-IJ2NNN/mSl9w3kzWB92rcdHpz+HjkxhDJWNDBqSlas+zQdP8wBiJzITPg08M/k2uVvMow7Sk41atndNtt/PHSA==", + "dependencies": { + "debug": "3.1.0", + "methods": "~1.1.2", + "parseurl": "~1.3.2", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/method-override/node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/morgan": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", + "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==", + "dependencies": { + "basic-auth": "~2.0.1", + "debug": "2.6.9", + "depd": "~2.0.0", + "on-finished": "~2.3.0", + "on-headers": "~1.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/morgan/node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "engines": { + "node": ">=4" + } + }, + "node_modules/please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dependencies": { + "semver-compare": "^1.0.0" + } + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "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==" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/server-destroy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/server-destroy/-/server-destroy-1.0.1.tgz", + "integrity": "sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/steno": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/steno/-/steno-0.4.4.tgz", + "integrity": "sha512-EEHMVYHNXFHfGtgjNITnka0aHhiAlo93F7z2/Pwd+g0teG9CnM3JIINM7hVVB5/rhw9voufD7Wukwgtw2uqh6w==", + "dependencies": { + "graceful-fs": "^4.1.3" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + } + } +} diff --git a/mock-backend/package.json b/mock-backend/package.json new file mode 100644 index 00000000..8b0b358d --- /dev/null +++ b/mock-backend/package.json @@ -0,0 +1,20 @@ +{ + "name": "mock-backend", + "version": "1.0.0", + "description": "", + "main": "index.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node src/server.js" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "json-server": "^0.17.4" + }, + "devDependencies": { + "@types/json-server": "^0.14.5" + } +} diff --git a/mock-backend/src/mocks/db.json b/mock-backend/src/mocks/db.json new file mode 100644 index 00000000..0e60018e --- /dev/null +++ b/mock-backend/src/mocks/db.json @@ -0,0 +1,231 @@ +{ + "combine": [ + { + "date": "default", + "description": "default", + "docLink": "default", + "fullName": "default", + "language": "default", + "location": "local", + "model": "openai_text-embedding-ada-002", + "name": "default", + "version": "" + }, + { + "date": "13/02/2023", + "description": "Serverless Framework, the serverless application framework for building web, mobile and IoT applications on AWS Lambda, Azure Functions, Google CloudFunctions & more!", + "docLink": "https://serverless.com/framework/docs/", + "fullName": "Serverless Framework", + "language": "serverless", + "location": "remote", + "name": "serverless framework", + "version": "3.27.0" + }, + { + "date": "15/02/2023", + "description": "Machine Learning in Python", + "docLink": "https://scikit-learn.org/stable/", + "fullName": "scikit-learn", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "scikit-learn", + "version": "1.2.1" + }, + { + "date": "07/02/2023", + "description": "Machine Learning in Python", + "docLink": "https://scikit-learn.org/stable/", + "fullName": "scikit-learn", + "language": "python", + "location": "remote", + "name": "scikit-learn", + "version": "1.2.1" + }, + { + "date": "07/02/2023", + "description": "Pandas is alibrary providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.", + "docLink": "https://pandas.pydata.org/docs/", + "fullName": "Pandas", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "pandas", + "version": "1.5.3" + }, + { + "date": "07/02/2023", + "description": "Pandas is alibrary providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.", + "docLink": "https://pandas.pydata.org/docs/", + "fullName": "Pandas", + "language": "python", + "location": "remote", + "name": "pandas", + "version": "1.5.3" + }, + { + "date": "29/02/2023", + "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", + "docLink": "https://docs.python.org/3/", + "fullName": "Python", + "language": "python", + "location": "remote", + "model": "huggingface_sentence-transformers-all-mpnet-base-v2", + "name": "python", + "version": "3.11.1" + }, + { + "date": "15/02/2023", + "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", + "docLink": "https://docs.python.org/3/", + "fullName": "Python", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "python", + "version": "3.11.1" + }, + { + "date": "07/02/2023", + "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", + "docLink": "https://docs.python.org/3/", + "fullName": "Python", + "language": "python", + "location": "remote", + "name": "python", + "version": "3.11.1" + }, + { + "date": "08/02/2023", + "description": "GPT Index is a project consisting of a set of data structures designed to make it easier to use large external knowledge bases with LLMs.", + "docLink": "https://gpt-index.readthedocs.io/en/latest/index.html", + "fullName": "LangChain", + "language": "python", + "location": "remote", + "name": "gpt-index", + "version": "0.4.0" + }, + { + "date": "15/02/2023", + "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", + "docLink": "https://langchain.readthedocs.io/en/latest/index.html", + "fullName": "LangChain", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "langchain", + "version": "0.0.87" + }, + { + "date": "07/02/2023", + "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", + "docLink": "https://langchain.readthedocs.io/en/latest/index.html", + "fullName": "LangChain", + "language": "python", + "location": "remote", + "name": "langchain", + "version": "0.0.79" + }, + { + "date": "13/03/2023", + "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", + "docLink": "https://langchain.readthedocs.io/en/latest/index.html", + "fullName": "LangChain", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "langchain", + "version": "0.0.109" + }, + { + "date": "16/03/2023", + "description": "A JavaScript library for building user interfaces\nGet Started\n", + "docLink": "https://reactjs.org/", + "fullName": "React", + "language": "javascript", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "react", + "version": "v18.2.0" + }, + { + "date": "15/02/2023", + "description": "is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.", + "docLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript", + "fullName": "JavaScript", + "language": "javascript", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "javascript", + "version": "ES2015" + }, + { + "date": "16/03/2023", + "description": "An approachable, performant and versatile framework for building web user interfaces. ", + "docLink": "https://vuejs.org/", + "fullName": "Vue.js", + "language": "javascript", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "vuejs", + "version": "v3.3.0" + }, + { + "date": "16/03/2023", + "description": "Get ready for a development environment that can finally catch up with you.", + "docLink": "https://vitejs.dev/", + "fullName": "Vite", + "language": "javascript", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "vitejs", + "version": "v4.2.0" + }, + { + "date": "15/02/2023", + "description": "Solidity is an object-oriented, high-level language for implementing smart contracts.", + "docLink": "https://docs.soliditylang.org/en/v0.8.18/", + "fullName": "Solidity", + "language": "ethereum", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "solidity", + "version": "0.8.18" + }, + { + "date": "07/02/2023", + "description": "Solidity is an object-oriented, high-level language for implementing smart contracts.", + "docLink": "https://docs.soliditylang.org/en/v0.8.18/", + "fullName": "Solidity", + "language": "ethereum", + "location": "remote", + "name": "solidity", + "version": "0.8.18" + }, + { + "date": "28/02/2023", + "description": "GPT-powered chat for documentation search & assistance. ", + "docLink": "https://github.com/arc53/DocsGPT/wiki", + "fullName": "DocsGPT", + "language": "docsgpt", + "location": "remote", + "model": "huggingface_sentence-transformers-all-mpnet-base-v2", + "name": "docsgpt", + "version": "0.1.0" + }, + { + "date": "28/02/2023", + "description": "GPT-powered chat for documentation search & assistance. ", + "docLink": "https://github.com/arc53/DocsGPT/wiki", + "fullName": "DocsGPT", + "language": "docsgpt", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "docsgpt", + "version": "0.1.0" + } + ] + , + "conversations": [ + ] + } \ No newline at end of file diff --git a/mock-backend/src/mocks/routes.json b/mock-backend/src/mocks/routes.json new file mode 100644 index 00000000..7f436024 --- /dev/null +++ b/mock-backend/src/mocks/routes.json @@ -0,0 +1,4 @@ +{ + "/api/*": "/$1", + "/get_conversations": "/conversations" +} \ No newline at end of file diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js new file mode 100644 index 00000000..3cd20285 --- /dev/null +++ b/mock-backend/src/server.js @@ -0,0 +1,17 @@ +import jsonServer from 'json-server'; +import routes from './mocks/routes.json' assert { type: "json" }; + + +const server = jsonServer.create(); +const router = jsonServer.router('./src/mocks/db.json'); +const middlewares = jsonServer.defaults(); + +server.use(middlewares); +server.use(jsonServer.rewriter(routes)); + + +server.use(router); + +server.listen(7091, () => { + console.log('JSON Server is running') +}); \ No newline at end of file From 8c7da0bdb6c58e3d53c6741043106a8e540cb3cc Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 8 Oct 2023 19:56:27 +0530 Subject: [PATCH 02/10] Add more routes --- mock-backend/src/mocks/db.json | 458 ++++++++++++++--------------- mock-backend/src/mocks/routes.json | 5 +- mock-backend/src/server.js | 11 +- 3 files changed, 242 insertions(+), 232 deletions(-) diff --git a/mock-backend/src/mocks/db.json b/mock-backend/src/mocks/db.json index 0e60018e..f0cb04b6 100644 --- a/mock-backend/src/mocks/db.json +++ b/mock-backend/src/mocks/db.json @@ -1,231 +1,229 @@ { - "combine": [ - { - "date": "default", - "description": "default", - "docLink": "default", - "fullName": "default", - "language": "default", - "location": "local", - "model": "openai_text-embedding-ada-002", - "name": "default", - "version": "" - }, - { - "date": "13/02/2023", - "description": "Serverless Framework, the serverless application framework for building web, mobile and IoT applications on AWS Lambda, Azure Functions, Google CloudFunctions & more!", - "docLink": "https://serverless.com/framework/docs/", - "fullName": "Serverless Framework", - "language": "serverless", - "location": "remote", - "name": "serverless framework", - "version": "3.27.0" - }, - { - "date": "15/02/2023", - "description": "Machine Learning in Python", - "docLink": "https://scikit-learn.org/stable/", - "fullName": "scikit-learn", - "language": "python", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "scikit-learn", - "version": "1.2.1" - }, - { - "date": "07/02/2023", - "description": "Machine Learning in Python", - "docLink": "https://scikit-learn.org/stable/", - "fullName": "scikit-learn", - "language": "python", - "location": "remote", - "name": "scikit-learn", - "version": "1.2.1" - }, - { - "date": "07/02/2023", - "description": "Pandas is alibrary providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.", - "docLink": "https://pandas.pydata.org/docs/", - "fullName": "Pandas", - "language": "python", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "pandas", - "version": "1.5.3" - }, - { - "date": "07/02/2023", - "description": "Pandas is alibrary providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.", - "docLink": "https://pandas.pydata.org/docs/", - "fullName": "Pandas", - "language": "python", - "location": "remote", - "name": "pandas", - "version": "1.5.3" - }, - { - "date": "29/02/2023", - "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", - "docLink": "https://docs.python.org/3/", - "fullName": "Python", - "language": "python", - "location": "remote", - "model": "huggingface_sentence-transformers-all-mpnet-base-v2", - "name": "python", - "version": "3.11.1" - }, - { - "date": "15/02/2023", - "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", - "docLink": "https://docs.python.org/3/", - "fullName": "Python", - "language": "python", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "python", - "version": "3.11.1" - }, - { - "date": "07/02/2023", - "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", - "docLink": "https://docs.python.org/3/", - "fullName": "Python", - "language": "python", - "location": "remote", - "name": "python", - "version": "3.11.1" - }, - { - "date": "08/02/2023", - "description": "GPT Index is a project consisting of a set of data structures designed to make it easier to use large external knowledge bases with LLMs.", - "docLink": "https://gpt-index.readthedocs.io/en/latest/index.html", - "fullName": "LangChain", - "language": "python", - "location": "remote", - "name": "gpt-index", - "version": "0.4.0" - }, - { - "date": "15/02/2023", - "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", - "docLink": "https://langchain.readthedocs.io/en/latest/index.html", - "fullName": "LangChain", - "language": "python", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "langchain", - "version": "0.0.87" - }, - { - "date": "07/02/2023", - "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", - "docLink": "https://langchain.readthedocs.io/en/latest/index.html", - "fullName": "LangChain", - "language": "python", - "location": "remote", - "name": "langchain", - "version": "0.0.79" - }, - { - "date": "13/03/2023", - "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", - "docLink": "https://langchain.readthedocs.io/en/latest/index.html", - "fullName": "LangChain", - "language": "python", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "langchain", - "version": "0.0.109" - }, - { - "date": "16/03/2023", - "description": "A JavaScript library for building user interfaces\nGet Started\n", - "docLink": "https://reactjs.org/", - "fullName": "React", - "language": "javascript", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "react", - "version": "v18.2.0" - }, - { - "date": "15/02/2023", - "description": "is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.", - "docLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript", - "fullName": "JavaScript", - "language": "javascript", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "javascript", - "version": "ES2015" - }, - { - "date": "16/03/2023", - "description": "An approachable, performant and versatile framework for building web user interfaces. ", - "docLink": "https://vuejs.org/", - "fullName": "Vue.js", - "language": "javascript", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "vuejs", - "version": "v3.3.0" - }, - { - "date": "16/03/2023", - "description": "Get ready for a development environment that can finally catch up with you.", - "docLink": "https://vitejs.dev/", - "fullName": "Vite", - "language": "javascript", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "vitejs", - "version": "v4.2.0" - }, - { - "date": "15/02/2023", - "description": "Solidity is an object-oriented, high-level language for implementing smart contracts.", - "docLink": "https://docs.soliditylang.org/en/v0.8.18/", - "fullName": "Solidity", - "language": "ethereum", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "solidity", - "version": "0.8.18" - }, - { - "date": "07/02/2023", - "description": "Solidity is an object-oriented, high-level language for implementing smart contracts.", - "docLink": "https://docs.soliditylang.org/en/v0.8.18/", - "fullName": "Solidity", - "language": "ethereum", - "location": "remote", - "name": "solidity", - "version": "0.8.18" - }, - { - "date": "28/02/2023", - "description": "GPT-powered chat for documentation search & assistance. ", - "docLink": "https://github.com/arc53/DocsGPT/wiki", - "fullName": "DocsGPT", - "language": "docsgpt", - "location": "remote", - "model": "huggingface_sentence-transformers-all-mpnet-base-v2", - "name": "docsgpt", - "version": "0.1.0" - }, - { - "date": "28/02/2023", - "description": "GPT-powered chat for documentation search & assistance. ", - "docLink": "https://github.com/arc53/DocsGPT/wiki", - "fullName": "DocsGPT", - "language": "docsgpt", - "location": "remote", - "model": "openai_text-embedding-ada-002", - "name": "docsgpt", - "version": "0.1.0" - } - ] - , - "conversations": [ - ] - } \ No newline at end of file + "combine": [ + { + "date": "default", + "description": "default", + "docLink": "default", + "fullName": "default", + "language": "default", + "location": "local", + "model": "openai_text-embedding-ada-002", + "name": "default", + "version": "" + }, + { + "date": "13/02/2023", + "description": "Serverless Framework, the serverless application framework for building web, mobile and IoT applications on AWS Lambda, Azure Functions, Google CloudFunctions & more!", + "docLink": "https://serverless.com/framework/docs/", + "fullName": "Serverless Framework", + "language": "serverless", + "location": "remote", + "name": "serverless framework", + "version": "3.27.0" + }, + { + "date": "15/02/2023", + "description": "Machine Learning in Python", + "docLink": "https://scikit-learn.org/stable/", + "fullName": "scikit-learn", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "scikit-learn", + "version": "1.2.1" + }, + { + "date": "07/02/2023", + "description": "Machine Learning in Python", + "docLink": "https://scikit-learn.org/stable/", + "fullName": "scikit-learn", + "language": "python", + "location": "remote", + "name": "scikit-learn", + "version": "1.2.1" + }, + { + "date": "07/02/2023", + "description": "Pandas is alibrary providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.", + "docLink": "https://pandas.pydata.org/docs/", + "fullName": "Pandas", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "pandas", + "version": "1.5.3" + }, + { + "date": "07/02/2023", + "description": "Pandas is alibrary providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.", + "docLink": "https://pandas.pydata.org/docs/", + "fullName": "Pandas", + "language": "python", + "location": "remote", + "name": "pandas", + "version": "1.5.3" + }, + { + "date": "29/02/2023", + "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", + "docLink": "https://docs.python.org/3/", + "fullName": "Python", + "language": "python", + "location": "remote", + "model": "huggingface_sentence-transformers-all-mpnet-base-v2", + "name": "python", + "version": "3.11.1" + }, + { + "date": "15/02/2023", + "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", + "docLink": "https://docs.python.org/3/", + "fullName": "Python", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "python", + "version": "3.11.1" + }, + { + "date": "07/02/2023", + "description": "Python is a programming language that lets you work quickly and integrate systems more effectively.", + "docLink": "https://docs.python.org/3/", + "fullName": "Python", + "language": "python", + "location": "remote", + "name": "python", + "version": "3.11.1" + }, + { + "date": "08/02/2023", + "description": "GPT Index is a project consisting of a set of data structures designed to make it easier to use large external knowledge bases with LLMs.", + "docLink": "https://gpt-index.readthedocs.io/en/latest/index.html", + "fullName": "LangChain", + "language": "python", + "location": "remote", + "name": "gpt-index", + "version": "0.4.0" + }, + { + "date": "15/02/2023", + "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", + "docLink": "https://langchain.readthedocs.io/en/latest/index.html", + "fullName": "LangChain", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "langchain", + "version": "0.0.87" + }, + { + "date": "07/02/2023", + "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", + "docLink": "https://langchain.readthedocs.io/en/latest/index.html", + "fullName": "LangChain", + "language": "python", + "location": "remote", + "name": "langchain", + "version": "0.0.79" + }, + { + "date": "13/03/2023", + "description": "Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not.", + "docLink": "https://langchain.readthedocs.io/en/latest/index.html", + "fullName": "LangChain", + "language": "python", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "langchain", + "version": "0.0.109" + }, + { + "date": "16/03/2023", + "description": "A JavaScript library for building user interfaces\nGet Started\n", + "docLink": "https://reactjs.org/", + "fullName": "React", + "language": "javascript", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "react", + "version": "v18.2.0" + }, + { + "date": "15/02/2023", + "description": "is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.", + "docLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript", + "fullName": "JavaScript", + "language": "javascript", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "javascript", + "version": "ES2015" + }, + { + "date": "16/03/2023", + "description": "An approachable, performant and versatile framework for building web user interfaces. ", + "docLink": "https://vuejs.org/", + "fullName": "Vue.js", + "language": "javascript", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "vuejs", + "version": "v3.3.0" + }, + { + "date": "16/03/2023", + "description": "Get ready for a development environment that can finally catch up with you.", + "docLink": "https://vitejs.dev/", + "fullName": "Vite", + "language": "javascript", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "vitejs", + "version": "v4.2.0" + }, + { + "date": "15/02/2023", + "description": "Solidity is an object-oriented, high-level language for implementing smart contracts.", + "docLink": "https://docs.soliditylang.org/en/v0.8.18/", + "fullName": "Solidity", + "language": "ethereum", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "solidity", + "version": "0.8.18" + }, + { + "date": "07/02/2023", + "description": "Solidity is an object-oriented, high-level language for implementing smart contracts.", + "docLink": "https://docs.soliditylang.org/en/v0.8.18/", + "fullName": "Solidity", + "language": "ethereum", + "location": "remote", + "name": "solidity", + "version": "0.8.18" + }, + { + "date": "28/02/2023", + "description": "GPT-powered chat for documentation search & assistance. ", + "docLink": "https://github.com/arc53/DocsGPT/wiki", + "fullName": "DocsGPT", + "language": "docsgpt", + "location": "remote", + "model": "huggingface_sentence-transformers-all-mpnet-base-v2", + "name": "docsgpt", + "version": "0.1.0" + }, + { + "date": "28/02/2023", + "description": "GPT-powered chat for documentation search & assistance. ", + "docLink": "https://github.com/arc53/DocsGPT/wiki", + "fullName": "DocsGPT", + "language": "docsgpt", + "location": "remote", + "model": "openai_text-embedding-ada-002", + "name": "docsgpt", + "version": "0.1.0" + } + ], + "conversations": [] +} diff --git a/mock-backend/src/mocks/routes.json b/mock-backend/src/mocks/routes.json index 7f436024..5bcccf0f 100644 --- a/mock-backend/src/mocks/routes.json +++ b/mock-backend/src/mocks/routes.json @@ -1,4 +1,7 @@ { "/api/*": "/$1", - "/get_conversations": "/conversations" + "/get_conversations": "/conversations", + "/get_single_conversation?id=:id": "/conversations/:id", + "/delete_conversation?id=:id": "/conversations/:id", + "/conversations?id=:id": "/conversations/:id" } \ No newline at end of file diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 3cd20285..0523f254 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -7,8 +7,17 @@ const router = jsonServer.router('./src/mocks/db.json'); const middlewares = jsonServer.defaults(); server.use(middlewares); -server.use(jsonServer.rewriter(routes)); +server.use((req, res, next) => { + if (req.method === 'POST') { + if (req.url.includes('/delete_conversation')) { + req.method = 'DELETE'; + } + } + next() +}) + +server.use(jsonServer.rewriter(routes)); server.use(router); From 01457bbe79750130556752aadf2009cbc78075c5 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 8 Oct 2023 20:05:08 +0530 Subject: [PATCH 03/10] Add feedback endpoint --- mock-backend/src/server.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 0523f254..02867229 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -1,26 +1,31 @@ -import jsonServer from 'json-server'; -import routes from './mocks/routes.json' assert { type: "json" }; - +import jsonServer from "json-server"; +import routes from "./mocks/routes.json" assert { type: "json" }; const server = jsonServer.create(); -const router = jsonServer.router('./src/mocks/db.json'); +const router = jsonServer.router("./src/mocks/db.json"); const middlewares = jsonServer.defaults(); server.use(middlewares); server.use((req, res, next) => { - if (req.method === 'POST') { - if (req.url.includes('/delete_conversation')) { - req.method = 'DELETE'; + if (req.method === "POST") { + if (req.url.includes("/delete_conversation")) { + req.method = "DELETE"; } } - next() -}) + next(); +}); server.use(jsonServer.rewriter(routes)); +router.render = (req, res) => { + if (req.url === "/feedback") { + res.status(200).jsonp({ status: "ok" }); + } +}; + server.use(router); server.listen(7091, () => { - console.log('JSON Server is running') -}); \ No newline at end of file + console.log("JSON Server is running"); +}); From ff1362e4623b018b2bd1c6630f51bf4872acc262 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 8 Oct 2023 21:40:17 +0530 Subject: [PATCH 04/10] Mock upload call --- mock-backend/package-lock.json | 15 ++++++++++++++- mock-backend/package.json | 3 ++- mock-backend/src/server.js | 4 ++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/mock-backend/package-lock.json b/mock-backend/package-lock.json index 55e49560..5a3378fc 100644 --- a/mock-backend/package-lock.json +++ b/mock-backend/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "json-server": "^0.17.4" + "json-server": "^0.17.4", + "uuid": "^9.0.1" }, "devDependencies": { "@types/json-server": "^0.14.5" @@ -1226,6 +1227,18 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/mock-backend/package.json b/mock-backend/package.json index 8b0b358d..7cfab8c3 100644 --- a/mock-backend/package.json +++ b/mock-backend/package.json @@ -12,7 +12,8 @@ "author": "", "license": "ISC", "dependencies": { - "json-server": "^0.17.4" + "json-server": "^0.17.4", + "uuid": "^9.0.1" }, "devDependencies": { "@types/json-server": "^0.14.5" diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 02867229..2e4d907c 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -1,5 +1,6 @@ import jsonServer from "json-server"; import routes from "./mocks/routes.json" assert { type: "json" }; +import { v4 as uuid } from "uuid"; const server = jsonServer.create(); const router = jsonServer.router("./src/mocks/db.json"); @@ -11,6 +12,9 @@ server.use((req, res, next) => { if (req.method === "POST") { if (req.url.includes("/delete_conversation")) { req.method = "DELETE"; + } else if (req.url === "/upload") { + const taskId = uuid(); + localStorage.setItem(taskId, true); } } next(); From 930218c0670550f5c3d76a95c36124ff95ec2a1e Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 8 Oct 2023 21:52:22 +0530 Subject: [PATCH 05/10] Mock task status call --- mock-backend/src/server.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 2e4d907c..1a52b862 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -25,6 +25,23 @@ server.use(jsonServer.rewriter(routes)); router.render = (req, res) => { if (req.url === "/feedback") { res.status(200).jsonp({ status: "ok" }); + } else if (req.url.includes("/task_status")) { + const taskId = req.query["task_id"]; + const taskIdExists = localStorage.getItem(taskId); + if (taskIdExists) { + res.status(200).jsonp({ + result: { + directory: "temp", + filename: "install.rst", + formats: [".rst", ".md", ".pdf"], + name_job: "somename", + user: "local", + }, + status: "SUCCESS", + }); + } else { + res.status(404); + } } }; From e5a875856ab350bbc1438521bf5c01e40c9c5247 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 8 Oct 2023 22:12:13 +0530 Subject: [PATCH 06/10] Minor --- mock-backend/src/server.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 1a52b862..4ea06c95 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -6,6 +6,8 @@ const server = jsonServer.create(); const router = jsonServer.router("./src/mocks/db.json"); const middlewares = jsonServer.defaults(); +const localStorage = []; + server.use(middlewares); server.use((req, res, next) => { @@ -14,7 +16,7 @@ server.use((req, res, next) => { req.method = "DELETE"; } else if (req.url === "/upload") { const taskId = uuid(); - localStorage.setItem(taskId, true); + localStorage.push(taskId); } } next(); @@ -27,7 +29,7 @@ router.render = (req, res) => { res.status(200).jsonp({ status: "ok" }); } else if (req.url.includes("/task_status")) { const taskId = req.query["task_id"]; - const taskIdExists = localStorage.getItem(taskId); + const taskIdExists = localStorage.includes(taskId); if (taskIdExists) { res.status(200).jsonp({ result: { @@ -40,7 +42,7 @@ router.render = (req, res) => { status: "SUCCESS", }); } else { - res.status(404); + res.status(404).jsonp({}); } } }; From e95ebfd6a0bff169064c5ec0cd86f092fac26318 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 15 Oct 2023 20:21:09 +0530 Subject: [PATCH 07/10] Add docker files --- docker-compose-mock.yaml | 22 ++++++++++++++++++++++ mock-backend/Dockerfile | 11 +++++++++++ 2 files changed, 33 insertions(+) create mode 100644 docker-compose-mock.yaml create mode 100644 mock-backend/Dockerfile diff --git a/docker-compose-mock.yaml b/docker-compose-mock.yaml new file mode 100644 index 00000000..a5c7419b --- /dev/null +++ b/docker-compose-mock.yaml @@ -0,0 +1,22 @@ +version: "3.9" + +services: + frontend: + build: ./frontend + environment: + - VITE_API_HOST=http://localhost:7091 + - VITE_API_STREAMING=$VITE_API_STREAMING + ports: + - "5173:5173" + depends_on: + - mock-backend + + mock-backend: + build: ./mock-backend + ports: + - "7091:7091" + + redis: + image: redis:6-alpine + ports: + - 6379:6379 diff --git a/mock-backend/Dockerfile b/mock-backend/Dockerfile new file mode 100644 index 00000000..5903b27e --- /dev/null +++ b/mock-backend/Dockerfile @@ -0,0 +1,11 @@ +FROM node:20.6.1-bullseye-slim + + +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . + +EXPOSE 7091 + +CMD [ "npm", "run", "start"] From e71d21fc274c82632da28c2d1b9f163cc5a4d1a3 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 15 Oct 2023 20:21:22 +0530 Subject: [PATCH 08/10] Fix render method --- mock-backend/src/server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 4ea06c95..8862050b 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -45,6 +45,7 @@ router.render = (req, res) => { res.status(404).jsonp({}); } } + res.status(res.statusCode).jsonp(res.locals.data); }; server.use(router); From cdfcd996952f1b7984e6896b88836266c7858f62 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 15 Oct 2023 21:31:02 +0530 Subject: [PATCH 09/10] Fix docs_check and upload endpoint --- mock-backend/src/mocks/db.json | 5 ++++- mock-backend/src/server.js | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/mock-backend/src/mocks/db.json b/mock-backend/src/mocks/db.json index f0cb04b6..6a15583e 100644 --- a/mock-backend/src/mocks/db.json +++ b/mock-backend/src/mocks/db.json @@ -225,5 +225,8 @@ "version": "0.1.0" } ], - "conversations": [] + "conversations": [], + "docs_check" : { + "status": "loaded" + } } diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 8862050b..1efb9658 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -10,6 +10,8 @@ const localStorage = []; server.use(middlewares); +server.use(jsonServer.rewriter(routes)); + server.use((req, res, next) => { if (req.method === "POST") { if (req.url.includes("/delete_conversation")) { @@ -22,11 +24,14 @@ server.use((req, res, next) => { next(); }); -server.use(jsonServer.rewriter(routes)); - router.render = (req, res) => { if (req.url === "/feedback") { res.status(200).jsonp({ status: "ok" }); + } else if (req.url === '/upload') { + res.status(200).jsonp({ + "status": "ok", + "task_id": localStorage[localStorage.length - 1] + }) } else if (req.url.includes("/task_status")) { const taskId = req.query["task_id"]; const taskIdExists = localStorage.includes(taskId); @@ -44,8 +49,9 @@ router.render = (req, res) => { } else { res.status(404).jsonp({}); } + }else { + res.status(res.statusCode).jsonp(res.locals.data); } - res.status(res.statusCode).jsonp(res.locals.data); }; server.use(router); From c0c9cab14c116f942658f4ab46b1a832365ccd37 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 29 Oct 2023 21:38:17 +0530 Subject: [PATCH 10/10] Formatting --- mock-backend/src/mocks/db.json | 4 ++-- mock-backend/src/server.js | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/mock-backend/src/mocks/db.json b/mock-backend/src/mocks/db.json index 6a15583e..4be7d3f9 100644 --- a/mock-backend/src/mocks/db.json +++ b/mock-backend/src/mocks/db.json @@ -226,7 +226,7 @@ } ], "conversations": [], - "docs_check" : { + "docs_check": { "status": "loaded" - } + } } diff --git a/mock-backend/src/server.js b/mock-backend/src/server.js index 1efb9658..f37b5d9e 100644 --- a/mock-backend/src/server.js +++ b/mock-backend/src/server.js @@ -27,11 +27,11 @@ server.use((req, res, next) => { router.render = (req, res) => { if (req.url === "/feedback") { res.status(200).jsonp({ status: "ok" }); - } else if (req.url === '/upload') { + } else if (req.url === "/upload") { res.status(200).jsonp({ - "status": "ok", - "task_id": localStorage[localStorage.length - 1] - }) + status: "ok", + task_id: localStorage[localStorage.length - 1], + }); } else if (req.url.includes("/task_status")) { const taskId = req.query["task_id"]; const taskIdExists = localStorage.includes(taskId); @@ -49,7 +49,16 @@ router.render = (req, res) => { } else { res.status(404).jsonp({}); } - }else { + } else if (req.url === "/stream") { + res.status(200).jsonp({ + data: "The answer is 42", + sources: [ + "https://en.wikipedia.org/wiki/42_(number)", + "https://en.wikipedia.org/wiki/42_(number)", + ], + conversation_id: "1234", + }); + } else { res.status(res.statusCode).jsonp(res.locals.data); } };