diff --git a/.github/workflows/backend-lint.yml b/.github/workflows/backend-lint.yml new file mode 100644 index 00000000..28431e37 --- /dev/null +++ b/.github/workflows/backend-lint.yml @@ -0,0 +1,29 @@ +name: Backend Linting + +on: + pull_request: + branches: ["main"] + paths: + - "backend/**" + +defaults: + run: + working-directory: ./backend + +jobs: + eslint: + name: Run eslint scanning + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install packages + run: npm ci + + - name: Run ESLint + run: npm run lint diff --git a/.github/workflows/frontend-service-tests.yml b/.github/workflows/frontend-service-tests.yml index 82092a49..6112af40 100644 --- a/.github/workflows/frontend-service-tests.yml +++ b/.github/workflows/frontend-service-tests.yml @@ -3,6 +3,9 @@ name: Frontend Service Tests - Playwright on: pull_request: branches: [ "main" ] + paths: + - "playwright/**" + - "frontend/**" jobs: build: diff --git a/backend/.prettierrc.json b/backend/.prettierrc.json new file mode 100644 index 00000000..cf2cbce6 --- /dev/null +++ b/backend/.prettierrc.json @@ -0,0 +1,13 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": true, + "trailingComma": "es5", + "bracketSpacing": true, + "jsxSingleQuote": false, + "arrowParens": "always", + "htmlWhitespaceSensitivity": "strict", + "endOfLine": "lf" +} \ No newline at end of file diff --git a/backend/eslint.config.mjs b/backend/eslint.config.mjs new file mode 100644 index 00000000..c6987bcc --- /dev/null +++ b/backend/eslint.config.mjs @@ -0,0 +1,30 @@ +import globals from 'globals'; +import pluginJs from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; + +export default [ + { + files: ['**/*.js'], + languageOptions: { sourceType: 'script' }, + }, + { languageOptions: { globals: globals.browser } }, + pluginJs.configs.recommended, + { + rules: { + "no-empty-pattern": ["error", { allowObjectPatternsAsParameters: true }], + }, + }, + ...tseslint.configs.recommended, + { + ignores: [ + '**config**', + 'scripts/*', + 'dist/*', + 'build/*', + 'coverage/*', + 'node_modules/*', + ], + }, + eslintPluginPrettierRecommended, +]; diff --git a/backend/package-lock.json b/backend/package-lock.json index 1e1b0ef3..c7cbd799 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -18,6 +18,7 @@ "jsonwebtoken": "^9.0.2" }, "devDependencies": { + "@eslint/js": "^9.2.0", "@types/cors": "2.8.17", "@types/express": "4.17.21", "@types/jsonwebtoken": "^9.0.6", @@ -26,12 +27,20 @@ "@vitest/coverage-istanbul": "1.2.1", "@vitest/coverage-v8": "1.2.1", "axios": "1.6.5", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", + "globals": "^15.1.0", + "husky": "^9.0.11", "nodemon": "3.0.2", "nyc": "15.1.0", + "prettier": "^3.2.5", + "pretty-quick": "^4.0.0", "prisma": "5.7.1", "supertest": "6.3.4", "ts-node": "10.9.2", "typescript": "5.3.3", + "typescript-eslint": "^7.8.0", "vitest": "1.2.1", "vitest-mock-extended": "1.3.1" } @@ -341,6 +350,15 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/traverse/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/types": { "version": "7.23.6", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", @@ -751,6 +769,140 @@ "node": ">=12" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.2.0.tgz", + "integrity": "sha512-ESiIudvhoYni+MdsI8oD7skpprZ89qKocwRM2KEvhhBJ9nl5MRh7BXU5GTod7Mdygq+AUl+QzId6iWJKR/wABA==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "dev": true + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -848,6 +1000,53 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/@prisma/client": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.7.1.tgz", @@ -1190,6 +1389,12 @@ "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", "dev": true }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, "node_modules/@types/jsonwebtoken": { "version": "9.0.6", "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.6.tgz", @@ -1232,6 +1437,12 @@ "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", "dev": true }, + "node_modules/@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", + "dev": true + }, "node_modules/@types/send": { "version": "0.17.4", "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", @@ -1274,6 +1485,226 @@ "@types/superagent": "^8.1.0" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.8.0.tgz", + "integrity": "sha512-gFTT+ezJmkwutUPmB0skOj3GZJtlEGnlssems4AjkVweUPGj7jRwwqg0Hhg7++kPGJqKtTYx+R05Ftww372aIg==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/type-utils": "7.8.0", + "@typescript-eslint/utils": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.8.0.tgz", + "integrity": "sha512-KgKQly1pv0l4ltcftP59uQZCi4HUYswCLbTqVZEJu7uLX8CTLyswqMLqLN+2QFz4jCptqWVV4SB7vdxcH2+0kQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/typescript-estree": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.8.0.tgz", + "integrity": "sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz", + "integrity": "sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "7.8.0", + "@typescript-eslint/utils": "7.8.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.8.0.tgz", + "integrity": "sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==", + "dev": true, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.8.0.tgz", + "integrity": "sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.8.0.tgz", + "integrity": "sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.15", + "@types/semver": "^7.5.8", + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/typescript-estree": "7.8.0", + "semver": "^7.6.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz", + "integrity": "sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.8.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@vitest/coverage-istanbul": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@vitest/coverage-istanbul/-/coverage-istanbul-1.2.1.tgz", @@ -1438,6 +1869,15 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/acorn-walk": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", @@ -1460,6 +1900,22 @@ "node": ">=8" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -1532,6 +1988,15 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", @@ -1756,6 +2221,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -2038,6 +2512,12 @@ "node": ">=6" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/default-require-extensions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.1.tgz", @@ -2120,6 +2600,30 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/dotenv": { "version": "16.3.2", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.2.tgz", @@ -2231,6 +2735,369 @@ "node": ">=0.8.0" } }, + "node_modules/eslint": { + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", + "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.6" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/@eslint/js": { + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/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==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "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/eslint/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==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/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==", + "dev": true + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/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==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/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==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2244,6 +3111,39 @@ "node": ">=4" } }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", @@ -2253,6 +3153,15 @@ "@types/estree": "^1.0.0" } }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -2362,12 +3271,73 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, "node_modules/fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "dev": true }, + "node_modules/fastq": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2464,6 +3434,26 @@ "node": ">=8" } }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "dev": true + }, "node_modules/follow-redirects": { "version": "1.15.5", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", @@ -2685,12 +3675,35 @@ } }, "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.1.0.tgz", + "integrity": "sha512-926gJqg+4mkxwYKiFvoomM4J0kWESfk3qfTvRL2/oc/tK/eTDBbrfcKnSa2KtfdxB5onoL7D3A3qIHQFpd4+UA==", "dev": true, "engines": { - "node": ">=4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/gopd": { @@ -2710,6 +3723,12 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -2818,6 +3837,21 @@ "node": ">=16.17.0" } }, + "node_modules/husky": { + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", + "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", + "dev": true, + "bin": { + "husky": "bin.mjs" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -2829,12 +3863,46 @@ "node": ">=0.10.0" } }, + "node_modules/ignore": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", "dev": true }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -2927,6 +3995,15 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -3107,6 +4184,24 @@ "node": ">=4" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -3165,6 +4260,28 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/local-pkg": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", @@ -3229,6 +4346,12 @@ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", @@ -3315,6 +4438,15 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -3323,6 +4455,19 @@ "node": ">= 0.6" } }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -3389,6 +4534,15 @@ "ufo": "^1.3.2" } }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3412,6 +4566,12 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -3654,6 +4814,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -3717,6 +4894,18 @@ "node": ">=8" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -3725,146 +4914,389 @@ "node": ">= 0.8" } }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=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/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "dev": true, + "dependencies": { + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" + } + }, + "node_modules/postcss": { + "version": "8.4.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", + "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/pretty-quick": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-4.0.0.tgz", + "integrity": "sha512-M+2MmeufXb/M7Xw3Afh1gxcYpj+sK0AxEfnfF958ktFeAyi5MsKY5brymVURQLgPLV1QaF5P4pb2oFJ54H3yzQ==", + "dev": true, + "dependencies": { + "execa": "^5.1.1", + "find-up": "^5.0.0", + "ignore": "^5.3.0", + "mri": "^1.2.0", + "picocolors": "^1.0.0", + "picomatch": "^3.0.1", + "tslib": "^2.6.2" + }, + "bin": { + "pretty-quick": "lib/cli.mjs" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "prettier": "^3.0.0" + } + }, + "node_modules/pretty-quick/node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/pretty-quick/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pretty-quick/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pretty-quick/node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true, "engines": { - "node": ">=8" + "node": ">=10.17.0" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "node_modules/pretty-quick/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "node_modules/pretty-quick/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true, "engines": { - "node": ">=8" + "node": ">=6" } }, - "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/pathe": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", - "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", - "dev": true - }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "node_modules/pretty-quick/node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, "engines": { - "node": "*" + "node": ">=8" } }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "node_modules/pretty-quick/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, "engines": { - "node": ">=8.6" + "node": ">=6" }, "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "node_modules/pretty-quick/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "dependencies": { - "find-up": "^4.0.0" + "yocto-queue": "^0.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/pkg-types": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", - "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "node_modules/pretty-quick/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "dependencies": { - "jsonc-parser": "^3.2.0", - "mlly": "^1.2.0", - "pathe": "^1.1.0" + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/postcss": { - "version": "8.4.33", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", - "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", + "node_modules/pretty-quick/node_modules/picomatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz", + "integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - }, "engines": { - "node": "^10 || ^12 || >=14" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "node_modules/pretty-quick/node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true, - "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=6" } }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "node_modules/pretty-quick/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, "engines": { "node": ">=10" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/prisma": { @@ -3919,6 +5351,15 @@ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", "dev": true }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -3933,6 +5374,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -4009,6 +5470,16 @@ "node": ">=8" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -4056,6 +5527,29 @@ "fsevents": "~2.3.2" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -4081,9 +5575,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4249,6 +5743,15 @@ "node": ">=10" } }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -4393,6 +5896,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-literal": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", @@ -4463,6 +5978,22 @@ "node": ">=4" } }, + "node_modules/synckit": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", + "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/terser": { "version": "5.27.0", "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.0.tgz", @@ -4505,6 +6036,12 @@ "node": ">=8" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/tinybench": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.6.0.tgz", @@ -4570,6 +6107,18 @@ "nodetouch": "bin/nodetouch.js" } }, + "node_modules/ts-api-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "dev": true, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/ts-essentials": { "version": "9.4.1", "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-9.4.1.tgz", @@ -4627,6 +6176,24 @@ } } }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -4679,6 +6246,32 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.8.0.tgz", + "integrity": "sha512-sheFG+/D8N/L7gC3WT0Q8sB97Nm573Yfr+vZFzl/4nBdYcmviBPtwGSX9TJ7wpVg28ocerKVOt+k2eGmHzcgVA==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "7.8.0", + "@typescript-eslint/parser": "7.8.0", + "@typescript-eslint/utils": "7.8.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/ufo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz", @@ -4735,6 +6328,15 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -4973,6 +6575,15 @@ "node": ">=8" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", diff --git a/backend/package.json b/backend/package.json index a994326f..c9f53484 100644 --- a/backend/package.json +++ b/backend/package.json @@ -16,11 +16,14 @@ "docker:db:up": "docker-compose up postgres -d", "docker:down": "docker-compose down", "prisma": "npx prisma migrate dev --name init", - "seed": "npx ts-node prisma/seed.ts" + "seed": "npx ts-node prisma/seed.ts", + "lint": "eslint .", + "lint:fix": "eslint . --fix" }, "author": "Dave Gordon", "license": "ISC", "devDependencies": { + "@eslint/js": "^9.2.0", "@types/cors": "2.8.17", "@types/express": "4.17.21", "@types/jsonwebtoken": "^9.0.6", @@ -29,12 +32,20 @@ "@vitest/coverage-istanbul": "1.2.1", "@vitest/coverage-v8": "1.2.1", "axios": "1.6.5", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", + "globals": "^15.1.0", + "husky": "^9.0.11", "nodemon": "3.0.2", "nyc": "15.1.0", + "prettier": "^3.2.5", + "pretty-quick": "^4.0.0", "prisma": "5.7.1", "supertest": "6.3.4", "ts-node": "10.9.2", "typescript": "5.3.3", + "typescript-eslint": "^7.8.0", "vitest": "1.2.1", "vitest-mock-extended": "1.3.1" }, @@ -46,5 +57,10 @@ "dotenv": "16.3.2", "express": "4.18.2", "jsonwebtoken": "^9.0.2" - } + }, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } +} } diff --git a/backend/prisma/seed.ts b/backend/prisma/seed.ts index b13c1d1b..229cd780 100644 --- a/backend/prisma/seed.ts +++ b/backend/prisma/seed.ts @@ -4,102 +4,106 @@ const prisma = new PrismaClient(); export const seed = [ { - "title": "Meeting Notes", - "content": "Discussed project timelines and goals.", - "createdAt": "2024-02-05T23:33:42.252Z", - "updatedAt": "2024-02-05T23:33:42.252Z", - "userID": "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" + title: 'Meeting Notes', + content: 'Discussed project timelines and goals.', + createdAt: '2024-02-05T23:33:42.252Z', + updatedAt: '2024-02-05T23:33:42.252Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, { - "title": "Different User - scoping check", - "content": "Should not see this note with Test User", - "createdAt": "2024-02-05T23:33:42.253Z", - "updatedAt": "2024-02-05T23:33:42.253Z", - "userID": "dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272" + title: 'Different User - scoping check', + content: 'Should not see this note with Test User', + createdAt: '2024-02-05T23:33:42.253Z', + updatedAt: '2024-02-05T23:33:42.253Z', + userID: 'dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, { - "title": "Recipe", - "content": "Ingredients: Chicken, tomatoes, onions, garlic.", - "createdAt": "2024-02-05T23:33:42.254Z", - "updatedAt": "2024-02-05T23:33:42.254Z", - "userID": "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" + title: 'Recipe', + content: 'Ingredients: Chicken, tomatoes, onions, garlic.', + createdAt: '2024-02-05T23:33:42.254Z', + updatedAt: '2024-02-05T23:33:42.254Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, { - "title": "Ideas", - "content": "Brainstorming ideas for the next feature release. 🚀", - "createdAt": "2024-02-05T23:33:42.255Z", - "updatedAt": "2024-02-05T23:33:42.255Z", - "userID": "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" + title: 'Ideas', + content: 'Brainstorming ideas for the next feature release. 🚀', + createdAt: '2024-02-05T23:33:42.255Z', + updatedAt: '2024-02-05T23:33:42.255Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, { - "title": "Personal Goals", - "content": "Exercise for 30 minutes daily. Read a book every week.", - "createdAt": "2024-02-05T23:33:42.256Z", - "updatedAt": "2024-02-05T23:33:42.256Z", - "userID": "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" + title: 'Personal Goals', + content: 'Exercise for 30 minutes daily. Read a book every week.', + createdAt: '2024-02-05T23:33:42.256Z', + updatedAt: '2024-02-05T23:33:42.256Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, { - "title": "Fête d'anniversaire", - "content": "Préparer une surprise pour la fête d'anniversaire.", - "createdAt": "2024-02-05T23:33:42.257Z", - "updatedAt": "2024-02-05T23:33:42.257Z", - "userID": "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" + title: "Fête d'anniversaire", + content: "Préparer une surprise pour la fête d'anniversaire.", + createdAt: '2024-02-05T23:33:42.257Z', + updatedAt: '2024-02-05T23:33:42.257Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, { - "title": "日本旅行", - "content": "計画: 東京、京都、大阪を訪れる。", - "createdAt": "2024-02-05T23:33:42.258Z", - "updatedAt": "2024-02-05T23:33:42.258Z", - "userID": "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" + title: '日本旅行', + content: '計画: 東京、京都、大阪を訪れる。', + createdAt: '2024-02-05T23:33:42.258Z', + updatedAt: '2024-02-05T23:33:42.258Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, { - "title": "Семейный ужин", - "content": "Приготовить вкусный ужин для всей семьи.", - "createdAt": "2024-02-05T23:33:42.259Z", - "updatedAt": "2024-02-05T23:33:42.259Z", - "userID": "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" + title: 'Семейный ужин', + content: 'Приготовить вкусный ужин для всей семьи.', + createdAt: '2024-02-05T23:33:42.259Z', + updatedAt: '2024-02-05T23:33:42.259Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, { - "title": "Coding Project", - "content": "Implement new features using React and Express.", - "createdAt": "2024-02-05T23:33:42.260Z", - "updatedAt": "2024-02-05T23:33:42.260Z", - "userID": "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - } + title: 'Coding Project', + content: 'Implement new features using React and Express.', + createdAt: '2024-02-05T23:33:42.260Z', + updatedAt: '2024-02-05T23:33:42.260Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, ]; async function main() { - // Seed user data - await prisma.user.createMany({ - data: [{ - id : 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', - email: 'helloitsdave@hotmail.com', - password: '$2y$10$12dKPJq7kynM4JnI.X.l6evnYqC7zFWHcAGNU4efLbtcS0ndHD23.', // n0te$App!23 - username: 'Test User', - createdAt: "2024-02-05T23:33:42.260Z", - updatedAt: "2024-02-05T23:33:42.260Z", - }, { - id : 'dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', - email: 'testing@anemailtest.com', - password: '$2y$10$U1Py3XYLbDjYC5fmktUWG.JGIfaTwu0wxdFxNKg7vFrzCuywopFYq', // test - username: 'dave', - createdAt: "2024-02-05T23:34:42.260Z", - updatedAt: "2024-02-05T23:34:42.260Z", - }] - }); + // Seed user data + await prisma.user.createMany({ + data: [ + { + id: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + email: 'helloitsdave@hotmail.com', + password: + '$2y$10$12dKPJq7kynM4JnI.X.l6evnYqC7zFWHcAGNU4efLbtcS0ndHD23.', // n0te$App!23 + username: 'Test User', + createdAt: '2024-02-05T23:33:42.260Z', + updatedAt: '2024-02-05T23:33:42.260Z', + }, + { + id: 'dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + email: 'testing@anemailtest.com', + password: + '$2y$10$U1Py3XYLbDjYC5fmktUWG.JGIfaTwu0wxdFxNKg7vFrzCuywopFYq', // test + username: 'dave', + createdAt: '2024-02-05T23:34:42.260Z', + updatedAt: '2024-02-05T23:34:42.260Z', + }, + ], + }); - // Seed note data - await prisma.note.createMany({ - data: seed, - }); + // Seed note data + await prisma.note.createMany({ + data: seed, + }); } main() - .catch((e) => { - console.error(e); - // process.exit(1); - }) - .finally(async () => { - await prisma.$disconnect(); - }); - + .catch((e) => { + console.error(e); + // process.exit(1); + }) + .finally(async () => { + await prisma.$disconnect(); + }); diff --git a/backend/src/__mocks__/prisma.ts b/backend/src/__mocks__/prisma.ts index 0dab5db8..c4a3f956 100644 --- a/backend/src/__mocks__/prisma.ts +++ b/backend/src/__mocks__/prisma.ts @@ -1,13 +1,11 @@ -import { PrismaClient } from '@prisma/client' -import { beforeEach } from 'vitest' -import { mockDeep, mockReset } from 'vitest-mock-extended' - +import { PrismaClient } from '@prisma/client'; +import { beforeEach } from 'vitest'; +import { mockDeep, mockReset } from 'vitest-mock-extended'; beforeEach(() => { - mockReset(prisma) -}) - + mockReset(prisma); +}); // 3 -const prisma = mockDeep() -export default prisma \ No newline at end of file +const prisma = mockDeep(); +export default prisma; diff --git a/backend/src/authenticateToken.ts b/backend/src/authenticateToken.ts index a71ce73a..254aa1db 100644 --- a/backend/src/authenticateToken.ts +++ b/backend/src/authenticateToken.ts @@ -1,20 +1,20 @@ -import jwt from "jsonwebtoken"; +import jwt from 'jsonwebtoken'; function authenticateToken(req, res, next) { - const authHeader = req.headers["authorization"]; - const token = authHeader && authHeader.split(" ")[1]; - - if (!token) { - return res.status(401).send({ error: "unauthorized" }); - } - - jwt.verify(token, process.env.JWT_SECRET, (err, user) => { - if (err) { - return res.status(403).send({ error: "forbidden" }); - } - req.user = user; - next(); - }); + const authHeader = req.headers['authorization']; + const token = authHeader && authHeader.split(' ')[1]; + + if (!token) { + return res.status(401).send({ error: 'unauthorized' }); } - export default authenticateToken; \ No newline at end of file + jwt.verify(token, process.env.JWT_SECRET, (err, user) => { + if (err) { + return res.status(403).send({ error: 'forbidden' }); + } + req.user = user; + next(); + }); +} + +export default authenticateToken; diff --git a/backend/src/index.ts b/backend/src/index.ts index de5127c7..ba337994 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1,10 +1,11 @@ -import express from "express"; -import cors from "cors"; -import noteRoutes from "./routes/noteRoutes"; -import userRoutes from "./routes/userRoutes"; -import loginRoutes from "./routes/loginRoutes"; +import express from 'express'; +import cors from 'cors'; +import noteRoutes from './routes/noteRoutes'; +import userRoutes from './routes/userRoutes'; +import loginRoutes from './routes/loginRoutes'; declare global { + // eslint-disable-next-line @typescript-eslint/no-namespace namespace Express { interface Request { user: { userId: string }; @@ -18,19 +19,18 @@ const PORT = 5000; app.use(express.json()); app.use(cors()); -app.use("/", noteRoutes); -app.use("/", userRoutes); -app.use("/", loginRoutes); +app.use('/', noteRoutes); +app.use('/', userRoutes); +app.use('/', loginRoutes); -app.get("/health", (req, res) => { - res.json({ status: "ok" }); +app.get('/health', (req, res) => { + res.json({ status: 'ok' }); }); - /* istanbul ignore next */ -if (process.env.NODE_ENV !== "test") { +if (process.env.NODE_ENV !== 'test') { app.listen(PORT, () => { - console.log("server running on localhost", PORT); + console.log('server running on localhost', PORT); }); } diff --git a/backend/src/prisma.ts b/backend/src/prisma.ts index ee536ace..736f1462 100644 --- a/backend/src/prisma.ts +++ b/backend/src/prisma.ts @@ -1,4 +1,4 @@ -import { PrismaClient } from '@prisma/client' +import { PrismaClient } from '@prisma/client'; -const prisma = new PrismaClient() -export default prisma \ No newline at end of file +const prisma = new PrismaClient(); +export default prisma; diff --git a/backend/src/routes/loginRoutes.ts b/backend/src/routes/loginRoutes.ts index 9063d6ae..3c8e5928 100644 --- a/backend/src/routes/loginRoutes.ts +++ b/backend/src/routes/loginRoutes.ts @@ -1,38 +1,38 @@ -import express from "express"; -import jwt from "jsonwebtoken"; -import prisma from "../prisma"; -import { comparePassword } from "../hash"; +import express from 'express'; +import jwt from 'jsonwebtoken'; +import prisma from '../prisma'; +import { comparePassword } from '../hash'; const router = express.Router(); -router.post("/api/login", async (req, res) => { +router.post('/api/login', async (req, res) => { const { username, password } = req.body; if (!username || !password) { return res .status(400) - .send({ error: "username and password fields required" }); + .send({ error: 'username and password fields required' }); } try { const user = await prisma.user.findFirst({ where: { username } }); if (!user) { - return res.status(401).send({ error: "invalid username or password" }); + return res.status(401).send({ error: 'invalid username or password' }); } const passwordMatch = await comparePassword(password, user.password); if (!passwordMatch) { - return res.status(401).send({ error: "invalid username or password" }); + return res.status(401).send({ error: 'invalid username or password' }); } const token = jwt.sign({ userId: user.id }, process.env.JWT_SECRET, { - expiresIn: "1h", + expiresIn: '1h', }); res.json({ token }); } catch (error) { - res.status(500).send({ error: "Oops, something went wrong" }); + res.status(500).send({ error: 'Oops, something went wrong' }); } }); diff --git a/backend/src/routes/noteRoutes.ts b/backend/src/routes/noteRoutes.ts index e2ba5965..410678d6 100644 --- a/backend/src/routes/noteRoutes.ts +++ b/backend/src/routes/noteRoutes.ts @@ -1,78 +1,78 @@ import express from 'express'; -import prisma from "../prisma"; -import authenticateToken from "../authenticateToken"; +import prisma from '../prisma'; +import authenticateToken from '../authenticateToken'; const router = express.Router(); -router.get("/api/notes", authenticateToken, async (req, res) => { - const userId = req.user.userId; - try { - const notes = await prisma.note.findMany({ - where: { userID: userId }, - orderBy: { updatedAt: "desc" }, - }); - res.json(notes); - } catch (error) { - res.status(500).send({ error: "Oops, something went wrong" }); - } - }); - - router.post("/api/notes", authenticateToken, async (req, res) => { - const { title, content } = req.body; - const userID = req.user.userId; - - if (!title || !content) { - return res.status(400).send({ error: "title and content fields required" }); - } - - try { - const note = await prisma.note.create({ - data: { title, content, userID }, - }); - res.json(note); - } catch (error) { - res.status(500).send({ error: "Oops, something went wrong" }); - } - }); - - router.put("/api/notes/:id", authenticateToken, async (req, res) => { - const { title, content } = req.body; - const id = parseInt(req.params.id); - - if (!title || !content) { - return res.status(400).send({ error: "title and content fields required" }); - } - - if (!id || isNaN(id)) { - return res.status(400).send({ error: "ID must be a valid number" }); - } - - try { - const updatedNote = await prisma.note.update({ - where: { id }, - data: { title, content, updatedAt: new Date() }, - }); - res.json(updatedNote); - } catch (error) { - res.status(500).send({ error: "Oops, something went wrong" }); - } - }); - - router.delete("/api/notes/:id", authenticateToken, async (req, res) => { - const id = parseInt(req.params.id); - - if (!id || isNaN(id)) { - return res.status(400).send({ error: "ID field required" }); - } - - try { - await prisma.note.delete({ - where: { id }, - }); - res.json({ status: "ok" }); - } catch (error) { - res.status(500).send({ error: "Oops, something went wrong" }); - } - }); +router.get('/api/notes', authenticateToken, async (req, res) => { + const userId = req.user.userId; + try { + const notes = await prisma.note.findMany({ + where: { userID: userId }, + orderBy: { updatedAt: 'desc' }, + }); + res.json(notes); + } catch (error) { + res.status(500).send({ error: 'Oops, something went wrong' }); + } +}); -export default router; \ No newline at end of file +router.post('/api/notes', authenticateToken, async (req, res) => { + const { title, content } = req.body; + const userID = req.user.userId; + + if (!title || !content) { + return res.status(400).send({ error: 'title and content fields required' }); + } + + try { + const note = await prisma.note.create({ + data: { title, content, userID }, + }); + res.json(note); + } catch (error) { + res.status(500).send({ error: 'Oops, something went wrong' }); + } +}); + +router.put('/api/notes/:id', authenticateToken, async (req, res) => { + const { title, content } = req.body; + const id = parseInt(req.params.id); + + if (!title || !content) { + return res.status(400).send({ error: 'title and content fields required' }); + } + + if (!id || isNaN(id)) { + return res.status(400).send({ error: 'ID must be a valid number' }); + } + + try { + const updatedNote = await prisma.note.update({ + where: { id }, + data: { title, content, updatedAt: new Date() }, + }); + res.json(updatedNote); + } catch (error) { + res.status(500).send({ error: 'Oops, something went wrong' }); + } +}); + +router.delete('/api/notes/:id', authenticateToken, async (req, res) => { + const id = parseInt(req.params.id); + + if (!id || isNaN(id)) { + return res.status(400).send({ error: 'ID field required' }); + } + + try { + await prisma.note.delete({ + where: { id }, + }); + res.json({ status: 'ok' }); + } catch (error) { + res.status(500).send({ error: 'Oops, something went wrong' }); + } +}); + +export default router; diff --git a/backend/src/routes/userRoutes.ts b/backend/src/routes/userRoutes.ts index d4f9c8a6..737f6f76 100644 --- a/backend/src/routes/userRoutes.ts +++ b/backend/src/routes/userRoutes.ts @@ -1,54 +1,55 @@ import express from 'express'; -import prisma from "../prisma"; -import authenticateToken from "../authenticateToken"; -import { hashPassword } from "../hash"; -import { comparePassword } from "../hash"; +import prisma from '../prisma'; +import authenticateToken from '../authenticateToken'; +import { hashPassword } from '../hash'; const router = express.Router(); -router.get("/api/users", authenticateToken, async (req, res) => { - try { - const users = await prisma.user.findMany(); - - const usersWithPasswordsRemoved = users.map((user) => { - delete user.password; - return user; - }); - res.json(usersWithPasswordsRemoved); - } catch (error) { - console.log("error", error); - res.status(500).send({ error: "Oops, something went wrong" }); - } +router.get('/api/users', authenticateToken, async (req, res) => { + try { + const users = await prisma.user.findMany(); + + const usersWithPasswordsRemoved = users.map((user) => { + delete user.password; + return user; + }); + res.json(usersWithPasswordsRemoved); + } catch (error) { + console.log('error', error); + res.status(500).send({ error: 'Oops, something went wrong' }); + } +}); + +router.post('/api/users', authenticateToken, async (req, res) => { + const { email, password, username } = req.body; + + if (!email || !password || !username) { + return res + .status(400) + .send({ error: 'email, password, and username fields required' }); + } + + const existingUser = await prisma.user.findFirst({ + where: { OR: [{ email }, { username }] }, }); - - router.post("/api/users", authenticateToken, async (req, res) => { - const { email, password, username } = req.body; - - if (!email || !password || !username) { + + try { + if (existingUser) { return res .status(400) - .send({ error: "email, password, and username fields required" }); + .send({ error: 'Username or email already exists' }); } - - const existingUser = await prisma.user.findFirst({ - where: { OR: [{ email }, { username }] }, + + const hashedPassword = await hashPassword(password); + + const user = await prisma.user.create({ + data: { email, password: hashedPassword, username }, }); - - try { - if (existingUser) { - return res.status(400).send({ error: "Username or email already exists" }); - } - - const hashedPassword = await hashPassword(password); - - const user = await prisma.user.create({ - data: { email, password: hashedPassword, username }, - }); - const userWithoutPassword = { ...user, password: undefined }; - res.json(userWithoutPassword); - } catch (error) { - res.status(500).send({ error: "Oops, something went wrong" }); - } - }); + const userWithoutPassword = { ...user, password: undefined }; + res.json(userWithoutPassword); + } catch (error) { + res.status(500).send({ error: 'Oops, something went wrong' }); + } +}); -export default router; \ No newline at end of file +export default router; diff --git a/backend/tests/service/notes.spec.ts b/backend/tests/service/notes.spec.ts index 72b68c8e..41efd957 100644 --- a/backend/tests/service/notes.spec.ts +++ b/backend/tests/service/notes.spec.ts @@ -1,52 +1,51 @@ -import { config } from "dotenv"; -import { test, expect, beforeAll } from "vitest"; -import request from "supertest"; -import { describe } from "node:test"; +import { config } from 'dotenv'; +import { test, expect, beforeAll } from 'vitest'; +import request from 'supertest'; +import { describe } from 'node:test'; config(); const BASE_URL = `${process.env.API_URL}`; const NOTES_URL = `${BASE_URL}/api/notes`; -let getNoteResponse: any; let createdID: number; let token: string; -test("Health check", async () => { - const response = await request(BASE_URL).get("/health"); +test('Health check', async () => { + const response = await request(BASE_URL).get('/health'); expect(response.status).toBe(200); }); -describe("Unauthenticated Flows", () => { - test("Unauthenticated - Try to get the list of Notes", async () => { - getNoteResponse = await request(NOTES_URL).get("/"); +describe('Unauthenticated Flows', () => { + test('Unauthenticated - Try to get the list of Notes', async () => { + const getNoteResponse = await request(NOTES_URL).get('/'); expect(getNoteResponse.status).toBe(401); }); - test("Unauthenticated - Try to create a note", async () => { - const res = await request(NOTES_URL).post("/").send({ - title: "This is a test note title with special characters: !@#$%^&*()", + test('Unauthenticated - Try to create a note', async () => { + const res = await request(NOTES_URL).post('/').send({ + title: 'This is a test note title with special characters: !@#$%^&*()', content: - "This is a test note content with special characters: !@#$%^&*()", + 'This is a test note content with special characters: !@#$%^&*()', }); expect(res.status).toBe(401); }); - test("Invalid username or password", async () => { - const response = await request(BASE_URL).post("/api/login").send({ - password: "wrong-password", - username: "Test User", + test('Invalid username or password', async () => { + const response = await request(BASE_URL).post('/api/login').send({ + password: 'wrong-password', + username: 'Test User', }); expect(response.status).toBe(401); - expect(response.body.error).toBe("invalid username or password"); + expect(response.body.error).toBe('invalid username or password'); }); }); -describe("Authenticated Flows", () => { +describe('Authenticated Flows', () => { beforeAll(async () => { - const response = await request(BASE_URL).post("/api/login").send({ - password: "n0te$App!23", - username: "Test User", + const response = await request(BASE_URL).post('/api/login').send({ + password: 'n0te$App!23', + username: 'Test User', }); expect(response.status).toBe(200); expect(response.body.token).toBeDefined(); @@ -54,10 +53,10 @@ describe("Authenticated Flows", () => { token = response.body.token; }); - test("Should only see notes for the given user ", async () => { - getNoteResponse = await request(NOTES_URL) - .get("/") - .set("Authorization", `Bearer ${token}`); + test('Should only see notes for the given user ', async () => { + const getNoteResponse = await request(NOTES_URL) + .get('/') + .set('Authorization', `Bearer ${token}`); expect(getNoteResponse.status).toBe(200); @@ -66,60 +65,65 @@ describe("Authenticated Flows", () => { expect(getNoteResponse.body[getNoteResponse.body.length - 1]).toStrictEqual( { - content: "Discussed project timelines and goals.", - createdAt: "2024-02-05T23:33:42.252Z", + content: 'Discussed project timelines and goals.', + createdAt: '2024-02-05T23:33:42.252Z', id: 1, - title: "Meeting Notes", - updatedAt: "2024-02-05T23:33:42.252Z", - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272", + title: 'Meeting Notes', + updatedAt: '2024-02-05T23:33:42.252Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', } ); /** Should not see notes for a different user */ - expect(getNoteResponse.body.find((note: any) => note.title === "Different User - scoping check")).toBeUndefined(); + expect( + getNoteResponse.body.find( + (note: { title: string }) => + note.title === 'Different User - scoping check' + ) + ).toBeUndefined(); }); - test("Create a new Note", async () => { + test('Create a new Note', async () => { const res = await request(NOTES_URL) - .post("/") - .set("Authorization", `Bearer ${token}`) + .post('/') + .set('Authorization', `Bearer ${token}`) .send({ - title: "This is a test note title with special characters: !@#$%^&*()", + title: 'This is a test note title with special characters: !@#$%^&*()', content: - "This is a test note content with special characters: !@#$%^&*()", + 'This is a test note content with special characters: !@#$%^&*()', }); expect(res.status).toBe(200); expect(res.body.title).toBe( - "This is a test note title with special characters: !@#$%^&*()" + 'This is a test note title with special characters: !@#$%^&*()' ); expect(res.body.content).toBe( - "This is a test note content with special characters: !@#$%^&*()" + 'This is a test note content with special characters: !@#$%^&*()' ); createdID = res.body.id; - getNoteResponse = await request(NOTES_URL) - .get("/") - .set("Authorization", `Bearer ${token}`); + const getNoteResponse = await request(NOTES_URL) + .get('/') + .set('Authorization', `Bearer ${token}`); expect(getNoteResponse.status).toBe(200); expect(getNoteResponse.body).toHaveLength(9); }); - test("Update a Note", async () => { + test('Update a Note', async () => { const updateRes = await request(NOTES_URL) .put(`/${createdID}`) - .set("Authorization", `Bearer ${token}`) + .set('Authorization', `Bearer ${token}`) .send({ - title: "This is an updated test note title", - content: "This is an updated test note content", + title: 'This is an updated test note title', + content: 'This is an updated test note content', }); expect(updateRes.status).toBe(200); - expect(updateRes.body.title).toBe("This is an updated test note title"); - expect(updateRes.body.content).toBe("This is an updated test note content"); + expect(updateRes.body.title).toBe('This is an updated test note title'); + expect(updateRes.body.content).toBe('This is an updated test note content'); - getNoteResponse = await request(NOTES_URL) - .get("/") - .set("Authorization", `Bearer ${token}`); + const getNoteResponse = await request(NOTES_URL) + .get('/') + .set('Authorization', `Bearer ${token}`); expect(getNoteResponse.status).toBe(200); expect(getNoteResponse.body).toHaveLength(9); @@ -127,24 +131,24 @@ describe("Authenticated Flows", () => { expect(getNoteResponse.body[0].id).toBe(createdID); }); - test("Delete a Note", async () => { + test('Delete a Note', async () => { const deleteRes = await request(NOTES_URL) .delete(`/${createdID}`) - .set("Authorization", `Bearer ${token}`); + .set('Authorization', `Bearer ${token}`); expect(deleteRes.status).toBe(200); - getNoteResponse = await request(NOTES_URL) - .get("/") - .set("Authorization", `Bearer ${token}`); + const getNoteResponse = await request(NOTES_URL) + .get('/') + .set('Authorization', `Bearer ${token}`); expect(getNoteResponse.status).toBe(200); expect(getNoteResponse.body).toHaveLength(8); }); - test("Error handling: Attempt to Delete a Note with invalid ID", async () => { + test('Error handling: Attempt to Delete a Note with invalid ID', async () => { const deleteRes = await request(NOTES_URL) .delete(`/invalid-id`) - .set("Authorization", `Bearer ${token}`); + .set('Authorization', `Bearer ${token}`); expect(deleteRes.status).toBe(400); - expect(deleteRes.body.error).toBe("ID field required"); + expect(deleteRes.body.error).toBe('ID field required'); }); }); diff --git a/backend/tests/service/users.spec.ts b/backend/tests/service/users.spec.ts index 89f52cb3..1bac299f 100644 --- a/backend/tests/service/users.spec.ts +++ b/backend/tests/service/users.spec.ts @@ -1,29 +1,27 @@ -import { config } from "dotenv"; -import { test, expect, beforeAll } from "vitest"; -import request from "supertest"; -import { describe } from "node:test"; +import { config } from 'dotenv'; +import { test, expect, beforeAll } from 'vitest'; +import request from 'supertest'; +import { describe } from 'node:test'; config(); const BASE_URL = `${process.env.API_URL}`; const USERS_URL = `${BASE_URL}/api/users`; -let getUsersResponse: any; -let createdID: number; let token: string; -describe("Unauthenticated Flows", () => { - test("Should not be able to get the list of Users", async () => { - getUsersResponse = await request(USERS_URL).get("/"); +describe('Unauthenticated Flows', () => { + test('Should not be able to get the list of Users', async () => { + const getUsersResponse = await request(USERS_URL).get('/'); expect(getUsersResponse.status).toBe(401); }); }); -describe("Authenticated Flows", () => { +describe('Authenticated Flows', () => { beforeAll(async () => { - const response = await request(BASE_URL).post("/api/login").send({ - password: "n0te$App!23", - username: "Test User", + const response = await request(BASE_URL).post('/api/login').send({ + password: 'n0te$App!23', + username: 'Test User', }); expect(response.status).toBe(200); expect(response.body.token).toBeDefined(); @@ -31,40 +29,38 @@ describe("Authenticated Flows", () => { token = response.body.token; }); - test("Get the list of Users", async () => { - getUsersResponse = await request(USERS_URL) - .get("/") - .set("Authorization", `Bearer ${token}`); + test('Get the list of Users', async () => { + const getUsersResponse = await request(USERS_URL) + .get('/') + .set('Authorization', `Bearer ${token}`); expect(getUsersResponse.status).toBe(200); expect(getUsersResponse.body.length).toBeGreaterThan(0); }); test("Username's should be unique", async () => { const response = await request(USERS_URL) - .post("/") - .set("Authorization", `Bearer ${token}`) + .post('/') + .set('Authorization', `Bearer ${token}`) .send({ - username: "Test User", - password: "n0te$App!23", - email: "helloitsdave@hotmail.com" + username: 'Test User', + password: 'n0te$App!23', + email: 'helloitsdave@hotmail.com', }); expect(response.status).toBe(400); - expect(response.body.error).toBe("Username or email already exists"); + expect(response.body.error).toBe('Username or email already exists'); }); test('Create a new User', async () => { const randomUsername = Math.random().toString(36).substring(7); const response = await request(USERS_URL) - .post("/") - .set("Authorization", `Bearer ${token}`) + .post('/') + .set('Authorization', `Bearer ${token}`) .send({ username: randomUsername, - password: "n0te$App!23", - email: `${randomUsername}@testing.com` + password: 'n0te$App!23', + email: `${randomUsername}@testing.com`, }); expect(response.status).toBe(200); expect(response.body.id).toBeDefined(); - createdID = response.body.id; }); - }); diff --git a/backend/tests/unit/login.spec.ts b/backend/tests/unit/login.spec.ts index 7448bca2..7fb38965 100644 --- a/backend/tests/unit/login.spec.ts +++ b/backend/tests/unit/login.spec.ts @@ -1,122 +1,122 @@ -import { test, describe, expect, vi, beforeAll, afterAll } from "vitest"; -import request from "supertest"; -import jwt from "jsonwebtoken"; -import app from "../../src/index"; -import prisma from "../../src/__mocks__/prisma"; -import { noteSeed } from "./mocks/notes.mock"; +import { test, describe, expect, vi, beforeAll } from 'vitest'; +import request from 'supertest'; +import jwt from 'jsonwebtoken'; +import app from '../../src/index'; +import prisma from '../../src/__mocks__/prisma'; +import { noteSeed } from './mocks/notes.mock'; process.env.JWT_SECRET = - "6aee497e203c288c08420c4db3375648390d51a873bf916e8d22d1f32e02f571e3ec57b78bd4be29a9d42cc5953df6c7902f77c560892754954d0efa74d2f154"; + '6aee497e203c288c08420c4db3375648390d51a873bf916e8d22d1f32e02f571e3ec57b78bd4be29a9d42cc5953df6c7902f77c560892754954d0efa74d2f154'; beforeAll(() => { // Mock the prisma client - vi.mock("../../src/prisma"); + vi.mock('../../src/prisma'); }); -describe("Login", () => { - test("Valid Login returns token", async ({}) => { +describe('Login', () => { + test('Valid Login returns token', async ({}) => { prisma.user.findFirst.mockResolvedValue({ - id: "dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272", - username: "Jim", - email: "jim@test.com", - password: "$2y$10$bKV15yWoF6HsPvXbHvSVq.j5bJ/FItstiCt/DraA9i.LxYx2hLrbG", // pass - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), + id: 'dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + username: 'Jim', + email: 'jim@test.com', + password: '$2y$10$bKV15yWoF6HsPvXbHvSVq.j5bJ/FItstiCt/DraA9i.LxYx2hLrbG', // pass + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), }); - const response = await request(app).post("/api/login").send({ - username: "Jim", - password: "pass", + const response = await request(app).post('/api/login').send({ + username: 'Jim', + password: 'pass', }); expect(response.status).toBe(200); expect(response.body.token).toBeDefined(); // Expect the token when parsed to have the user id const token = response.body.token; const decoded = jwt.decode(token) as jwt.JwtPayload; - expect(decoded.userId).toBe("dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272"); + expect(decoded.userId).toBe('dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272'); }); - test("Invalid password", async ({}) => { + test('Invalid password', async ({}) => { prisma.user.findFirst.mockResolvedValue({ - id: "dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272", - username: "Jim", - email: "jim@test.com", - password: "$2y$10$bKV15yWoF6HsPvXbHvSVq.j5bJ/FItstiCt/DraA9i.LxYx2hLrbG", // pass - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), + id: 'dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + username: 'Jim', + email: 'jim@test.com', + password: '$2y$10$bKV15yWoF6HsPvXbHvSVq.j5bJ/FItstiCt/DraA9i.LxYx2hLrbG', // pass + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), }); - const response = await request(app).post("/api/login").send({ - username: "Jim", - password: "wrongpass", + const response = await request(app).post('/api/login').send({ + username: 'Jim', + password: 'wrongpass', }); expect(response.status).toBe(401); expect(response.body).toStrictEqual({ - error: "invalid username or password", + error: 'invalid username or password', }); }); - test("No username", async ({}) => { - const response = await request(app).post("/api/login").send({ - password: "password", + test('No username', async ({}) => { + const response = await request(app).post('/api/login').send({ + password: 'password', }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "username and password fields required", + error: 'username and password fields required', }); }); - test("No password", async ({}) => { - const response = await request(app).post("/api/login").send({ - username: "checer", + test('No password', async ({}) => { + const response = await request(app).post('/api/login').send({ + username: 'checer', }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "username and password fields required", + error: 'username and password fields required', }); }); - test("No matching user", async ({}) => { + test('No matching user', async ({}) => { prisma.user.findFirst.mockResolvedValue(null); - const response = await request(app).post("/api/login").send({ - username: "Frank", - password: "pass", + const response = await request(app).post('/api/login').send({ + username: 'Frank', + password: 'pass', }); expect(response.status).toBe(401); expect(response.body).toStrictEqual({ - error: "invalid username or password", + error: 'invalid username or password', }); }); - test("Network error", async ({}) => { + test('Network error', async ({}) => { prisma.user.findFirst.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); - const response = await request(app).post("/api/login").send({ - username: "Frank", - password: "pass", + const response = await request(app).post('/api/login').send({ + username: 'Frank', + password: 'pass', }); expect(response.status).toBe(500); expect(response.body).toStrictEqual({ - error: "Oops, something went wrong", + error: 'Oops, something went wrong', }); }); }); -describe("Authenticate Token", () => { - test("Valid token", async ({}) => { +describe('Authenticate Token', () => { + test('Valid token', async ({}) => { const token = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJkY2Y4OWE3ZS1iOTQxLTRmMTctYmJlMC00ZTBjOGIyY2QyNzIiLCJpYXQiOjE3MTA3OTU1NDIsImV4cCI6MTc3MzkxMDc0Mn0.U17p3b4yYdOpfi2C1mh1IkDZqvPF-w_gIBsim-1ga8k"; + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJkY2Y4OWE3ZS1iOTQxLTRmMTctYmJlMC00ZTBjOGIyY2QyNzIiLCJpYXQiOjE3MTA3OTU1NDIsImV4cCI6MTc3MzkxMDc0Mn0.U17p3b4yYdOpfi2C1mh1IkDZqvPF-w_gIBsim-1ga8k'; prisma.note.findMany.mockResolvedValue(noteSeed); const response = await request(app) - .get("/api/notes") - .set("Authorization", `Bearer ${token}`); + .get('/api/notes') + .set('Authorization', `Bearer ${token}`); expect(response.status).toBe(200); }); - test("No token", async ({}) => { - const response = await request(app).get("/api/notes"); + test('No token', async ({}) => { + const response = await request(app).get('/api/notes'); expect(response.status).toBe(401); - expect(response.body).toStrictEqual({ error: "unauthorized" }); + expect(response.body).toStrictEqual({ error: 'unauthorized' }); }); - test("Invalid token", async ({}) => { + test('Invalid token', async ({}) => { const response = await request(app) - .get("/api/notes") - .set("Authorization", "Bearer invalidtoken"); + .get('/api/notes') + .set('Authorization', 'Bearer invalidtoken'); expect(response.status).toBe(403); - expect(response.body).toStrictEqual({ error: "forbidden" }); + expect(response.body).toStrictEqual({ error: 'forbidden' }); }); }); diff --git a/backend/tests/unit/mocks/notes.mock.ts b/backend/tests/unit/mocks/notes.mock.ts index 648d3796..6ce1ff4a 100644 --- a/backend/tests/unit/mocks/notes.mock.ts +++ b/backend/tests/unit/mocks/notes.mock.ts @@ -1,74 +1,74 @@ export const noteSeed = [ - { - id: 1, - title: "Meeting Notes", - content: "Discussed project timelines and goals.", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - { - id: 2, - title: "Shopping List", - content: "Milk, eggs, bread, and fruits.", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - { - id: 3, - title: "Recipe", - content: "Ingredients: Chicken, tomatoes, onions, garlic.", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - { - id: 4, - title: "Ideas", - content: "Brainstorming ideas for the next feature release. 🚀", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - { - id: 5, - title: "Personal Goals", - content: "Exercise for 30 minutes daily. Read a book every week.", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - { - id: 6, - title: "Fête d'anniversaire", - content: "Préparer une surprise pour la fête d'anniversaire.", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - { - id: 7, - title: "日本旅行", - content: "計画: 東京、京都、大阪を訪れる。", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - { - id: 8, - title: "Семейный ужин", - content: "Приготовить вкусный ужин для всей семьи.", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - { - id: 9, - title: "Coding Project", - content: "Implement new features using React and Express.", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" - }, - ]; \ No newline at end of file + { + id: 1, + title: 'Meeting Notes', + content: 'Discussed project timelines and goals.', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, + { + id: 2, + title: 'Shopping List', + content: 'Milk, eggs, bread, and fruits.', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, + { + id: 3, + title: 'Recipe', + content: 'Ingredients: Chicken, tomatoes, onions, garlic.', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, + { + id: 4, + title: 'Ideas', + content: 'Brainstorming ideas for the next feature release. 🚀', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, + { + id: 5, + title: 'Personal Goals', + content: 'Exercise for 30 minutes daily. Read a book every week.', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, + { + id: 6, + title: "Fête d'anniversaire", + content: "Préparer une surprise pour la fête d'anniversaire.", + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, + { + id: 7, + title: '日本旅行', + content: '計画: 東京、京都、大阪を訪れる。', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, + { + id: 8, + title: 'Семейный ужин', + content: 'Приготовить вкусный ужин для всей семьи.', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, + { + id: 9, + title: 'Coding Project', + content: 'Implement new features using React and Express.', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + }, +]; diff --git a/backend/tests/unit/mocks/users.mock.ts b/backend/tests/unit/mocks/users.mock.ts index 4291e07a..c2ce15c1 100644 --- a/backend/tests/unit/mocks/users.mock.ts +++ b/backend/tests/unit/mocks/users.mock.ts @@ -1,26 +1,26 @@ export const userSeed = [ - { - id: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272", - username: "Dave@notes.app", - email: "dave@test.com", - password: "shouldnotappear", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - }, - { - id: "dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272", - username: "Jim O'Brien", - email: "jim@test.com", - password: "shouldnotappear", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - }, - { - id: "dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272", - username: "Jim", - email: "email.email@email.io", - password: "shouldnotappear", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:43:42.252Z"), - }, - ]; \ No newline at end of file + { + id: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + username: 'Dave@notes.app', + email: 'dave@test.com', + password: 'shouldnotappear', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + }, + { + id: 'dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + username: "Jim O'Brien", + email: 'jim@test.com', + password: 'shouldnotappear', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + }, + { + id: 'dcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + username: 'Jim', + email: 'email.email@email.io', + password: 'shouldnotappear', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:43:42.252Z'), + }, +]; diff --git a/backend/tests/unit/notes.spec.ts b/backend/tests/unit/notes.spec.ts index 039795bb..8d5446ce 100644 --- a/backend/tests/unit/notes.spec.ts +++ b/backend/tests/unit/notes.spec.ts @@ -1,235 +1,235 @@ -import { test, describe, expect, vi, beforeAll } from "vitest"; -import request from "supertest"; -import app from "../../src/index"; -import prisma from "../../src/__mocks__/prisma"; -import { noteSeed } from "./mocks/notes.mock"; -import { userSeed } from "./mocks/users.mock"; +import { test, describe, expect, vi, beforeAll } from 'vitest'; +import request from 'supertest'; +import app from '../../src/index'; +import prisma from '../../src/__mocks__/prisma'; +import { noteSeed } from './mocks/notes.mock'; +import { userSeed } from './mocks/users.mock'; beforeAll(() => { // Mock the prisma client - vi.mock("../../src/prisma"); + vi.mock('../../src/prisma'); // Mock the authenticateToken function - vi.mock("../../src/authenticateToken", () => { + vi.mock('../../src/authenticateToken', () => { return { default: (req, res, next) => { - req.user = { id: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" }; + req.user = { id: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272' }; next(); }, }; }); }); -describe("View notes", () => { - test("No notes returned - success", async ({}) => { +describe('View notes', () => { + test('No notes returned - success', async ({}) => { prisma.note.findMany.mockResolvedValue([]); - const response = await request(app).get("/api/notes"); + const response = await request(app).get('/api/notes'); expect(response.status).toBe(200); expect(response.body).toStrictEqual([]); }); - test("Single note returned - success", async ({}) => { + test('Single note returned - success', async ({}) => { prisma.note.findMany.mockResolvedValue([noteSeed[0]]); - const response = await request(app).get("/api/notes"); + const response = await request(app).get('/api/notes'); expect(response.status).toBe(200); expect(response.body).toEqual([ { id: 1, - title: "Meeting Notes", - content: "Discussed project timelines and goals.", - createdAt: "2024-02-05T23:43:42.252Z", - updatedAt: "2024-02-05T23:33:42.252Z", - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272", + title: 'Meeting Notes', + content: 'Discussed project timelines and goals.', + createdAt: '2024-02-05T23:43:42.252Z', + updatedAt: '2024-02-05T23:33:42.252Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }, ]); }); - test("Many notes returned - success", async ({}) => { + test('Many notes returned - success', async ({}) => { prisma.note.findMany.mockResolvedValue(noteSeed); - const response = await request(app).get("/api/notes"); + const response = await request(app).get('/api/notes'); expect(response.status).toBe(200); const expectedResult = noteSeed.map((item) => ({ ...item, createdAt: new Date(item.createdAt).toISOString(), updatedAt: new Date(item.updatedAt).toISOString(), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272", + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', })); expect(response.body).toEqual(expectedResult); }); - test("500 error - failure", async ({}) => { + test('500 error - failure', async ({}) => { prisma.note.findMany.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); - const response = await request(app).get("/api/notes"); + const response = await request(app).get('/api/notes'); expect(response.status).toBe(500); }); }); -describe("Create a note", () => { - test("POST with title and content", async ({}) => { +describe('Create a note', () => { + test('POST with title and content', async ({}) => { prisma.note.create.mockResolvedValue({ - content: "Test", - title: "Test", + content: 'Test', + title: 'Test', id: 1, - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:33:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272", + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:33:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }); const response = await request(app) - .post("/api/notes") - .send({ content: "Test", title: "Test" }); + .post('/api/notes') + .send({ content: 'Test', title: 'Test' }); expect(response.status).toBe(200); }); - test("POST with with title - failure", async ({}) => { + test('POST with with title - failure', async ({}) => { const response = await request(app) - .post("/api/notes") - .send({ content: "Test" }); + .post('/api/notes') + .send({ content: 'Test' }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "title and content fields required", + error: 'title and content fields required', }); }); - test("POST without content - failure", async ({}) => { + test('POST without content - failure', async ({}) => { const response = await request(app) - .post("/api/notes") - .send({ title: "Test" }); + .post('/api/notes') + .send({ title: 'Test' }); expect(response.status).toBe(400); }); - test("POST without title - failure", async ({}) => { + test('POST without title - failure', async ({}) => { const response = await request(app) - .post("/api/notes") - .send({ content: "Test" }); + .post('/api/notes') + .send({ content: 'Test' }); expect(response.status).toBe(400); }); - test("POST with 500 error", async ({}) => { + test('POST with 500 error', async ({}) => { prisma.note.create.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); const response = await request(app) - .post("/api/notes") - .send({ content: "Test", title: "Test" }); + .post('/api/notes') + .send({ content: 'Test', title: 'Test' }); expect(response.status).toBe(500); expect(response.body).toStrictEqual({ - error: "Oops, something went wrong", + error: 'Oops, something went wrong', }); }); }); -describe("Update a note", () => { - test("PUT update note - success", async ({}) => { +describe('Update a note', () => { + test('PUT update note - success', async ({}) => { prisma.note.update.mockResolvedValue({ - title: "Test update", - content: "Test", + title: 'Test update', + content: 'Test', id: 1, - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:33:42.252Z"), - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272", + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:33:42.252Z'), + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }); const response = await request(app) - .put("/api/notes/1") - .send({ title: "Test update", content: "Test", id: 1 }); + .put('/api/notes/1') + .send({ title: 'Test update', content: 'Test', id: 1 }); expect(response.status).toBe(200); expect(response.body).toStrictEqual({ - title: "Test update", - content: "Test", - createdAt: "2024-02-05T23:33:42.252Z", + title: 'Test update', + content: 'Test', + createdAt: '2024-02-05T23:33:42.252Z', id: 1, - updatedAt: "2024-02-05T23:33:42.252Z", - userID: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272", + updatedAt: '2024-02-05T23:33:42.252Z', + userID: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272', }); }); - test("PUT without title - failure", async ({}) => { + test('PUT without title - failure', async ({}) => { const response = await request(app) - .put("/api/notes/1") - .send({ content: "Test", id: 1 }); + .put('/api/notes/1') + .send({ content: 'Test', id: 1 }); expect(response.status).toBe(400); }); - test("PUT without content - failure", async ({}) => { + test('PUT without content - failure', async ({}) => { const response = await request(app) - .put("/api/notes/1") - .send({ title: "Test" }); + .put('/api/notes/1') + .send({ title: 'Test' }); expect(response.status).toBe(400); }); - test("PUT without id in url - failure", async ({}) => { + test('PUT without id in url - failure', async ({}) => { const response = await request(app) - .put("/api/notes/") - .send({ title: "Test" }); + .put('/api/notes/') + .send({ title: 'Test' }); expect(response.status).toBe(404); }); - test("PUT with not string in url - failure", async ({}) => { + test('PUT with not string in url - failure', async ({}) => { const response = await request(app) - .put("/api/notes/blah") - .send({ title: "Test", content: "Test", id: 1 }); + .put('/api/notes/blah') + .send({ title: 'Test', content: 'Test', id: 1 }); expect(response.status).toBe(400); - expect(response.body).toStrictEqual({ error: "ID must be a valid number" }); + expect(response.body).toStrictEqual({ error: 'ID must be a valid number' }); }); - test("PUT with a 500 error - failure", async ({}) => { + test('PUT with a 500 error - failure', async ({}) => { prisma.note.update.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); const response = await request(app) - .put("/api/notes/1") - .send({ title: "Test update", content: "Test", id: 1 }); + .put('/api/notes/1') + .send({ title: 'Test update', content: 'Test', id: 1 }); expect(response.status).toBe(500); expect(response.body).toStrictEqual({ - error: "Oops, something went wrong", + error: 'Oops, something went wrong', }); }); }); -describe("Delete a note", () => { - test("DELETE with id error", async ({}) => { - const response = await request(app).delete("/api/notes/1"); +describe('Delete a note', () => { + test('DELETE with id error', async ({}) => { + const response = await request(app).delete('/api/notes/1'); expect(prisma.note.delete).toHaveBeenCalled(); expect(response.status).toBe(200); - expect(response.body).toStrictEqual({ status: "ok" }); + expect(response.body).toStrictEqual({ status: 'ok' }); }); - test("DELETE without id - failure", async ({}) => { - const response = await request(app).delete("/api/notes/"); + test('DELETE without id - failure', async ({}) => { + const response = await request(app).delete('/api/notes/'); expect(response.status).toBe(404); }); - test("DELETE with id error", async ({}) => { + test('DELETE with id error', async ({}) => { prisma.note.delete.mockRejectedValue({}); - const response = await request(app).delete("/api/notes/1"); + const response = await request(app).delete('/api/notes/1'); expect(prisma.note.delete).toHaveBeenCalled(); expect(response.status).toBe(500); expect(response.body).toStrictEqual({ - error: "Oops, something went wrong", + error: 'Oops, something went wrong', }); }); - test("DELETE with id error", async ({}) => { + test('DELETE with id error', async ({}) => { prisma.note.delete.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); - const response = await request(app).delete("/api/notes/string"); + const response = await request(app).delete('/api/notes/string'); expect(response.status).toBe(400); - expect(response.body).toStrictEqual({ error: "ID field required" }); + expect(response.body).toStrictEqual({ error: 'ID field required' }); }); }); -describe("Health check", () => { - test("GET /health", async ({}) => { - const response = await request(app).get("/health"); +describe('Health check', () => { + test('GET /health', async ({}) => { + const response = await request(app).get('/health'); expect(response.status).toBe(200); - expect(response.body).toStrictEqual({ status: "ok" }); + expect(response.body).toStrictEqual({ status: 'ok' }); }); }); -describe("Get Users", () => { - test("No Users returned", async ({}) => { +describe('Get Users', () => { + test('No Users returned', async ({}) => { prisma.user.findMany.mockResolvedValue([]); - const response = await request(app).get("/api/users"); + const response = await request(app).get('/api/users'); expect(response.status).toBe(200); expect(response.body).toStrictEqual([]); }); - test("Should get many users returned", async () => { + test('Should get many users returned', async () => { prisma.user.findMany.mockResolvedValue(userSeed); - const response = await request(app).get("/api/users"); + const response = await request(app).get('/api/users'); expect(response.status).toBe(200); const expectedResult = userSeed.map((item) => ({ @@ -238,79 +238,79 @@ describe("Get Users", () => { updatedAt: new Date(item.updatedAt).toISOString(), })); - expect(response.body[0]).not.toHaveProperty("password"); + expect(response.body[0]).not.toHaveProperty('password'); expect(response.body).toEqual(expectedResult); }); - test("Network Error", async ({}) => { + test('Network Error', async ({}) => { prisma.user.findMany.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); - const response = await request(app).get("/api/users"); + const response = await request(app).get('/api/users'); expect(response.status).toBe(500); expect(response.body).toStrictEqual({ - error: "Oops, something went wrong", + error: 'Oops, something went wrong', }); }); }); -describe("Create User", () => { - test("POST with email, username and password", async ({}) => { +describe('Create User', () => { + test('POST with email, username and password', async ({}) => { prisma.user.create.mockResolvedValue({ - id: "gcf89a7e-b941-4f17-bbe0-4e0c8b2cd272", - email: "test@email.com", - username: "Dave", - password: "check", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:33:42.252Z"), + id: 'gcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + email: 'test@email.com', + username: 'Dave', + password: 'check', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:33:42.252Z'), }); const response = await request(app) - .post("/api/users") - .send({ email: "email", username: "Dave", password: "check" }); + .post('/api/users') + .send({ email: 'email', username: 'Dave', password: 'check' }); expect(response.status).toBe(200); }); - test("POST without email", async ({}) => { + test('POST without email', async ({}) => { const response = await request(app) - .post("/api/users") - .send({ username: "Dave", password: "check" }); + .post('/api/users') + .send({ username: 'Dave', password: 'check' }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "email, password, and username fields required", + error: 'email, password, and username fields required', }); }); - test("POST without username", async ({}) => { + test('POST without username', async ({}) => { const response = await request(app) - .post("/api/users") - .send({ email: "Dave@hotmail.com", password: "check" }); + .post('/api/users') + .send({ email: 'Dave@hotmail.com', password: 'check' }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "email, password, and username fields required", + error: 'email, password, and username fields required', }); }); - test("POST without password", async ({}) => { + test('POST without password', async ({}) => { const response = await request(app) - .post("/api/users") - .send({ email: "Dave@hotmail.com", username: "check" }); + .post('/api/users') + .send({ email: 'Dave@hotmail.com', username: 'check' }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "email, password, and username fields required", + error: 'email, password, and username fields required', }); }); - test("POST with error", async ({}) => { + test('POST with error', async ({}) => { prisma.user.create.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); const response = await request(app) - .post("/api/users") - .send({ email: "email", username: "Dave", password: "check" }); + .post('/api/users') + .send({ email: 'email', username: 'Dave', password: 'check' }); expect(response.status).toBe(500); expect(response.body).toStrictEqual({ - error: "Oops, something went wrong", + error: 'Oops, something went wrong', }); }); }); diff --git a/backend/tests/unit/primsa.spec.ts b/backend/tests/unit/primsa.spec.ts index a8532a93..c8378007 100644 --- a/backend/tests/unit/primsa.spec.ts +++ b/backend/tests/unit/primsa.spec.ts @@ -1,10 +1,10 @@ -import { test, expect } from "vitest"; -import prisma from "../../src/prisma"; +import { test, expect } from 'vitest'; +import prisma from '../../src/prisma'; -test("Ensure Prisma Singleton contains note schema", async () => { - expect(prisma).toHaveProperty('note'); +test('Ensure Prisma Singleton contains note schema', async () => { + expect(prisma).toHaveProperty('note'); }); -test("Ensure Prisma Singleton contains note schema", async () => { - expect(prisma).toHaveProperty('user'); +test('Ensure Prisma Singleton contains note schema', async () => { + expect(prisma).toHaveProperty('user'); }); diff --git a/backend/tests/unit/users.spec.ts b/backend/tests/unit/users.spec.ts index 711bc266..89c22805 100644 --- a/backend/tests/unit/users.spec.ts +++ b/backend/tests/unit/users.spec.ts @@ -1,37 +1,36 @@ -import { test, describe, expect, vi, beforeAll, afterAll } from "vitest"; -import request from "supertest"; -import app from "../../src/index"; -import prisma from "../../src/__mocks__/prisma"; -import { noteSeed } from "./mocks/notes.mock"; -import { userSeed } from "./mocks/users.mock"; +import { test, describe, expect, vi, beforeAll } from 'vitest'; +import request from 'supertest'; +import app from '../../src/index'; +import prisma from '../../src/__mocks__/prisma'; +import { userSeed } from './mocks/users.mock'; beforeAll(() => { // Mock the prisma client - vi.mock("../../src/prisma"); + vi.mock('../../src/prisma'); // Mock the authenticateToken function - vi.mock("../../src/authenticateToken", () => { + vi.mock('../../src/authenticateToken', () => { return { default: (req, res, next) => { - req.user = { id: "ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272" }; + req.user = { id: 'ccf89a7e-b941-4f17-bbe0-4e0c8b2cd272' }; next(); }, }; }); }); -describe("Get Users", () => { - test("No Users returned", async ({}) => { +describe('Get Users', () => { + test('No Users returned', async ({}) => { prisma.user.findMany.mockResolvedValue([]); - const response = await request(app).get("/api/users"); + const response = await request(app).get('/api/users'); expect(response.status).toBe(200); expect(response.body).toStrictEqual([]); }); - test("Should get many users returned", async () => { + test('Should get many users returned', async () => { prisma.user.findMany.mockResolvedValue(userSeed); - const response = await request(app).get("/api/users"); + const response = await request(app).get('/api/users'); expect(response.status).toBe(200); const expectedResult = userSeed.map((item) => ({ @@ -40,97 +39,97 @@ describe("Get Users", () => { updatedAt: new Date(item.updatedAt).toISOString(), })); - expect(response.body[0]).not.toHaveProperty("password"); + expect(response.body[0]).not.toHaveProperty('password'); expect(response.body).toEqual(expectedResult); }); - test("Network Error", async ({}) => { + test('Network Error', async ({}) => { prisma.user.findMany.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); - const response = await request(app).get("/api/users"); + const response = await request(app).get('/api/users'); expect(response.status).toBe(500); expect(response.body).toStrictEqual({ - error: "Oops, something went wrong", + error: 'Oops, something went wrong', }); }); }); -describe("Create User", () => { - test("POST with email, username and password", async ({}) => { +describe('Create User', () => { + test('POST with email, username and password', async ({}) => { prisma.user.create.mockResolvedValue({ - id: "gcf89a7e-b941-4f17-bbe0-4e0c8b2cd272", - email: "test@email.com", - username: "Dave", - password: "check", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:33:42.252Z"), + id: 'gcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + email: 'test@email.com', + username: 'Dave', + password: 'check', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:33:42.252Z'), }); const response = await request(app) - .post("/api/users") - .send({ email: "email", username: "Dave", password: "check" }); + .post('/api/users') + .send({ email: 'email', username: 'Dave', password: 'check' }); expect(response.status).toBe(200); }); - test("POST with existing username", async ({}) => { + test('POST with existing username', async ({}) => { prisma.user.findFirst.mockResolvedValue({ - id: "gcf89a7e-b941-4f17-bbe0-4e0c8b2cd272", - email: "email", - username: "Dave", - password: "check", - updatedAt: new Date("2024-02-05T23:33:42.252Z"), - createdAt: new Date("2024-02-05T23:33:42.252Z"), + id: 'gcf89a7e-b941-4f17-bbe0-4e0c8b2cd272', + email: 'email', + username: 'Dave', + password: 'check', + updatedAt: new Date('2024-02-05T23:33:42.252Z'), + createdAt: new Date('2024-02-05T23:33:42.252Z'), }); const response = await request(app) - .post("/api/users") - .send({ email: "email", username: "Dave", password: "check" }); + .post('/api/users') + .send({ email: 'email', username: 'Dave', password: 'check' }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "Username or email already exists", + error: 'Username or email already exists', }); }); - test("POST without email", async ({}) => { + test('POST without email', async ({}) => { const response = await request(app) - .post("/api/users") - .send({ username: "Dave", password: "check" }); + .post('/api/users') + .send({ username: 'Dave', password: 'check' }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "email, password, and username fields required", + error: 'email, password, and username fields required', }); }); - test("POST without username", async ({}) => { + test('POST without username', async ({}) => { const response = await request(app) - .post("/api/users") - .send({ email: "Dave@hotmail.com", password: "check" }); + .post('/api/users') + .send({ email: 'Dave@hotmail.com', password: 'check' }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "email, password, and username fields required", + error: 'email, password, and username fields required', }); }); - test("POST without password", async ({}) => { + test('POST without password', async ({}) => { const response = await request(app) - .post("/api/users") - .send({ email: "Dave@hotmail.com", username: "check" }); + .post('/api/users') + .send({ email: 'Dave@hotmail.com', username: 'check' }); expect(response.status).toBe(400); expect(response.body).toStrictEqual({ - error: "email, password, and username fields required", + error: 'email, password, and username fields required', }); }); - test("POST with error", async ({}) => { + test('POST with error', async ({}) => { prisma.user.create.mockImplementation(() => { - throw new Error("Test error"); + throw new Error('Test error'); }); const response = await request(app) - .post("/api/users") - .send({ email: "email", username: "Dave", password: "check" }); + .post('/api/users') + .send({ email: 'email', username: 'Dave', password: 'check' }); expect(response.status).toBe(500); expect(response.body).toStrictEqual({ - error: "Oops, something went wrong", + error: 'Oops, something went wrong', }); }); });