From dc7b0b6c312b35601aaad136d3f91e66e0af0cf2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Aug 2026 17:54:41 +0000 Subject: [PATCH 01/13] build(deps): bump brace-expansion, typescript-eslint and eslint Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) to 5.0.9 and updates ancestor dependencies [brace-expansion](https://github.com/juliangruber/brace-expansion), [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) and [eslint](https://github.com/eslint/eslint). These dependencies need to be updated together. Updates `brace-expansion` from 5.0.7 to 5.0.9 - [Release notes](https://github.com/juliangruber/brace-expansion/releases) - [Commits](https://github.com/juliangruber/brace-expansion/compare/v5.0.7...v5.0.9) Updates `typescript-eslint` from 7.18.0 to 8.65.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.65.0/packages/typescript-eslint) Updates `eslint` from 8.57.1 to 10.8.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Commits](https://github.com/eslint/eslint/compare/v8.57.1...v10.8.0) --- updated-dependencies: - dependency-name: brace-expansion dependency-version: 5.0.9 dependency-type: indirect - dependency-name: typescript-eslint dependency-version: 8.65.0 dependency-type: direct:production - dependency-name: eslint dependency-version: 10.8.0 dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package-lock.json | 1172 +++++++++++++++++---------------------------- package.json | 4 +- 2 files changed, 440 insertions(+), 736 deletions(-) diff --git a/package-lock.json b/package-lock.json index a6429e7..770f8d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "mariadb": "^3.2.0", "morgan": "^1.10.1", "rss-parser": "github:ZRunner/rss-parser", - "typescript-eslint": "^7.1.1", + "typescript-eslint": "^8.65.0", "typia": "^7.0.0" }, "devDependencies": { @@ -33,7 +33,7 @@ "@types/jsonwebtoken": "^9.0.2", "@types/morgan": "^1.9.4", "@types/node": "^20.4.8", - "eslint": "^8.57.0", + "eslint": "^10.8.0", "eslint-plugin-simple-import-sort": "^12.0.0", "nodemon": "^3.1.0", "ts-node": "^10.9.2", @@ -221,30 +221,21 @@ "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==", - "license": "MIT", + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "license": "Apache-2.0", "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" + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@eslint/eslintrc/node_modules/debug": { + "node_modules/@eslint/config-array/node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", @@ -261,58 +252,92 @@ } } }, - "node_modules/@eslint/eslintrc/node_modules/ms": { + "node_modules/@eslint/config-array/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, - "node_modules/@eslint/js": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", - "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", - "license": "MIT", + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", - "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", - "deprecated": "Use @eslint/config-array instead", + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^2.0.3", - "debug": "^4.3.1", - "minimatch": "^3.0.5" + "@types/json-schema": "^7.0.15" }, "engines": { - "node": ">=10.10.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@humanwhocodes/config-array/node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.2.tgz", + "integrity": "sha512-+CNAzxglkrpNf/kKywqQfk74QjtceuOE7Qm+AF8miRvPF/wmmK5+OJOgVh3AVTT3RP2mH3+FOaxlE5v72owk0A==", + "license": "Apache-2.0", "dependencies": { - "ms": "^2.1.3" + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" }, "engines": { - "node": ">=6.0" + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "engines": { + "node": ">=18.18.0" } }, - "node_modules/@humanwhocodes/config-array/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", @@ -327,12 +352,18 @@ "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==", - "deprecated": "Use @eslint/object-schema instead", - "license": "BSD-3-Clause" + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } }, "node_modules/@inquirer/external-editor": { "version": "1.0.3", @@ -383,41 +414,6 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/@samchon/openapi": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/@samchon/openapi/-/openapi-2.5.3.tgz", @@ -527,6 +523,18 @@ "@types/node": "*" } }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "license": "MIT" + }, "node_modules/@types/express": { "version": "5.0.6", "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.6.tgz", @@ -572,6 +580,12 @@ "dev": true, "license": "MIT" }, + "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==", + "license": "MIT" + }, "node_modules/@types/jsonwebtoken": { "version": "9.0.10", "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz", @@ -654,67 +668,111 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz", - "integrity": "sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==", - "license": "MIT", - "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.18.0", - "@typescript-eslint/type-utils": "7.18.0", - "@typescript-eslint/utils": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", - "graphemer": "^1.4.0", - "ignore": "^5.3.1", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.65.0.tgz", + "integrity": "sha512-IEgob78X12rHpUmtcwFsXhZdVGJtwTVP8FiCLZkR6GlYVrl2PcuB+KhCE5BlVC/eQpQnu8WXRtkHZuPar+gCRA==", + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.65.0", + "@typescript-eslint/type-utils": "8.65.0", + "@typescript-eslint/utils": "8.65.0", + "@typescript-eslint/visitor-keys": "8.65.0", + "ignore": "^7.0.5", "natural-compare": "^1.4.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.5.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.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 - } + "@typescript-eslint/parser": "^8.65.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz", + "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==", + "license": "MIT", + "engines": { + "node": ">= 4" } }, "node_modules/@typescript-eslint/parser": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz", - "integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==", - "license": "BSD-2-Clause", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.65.0.tgz", + "integrity": "sha512-CZ4nMxWwgu1HEEFNkeaCptra9QCtkmKdgf3sWh1rl1trIhmxLilgTV4cwcbQ4wemnT4sWQN8CaKOmdYx+g2gMA==", + "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "7.18.0", - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/typescript-estree": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", - "debug": "^4.3.4" + "@typescript-eslint/scope-manager": "8.65.0", + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/typescript-estree": "8.65.0", + "@typescript-eslint/visitor-keys": "8.65.0", + "debug": "^4.4.3" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" }, "peerDependenciesMeta": { - "typescript": { + "supports-color": { "optional": true } } }, - "node_modules/@typescript-eslint/parser/node_modules/debug": { + "node_modules/@typescript-eslint/parser/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.65.0.tgz", + "integrity": "sha512-SxnPhbTsGahizDgbu7oqFH/xVtzIqMd/s+WtnSxNxJZJpLbdT5IPdzg8EZxO3+PoKahXmwJLeNQOpKJb3/bi7Q==", + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.65.0", + "@typescript-eslint/types": "^8.65.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service/node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", @@ -731,54 +789,67 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/ms": { + "node_modules/@typescript-eslint/project-service/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz", - "integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.65.0.tgz", + "integrity": "sha512-Esbl8OSYiVxBokYgWPf7VVWg/BE798wXhimnn9ML9Pt5qoDf8bfQlgjlKXR/k98+AcNzlLKYrpCcrcuZ9DZLgg==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0" + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/visitor-keys": "8.65.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.65.0.tgz", + "integrity": "sha512-j6GzGqCiRdA7Qhur2VVmKZAkBLfnHFQfx4TaJGL9RMveZqCo48jSHHO0DTgizEnGhtWnqmbtCUSrqSkdiY/0Hg==", + "license": "MIT", "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.18.0.tgz", - "integrity": "sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.65.0.tgz", + "integrity": "sha512-YjaZ7PRI5qY7ax2L3PbvX0rRyGtipAReCWs0mhhDBHjH/vl0g0BonaGXrKdKpMbIIsMIwDgbk/xzkBTyAltS5g==", "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "7.18.0", - "@typescript-eslint/utils": "7.18.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.3.0" + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/typescript-estree": "8.65.0", + "@typescript-eslint/utils": "8.65.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/type-utils/node_modules/debug": { @@ -805,12 +876,12 @@ "license": "MIT" }, "node_modules/@typescript-eslint/types": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz", - "integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.65.0.tgz", + "integrity": "sha512-JSSwWNy+H0E/01jJEM+hrX6N0OFDzFzeIhHFSAS01tlVaevpG8cFyYRPhS5yjGOvBUx3sqQHVMjCL1CAZZMxBg==", "license": "MIT", "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -818,40 +889,30 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz", - "integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==", - "license": "BSD-2-Clause", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.65.0.tgz", + "integrity": "sha512-JboAE2swaYt4tb1fHhHTABE2K+OLy09XfcTbhnk4Pw96f9dd2e9iYsJ28gBggHlo5z5x1rkyWvcPoTuNTd4oGg==", + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.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" + "@typescript-eslint/project-service": "8.65.0", + "@typescript-eslint/tsconfig-utils": "8.65.0", + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/visitor-keys": "8.65.0", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.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.1.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz", - "integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { @@ -871,21 +932,6 @@ } } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", - "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.2" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -893,49 +939,56 @@ "license": "MIT" }, "node_modules/@typescript-eslint/utils": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.18.0.tgz", - "integrity": "sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.65.0.tgz", + "integrity": "sha512-gXiwIHsYreboxeJucHKPvgwl7dXt50mF8s1/c00cP/WoVTyWKFdtfhRWwZiXYFU5H2O8vVoSLNrexFZjYS/SGA==", "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.18.0", - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/typescript-estree": "7.18.0" + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.65.0", + "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/typescript-estree": "8.65.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz", - "integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.65.0.tgz", + "integrity": "sha512-8C71BQkGjiMmXtop7pHVJu1l2NNShFdkCyD6a2ezzs5vU/L3LRtb69EtcteFwz0mYMPzIgOw0n6OV4VBUWZd7A==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "7.18.0", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.65.0", + "eslint-visitor-keys": "^5.0.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.2.tgz", - "integrity": "sha512-5jsZFwgR5rTdKwidH9Qmat75RKwqfpKlWWB1frDkljN127mwqBu8K0PYo7/hFpF03IEJpfVPpCQDY/eDx3iHvA==", - "license": "ISC" + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } }, "node_modules/@vladfrangu/async_event_emitter": { "version": "2.4.7", @@ -1091,33 +1144,21 @@ "dev": true, "license": "MIT" }, - "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==", - "license": "Python-2.0" - }, "node_modules/array-timsort": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/array-timsort/-/array-timsort-1.0.3.tgz", "integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==", "license": "MIT" }, - "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==", + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", "license": "MIT", "engines": { - "node": ">=8" + "node": "18 || 20 || >=22" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "license": "MIT" - }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -1250,19 +1291,22 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz", - "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" } }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, "license": "MIT", "dependencies": { "fill-range": "^7.1.1" @@ -1354,15 +1398,6 @@ "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==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1535,12 +1570,6 @@ "node": ">= 0.8.0" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "license": "MIT" - }, "node_modules/console-stamp": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/console-stamp/-/console-stamp-3.1.2.tgz", @@ -1696,18 +1725,6 @@ "node": ">=0.3.1" } }, - "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==", - "license": "MIT", - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/discord-api-types": { "version": "0.38.49", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.49.tgz", @@ -1744,18 +1761,6 @@ "url": "https://github.com/discordjs/discord.js?sponsor" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dotenv": { "version": "16.6.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", @@ -1879,59 +1884,61 @@ } }, "node_modules/eslint": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", - "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", - "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "version": "10.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.8.0.tgz", + "integrity": "sha512-nuKKvN+oIBO0koN7Tm7dlkmnkc21mtt0QJLwAKzjLq14y6lRTdVG36MZHJ8eQHwdJMwZbQNMlPOYedMq/oVJvQ==", "license": "MIT", + "workspaces": [ + "packages/*" + ], "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.1", - "@humanwhocodes/config-array": "^0.13.0", + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.2", + "@humanfs/node": "^0.16.6", "@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", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", "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", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "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", + "minimatch": "^10.2.5", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-plugin-simple-import-sort": { @@ -1945,16 +1952,18 @@ } }, "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==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", "license": "BSD-2-Clause", "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" @@ -1989,6 +1998,18 @@ } } }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1996,17 +2017,29 @@ "license": "MIT" }, "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==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.9.0", + "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^5.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" @@ -2169,34 +2202,6 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "license": "MIT" }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "license": "MIT", - "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.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "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", @@ -2209,15 +2214,6 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "license": "MIT" }, - "node_modules/fastq": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", - "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" - } - }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -2243,21 +2239,22 @@ } }, "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==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "license": "MIT", "dependencies": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16.0.0" } }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" @@ -2327,23 +2324,22 @@ } }, "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==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "license": "MIT", "dependencies": { "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" + "keyv": "^4.5.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16" } }, "node_modules/flatted": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", - "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", "license": "ISC" }, "node_modules/forwarded": { @@ -2364,12 +2360,6 @@ "node": ">= 0.8" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "license": "ISC" - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -2427,29 +2417,8 @@ "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "engines": { + "node": ">= 0.4" } }, "node_modules/glob-parent": { @@ -2505,41 +2474,6 @@ "node": "^16.13.0 || >=18.0.0" } }, - "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "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==", - "license": "MIT", - "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": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -2552,12 +2486,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "license": "MIT" - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2663,22 +2591,6 @@ "dev": true, "license": "ISC" }, - "node_modules/import-fresh": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -2688,17 +2600,6 @@ "node": ">=0.8.19" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2822,20 +2723,12 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "license": "MIT", "engines": { "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==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-promise": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", @@ -2860,28 +2753,6 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "license": "ISC" }, - "node_modules/js-yaml": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", - "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/puzrin" - }, - { - "type": "github", - "url": "https://github.com/sponsors/nodeca" - } - ], - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/json-bigint": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", @@ -3053,12 +2924,6 @@ "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", "license": "MIT" }, - "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==", - "license": "MIT" - }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", @@ -3161,28 +3026,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/mime-db": { "version": "1.54.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", @@ -3218,15 +3061,18 @@ } }, "node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", - "license": "ISC", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^5.0.8" }, "engines": { - "node": "*" + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/minimist": { @@ -3315,29 +3161,6 @@ "url": "https://opencollective.com/nodemon" } }, - "node_modules/nodemon/node_modules/balanced-match": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", - "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/nodemon/node_modules/brace-expansion": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.7.tgz", - "integrity": "sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^4.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - } - }, "node_modules/nodemon/node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -3366,22 +3189,6 @@ "node": ">=4" } }, - "node_modules/nodemon/node_modules/minimatch": { - "version": "10.2.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", - "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.5" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/nodemon/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -3557,18 +3364,6 @@ "quansync": "^0.2.7" } }, - "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==", - "license": "MIT", - "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", @@ -3587,15 +3382,6 @@ "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==", - "license": "MIT", - "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", @@ -3622,19 +3408,11 @@ "url": "https://opencollective.com/express" } }, - "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==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/picomatch": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, "license": "MIT", "engines": { "node": ">=8.6" @@ -3722,26 +3500,6 @@ ], "license": "MIT" }, - "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==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/randexp": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.5.3.tgz", @@ -3832,15 +3590,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "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==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -3863,32 +3612,6 @@ "node": ">=4" } }, - "node_modules/reusify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", - "license": "MIT", - "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", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/router": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", @@ -3946,29 +3669,6 @@ "node": ">=0.12.0" } }, - "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==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, "node_modules/rxjs": { "version": "7.8.2", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", @@ -4211,15 +3911,6 @@ "node": ">=10" } }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", @@ -4264,18 +3955,6 @@ "node": ">=8" } }, - "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==", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -4301,22 +3980,62 @@ "url": "https://github.com/sponsors/ljharb" } }, - "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==", - "license": "MIT" - }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "license": "MIT" }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "license": "MIT", "dependencies": { "is-number": "^7.0.0" @@ -4345,15 +4064,15 @@ } }, "node_modules/ts-api-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", - "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", "license": "MIT", "engines": { - "node": ">=16" + "node": ">=18.12" }, "peerDependencies": { - "typescript": ">=4.2.0" + "typescript": ">=4.8.4" } }, "node_modules/ts-mixer": { @@ -4443,18 +4162,6 @@ "node": ">= 0.8.0" } }, - "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==", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/type-is": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", @@ -4500,29 +4207,26 @@ } }, "node_modules/typescript-eslint": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.18.0.tgz", - "integrity": "sha512-PonBkP603E3tt05lDkbOMyaxJjvKqQrXsnow72sVeOFINDE/qNmnnd+f9b4N+U7W6MXnnYyrhtmF2t08QWwUbA==", + "version": "8.65.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.65.0.tgz", + "integrity": "sha512-/ggrHAwyjENDusvyxbuqxAC2dTnZg/Z8F+fgQtYIz+L6n/9HfSlEZcFGV/NsMNa6CkGk0xUjUAFwC0vHOflvIA==", "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "7.18.0", - "@typescript-eslint/parser": "7.18.0", - "@typescript-eslint/utils": "7.18.0" + "@typescript-eslint/eslint-plugin": "8.65.0", + "@typescript-eslint/parser": "8.65.0", + "@typescript-eslint/typescript-estree": "8.65.0", + "@typescript-eslint/utils": "8.65.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/typia": { diff --git a/package.json b/package.json index 0b1e162..285ee10 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@types/jsonwebtoken": "^9.0.2", "@types/morgan": "^1.9.4", "@types/node": "^20.4.8", - "eslint": "^8.57.0", + "eslint": "^10.8.0", "eslint-plugin-simple-import-sort": "^12.0.0", "nodemon": "^3.1.0", "ts-node": "^10.9.2", @@ -50,7 +50,7 @@ "mariadb": "^3.2.0", "morgan": "^1.10.1", "rss-parser": "github:ZRunner/rss-parser", - "typescript-eslint": "^7.1.1", + "typescript-eslint": "^8.65.0", "typia": "^7.0.0" } } \ No newline at end of file From 7eaf18b3970dffc6288eedbd079ed84472449078 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 13:09:54 +0000 Subject: [PATCH 02/13] build(deps): bump undici and discord.js Bumps [undici](https://github.com/nodejs/undici) to 6.28.0 and updates ancestor dependency [discord.js](https://github.com/discordjs/discord.js/tree/HEAD/packages/discord.js). These dependencies need to be updated together. Updates `undici` from 6.24.1 to 6.28.0 - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](https://github.com/nodejs/undici/compare/v6.24.1...v6.28.0) Updates `discord.js` from 14.26.4 to 14.27.0 - [Release notes](https://github.com/discordjs/discord.js/releases) - [Changelog](https://github.com/discordjs/discord.js/blob/14.27.0/packages/discord.js/CHANGELOG.md) - [Commits](https://github.com/discordjs/discord.js/commits/14.27.0/packages/discord.js) --- updated-dependencies: - dependency-name: undici dependency-version: 6.28.0 dependency-type: indirect - dependency-name: discord.js dependency-version: 14.27.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- package-lock.json | 54 +++++++++++++++++++---------------------------- package.json | 2 +- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 770f8d2..195a2ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "compression": "^1.8.1", "console-stamp": "^3.1.1", "cors": "^2.8.5", - "discord.js": "^14.21.0", + "discord.js": "^14.27.0", "dotenv": "^16.3.1", "express": "^5.2.1", "express-rate-limit": "^7.4.0", @@ -100,9 +100,9 @@ } }, "node_modules/@discordjs/rest": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.6.1.tgz", - "integrity": "sha512-wwQdgjeaoYFiaG+atbqx6aJDpqW7JHAo0HrQkBTbYzM3/PJ3GweQIpgElNcGZ26DCUOXMyawYd0YF7vtr+fZXg==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.6.3.tgz", + "integrity": "sha512-wvOylxNYJkwKjctS/Mn5GP1w9r3/rzyH+ThD1JlAca6zEdlHs8QWBBUQJpU5Q+W6DoIj/Ljh1IPlZs7hTU+UAg==", "license": "Apache-2.0", "dependencies": { "@discordjs/collection": "^2.1.1", @@ -110,10 +110,10 @@ "@sapphire/async-queue": "^1.5.3", "@sapphire/snowflake": "^3.5.5", "@vladfrangu/async_event_emitter": "^2.4.6", - "discord-api-types": "^0.38.40", + "discord-api-types": "^0.38.50", "magic-bytes.js": "^1.13.0", "tslib": "^2.6.3", - "undici": "6.24.1" + "undici": "^6.27.0" }, "engines": { "node": ">=18" @@ -134,16 +134,6 @@ "url": "https://github.com/discordjs/discord.js?sponsor" } }, - "node_modules/@discordjs/rest/node_modules/@sapphire/snowflake": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.5.tgz", - "integrity": "sha512-xzvBr1Q1c4lCe7i6sRnrofxeO1QTP/LKQ6A6qy0iB4x5yfiSfARMEQEghojzTNALDTcv8En04qYNIco9/K9eZQ==", - "license": "MIT", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@discordjs/util": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.2.0.tgz", @@ -444,9 +434,9 @@ } }, "node_modules/@sapphire/snowflake": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.3.tgz", - "integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==", + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.5.tgz", + "integrity": "sha512-xzvBr1Q1c4lCe7i6sRnrofxeO1QTP/LKQ6A6qy0iB4x5yfiSfARMEQEghojzTNALDTcv8En04qYNIco9/K9eZQ==", "license": "MIT", "engines": { "node": ">=v14.0.0", @@ -1726,33 +1716,33 @@ } }, "node_modules/discord-api-types": { - "version": "0.38.49", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.49.tgz", - "integrity": "sha512-XnqcWmnFZFAE8ZM8SHAw9DIV8D3Or00rMQ8iQLotrEA2PmXhl+ykaf6L6q4l474hrSUH1JaYcv+iOMRWp2p6Tg==", + "version": "0.38.52", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.52.tgz", + "integrity": "sha512-uwe9EKfbjsmgWc2fdFjvDbj+dQqx3lp7wqDCmIha0jInuU+xeQjkCK9tMMn+p7RXfdVQORCInq4cD3U2ymDmyg==", "license": "MIT", "workspaces": [ "scripts/actions/documentation" ] }, "node_modules/discord.js": { - "version": "14.26.4", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.26.4.tgz", - "integrity": "sha512-4oBp8tc6Kf8IDBwAHhbsMaAqx1b5fob9SNasZT7V6yyyUydoO5i5fGuX7TmvRtR+q/WgKRnRViRoAWnG7fNyvA==", + "version": "14.27.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.27.0.tgz", + "integrity": "sha512-qHbFlFG2N7y3LjPySYsL6A1+BnX6bkTVgo842EX0CqVPk/KTMwZkojPHEXKsQUpWZNyz5BISNHK1cPpQw0+m4A==", "license": "Apache-2.0", "dependencies": { "@discordjs/builders": "^1.14.1", "@discordjs/collection": "1.5.3", "@discordjs/formatters": "^0.6.2", - "@discordjs/rest": "^2.6.1", + "@discordjs/rest": "^2.6.2", "@discordjs/util": "^1.2.0", "@discordjs/ws": "^1.2.3", - "@sapphire/snowflake": "3.5.3", - "discord-api-types": "^0.38.40", + "@sapphire/snowflake": "3.5.5", + "discord-api-types": "^0.38.49", "fast-deep-equal": "3.1.3", "lodash.snakecase": "4.1.1", "magic-bytes.js": "^1.13.0", "tslib": "^2.6.3", - "undici": "6.24.1" + "undici": "^6.27.0" }, "engines": { "node": ">=18" @@ -4258,9 +4248,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.24.1.tgz", - "integrity": "sha512-sC+b0tB1whOCzbtlx20fx3WgCXwkW627p4EA9uM+/tNNPkSS+eSEld6pAs9nDv7WbY1UUljBMYPtu9BCOrCWKA==", + "version": "6.28.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.28.0.tgz", + "integrity": "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA==", "license": "MIT", "engines": { "node": ">=18.17" diff --git a/package.json b/package.json index 285ee10..7c2b7fd 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "compression": "^1.8.1", "console-stamp": "^3.1.1", "cors": "^2.8.5", - "discord.js": "^14.21.0", + "discord.js": "^14.27.0", "dotenv": "^16.3.1", "express": "^5.2.1", "express-rate-limit": "^7.4.0", From 8eea76646ef6fb785de0a818389762c65b94a62e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 10:28:36 +0000 Subject: [PATCH 03/13] build(deps): bump qs from 6.15.3 to 6.16.0 Bumps [qs](https://github.com/ljharb/qs) from 6.15.3 to 6.16.0. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.3...v6.16.0) --- updated-dependencies: - dependency-name: qs dependency-version: 6.16.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 195a2ec..adc2ff9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3459,9 +3459,9 @@ } }, "node_modules/qs": { - "version": "6.15.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz", - "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==", + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz", + "integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==", "license": "BSD-3-Clause", "dependencies": { "es-define-property": "^1.0.1", From 2db99cd73b0e23db2a52ab480548ba4268270ffe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Sep 2026 19:23:13 +0000 Subject: [PATCH 04/13] build(deps): bump morgan from 1.11.0 to 1.12.0 Bumps [morgan](https://github.com/expressjs/morgan) from 1.11.0 to 1.12.0. - [Release notes](https://github.com/expressjs/morgan/releases) - [Changelog](https://github.com/expressjs/morgan/blob/master/HISTORY.md) - [Commits](https://github.com/expressjs/morgan/compare/1.11.0...1.12.0) --- updated-dependencies: - dependency-name: morgan dependency-version: 1.12.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index adc2ff9..455e4f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "json-bigint": "^1.0.0", "jsonwebtoken": "^9.0.1", "mariadb": "^3.2.0", - "morgan": "^1.10.1", + "morgan": "^1.12.0", "rss-parser": "github:ZRunner/rss-parser", "typescript-eslint": "^8.65.0", "typia": "^7.0.0" @@ -3076,9 +3076,9 @@ } }, "node_modules/morgan": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.11.0.tgz", - "integrity": "sha512-zSkVu3t18r39pw4ixfBKvfZi3y2UOqr7d4WYwcj3m8nXpEQK4rPO6GLzs/CExoRgmX3y9EjmmcXqv6jq0SK46g==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.12.0.tgz", + "integrity": "sha512-OHpTRQwn2ezasILW8iKe+Yww1XsfWsZIpUOLF7RDb2g5GwO3trPaRwi7+8BDiJ7HFx2Kg2mfUdCBcVhwYlOz2g==", "license": "MIT", "dependencies": { "basic-auth": "~2.0.1", diff --git a/package.json b/package.json index 7c2b7fd..f1c44f4 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "json-bigint": "^1.0.0", "jsonwebtoken": "^9.0.1", "mariadb": "^3.2.0", - "morgan": "^1.10.1", + "morgan": "^1.12.0", "rss-parser": "github:ZRunner/rss-parser", "typescript-eslint": "^8.65.0", "typia": "^7.0.0" From c06e45b200d75acffb0613ea84a39c9f1d45ff53 Mon Sep 17 00:00:00 2001 From: ZRunner Date: Sat, 10 Oct 2026 00:11:25 +0200 Subject: [PATCH 05/13] feat(deps): update dependencies --- package-lock.json | 658 ++++++++++++++++++++++++++-------------------- package.json | 8 +- 2 files changed, 384 insertions(+), 282 deletions(-) diff --git a/package-lock.json b/package-lock.json index 455e4f0..c1c031b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "axobot-api", - "version": "1.6.2", + "version": "1.6.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "axobot-api", - "version": "1.6.2", + "version": "1.6.3", "license": "GPL-3.0", "dependencies": { "cache-manager": "^5.4.0", @@ -14,9 +14,9 @@ "console-stamp": "^3.1.1", "cors": "^2.8.5", "discord.js": "^14.27.0", - "dotenv": "^16.3.1", + "dotenv": "^18.0.0", "express": "^5.2.1", - "express-rate-limit": "^7.4.0", + "express-rate-limit": "^8.7.0", "json-bigint": "^1.0.0", "jsonwebtoken": "^9.0.1", "mariadb": "^3.2.0", @@ -34,13 +34,35 @@ "@types/morgan": "^1.9.4", "@types/node": "^20.4.8", "eslint": "^10.8.0", - "eslint-plugin-simple-import-sort": "^12.0.0", + "eslint-plugin-simple-import-sort": "^14.0.0", "nodemon": "^3.1.0", "ts-node": "^10.9.2", "ts-patch": "^3.3.0", "typescript": "~5.7.3" } }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -185,9 +207,9 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", - "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.4.3" @@ -202,6 +224,18 @@ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, + "node_modules/@eslint-community/eslint-utils/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==", + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/@eslint-community/regexpp": { "version": "4.12.2", "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", @@ -282,9 +316,9 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.2.tgz", - "integrity": "sha512-+CNAzxglkrpNf/kKywqQfk74QjtceuOE7Qm+AF8miRvPF/wmmK5+OJOgVh3AVTT3RP2mH3+FOaxlE5v72owk0A==", + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", "license": "Apache-2.0", "dependencies": { "@eslint/core": "^1.2.1", @@ -387,9 +421,9 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", "dev": true, "license": "MIT" }, @@ -404,6 +438,28 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "license": "MIT" + }, "node_modules/@samchon/openapi": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/@samchon/openapi/-/openapi-2.5.3.tgz", @@ -444,9 +500,9 @@ } }, "node_modules/@tsconfig/node10": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz", - "integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.13.tgz", + "integrity": "sha512-gcLdvR9HO1ZJBypsOGqaP6TFEzb6vIta0KSTLt9NAQ6pXQO3cRgSVyCN6pzYqI9DlJgY71XKO0dpDhCf08b3pg==", "dev": true, "license": "MIT" }, @@ -538,9 +594,9 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.1.1.tgz", - "integrity": "sha512-v4zIMr/cX7/d2BpAEX3KNKL/JrT1s43s96lLvvdTmza1oEvDudCqK9aF/djc/SWgy8Yh0h30TZx5VpzqFCxk5A==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.1.3.tgz", + "integrity": "sha512-dPfW8NFiOF4wOHc7+N/QSxlY9cfSsenewGbAz8C8U/MULPd/YZ27LvJUIlzaXie7e6Ove9YunJGgC9tbHD2cKw==", "dev": true, "license": "MIT", "dependencies": { @@ -649,25 +705,25 @@ } }, "node_modules/@types/ws": { - "version": "8.18.1", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", - "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w==", "license": "MIT", "dependencies": { "@types/node": "*" } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.65.0.tgz", - "integrity": "sha512-IEgob78X12rHpUmtcwFsXhZdVGJtwTVP8FiCLZkR6GlYVrl2PcuB+KhCE5BlVC/eQpQnu8WXRtkHZuPar+gCRA==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.71.1.tgz", + "integrity": "sha512-nNlBf6HuotqMgZvSkWD5hNdemiBIxQ2NmrlgfcUIeZRs+BbakjscCQRq/Hb74EFVnFiSWWdL12JruqwBy3ERDw==", "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.65.0", - "@typescript-eslint/type-utils": "8.65.0", - "@typescript-eslint/utils": "8.65.0", - "@typescript-eslint/visitor-keys": "8.65.0", + "@typescript-eslint/scope-manager": "8.71.1", + "@typescript-eslint/type-utils": "8.71.1", + "@typescript-eslint/utils": "8.71.1", + "@typescript-eslint/visitor-keys": "8.71.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.5.0" @@ -680,30 +736,30 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.65.0", + "@typescript-eslint/parser": "^8.71.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz", - "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==", + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.12.tgz", + "integrity": "sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==", "license": "MIT", "engines": { "node": ">= 4" } }, "node_modules/@typescript-eslint/parser": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.65.0.tgz", - "integrity": "sha512-CZ4nMxWwgu1HEEFNkeaCptra9QCtkmKdgf3sWh1rl1trIhmxLilgTV4cwcbQ4wemnT4sWQN8CaKOmdYx+g2gMA==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.71.1.tgz", + "integrity": "sha512-oM/5sAqz/l1v/zYK1qTOPrn2+JIrBGC1V6uNYucRO5gh6eT9vWJ/RhPbGE59byvZEUQ4VP6XkLBaS5Jti5jpvw==", "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.65.0", - "@typescript-eslint/types": "8.65.0", - "@typescript-eslint/typescript-estree": "8.65.0", - "@typescript-eslint/visitor-keys": "8.65.0", + "@typescript-eslint/scope-manager": "8.71.1", + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/typescript-estree": "8.71.1", + "@typescript-eslint/visitor-keys": "8.71.1", "debug": "^4.4.3" }, "engines": { @@ -742,13 +798,13 @@ "license": "MIT" }, "node_modules/@typescript-eslint/project-service": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.65.0.tgz", - "integrity": "sha512-SxnPhbTsGahizDgbu7oqFH/xVtzIqMd/s+WtnSxNxJZJpLbdT5IPdzg8EZxO3+PoKahXmwJLeNQOpKJb3/bi7Q==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.71.1.tgz", + "integrity": "sha512-Oijc9RUsohHjncg6iGi7gCtjnEjYt9FWv9u6ygK8uKcHK5eLjLAkqERQ9BaytbpceOFdk6kifPCS/zAZE+A99g==", "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.65.0", - "@typescript-eslint/types": "^8.65.0", + "@typescript-eslint/tsconfig-utils": "^8.71.1", + "@typescript-eslint/types": "^8.71.1", "debug": "^4.4.3" }, "engines": { @@ -786,13 +842,13 @@ "license": "MIT" }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.65.0.tgz", - "integrity": "sha512-Esbl8OSYiVxBokYgWPf7VVWg/BE798wXhimnn9ML9Pt5qoDf8bfQlgjlKXR/k98+AcNzlLKYrpCcrcuZ9DZLgg==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.71.1.tgz", + "integrity": "sha512-1YUDZXdTnXLlob03SFHBipdyMBsDVm7zoSz0ytTJ39dk5J1TgsTK03VlR/dLXG/RLLUrPcYbD4rp23BmHxHP0w==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.65.0", - "@typescript-eslint/visitor-keys": "8.65.0" + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/visitor-keys": "8.71.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -803,9 +859,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.65.0.tgz", - "integrity": "sha512-j6GzGqCiRdA7Qhur2VVmKZAkBLfnHFQfx4TaJGL9RMveZqCo48jSHHO0DTgizEnGhtWnqmbtCUSrqSkdiY/0Hg==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.71.1.tgz", + "integrity": "sha512-oTvkml5SxXhgg+WWKhod5qWQICDXtOB+/Hi9VdPKFAANJ2b7YOgMffgvzXuqog7R6A/JtrzRf128dsxummyWhg==", "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -819,14 +875,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.65.0.tgz", - "integrity": "sha512-YjaZ7PRI5qY7ax2L3PbvX0rRyGtipAReCWs0mhhDBHjH/vl0g0BonaGXrKdKpMbIIsMIwDgbk/xzkBTyAltS5g==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.71.1.tgz", + "integrity": "sha512-kH3t3jZCYv2PZSBEWPKTariLrCaoF1CLoPitYFBJOhAGEwWnSRAtGEifrfrpBa4K9JlwWNZotgA5w3/wLSk/FQ==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.65.0", - "@typescript-eslint/typescript-estree": "8.65.0", - "@typescript-eslint/utils": "8.65.0", + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/typescript-estree": "8.71.1", + "@typescript-eslint/utils": "8.71.1", "debug": "^4.4.3", "ts-api-utils": "^2.5.0" }, @@ -866,9 +922,9 @@ "license": "MIT" }, "node_modules/@typescript-eslint/types": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.65.0.tgz", - "integrity": "sha512-JSSwWNy+H0E/01jJEM+hrX6N0OFDzFzeIhHFSAS01tlVaevpG8cFyYRPhS5yjGOvBUx3sqQHVMjCL1CAZZMxBg==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.71.1.tgz", + "integrity": "sha512-ybYnPTUwg3VQQOFEiBPLs8Jxl1ry2vXdn1kVKguomBbvxpetdu3MKTNDqFNUrlG8ylP9MpZosmXMFYlGQHk1oQ==", "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -879,15 +935,15 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.65.0.tgz", - "integrity": "sha512-JboAE2swaYt4tb1fHhHTABE2K+OLy09XfcTbhnk4Pw96f9dd2e9iYsJ28gBggHlo5z5x1rkyWvcPoTuNTd4oGg==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.71.1.tgz", + "integrity": "sha512-pSKSEK1JJpHs6KiKVtABCE4iJK5d7FLFzDXQNBQ2oRY7LEd3UwOt3TZemTgu9syTIf56dJWlTn/pdmrO9oKUXQ==", "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.65.0", - "@typescript-eslint/tsconfig-utils": "8.65.0", - "@typescript-eslint/types": "8.65.0", - "@typescript-eslint/visitor-keys": "8.65.0", + "@typescript-eslint/project-service": "8.71.1", + "@typescript-eslint/tsconfig-utils": "8.71.1", + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/visitor-keys": "8.71.1", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", @@ -929,15 +985,15 @@ "license": "MIT" }, "node_modules/@typescript-eslint/utils": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.65.0.tgz", - "integrity": "sha512-gXiwIHsYreboxeJucHKPvgwl7dXt50mF8s1/c00cP/WoVTyWKFdtfhRWwZiXYFU5H2O8vVoSLNrexFZjYS/SGA==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.71.1.tgz", + "integrity": "sha512-CBjT6gfAz3DW2j9Q4moFnqt208Aq+506sVGXfpRcyAeqn0EpayL0mjdWoCO2t3RC7GewNrFxdeehuEaPg6DMzQ==", "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.65.0", - "@typescript-eslint/types": "8.65.0", - "@typescript-eslint/typescript-estree": "8.65.0" + "@typescript-eslint/scope-manager": "8.71.1", + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/typescript-estree": "8.71.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -952,12 +1008,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.65.0.tgz", - "integrity": "sha512-8C71BQkGjiMmXtop7pHVJu1l2NNShFdkCyD6a2ezzs5vU/L3LRtb69EtcteFwz0mYMPzIgOw0n6OV4VBUWZd7A==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.71.1.tgz", + "integrity": "sha512-0GxiUGqMU0qXJt58cBsiG3DP8lUmBaFo2vChtUX+CT7PnR3v/VGLLrzVP4K9r1lNiZXjHYefMBbPunplr09v6w==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.65.0", + "@typescript-eslint/types": "8.71.1", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -968,18 +1024,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", - "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", - "license": "Apache-2.0", - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/@vladfrangu/async_event_emitter": { "version": "2.4.7", "resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.4.7.tgz", @@ -1004,18 +1048,25 @@ } }, "node_modules/accepts/node_modules/negotiator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", - "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.1.0.tgz", + "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==", "license": "MIT", + "dependencies": { + "content-type": "^2.1.0" + }, "engines": { - "node": ">= 0.6" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/acorn": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", - "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -1077,18 +1128,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -1244,19 +1283,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/body-parser/node_modules/content-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz", - "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, "node_modules/body-parser/node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -1281,9 +1307,9 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", - "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" @@ -1359,6 +1385,19 @@ "node": ">= 18" } }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -1543,14 +1582,15 @@ } }, "node_modules/compression": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.1.tgz", - "integrity": "sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.2.tgz", + "integrity": "sha512-o8vI5RE5A6EVVOd9o41jKp41aJom+QTEO/Bx8MYNjexMo/Bv2WOjUfZr+aL0WnYSgymUy6zeguqLTsIhV0gMvQ==", "license": "MIT", "dependencies": { "bytes": "3.1.2", "compressible": "~2.0.18", "debug": "2.6.9", + "destroy": "1.2.0", "negotiator": "~0.6.4", "on-headers": "~1.1.0", "safe-buffer": "5.2.1", @@ -1558,6 +1598,10 @@ }, "engines": { "node": ">= 0.8.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/console-stamp": { @@ -1574,9 +1618,9 @@ } }, "node_modules/content-disposition": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz", - "integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-2.0.1.tgz", + "integrity": "sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==", "license": "MIT", "engines": { "node": ">=18" @@ -1587,12 +1631,16 @@ } }, "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/cookie": { @@ -1705,6 +1753,16 @@ "node": ">= 0.8" } }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, "node_modules/diff": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", @@ -1716,13 +1774,10 @@ } }, "node_modules/discord-api-types": { - "version": "0.38.52", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.52.tgz", - "integrity": "sha512-uwe9EKfbjsmgWc2fdFjvDbj+dQqx3lp7wqDCmIha0jInuU+xeQjkCK9tMMn+p7RXfdVQORCInq4cD3U2ymDmyg==", - "license": "MIT", - "workspaces": [ - "scripts/actions/documentation" - ] + "version": "0.38.56", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.56.tgz", + "integrity": "sha512-Hti4RZsGvF5C7SM8rF2MDHtIm0Hyfrlk84GpEA29nj91tvVVMvX+oQSCodu10t2ZcjFGofq8TX0YyC04B2E69Q==", + "license": "MIT" }, "node_modules/discord.js": { "version": "14.27.0", @@ -1752,10 +1807,13 @@ } }, "node_modules/dotenv": { - "version": "16.6.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", - "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "version": "18.0.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-18.0.7.tgz", + "integrity": "sha512-QEvMEF8ca3GNZJJnAbOgxpj5ULhBvnMcURp+XKrtvqFNPgjBvYoswQ0Jl2cO7JzCjxZjJhr9ZuIEhlrRxMft/Q==", "license": "BSD-2-Clause", + "bin": { + "dotenv": "dist/index.cjs" + }, "engines": { "node": ">=12" }, @@ -1874,9 +1932,9 @@ } }, "node_modules/eslint": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.8.0.tgz", - "integrity": "sha512-nuKKvN+oIBO0koN7Tm7dlkmnkc21mtt0QJLwAKzjLq14y6lRTdVG36MZHJ8eQHwdJMwZbQNMlPOYedMq/oVJvQ==", + "version": "10.12.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.12.0.tgz", + "integrity": "sha512-npHjrHb2o4ehH3mE+YuxABR+0gyb0aVWCIolgJDArwCiHEIsonBm3ZKjel5b0U5+a+MbEvIyRCGCzD3eKKK2NA==", "license": "MIT", "workspaces": [ "packages/*" @@ -1887,7 +1945,7 @@ "@eslint/config-array": "^0.23.5", "@eslint/config-helpers": "^0.7.0", "@eslint/core": "^1.2.1", - "@eslint/plugin-kit": "^0.7.2", + "@eslint/plugin-kit": "^0.7.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", @@ -1902,7 +1960,7 @@ "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", + "file-entry-cache": "11.1.5 || >11.1.6 <12", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", @@ -1932,9 +1990,9 @@ } }, "node_modules/eslint-plugin-simple-import-sort": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz", - "integrity": "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-14.0.0.tgz", + "integrity": "sha512-NUJO0+XFCkk+o5EsAJruTgnfMEpeWrPWeJS15UVF60GgXmqz1BJ9/3hzlvG7lkL8Bubzos5cCLptThbFfPnSMQ==", "dev": true, "license": "MIT", "peerDependencies": { @@ -1960,12 +2018,12 @@ } }, "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==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", "license": "Apache-2.0", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" @@ -1988,18 +2046,6 @@ } } }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", - "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", - "license": "Apache-2.0", - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -2023,18 +2069,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", - "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", - "license": "Apache-2.0", - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2106,15 +2140,15 @@ "license": "MIT" }, "node_modules/express": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", - "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.3.0.tgz", + "integrity": "sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==", "license": "MIT", "dependencies": { "accepts": "^2.0.0", - "body-parser": "^2.2.1", - "content-disposition": "^1.0.0", - "content-type": "^1.0.5", + "body-parser": "^2.3.0", + "content-disposition": "^2.0.1", + "content-type": "^2.0.0", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", @@ -2130,14 +2164,14 @@ "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", - "proxy-addr": "^2.0.7", - "qs": "^6.14.0", + "proxy-addr": "^2.0.8", + "qs": "^6.16.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", - "type-is": "^2.0.1", + "type-is": "^2.1.0", "vary": "^1.1.2" }, "engines": { @@ -2149,10 +2183,14 @@ } }, "node_modules/express-rate-limit": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz", - "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==", + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.1.tgz", + "integrity": "sha512-2FXbqkygil3mZiXzEtM0IjE/UBmBNot0J1GEVrJT4JbrvwOSoEtqtO+wHbiMQELWe1eNvHoYRg2dkjOid+6JkA==", "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "ip-address": "^10.2.0" + }, "engines": { "node": ">= 16" }, @@ -2163,6 +2201,29 @@ "express": ">= 4.11" } }, + "node_modules/express-rate-limit/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/express-rate-limit/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, "node_modules/express/node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -2229,15 +2290,12 @@ } }, "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", "license": "MIT", "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" + "flat-cache": "^6.1.23" } }, "node_modules/fill-range": { @@ -2314,16 +2372,14 @@ } }, "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", "license": "MIT", "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" } }, "node_modules/flatted": { @@ -2497,6 +2553,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/hasown": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", @@ -2509,6 +2577,12 @@ "node": ">= 0.4" } }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "license": "MIT" + }, "node_modules/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", @@ -2632,6 +2706,15 @@ "node": ">=12.0.0" } }, + "node_modules/ip-address": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.3.tgz", + "integrity": "sha512-A1kdq/tSb5QjvKvAMgIoEvDBIgL7qaqVP/jkvSwYYRZ9iEzvPpopxp2wQfu3SuZRHtpHNxMn8Fs0bS+gf5Xmwg==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -2655,13 +2738,13 @@ } }, "node_modules/is-core-module": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", - "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz", + "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==", "dev": true, "license": "MIT", "dependencies": { - "hasown": "^2.0.3" + "hasown": "^2.0.4" }, "engines": { "node": ">= 0.4" @@ -2752,12 +2835,6 @@ "bignumber.js": "^9.0.0" } }, - "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==", - "license": "MIT" - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -2820,12 +2897,12 @@ } }, "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==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", "license": "MIT", "dependencies": { - "json-buffer": "3.0.1" + "@keyv/serialize": "^1.1.1" } }, "node_modules/kind-of": { @@ -2949,9 +3026,9 @@ "license": "ISC" }, "node_modules/magic-bytes.js": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.13.0.tgz", - "integrity": "sha512-afO2mnxW7GDTXMm5/AoN1WuOcdoKhtgXjIvHmobqTD1grNplhGdv3PFOyjCVmrnOZBIT/gD/koDKpYG+0mvHcg==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.13.1.tgz", + "integrity": "sha512-x5sn4UX2k5gCWlcfmoFwG4TPie8+dctESyqOBdhB5p6MsgWXdBKGmt9nXPObj/JI50TTL928lc5Yt1WntMn1bw==", "license": "MIT" }, "node_modules/make-error": { @@ -2962,9 +3039,9 @@ "license": "ISC" }, "node_modules/mariadb": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/mariadb/-/mariadb-3.5.3.tgz", - "integrity": "sha512-i053Kc0MgdUv/hu9mCyq67TYfPXFj3/MV8I7ZW5wvJNixIyXC0VztMPUjIVj/449nQo+BsxFD4Fdk/sA/uqKPQ==", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/mariadb/-/mariadb-3.5.4.tgz", + "integrity": "sha512-3m0vdfgRkjle5/9hHl4R7rlVvnDA7QfuFSNkdIAQNROWKOS0J3b9IQK9HaZSCGEVKiDUbFXFiINfC+cmR5P/aA==", "license": "LGPL-2.1-or-later", "dependencies": { "@types/geojson": "^7946.0.16", @@ -2978,9 +3055,9 @@ } }, "node_modules/mariadb/node_modules/lru-cache": { - "version": "11.5.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", - "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" @@ -2996,12 +3073,16 @@ } }, "node_modules/media-typer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", - "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.1.tgz", + "integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==", "license": "MIT", "engines": { "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/merge-descriptors": { @@ -3076,9 +3157,9 @@ } }, "node_modules/morgan": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.12.0.tgz", - "integrity": "sha512-OHpTRQwn2ezasILW8iKe+Yww1XsfWsZIpUOLF7RDb2g5GwO3trPaRwi7+8BDiJ7HFx2Kg2mfUdCBcVhwYlOz2g==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.12.1.tgz", + "integrity": "sha512-tljKC0ex20AjO58Ob/eZ53JloycbVswbVNCHx6V6VLGzqt/w8dIynVGL0G8qVjNKwiA7sYSogCrN6QtJ82IV+g==", "license": "MIT", "dependencies": { "basic-auth": "~2.0.1", @@ -3430,9 +3511,9 @@ } }, "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", + "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", "license": "MIT", "dependencies": { "forwarded": "0.2.0", @@ -3440,6 +3521,10 @@ }, "engines": { "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/pstree.remy": { @@ -3458,6 +3543,24 @@ "node": ">=6" } }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "license": "MIT" + }, "node_modules/qs": { "version": "6.16.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz", @@ -3559,14 +3662,14 @@ } }, "node_modules/resolve": { - "version": "1.22.12", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", - "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", + "version": "1.22.13", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.13.tgz", + "integrity": "sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA==", "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", - "is-core-module": "^2.16.1", + "is-core-module": "^2.17.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -3695,9 +3798,9 @@ "license": "MIT" }, "node_modules/sax": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", - "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz", + "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", "license": "BlueOak-1.0.0", "engines": { "node": ">=11.0.0" @@ -4010,9 +4113,9 @@ } }, "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", - "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "license": "MIT", "engines": { "node": ">=12" @@ -4152,6 +4255,18 @@ "node": ">= 0.8.0" } }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/type-is": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", @@ -4170,19 +4285,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/type-is/node_modules/content-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz", - "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, "node_modules/typescript": { "version": "5.7.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", @@ -4197,15 +4299,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.65.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.65.0.tgz", - "integrity": "sha512-/ggrHAwyjENDusvyxbuqxAC2dTnZg/Z8F+fgQtYIz+L6n/9HfSlEZcFGV/NsMNa6CkGk0xUjUAFwC0vHOflvIA==", + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.71.1.tgz", + "integrity": "sha512-oiNVPC3/NbV1FpaHU07l8O6ynqG9v4PAiW2WvTrAmZdR0f2HI/gE668ElMLCK7Xbsu5k2fK5C4fXNiq05j7/nQ==", "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.65.0", - "@typescript-eslint/parser": "8.65.0", - "@typescript-eslint/typescript-estree": "8.65.0", - "@typescript-eslint/utils": "8.65.0" + "@typescript-eslint/eslint-plugin": "8.71.1", + "@typescript-eslint/parser": "8.71.1", + "@typescript-eslint/typescript-estree": "8.71.1", + "@typescript-eslint/utils": "8.71.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4248,9 +4350,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.28.0.tgz", - "integrity": "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA==", + "version": "6.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.0.tgz", + "integrity": "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==", "license": "MIT", "engines": { "node": ">=18.17" @@ -4356,9 +4458,9 @@ "license": "ISC" }, "node_modules/ws": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", - "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz", + "integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==", "license": "MIT", "engines": { "node": ">=10.0.0" diff --git a/package.json b/package.json index f1c44f4..255697f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "axobot-api", - "version": "1.6.2", + "version": "1.6.3", "description": "A TypeScript API for the Axobot Discord bot", "main": "index.js", "scripts": { @@ -30,7 +30,7 @@ "@types/morgan": "^1.9.4", "@types/node": "^20.4.8", "eslint": "^10.8.0", - "eslint-plugin-simple-import-sort": "^12.0.0", + "eslint-plugin-simple-import-sort": "^14.0.0", "nodemon": "^3.1.0", "ts-node": "^10.9.2", "ts-patch": "^3.3.0", @@ -42,9 +42,9 @@ "console-stamp": "^3.1.1", "cors": "^2.8.5", "discord.js": "^14.27.0", - "dotenv": "^16.3.1", + "dotenv": "^18.0.0", "express": "^5.2.1", - "express-rate-limit": "^7.4.0", + "express-rate-limit": "^8.7.0", "json-bigint": "^1.0.0", "jsonwebtoken": "^9.0.1", "mariadb": "^3.2.0", From 4b40249fbc60d4e3001b64d91a247bf3a3581ae5 Mon Sep 17 00:00:00 2001 From: ZRunner Date: Sat, 10 Oct 2026 00:26:29 +0200 Subject: [PATCH 06/13] feat(lint): replace eslint with oxlint/oxfmt --- .oxfmtrc.json | 6 + .oxlintrc.json | 124 +++ package-lock.json | 2331 ++++++++++++++++++++------------------------- package.json | 58 +- 4 files changed, 1167 insertions(+), 1352 deletions(-) create mode 100644 .oxfmtrc.json create mode 100644 .oxlintrc.json diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000..3c6d658 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,6 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "ignorePatterns": [], + "printWidth": 110, + "sortImports": true +} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..138c7d3 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,124 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["import", "promise", "typescript"], + "categories": { + "correctness": "off" + }, + "options": { + "typeAware": true, + "reportUnusedDisableDirectives": "warn", + "typeCheck": true + }, + "env": { + "builtin": true, + "node": true + }, + "ignorePatterns": ["src/repository/types/checks/generated/", "**/node_modules", "**/build"], + "rules": { + "constructor-super": "error", + "for-direction": "error", + "getter-return": "error", + "no-async-promise-executor": "error", + "no-case-declarations": "error", + "no-class-assign": "error", + "no-compare-neg-zero": "error", + "no-cond-assign": "error", + "no-const-assign": "error", + "no-constant-binary-expression": "error", + "no-constant-condition": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-dupe-class-members": "error", + "no-dupe-else-if": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-empty-static-block": "error", + "no-ex-assign": "error", + "no-extra-boolean-cast": "error", + "no-fallthrough": "error", + "no-func-assign": "error", + "no-global-assign": "error", + "no-import-assign": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", + "no-misleading-character-class": "error", + "no-new-native-nonconstructor": "error", + "no-nonoctal-decimal-escape": "error", + "no-obj-calls": "error", + "no-prototype-builtins": "error", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-self-assign": "error", + "no-setter-return": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-this-before-super": "error", + "no-unexpected-multiline": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-labels": "error", + "no-unused-private-class-members": "error", + "no-useless-backreference": "error", + "no-useless-catch": "error", + "no-useless-escape": "error", + "no-with": "error", + "require-yield": "error", + "use-isnan": "error", + "valid-typeof": "error", + "no-array-constructor": "error", + "no-unused-expressions": "error", + "arrow-body-style": "warn", + "curly": ["warn", "multi-line", "consistent"], + "default-param-last": "error", + "eqeqeq": "error", + "guard-for-in": "error", + "max-nested-callbacks": [ + "warn", + { + "max": 4 + } + ], + "no-empty-function": [ + "error", + { + "allow": ["private-constructors"] + } + ], + "no-lonely-if": "warn", + "no-return-assign": "error", + "no-shadow": [ + "error", + { + "allow": ["err", "resolve", "reject"] + } + ], + "no-unneeded-ternary": "warn", + "no-useless-return": "error", + "no-var": "error", + "prefer-const": "warn", + "typescript/ban-ts-comment": "error", + "typescript/no-duplicate-enum-values": "error", + "typescript/no-empty-object-type": "error", + "typescript/no-explicit-any": "error", + "typescript/no-extra-non-null-assertion": "error", + "typescript/no-misused-new": "error", + "typescript/no-namespace": "error", + "typescript/no-non-null-asserted-optional-chain": "error", + "typescript/no-require-imports": "error", + "typescript/no-this-alias": "error", + "typescript/no-unnecessary-type-constraint": "error", + "typescript/no-unsafe-declaration-merging": "error", + "typescript/no-unsafe-function-type": "error", + "typescript/no-wrapper-object-types": "error", + "typescript/prefer-as-const": "error", + "typescript/prefer-namespace-keyword": "error", + "typescript/triple-slash-reference": "error" + } +} diff --git a/package-lock.json b/package-lock.json index c1c031b..4f9e747 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,6 @@ "mariadb": "^3.2.0", "morgan": "^1.12.0", "rss-parser": "github:ZRunner/rss-parser", - "typescript-eslint": "^8.65.0", "typia": "^7.0.0" }, "devDependencies": { @@ -33,36 +32,15 @@ "@types/jsonwebtoken": "^9.0.2", "@types/morgan": "^1.9.4", "@types/node": "^20.4.8", - "eslint": "^10.8.0", - "eslint-plugin-simple-import-sort": "^14.0.0", "nodemon": "^3.1.0", + "oxfmt": "^0.72.0", + "oxlint": "^1.87.0", + "oxlint-tsgolint": "^7.0.2003", "ts-node": "^10.9.2", "ts-patch": "^3.3.0", "typescript": "~5.7.3" } }, - "node_modules/@cacheable/memory": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", - "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", - "license": "MIT", - "dependencies": { - "@cacheable/utils": "^2.5.0", - "@keyv/bigmap": "^1.3.1", - "hookified": "^1.15.1", - "keyv": "^5.6.0" - } - }, - "node_modules/@cacheable/utils": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", - "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", - "license": "MIT", - "dependencies": { - "hashery": "^1.5.1", - "keyv": "^5.6.0" - } - }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -206,189 +184,6 @@ "url": "https://github.com/discordjs/discord.js?sponsor" } }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", - "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^3.4.3" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/eslint-utils/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==", - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.12.2", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", - "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", - "license": "MIT", - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/config-array": { - "version": "0.23.5", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", - "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", - "license": "Apache-2.0", - "dependencies": { - "@eslint/object-schema": "^3.0.5", - "debug": "^4.3.1", - "minimatch": "^10.2.4" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - } - }, - "node_modules/@eslint/config-array/node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@eslint/config-array/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/@eslint/config-helpers": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", - "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^1.2.1" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - } - }, - "node_modules/@eslint/core": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", - "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - } - }, - "node_modules/@eslint/object-schema": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", - "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", - "license": "Apache-2.0", - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", - "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^1.2.1", - "levn": "^0.4.1" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - } - }, - "node_modules/@humanfs/core": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", - "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", - "license": "Apache-2.0", - "dependencies": { - "@humanfs/types": "^0.15.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node": { - "version": "0.16.8", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", - "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", - "license": "Apache-2.0", - "dependencies": { - "@humanfs/core": "^0.19.2", - "@humanfs/types": "^0.15.0", - "@humanwhocodes/retry": "^0.4.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/types": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", - "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", - "license": "Apache-2.0", - "engines": { - "node": ">=18.18.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==", - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", - "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@inquirer/external-editor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.3.tgz", @@ -438,590 +233,1017 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "node_modules/@keyv/bigmap": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", - "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "node_modules/@oxfmt/binding-android-arm-eabi": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.72.0.tgz", + "integrity": "sha512-u4U1uaDOVBuorGNC/07NLm48nECHOiJJka002YGML16Md2DRvf38RGBt01lH60EOGvNlFVmbLoksQedNBoZHKw==", + "cpu": [ + "arm" + ], + "dev": true, "license": "MIT", - "dependencies": { - "hashery": "^1.4.0", - "hookified": "^1.15.0" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "keyv": "^5.6.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@keyv/serialize": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", - "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", - "license": "MIT" - }, - "node_modules/@samchon/openapi": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/@samchon/openapi/-/openapi-2.5.3.tgz", - "integrity": "sha512-gLcGqPGsr/V43yNrhC+5E8ZR8y1JdLZDgkC6ULg+B03uvmdS2C7qIXpIWUe19MUPvXt5SCpjhvOykomEspinaw==", - "license": "MIT" - }, - "node_modules/@sapphire/async-queue": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.5.tgz", - "integrity": "sha512-cvGzxbba6sav2zZkH8GPf2oGk9yYoD5qrNWdu9fRehifgnFZJMV+nuy2nON2roRO4yQQ+v7MK/Pktl/HgfsUXg==", + "node_modules/@oxfmt/binding-android-arm64": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.72.0.tgz", + "integrity": "sha512-GCnM+Ae2mWOKC+92y3FOb6eZJeVnBAVz82e3lITUUg+kxukYKzBNAvJ/hhHIfa2A0md55SYYhdWPddSSy3KPVA==", + "cpu": [ + "arm64" + ], + "dev": true, "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@sapphire/shapeshift": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-4.0.0.tgz", - "integrity": "sha512-d9dUmWVA7MMiKobL3VpLF8P2aeanRTu6ypG2OIaEv/ZHH/SUQ2iHOVyi5wAPjQ+HmnMuL0whK9ez8I/raWbtIg==", + "node_modules/@oxfmt/binding-darwin-arm64": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.72.0.tgz", + "integrity": "sha512-LjQ8tlevdtwraFlWC6AnQ1Forzde0clRmnsP3QmK+ydSElDt/J+5Jc+m+//Ly1G97aP7WCNUw110QMIUw2K7xA==", + "cpu": [ + "arm64" + ], + "dev": true, "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "lodash": "^4.17.21" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=v16" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@sapphire/snowflake": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.5.tgz", - "integrity": "sha512-xzvBr1Q1c4lCe7i6sRnrofxeO1QTP/LKQ6A6qy0iB4x5yfiSfARMEQEghojzTNALDTcv8En04qYNIco9/K9eZQ==", + "node_modules/@oxfmt/binding-darwin-x64": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.72.0.tgz", + "integrity": "sha512-+ZbcxhB1C34RQR5IldSyY6Z/yalJIxHXhP36PGE4sEq0f/lgL5jCLmOKoDeVm8dqd9gFGDsd1bNWHSGCAwdSkw==", + "cpu": [ + "x64" + ], + "dev": true, "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@tsconfig/node10": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.13.tgz", - "integrity": "sha512-gcLdvR9HO1ZJBypsOGqaP6TFEzb6vIta0KSTLt9NAQ6pXQO3cRgSVyCN6pzYqI9DlJgY71XKO0dpDhCf08b3pg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "node_modules/@oxfmt/binding-freebsd-x64": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.72.0.tgz", + "integrity": "sha512-yGPhA8sePEBFV9iGcprhyOk3Bz3fZshswMH3DpYIPZFLT1DG5LjiZ0j6AJQpSueaL6bUK0av1K+5+fe+ldy5EQ==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "node_modules/@oxfmt/binding-linux-arm-gnueabihf": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.72.0.tgz", + "integrity": "sha512-/g5axuqFMcAtoQrFLR5EJEMDjR5Ea4GuzpdDmMpPWAgrF1DmL4kD1NPNVlpXEOxpFJnD6lPvLKYj1lzdlrfifA==", + "cpu": [ + "arm" + ], "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@types/body-parser": { - "version": "1.19.6", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", - "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", + "node_modules/@oxfmt/binding-linux-arm-musleabihf": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.72.0.tgz", + "integrity": "sha512-InVitdHbS09PM+w+WinIiyX37rC9R3L7lUP9mKy9uKTEDSUFaLjWsLoreRIxKivnv7Ndqc6Trvi+K+b6ZzhiJg==", + "cpu": [ + "arm" + ], "dev": true, "license": "MIT", - "dependencies": { - "@types/connect": "*", - "@types/node": "*" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@types/compression": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@types/compression/-/compression-1.8.1.tgz", - "integrity": "sha512-kCFuWS0ebDbmxs0AXYn6e2r2nrGAb5KwQhknjSPSPgJcGd8+HVSILlUyFhGqML2gk39HcG7D1ydW9/qpYkN00Q==", + "node_modules/@oxfmt/binding-linux-arm64-gnu": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.72.0.tgz", + "integrity": "sha512-WKjlyRAxpPjXoqeuwFBim5LscgvY+RNEiZ971C9JlRQZONhJTsXDki/oHFYQE+fzzRpzXh3owZvOdT3kNL2g+g==", + "cpu": [ + "arm64" + ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", - "dependencies": { - "@types/express": "*", - "@types/node": "*" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@types/connect": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", - "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "node_modules/@oxfmt/binding-linux-arm64-musl": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.72.0.tgz", + "integrity": "sha512-poafnbsPpJhR+5Mbwpf8CscugTyiRAzjTOxRVn8ra3X2jnURs2xL5Du2xl5g2iW85lICMglpmLf8jDjZEbNgzQ==", + "cpu": [ + "arm64" + ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", - "dependencies": { - "@types/node": "*" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@types/cors": { - "version": "2.8.19", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", - "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "node_modules/@oxfmt/binding-linux-ppc64-gnu": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.72.0.tgz", + "integrity": "sha512-zNUi0gKRsO7S3IfPzsTbnm88OedPuX32hmZFWZRWHvWJlAoZRwVbeO6Nb3hng4vDgL7qUKp4TGqzPz1mhsycYg==", + "cpu": [ + "ppc64" + ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", - "dependencies": { - "@types/node": "*" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@types/esrecurse": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", - "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", - "license": "MIT" - }, - "node_modules/@types/estree": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", - "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", - "license": "MIT" + "node_modules/@oxfmt/binding-linux-riscv64-gnu": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.72.0.tgz", + "integrity": "sha512-qTY7z/iyF/rWI2HWwWMevXqZW5PZUOofUy2afK7v6rseXnpld3yjgyIk6pCux3DqWQ0lB+f5atvLJNBwzLvFsw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@types/express": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.6.tgz", - "integrity": "sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA==", + "node_modules/@oxfmt/binding-linux-riscv64-musl": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.72.0.tgz", + "integrity": "sha512-w18qfo8vEMD6EKEHtzTvjc6jH8yCyXIT1Bn7PFWJd0PpZyzH/VQDx4xvjCh0LGz6GRzqiezbisTdG9AoXtpkZQ==", + "cpu": [ + "riscv64" + ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", - "dependencies": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^5.0.0", - "@types/serve-static": "^2" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@types/express-serve-static-core": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.1.3.tgz", - "integrity": "sha512-dPfW8NFiOF4wOHc7+N/QSxlY9cfSsenewGbAz8C8U/MULPd/YZ27LvJUIlzaXie7e6Ove9YunJGgC9tbHD2cKw==", + "node_modules/@oxfmt/binding-linux-s390x-gnu": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.72.0.tgz", + "integrity": "sha512-grW8HwEir+vK7fCcq1ZgL3NHQCfZ1PidiERE9Hbf+24xGys+DoDaoqTht4ccfn0PcBwbViLkwkda/KNpJu2KRQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-gnu": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.72.0.tgz", + "integrity": "sha512-wQJRQfWBRIn88Pkr449EUViwRayrYUScg7ty+Ihiem21mQ9BUA6S9e/4RAgyNk9lMag0KBouyKskjq61rOC0WQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-musl": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.72.0.tgz", + "integrity": "sha512-T1B0uQzafxuGPjjaPrZJ497nxoi1BiI65JfsYc56nNpmev3msfb/iaTmH2kQuNFqa8PKxpMlf3GhWrWBvBPORQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-openharmony-arm64": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.72.0.tgz", + "integrity": "sha512-OKxxgTurl7+hypVplO8QRAbbQlwEs0j1Y6FZv+ZN2qNbdxQk2muMlzuJNBGTCWwxQ0rkkOD1uK/DW1fvzoUSJA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-arm64-msvc": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.72.0.tgz", + "integrity": "sha512-L78TKzURqvjuZOCo88ixMbPXf/RP7u31Y0cmjJ/KEmrHmfYhmhEvsDaTYPiyTRne64jUgCbADfY0YeoQk4/Xyw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-ia32-msvc": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.72.0.tgz", + "integrity": "sha512-gQtFW+Ii8BWgtJTAD17TY/WsdNS5gUfAPov8iI1jeq4r9lRRYImmxPL08UU00/RLaCfBJwh2UgINnDY0iOiZ+A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-x64-msvc": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.72.0.tgz", + "integrity": "sha512-uhooIN+DCzWX5uH7mQkSVCsODqsGluGJ4n3ch4+mITtWKpESMDjUJUSDBAVFuYQDwqY2McPDKdKJbM0oZVW/Qw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint-tsgolint/darwin-arm64": { + "version": "7.0.2003", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-arm64/-/darwin-arm64-7.0.2003.tgz", + "integrity": "sha512-TgV33rXr6ueXBwvc+0nssUkTBSXHJxv77I8p4RCjDjCnvexHtmoPiudVRDfj3S3puMDdeQdHW6jdUgUPy3nr/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/darwin-x64": { + "version": "7.0.2003", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-x64/-/darwin-x64-7.0.2003.tgz", + "integrity": "sha512-hY3FMAjIaPDdK3FNxyRXRfHPOFeoBn6dmnLyKZgQ2IbTTD1adXhl6PfCIqHhCPvurigv7nf7mYuWZZ19MmJzmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/linux-arm64": { + "version": "7.0.2003", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-arm64/-/linux-arm64-7.0.2003.tgz", + "integrity": "sha512-eAET4JpyfBbg8SO0K74o4R55tEjVC292pIyxGOw2XGf8x/HrPNyxwQ478jMYOM54FIVOHc8sJ6VRHxluy6lucw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/linux-x64": { + "version": "7.0.2003", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-x64/-/linux-x64-7.0.2003.tgz", + "integrity": "sha512-GXdyO/XyqDJ3s/llR/oOktLsYNjZtWSQBy0JMc+/0gsNPvTcseKPhn9c6KcFyWmnr6H4vljYALbujonqSzzEGw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/win32-arm64": { + "version": "7.0.2003", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-arm64/-/win32-arm64-7.0.2003.tgz", + "integrity": "sha512-TWauXnPfet0VgpmrstoAK58eJ4gbuwPUuUTQmYQAzE/RG1CpnxXtrKUJULf6lyerPE4KN3gM+DflIA1hOH+38Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint-tsgolint/win32-x64": { + "version": "7.0.2003", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-x64/-/win32-x64-7.0.2003.tgz", + "integrity": "sha512-DoRmfe7j8VqNlukp8liRVW45GQDhzRccNenjD/pdzelgtffW47pCMd1xbJLkPaPbKnTwID3onn3VZlL7JbebEA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint/binding-android-arm-eabi": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.87.0.tgz", + "integrity": "sha512-22tVIHlB9898OYsBKmYB6He1MCSqdTmK1BVWuSNUTVrpS0KWNege+U9uEYqGJ+KatQag0r/oU44i3OOs46z7HQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-android-arm64": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.87.0.tgz", + "integrity": "sha512-JfZQ3MWf74n8ov0DojZpkOduIubYJvZL5tbTMMhDutsal6u1xH1QuNpN+lK+EQwF8AeAfgwTR2fgh5U2br27XA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-arm64": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.87.0.tgz", + "integrity": "sha512-rkx6Xvvw93z2GImVOyvbZwAZcoY0Z6MJW177XNsSB+i/CBsH7ANyelTp01VZyIkM3iSXtqKVb4+ptBgPHap5pQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-x64": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.87.0.tgz", + "integrity": "sha512-cw5nYw7L/pQ2SgGBgOcg/Qo89llQre3vIc/kuBLhSICzu1r5s8L76H3ug6AIFsD98WpROj8/z5JVzkf4daxHaQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-freebsd-x64": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.87.0.tgz", + "integrity": "sha512-x/SuznE6loRZK9gz9AS4ZmzNzSu+5KdeoCS+sVHhnrE8HM6AD8UyTjwldQTTqlXGvkwHASgB0NiTNOc3o3PdAg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-gnueabihf": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.87.0.tgz", + "integrity": "sha512-+JEDmCAXiiFmKhAjZhgAOwaHWY6WENOQ5QA+lFuY59tgsUCDOTRi46B+lENK6CWvtxsXpwkZXNOgpjAQcpIpnA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-musleabihf": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.87.0.tgz", + "integrity": "sha512-/uC9XqXLAC9AHFLNycwmSQEvKqGrOCgU+uXALI7gNW0DG81TJ/3T2eHnKdRvcb5R1gFEfjxDwI4e4zIa29rICQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-gnu": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.87.0.tgz", + "integrity": "sha512-FTRYPsBy/M728vnUv7l+KAwSAa3Qi4BQbhVvy7NYuMTZ0sUa/OWsbMx79HVFw6u/5KWcaYayDsoOiv7xbevzDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-musl": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.87.0.tgz", + "integrity": "sha512-6sC+N7IY0h1egd8SrYUGNN7CUyKJZ4bIZakKa7V7hfinf4jfi8Kq4+klJvFp5DqXcwMn44I5MeBwmJluO1odFg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-ppc64-gnu": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.87.0.tgz", + "integrity": "sha512-d5Mnn+ICbhoJPi37Ccjy+86T5qfH2+mSTrTMBXNPfB+wqSWOayBBLLIrCXdUy1YssluCVdGkl+DO9w5r5ODmUA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-gnu": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.87.0.tgz", + "integrity": "sha512-sf5YWuUo1Dx9loqWCgF8P278MycfcD4JHjDC/LV5j11L3Lqa4PFiwCjD6B8kP4AjsgZZkLn3xbpJEtZBaccs4Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-musl": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.87.0.tgz", + "integrity": "sha512-+aCraYbmK3uU3P0rFojjeaK9pGY6JvBDXh/0CM+gPyWKmNmXmnFe0qj4qj02U4ibFpbd9Pa9CmDvIdjJUd29rA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-s390x-gnu": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.87.0.tgz", + "integrity": "sha512-7rzbZQIljo6VLWVPqUyLa2P/WV3VFsJB4M52R4NCUJn1A50yjtUsHxiMHFL9opEKGFIiTbZ3VQzmtcJOPUq4NQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-gnu": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.87.0.tgz", + "integrity": "sha512-Dry46Fa+AXE/xt9J/YriujU1pU9mzfNWHGQwtOYibAFH8HLrKWCi93AhIGnuUMiwn2JbuBkRyz51f50Ly4r4ow==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-musl": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.87.0.tgz", + "integrity": "sha512-f/HMZez74gJvnRpGz+b5sdGyWrEgRLmFTXg9sNoqjPWogGxYHUhXKTKyMiYsu9rUGR2ciYqL3fk+Ua4JhMJbRA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-openharmony-arm64": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.87.0.tgz", + "integrity": "sha512-lEC6ZfPZm/07JlB7FsOWX9o1RiHlXiBW594LSUGuXmekC8LZmvUPP9XzE2WZcNxJi5cHA/Fw56o02c3JxgMA5g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-arm64-msvc": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.87.0.tgz", + "integrity": "sha512-afBWKOD36dUiA9AenaiWpCg8xfyUVPYznyAAVXu413brK4RA5UI/Xoc4yfeGIT8G1a44MV+JR7hioryerBDzGQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-ia32-msvc": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.87.0.tgz", + "integrity": "sha512-daptNsEOuru4/nJTxV4DBHNJ5GepzmaBVQf+jjgKQGi9NRlZKik+RFq4hUL7ewsF1pwjKM+SkYaMbF82UwFGnw==", + "cpu": [ + "ia32" + ], "dev": true, "license": "MIT", - "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*", - "@types/send": "*" + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@types/geojson": { - "version": "7946.0.16", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", - "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", - "license": "MIT" - }, - "node_modules/@types/http-errors": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", - "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", + "node_modules/@oxlint/binding-win32-x64-msvc": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.87.0.tgz", + "integrity": "sha512-k+m/EShyXE29J/r1fjk0HlAzhN5JhIvj044oSJkXTEkCLrWZQgXb/3r4q5LTw/eaKW/4GuMXG2xmiJs3s5rPNw==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@types/json-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@types/json-bigint/-/json-bigint-1.0.4.tgz", - "integrity": "sha512-ydHooXLbOmxBbubnA7Eh+RpBzuaIiQjh8WGJYQB50JFGFrdxW7JzVlyEV7fAXw0T2sqJ1ysTneJbiyNLqZRAag==", - "dev": true, + "node_modules/@samchon/openapi": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/@samchon/openapi/-/openapi-2.5.3.tgz", + "integrity": "sha512-gLcGqPGsr/V43yNrhC+5E8ZR8y1JdLZDgkC6ULg+B03uvmdS2C7qIXpIWUe19MUPvXt5SCpjhvOykomEspinaw==", "license": "MIT" }, - "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==", - "license": "MIT" + "node_modules/@sapphire/async-queue": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.5.tgz", + "integrity": "sha512-cvGzxbba6sav2zZkH8GPf2oGk9yYoD5qrNWdu9fRehifgnFZJMV+nuy2nON2roRO4yQQ+v7MK/Pktl/HgfsUXg==", + "license": "MIT", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } }, - "node_modules/@types/jsonwebtoken": { - "version": "9.0.10", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz", - "integrity": "sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==", - "dev": true, + "node_modules/@sapphire/shapeshift": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-4.0.0.tgz", + "integrity": "sha512-d9dUmWVA7MMiKobL3VpLF8P2aeanRTu6ypG2OIaEv/ZHH/SUQ2iHOVyi5wAPjQ+HmnMuL0whK9ez8I/raWbtIg==", "license": "MIT", "dependencies": { - "@types/ms": "*", - "@types/node": "*" + "fast-deep-equal": "^3.1.3", + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=v16" } }, - "node_modules/@types/morgan": { - "version": "1.9.10", - "resolved": "https://registry.npmjs.org/@types/morgan/-/morgan-1.9.10.tgz", - "integrity": "sha512-sS4A1zheMvsADRVfT0lYbJ4S9lmsey8Zo2F7cnbYjWHP67Q0AwMYuuzLlkIM2N8gAbb9cubhIVFwcIN2XyYCkA==", - "dev": true, + "node_modules/@sapphire/snowflake": { + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.5.tgz", + "integrity": "sha512-xzvBr1Q1c4lCe7i6sRnrofxeO1QTP/LKQ6A6qy0iB4x5yfiSfARMEQEghojzTNALDTcv8En04qYNIco9/K9eZQ==", "license": "MIT", - "dependencies": { - "@types/node": "*" + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" } }, - "node_modules/@types/ms": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", - "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "node_modules/@tsconfig/node10": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.13.tgz", + "integrity": "sha512-gcLdvR9HO1ZJBypsOGqaP6TFEzb6vIta0KSTLt9NAQ6pXQO3cRgSVyCN6pzYqI9DlJgY71XKO0dpDhCf08b3pg==", "dev": true, "license": "MIT" }, - "node_modules/@types/node": { - "version": "20.19.43", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz", - "integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==", - "license": "MIT", - "dependencies": { - "undici-types": "~6.21.0" - } + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "license": "MIT" }, - "node_modules/@types/qs": { - "version": "6.15.1", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.1.tgz", - "integrity": "sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw==", + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", "dev": true, "license": "MIT" }, - "node_modules/@types/range-parser": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", - "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", "dev": true, "license": "MIT" }, - "node_modules/@types/send": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", - "integrity": "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==", + "node_modules/@types/body-parser": { + "version": "1.19.6", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", + "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", "dev": true, "license": "MIT", "dependencies": { + "@types/connect": "*", "@types/node": "*" } }, - "node_modules/@types/serve-static": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-2.2.0.tgz", - "integrity": "sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ==", + "node_modules/@types/compression": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@types/compression/-/compression-1.8.1.tgz", + "integrity": "sha512-kCFuWS0ebDbmxs0AXYn6e2r2nrGAb5KwQhknjSPSPgJcGd8+HVSILlUyFhGqML2gk39HcG7D1ydW9/qpYkN00Q==", "dev": true, "license": "MIT", "dependencies": { - "@types/http-errors": "*", + "@types/express": "*", "@types/node": "*" } }, - "node_modules/@types/ws": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.2.tgz", - "integrity": "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w==", + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dev": true, "license": "MIT", "dependencies": { "@types/node": "*" } }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.71.1.tgz", - "integrity": "sha512-nNlBf6HuotqMgZvSkWD5hNdemiBIxQ2NmrlgfcUIeZRs+BbakjscCQRq/Hb74EFVnFiSWWdL12JruqwBy3ERDw==", + "node_modules/@types/cors": { + "version": "2.8.19", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", + "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.71.1", - "@typescript-eslint/type-utils": "8.71.1", - "@typescript-eslint/utils": "8.71.1", - "@typescript-eslint/visitor-keys": "8.71.1", - "ignore": "^7.0.5", - "natural-compare": "^1.4.0", - "ts-api-utils": "^2.5.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^8.71.1", - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.1.0" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.12", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.12.tgz", - "integrity": "sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==", - "license": "MIT", - "engines": { - "node": ">= 4" + "@types/node": "*" } }, - "node_modules/@typescript-eslint/parser": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.71.1.tgz", - "integrity": "sha512-oM/5sAqz/l1v/zYK1qTOPrn2+JIrBGC1V6uNYucRO5gh6eT9vWJ/RhPbGE59byvZEUQ4VP6XkLBaS5Jti5jpvw==", + "node_modules/@types/express": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.6.tgz", + "integrity": "sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA==", + "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.71.1", - "@typescript-eslint/types": "8.71.1", - "@typescript-eslint/typescript-estree": "8.71.1", - "@typescript-eslint/visitor-keys": "8.71.1", - "debug": "^4.4.3" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.1.0" + "@types/body-parser": "*", + "@types/express-serve-static-core": "^5.0.0", + "@types/serve-static": "^2" } }, - "node_modules/@typescript-eslint/parser/node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "node_modules/@types/express-serve-static-core": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.1.3.tgz", + "integrity": "sha512-dPfW8NFiOF4wOHc7+N/QSxlY9cfSsenewGbAz8C8U/MULPd/YZ27LvJUIlzaXie7e6Ove9YunJGgC9tbHD2cKw==", + "dev": true, "license": "MIT", "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" } }, - "node_modules/@typescript-eslint/parser/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "node_modules/@types/geojson": { + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", "license": "MIT" }, - "node_modules/@typescript-eslint/project-service": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.71.1.tgz", - "integrity": "sha512-Oijc9RUsohHjncg6iGi7gCtjnEjYt9FWv9u6ygK8uKcHK5eLjLAkqERQ9BaytbpceOFdk6kifPCS/zAZE+A99g==", - "license": "MIT", - "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.71.1", - "@typescript-eslint/types": "^8.71.1", - "debug": "^4.4.3" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.1.0" - } - }, - "node_modules/@typescript-eslint/project-service/node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/project-service/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "node_modules/@types/http-errors": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", + "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", + "dev": true, "license": "MIT" }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.71.1.tgz", - "integrity": "sha512-1YUDZXdTnXLlob03SFHBipdyMBsDVm7zoSz0ytTJ39dk5J1TgsTK03VlR/dLXG/RLLUrPcYbD4rp23BmHxHP0w==", - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.71.1", - "@typescript-eslint/visitor-keys": "8.71.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.71.1.tgz", - "integrity": "sha512-oTvkml5SxXhgg+WWKhod5qWQICDXtOB+/Hi9VdPKFAANJ2b7YOgMffgvzXuqog7R6A/JtrzRf128dsxummyWhg==", - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.1.0" - } + "node_modules/@types/json-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/json-bigint/-/json-bigint-1.0.4.tgz", + "integrity": "sha512-ydHooXLbOmxBbubnA7Eh+RpBzuaIiQjh8WGJYQB50JFGFrdxW7JzVlyEV7fAXw0T2sqJ1ysTneJbiyNLqZRAag==", + "dev": true, + "license": "MIT" }, - "node_modules/@typescript-eslint/type-utils": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.71.1.tgz", - "integrity": "sha512-kH3t3jZCYv2PZSBEWPKTariLrCaoF1CLoPitYFBJOhAGEwWnSRAtGEifrfrpBa4K9JlwWNZotgA5w3/wLSk/FQ==", + "node_modules/@types/jsonwebtoken": { + "version": "9.0.10", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz", + "integrity": "sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==", + "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.71.1", - "@typescript-eslint/typescript-estree": "8.71.1", - "@typescript-eslint/utils": "8.71.1", - "debug": "^4.4.3", - "ts-api-utils": "^2.5.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.1.0" + "@types/ms": "*", + "@types/node": "*" } }, - "node_modules/@typescript-eslint/type-utils/node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "node_modules/@types/morgan": { + "version": "1.9.10", + "resolved": "https://registry.npmjs.org/@types/morgan/-/morgan-1.9.10.tgz", + "integrity": "sha512-sS4A1zheMvsADRVfT0lYbJ4S9lmsey8Zo2F7cnbYjWHP67Q0AwMYuuzLlkIM2N8gAbb9cubhIVFwcIN2XyYCkA==", + "dev": true, "license": "MIT", "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "@types/node": "*" } }, - "node_modules/@typescript-eslint/type-utils/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, "license": "MIT" }, - "node_modules/@typescript-eslint/types": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.71.1.tgz", - "integrity": "sha512-ybYnPTUwg3VQQOFEiBPLs8Jxl1ry2vXdn1kVKguomBbvxpetdu3MKTNDqFNUrlG8ylP9MpZosmXMFYlGQHk1oQ==", - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.71.1.tgz", - "integrity": "sha512-pSKSEK1JJpHs6KiKVtABCE4iJK5d7FLFzDXQNBQ2oRY7LEd3UwOt3TZemTgu9syTIf56dJWlTn/pdmrO9oKUXQ==", + "node_modules/@types/node": { + "version": "20.19.43", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz", + "integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==", "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.71.1", - "@typescript-eslint/tsconfig-utils": "8.71.1", - "@typescript-eslint/types": "8.71.1", - "@typescript-eslint/visitor-keys": "8.71.1", - "debug": "^4.4.3", - "minimatch": "^10.2.2", - "semver": "^7.7.3", - "tinyglobby": "^0.2.15", - "ts-api-utils": "^2.5.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.1.0" + "undici-types": "~6.21.0" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "node_modules/@types/qs": { + "version": "6.15.1", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.1.tgz", + "integrity": "sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", + "integrity": "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==", + "dev": true, "license": "MIT", "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "@types/node": "*" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/@typescript-eslint/utils": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.71.1.tgz", - "integrity": "sha512-CBjT6gfAz3DW2j9Q4moFnqt208Aq+506sVGXfpRcyAeqn0EpayL0mjdWoCO2t3RC7GewNrFxdeehuEaPg6DMzQ==", + "node_modules/@types/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ==", + "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.71.1", - "@typescript-eslint/types": "8.71.1", - "@typescript-eslint/typescript-estree": "8.71.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.1.0" + "@types/http-errors": "*", + "@types/node": "*" } }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.71.1.tgz", - "integrity": "sha512-0GxiUGqMU0qXJt58cBsiG3DP8lUmBaFo2vChtUX+CT7PnR3v/VGLLrzVP4K9r1lNiZXjHYefMBbPunplr09v6w==", + "node_modules/@types/ws": { + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.71.1", - "eslint-visitor-keys": "^5.0.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "@types/node": "*" } }, "node_modules/@vladfrangu/async_event_emitter": { @@ -1067,6 +1289,7 @@ "version": "8.19.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -1075,15 +1298,6 @@ "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==", - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, "node_modules/acorn-walk": { "version": "8.3.5", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz", @@ -1097,22 +1311,6 @@ "node": ">=0.4.0" } }, - "node_modules/ajv": { - "version": "6.15.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", - "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", - "license": "MIT", - "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-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -1183,6 +1381,7 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, "license": "MIT", "engines": { "node": "18 || 20 || >=22" @@ -1310,6 +1509,7 @@ "version": "5.0.12", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" @@ -1385,19 +1585,6 @@ "node": ">= 18" } }, - "node_modules/cacheable": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", - "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", - "license": "MIT", - "dependencies": { - "@cacheable/memory": "^2.2.0", - "@cacheable/utils": "^2.5.0", - "hookified": "^1.15.0", - "keyv": "^5.6.0", - "qified": "^0.10.1" - } - }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -1685,20 +1872,6 @@ "dev": true, "license": "MIT" }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/dateformat": { "version": "4.6.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", @@ -1717,12 +1890,6 @@ "ms": "2.0.0" } }, - "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==", - "license": "MIT" - }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -1919,156 +2086,6 @@ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "license": "MIT" }, - "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==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "10.12.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.12.0.tgz", - "integrity": "sha512-npHjrHb2o4ehH3mE+YuxABR+0gyb0aVWCIolgJDArwCiHEIsonBm3ZKjel5b0U5+a+MbEvIyRCGCzD3eKKK2NA==", - "license": "MIT", - "workspaces": [ - "packages/*" - ], - "dependencies": { - "@eslint-community/eslint-utils": "^4.8.0", - "@eslint-community/regexpp": "^4.12.2", - "@eslint/config-array": "^0.23.5", - "@eslint/config-helpers": "^0.7.0", - "@eslint/core": "^1.2.1", - "@eslint/plugin-kit": "^0.7.3", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.2", - "@types/estree": "^1.0.6", - "ajv": "^6.14.0", - "cross-spawn": "^7.0.6", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^9.1.2", - "eslint-visitor-keys": "^5.0.1", - "espree": "^11.2.0", - "esquery": "^1.7.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "11.1.5 || >11.1.6 <12", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "minimatch": "^10.2.5", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-simple-import-sort": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-14.0.0.tgz", - "integrity": "sha512-NUJO0+XFCkk+o5EsAJruTgnfMEpeWrPWeJS15UVF60GgXmqz1BJ9/3hzlvG7lkL8Bubzos5cCLptThbFfPnSMQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "eslint": ">=5.0.0" - } - }, - "node_modules/eslint-scope": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", - "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", - "license": "BSD-2-Clause", - "dependencies": { - "@types/esrecurse": "^4.3.1", - "@types/estree": "^1.0.8", - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", - "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", - "license": "Apache-2.0", - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/eslint/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/espree": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", - "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.16.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^5.0.1" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2076,52 +2093,10 @@ "license": "BSD-2-Clause", "bin": { "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esquery": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", - "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", - "license": "BSD-3-Clause", - "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==", - "license": "BSD-2-Clause", - "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==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.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==", - "license": "BSD-2-Clause", + "esvalidate": "bin/esvalidate.js" + }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/etag": { @@ -2253,18 +2228,6 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "license": "MIT" }, - "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==", - "license": "MIT" - }, - "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==", - "license": "MIT" - }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -2289,15 +2252,6 @@ "node": ">=0.8.0" } }, - "node_modules/file-entry-cache": { - "version": "11.1.5", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", - "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", - "license": "MIT", - "dependencies": { - "flat-cache": "^6.1.23" - } - }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -2355,39 +2309,6 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, - "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==", - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat-cache": { - "version": "6.1.23", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", - "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", - "license": "MIT", - "dependencies": { - "cacheable": "^2.5.0", - "flatted": "^3.4.2", - "hookified": "^1.15.0" - } - }, - "node_modules/flatted": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", - "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", - "license": "ISC" - }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -2467,18 +2388,6 @@ "node": ">= 0.4" } }, - "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==", - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, "node_modules/global-prefix": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-4.0.0.tgz", @@ -2553,18 +2462,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hashery": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", - "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", - "license": "MIT", - "dependencies": { - "hookified": "^1.15.0" - }, - "engines": { - "node": ">=20" - } - }, "node_modules/hasown": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", @@ -2577,12 +2474,6 @@ "node": ">= 0.4" } }, - "node_modules/hookified": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", - "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", - "license": "MIT" - }, "node_modules/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", @@ -2639,15 +2530,6 @@ ], "license": "BSD-3-Clause" }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "license": "MIT", - "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", @@ -2655,15 +2537,6 @@ "dev": true, "license": "ISC" }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2757,6 +2630,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2775,6 +2649,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" @@ -2820,12 +2695,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC" - }, "node_modules/json-bigint": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", @@ -2835,18 +2704,6 @@ "bignumber.js": "^9.0.0" } }, - "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==", - "license": "MIT" - }, - "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==", - "license": "MIT" - }, "node_modules/jsonwebtoken": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", @@ -2896,15 +2753,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/keyv": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", - "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", - "license": "MIT", - "dependencies": { - "@keyv/serialize": "^1.1.1" - } - }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -2915,34 +2763,6 @@ "node": ">=0.10.0" } }, - "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==", - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "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==", - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/lodash": { "version": "4.18.1", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", @@ -3135,6 +2955,7 @@ "version": "10.2.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "brace-expansion": "^5.0.8" @@ -3188,12 +3009,6 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "license": "ISC" }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "license": "MIT" - }, "node_modules/negotiator": { "version": "0.6.4", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", @@ -3356,23 +3171,6 @@ "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==", - "license": "MIT", - "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/ora": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", @@ -3396,34 +3194,123 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "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==", + "node_modules/oxfmt": { + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/oxfmt/-/oxfmt-0.72.0.tgz", + "integrity": "sha512-16OQeL0uhPZbfmT9S9WWM0Nv9+BmVi8Ra1uTYaSKj/qSCs6FB30KOhz9JoNYw6thT+K5bVxsk/tSEOu497i34g==", + "dev": true, "license": "MIT", "dependencies": { - "yocto-queue": "^0.1.0" + "tinypool": "2.2.0" + }, + "bin": { + "oxfmt": "bin/oxfmt" }, "engines": { - "node": ">=10" + "node": "^20.19.0 || >=22.12.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxfmt/binding-android-arm-eabi": "0.72.0", + "@oxfmt/binding-android-arm64": "0.72.0", + "@oxfmt/binding-darwin-arm64": "0.72.0", + "@oxfmt/binding-darwin-x64": "0.72.0", + "@oxfmt/binding-freebsd-x64": "0.72.0", + "@oxfmt/binding-linux-arm-gnueabihf": "0.72.0", + "@oxfmt/binding-linux-arm-musleabihf": "0.72.0", + "@oxfmt/binding-linux-arm64-gnu": "0.72.0", + "@oxfmt/binding-linux-arm64-musl": "0.72.0", + "@oxfmt/binding-linux-ppc64-gnu": "0.72.0", + "@oxfmt/binding-linux-riscv64-gnu": "0.72.0", + "@oxfmt/binding-linux-riscv64-musl": "0.72.0", + "@oxfmt/binding-linux-s390x-gnu": "0.72.0", + "@oxfmt/binding-linux-x64-gnu": "0.72.0", + "@oxfmt/binding-linux-x64-musl": "0.72.0", + "@oxfmt/binding-openharmony-arm64": "0.72.0", + "@oxfmt/binding-win32-arm64-msvc": "0.72.0", + "@oxfmt/binding-win32-ia32-msvc": "0.72.0", + "@oxfmt/binding-win32-x64-msvc": "0.72.0" + }, + "peerDependencies": { + "svelte": "^5.0.0", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + }, + "vite-plus": { + "optional": true + } } }, - "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==", + "node_modules/oxlint": { + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.87.0.tgz", + "integrity": "sha512-drxVlaW7Oqq7wSy1CN25znRu00aRq8n57Q2wniJRxCmtYVz07ufCm7EVDPQFZURrTgQIjzKrVEHAD/HcvJXObg==", + "dev": true, "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" + "bin": { + "oxlint": "bin/oxlint" }, "engines": { - "node": ">=10" + "node": "^20.19.0 || >=22.12.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxlint/binding-android-arm-eabi": "1.87.0", + "@oxlint/binding-android-arm64": "1.87.0", + "@oxlint/binding-darwin-arm64": "1.87.0", + "@oxlint/binding-darwin-x64": "1.87.0", + "@oxlint/binding-freebsd-x64": "1.87.0", + "@oxlint/binding-linux-arm-gnueabihf": "1.87.0", + "@oxlint/binding-linux-arm-musleabihf": "1.87.0", + "@oxlint/binding-linux-arm64-gnu": "1.87.0", + "@oxlint/binding-linux-arm64-musl": "1.87.0", + "@oxlint/binding-linux-ppc64-gnu": "1.87.0", + "@oxlint/binding-linux-riscv64-gnu": "1.87.0", + "@oxlint/binding-linux-riscv64-musl": "1.87.0", + "@oxlint/binding-linux-s390x-gnu": "1.87.0", + "@oxlint/binding-linux-x64-gnu": "1.87.0", + "@oxlint/binding-linux-x64-musl": "1.87.0", + "@oxlint/binding-openharmony-arm64": "1.87.0", + "@oxlint/binding-win32-arm64-msvc": "1.87.0", + "@oxlint/binding-win32-ia32-msvc": "1.87.0", + "@oxlint/binding-win32-x64-msvc": "1.87.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=7.0.2003", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + }, + "vite-plus": { + "optional": true + } + } + }, + "node_modules/oxlint-tsgolint": { + "version": "7.0.2003", + "resolved": "https://registry.npmjs.org/oxlint-tsgolint/-/oxlint-tsgolint-7.0.2003.tgz", + "integrity": "sha512-VnK4zlqgmgq/7ZcjzCk/WpN8kKFsYGcB85Io9qT3wL4K8Un3RKmJkp793crNETieMusPMKOA4a+Mw2wbteI6TQ==", + "dev": true, + "license": "MIT", + "bin": { + "tsgolint": "bin/tsgolint.js" + }, + "optionalDependencies": { + "@oxlint-tsgolint/darwin-arm64": "7.0.2003", + "@oxlint-tsgolint/darwin-x64": "7.0.2003", + "@oxlint-tsgolint/linux-arm64": "7.0.2003", + "@oxlint-tsgolint/linux-x64": "7.0.2003", + "@oxlint-tsgolint/win32-arm64": "7.0.2003", + "@oxlint-tsgolint/win32-x64": "7.0.2003" } }, "node_modules/package-manager-detector": { @@ -3444,24 +3331,6 @@ "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==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "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==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", @@ -3492,15 +3361,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "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==", - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/promise-coalesce": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/promise-coalesce/-/promise-coalesce-1.5.0.tgz", @@ -3534,33 +3394,6 @@ "dev": true, "license": "MIT" }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/qified": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", - "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", - "license": "MIT", - "dependencies": { - "hookified": "^2.1.1" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/qified/node_modules/hookified": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", - "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", - "license": "MIT" - }, "node_modules/qs": { "version": "6.16.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz", @@ -3892,27 +3725,6 @@ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "license": "ISC" }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/side-channel": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", @@ -4079,49 +3891,14 @@ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "license": "MIT" }, - "node_modules/tinyglobby": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", - "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", - "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "node_modules/tinypool": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-2.2.0.tgz", + "integrity": "sha512-jBrmx4lYmaC9k/mgPbylxs7kBUxHtD8256up+HjLaDFfXScKJQyil+SWXSvhAtT7XHo+yTVlpB81PGmHP8oLSQ==", + "dev": true, "license": "MIT", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "node": "^20.0.0 || >=22.0.0" } }, "node_modules/to-regex-range": { @@ -4156,18 +3933,6 @@ "nodetouch": "bin/nodetouch.js" } }, - "node_modules/ts-api-utils": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", - "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", - "license": "MIT", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" - } - }, "node_modules/ts-mixer": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz", @@ -4243,18 +4008,6 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD" }, - "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==", - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", @@ -4298,29 +4051,6 @@ "node": ">=14.17" } }, - "node_modules/typescript-eslint": { - "version": "8.71.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.71.1.tgz", - "integrity": "sha512-oiNVPC3/NbV1FpaHU07l8O6ynqG9v4PAiW2WvTrAmZdR0f2HI/gE668ElMLCK7Xbsu5k2fK5C4fXNiq05j7/nQ==", - "license": "MIT", - "dependencies": { - "@typescript-eslint/eslint-plugin": "8.71.1", - "@typescript-eslint/parser": "8.71.1", - "@typescript-eslint/typescript-estree": "8.71.1", - "@typescript-eslint/utils": "8.71.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.1.0" - } - }, "node_modules/typia": { "version": "7.6.4", "resolved": "https://registry.npmjs.org/typia/-/typia-7.6.4.tgz", @@ -4373,15 +4103,6 @@ "node": ">= 0.8" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -4413,30 +4134,6 @@ "defaults": "^1.0.3" } }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "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==", - "license": "MIT", - "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", @@ -4509,18 +4206,6 @@ "engines": { "node": ">=6" } - }, - "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==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } } } } diff --git a/package.json b/package.json index 255697f..9eb9eaa 100644 --- a/package.json +++ b/package.json @@ -2,40 +2,25 @@ "name": "axobot-api", "version": "1.6.3", "description": "A TypeScript API for the Axobot Discord bot", + "homepage": "https://github.com/ZRunner/Axobot-API-V2#readme", + "bugs": { + "url": "https://github.com/ZRunner/Axobot-API-V2/issues" + }, + "license": "GPL-3.0", + "author": "ZRunner", + "repository": { + "type": "git", + "url": "git+https://github.com/ZRunner/Axobot-API-V2.git" + }, "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "lint": "eslint . --ext .ts", + "lint": "oxlint", + "fmt": "oxfmt", "dev": "npx nodemon", "build": "tsc", "start": "npm run build && node build/index.js", "prepare": "ts-patch install && typia patch" }, - "repository": { - "type": "git", - "url": "git+https://github.com/ZRunner/Axobot-API-V2.git" - }, - "author": "ZRunner", - "license": "GPL-3.0", - "bugs": { - "url": "https://github.com/ZRunner/Axobot-API-V2/issues" - }, - "homepage": "https://github.com/ZRunner/Axobot-API-V2#readme", - "devDependencies": { - "@types/compression": "^1.7.5", - "@types/cors": "^2.8.13", - "@types/express": "^5.0.0", - "@types/json-bigint": "^1.0.4", - "@types/jsonwebtoken": "^9.0.2", - "@types/morgan": "^1.9.4", - "@types/node": "^20.4.8", - "eslint": "^10.8.0", - "eslint-plugin-simple-import-sort": "^14.0.0", - "nodemon": "^3.1.0", - "ts-node": "^10.9.2", - "ts-patch": "^3.3.0", - "typescript": "~5.7.3" - }, "dependencies": { "cache-manager": "^5.4.0", "compression": "^1.8.1", @@ -50,7 +35,22 @@ "mariadb": "^3.2.0", "morgan": "^1.12.0", "rss-parser": "github:ZRunner/rss-parser", - "typescript-eslint": "^8.65.0", "typia": "^7.0.0" + }, + "devDependencies": { + "@types/compression": "^1.7.5", + "@types/cors": "^2.8.13", + "@types/express": "^5.0.0", + "@types/json-bigint": "^1.0.4", + "@types/jsonwebtoken": "^9.0.2", + "@types/morgan": "^1.9.4", + "@types/node": "^20.4.8", + "nodemon": "^3.1.0", + "oxfmt": "^0.72.0", + "oxlint": "^1.87.0", + "oxlint-tsgolint": "^7.0.2003", + "ts-node": "^10.9.2", + "ts-patch": "^3.3.0", + "typescript": "~5.7.3" } -} \ No newline at end of file +} From 30e245b5b19db7269356733dd33a75c2df4fff29 Mon Sep 17 00:00:00 2001 From: ZRunner Date: Sat, 10 Oct 2026 00:26:41 +0200 Subject: [PATCH 07/13] fix(lint): reformat every file --- .github/workflows/codeql.yml | 74 +- README.md | 1 + nodemon.json | 6 +- src/bot/client.ts | 561 +++---- src/database/db.ts | 523 ++++--- .../guild-config/guild-config-manager.ts | 419 ++--- .../guild-config/guild-config-options.json | 1016 ++++++------- .../guild-config/guild-config-types.ts | 175 ++- .../guild-config/value-validity-asserts.ts | 415 ++--- src/database/models/auth.d.ts | 12 +- src/database/models/misc-db-types.ts | 18 +- src/database/models/rss.ts | 168 +- src/database/models/users.d.ts | 12 +- src/database/models/xp.d.ts | 26 +- src/index.ts | 59 +- src/modules/auth/controler.ts | 135 +- src/modules/auth/ratelimits.ts | 8 +- src/modules/auth/router.ts | 2 +- src/modules/auth/tokens.ts | 74 +- src/modules/crowdin/controler.ts | 342 +++-- src/modules/crowdin/router.ts | 2 +- src/modules/crowdin/types/commons.d.ts | 94 +- src/modules/crowdin/types/events.d.ts | 62 +- src/modules/crowdin/types/index.ts | 25 +- src/modules/crowdin/utils.ts | 37 +- src/modules/discord/controler.ts | 1350 +++++++++-------- src/modules/discord/middlewares.ts | 98 +- src/modules/discord/ratelimits.ts | 60 +- src/modules/discord/router.ts | 165 +- src/modules/discord/types/guilds.d.ts | 80 +- src/modules/discord/types/typeguards.ts | 4 +- src/modules/discord/types/users.d.ts | 22 +- src/modules/discord/utils/leaderboard.ts | 100 +- src/modules/discord/utils/xp.ts | 26 +- src/modules/docker/controler.ts | 102 +- src/modules/docker/router.ts | 2 +- src/modules/docker/types/index.d.ts | 55 +- src/modules/rss/controler.ts | 51 +- src/modules/rss/ratelimits.ts | 6 +- src/modules/rss/router.ts | 2 +- src/modules/rss/types/api-input.d.ts | 8 +- src/rss/modules/parsed-entry.ts | 20 +- src/rss/modules/web-rss.ts | 162 +- src/rss/modules/youtube-rss.ts | 255 ++-- src/rss/rss-external-apis-manager.ts | 109 +- src/types.d.ts | 66 +- src/utils/cache_control.ts | 2 +- src/utils/date_formatter.ts | 14 +- src/utils/defaut_map.ts | 20 +- src/utils/discord_message.d.ts | 59 +- src/utils/env_checks.ts | 78 +- tsconfig.json | 26 +- 52 files changed, 3817 insertions(+), 3391 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index af0f8d4..801c097 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,11 +13,11 @@ name: "CodeQL" on: push: - branches: [ "main", "beta" ] + branches: ["main", "beta"] pull_request: - branches: [ "main", "beta" ] + branches: ["main", "beta"] schedule: - - cron: '28 4 * * 6' + - cron: "28 4 * * 6" jobs: analyze: @@ -41,8 +41,8 @@ jobs: fail-fast: false matrix: include: - - language: javascript-typescript - build-mode: none + - language: javascript-typescript + build-mode: none # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' # Use `c-cpp` to analyze code written in C, C++ or both # Use 'java-kotlin' to analyze code written in Java, Kotlin or both @@ -52,39 +52,39 @@ jobs: # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v7 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v4 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - queries: security-extended - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-extended + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - if: matrix.build-mode == 'manual' - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" diff --git a/README.md b/README.md index b0203c3..3824e9e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Axobot-API-V2 + The new TypeScript API for my Discord bot diff --git a/nodemon.json b/nodemon.json index 2970b36..5c14689 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,8 +1,6 @@ { - "watch": [ - "src" - ], + "watch": ["src"], "ext": ".ts,.js", "ignore": [], "exec": "npx ts-node --files ./src/index.ts" -} \ No newline at end of file +} diff --git a/src/bot/client.ts b/src/bot/client.ts index 7e474d0..c47cb4e 100644 --- a/src/bot/client.ts +++ b/src/bot/client.ts @@ -1,5 +1,14 @@ import { createCache, MemoryCache, memoryStore } from "cache-manager"; -import { AnonymousGuild, Client, DiscordAPIError, Events, GatewayIntentBits, GuildFeature, PermissionResolvable, PermissionsBitField } from "discord.js"; +import { + AnonymousGuild, + Client, + DiscordAPIError, + Events, + GatewayIntentBits, + GuildFeature, + PermissionResolvable, + PermissionsBitField, +} from "discord.js"; import Database from "../database/db"; import GuildConfigManager from "../database/guild-config/guild-config-manager"; @@ -8,310 +17,320 @@ import { PopulatedRoleReward } from "../database/models/xp"; import { OauthGuildData, OauthGuildRawData } from "../modules/discord/types/guilds"; import { isDiscordAPIError } from "../modules/discord/types/typeguards"; - export default class DiscordClient { - private static instance: DiscordClient; + private static instance: DiscordClient; - private client: Client | null = null; + private client: Client | null = null; - private db: Database = Database.getInstance(); + private db: Database = Database.getInstance(); - private cache: MemoryCache; + private cache: MemoryCache; - private fetchedGuildIds = new Set(); + private fetchedGuildIds = new Set(); - private constructor() { - this.cache = createCache(memoryStore({ - max: 100, - ttl: 120 * 1000, - })); - } + private constructor() { + this.cache = createCache( + memoryStore({ + max: 100, + ttl: 120 * 1000, + }), + ); + } - public static getInstance(): DiscordClient { - if (!DiscordClient.instance) { - DiscordClient.instance = new DiscordClient(); - } - return DiscordClient.instance; + public static getInstance(): DiscordClient { + if (!DiscordClient.instance) { + DiscordClient.instance = new DiscordClient(); } - - public async getClient(): Promise { - if (!this.client) { - console.debug("Creating new client"); - this.client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers] }); - this.client.once(Events.ClientReady, c => { - console.info(`Ready! Logged in as ${c.user.tag}`); - }); - if (process.env.NODE_ENV === "development") { - this.client.on("debug", console.debug); - } - this.client.on("warn", console.warn); - this.client.on("error", console.error); - await this.client.login(process.env.DISCORD_BOT_TOKEN); - } - return this.client; + return DiscordClient.instance; + } + + public async getClient(): Promise { + if (!this.client) { + console.debug("Creating new client"); + this.client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers] }); + this.client.once(Events.ClientReady, (c) => { + console.info(`Ready! Logged in as ${c.user.tag}`); + }); + if (process.env.NODE_ENV === "development") { + this.client.on("debug", console.debug); + } + this.client.on("warn", console.warn); + this.client.on("error", console.error); + await this.client.login(process.env.DISCORD_BOT_TOKEN); } - - public async logout() { - this.client?.destroy(); + return this.client; + } + + public async logout() { + this.client?.destroy(); + } + + private async waitUntilReady() { + return new Promise((resolve) => { + if (this.client?.isReady()) { + resolve(); + } else { + this.client?.once(Events.ClientReady, () => resolve()); + } + }); + } + + public async getGuildCount() { + const client = await this.getClient(); + await this.waitUntilReady(); + return client.guilds.cache.size; + } + + public async resolveUser(userId: string) { + const client = await this.getClient(); + try { + return await client.users.fetch(userId); + } catch (err) { + if (isDiscordAPIError(err) && err.code === 10013) { + return null; + } + throw err; } + } - private async waitUntilReady() { - return new Promise(resolve => { - if (this.client?.isReady()) { - resolve(); - } else { - this.client?.once(Events.ClientReady, () => resolve()); - } - }); + public getAvatarUrlFromHash(hash: string | null, userId: bigint | string) { + if (hash === null) { + const index = (BigInt(userId) >> 22n) % 6n; + return `https://cdn.discordapp.com/embed/avatars/${index}.png`; } - - public async getGuildCount() { - const client = await this.getClient(); - await this.waitUntilReady(); - return client.guilds.cache.size; + return `https://cdn.discordapp.com/avatars/${userId}/${hash}.webp`; + } + + public async getRawUserData(userId: bigint | string): Promise { + let intUserId: bigint; + try { + intUserId = BigInt(userId); + } catch (err) { + return null; } - - public async resolveUser(userId: string) { - const client = await this.getClient(); - try { - return await client.users.fetch(userId); - } catch (err) { - if (isDiscordAPIError(err) && err.code === 10013) { - return null; - } - throw err; - } + const dbCache = await this.db.getUserDataFromCache([intUserId]); + if (dbCache.length === 1) { + return dbCache[0]; } - - public getAvatarUrlFromHash(hash: string | null, userId: bigint | string) { - if (hash === null) { - const index = (BigInt(userId) >> 22n) % 6n; - return `https://cdn.discordapp.com/embed/avatars/${index}.png`; - } - return `https://cdn.discordapp.com/avatars/${userId}/${hash}.webp`; + const user = await this.resolveUser(userId.toString()); + if (user === null) { + return null; } - - public async getRawUserData(userId: bigint | string): Promise { - let intUserId: bigint; - try { - intUserId = BigInt(userId); - } catch (err) { - return null; - } - const dbCache = await this.db.getUserDataFromCache([intUserId]); - if (dbCache.length === 1) { - return dbCache[0]; - } - const user = await this.resolveUser(userId.toString()); - if (user === null) { - return null; - } - return { - "user_id": intUserId, - "username": user.username, - "global_name": user.globalName, - "avatar_hash": user.avatar, - "is_bot": user.bot, - }; + return { + user_id: intUserId, + username: user.username, + global_name: user.globalName, + avatar_hash: user.avatar, + is_bot: user.bot, + }; + } + + public async resolveGuild(guildId: string) { + const client = await this.getClient(); + try { + return await client.guilds.fetch(guildId); + } catch (err) { + if (isDiscordAPIError(err) && err.code === 10004) { + return null; + } + throw err; } + } - public async resolveGuild(guildId: string) { - const client = await this.getClient(); - try { - return await client.guilds.fetch(guildId); - } catch (err) { - if (isDiscordAPIError(err) && err.code === 10004) { - return null; - } - throw err; - } + public async resolveRole(guildId: string, roleId: string) { + const guild = await this.resolveGuild(guildId); + if (guild === null) { + return null; } - - public async resolveRole(guildId: string, roleId: string) { - const guild = await this.resolveGuild(guildId); - if (guild === null) { - return null; - } - try { - return guild.roles.fetch(roleId); - } catch (err) { - if (isDiscordAPIError(err) && err.code === 10011) { - return null; - } - throw err; - } + try { + return guild.roles.fetch(roleId); + } catch (err) { + if (isDiscordAPIError(err) && err.code === 10011) { + return null; + } + throw err; } + } - public async getMemberFromGuild(guildId: string, userId: string) { - const guild = await this.resolveGuild(guildId); - if (guild === null) { - return null; - } - let member; - try { - member = await guild.members.fetch(userId); - } catch (err) { - if (isDiscordAPIError(err) && (["10013", "10007"].includes(err.code.toString()))) { - // unknown guild, unknown user, unknown member - return null; - } - throw err; - } - return member; + public async getMemberFromGuild(guildId: string, userId: string) { + const guild = await this.resolveGuild(guildId); + if (guild === null) { + return null; } - - public async checkUserPresenceInGuild(guildId: string, userId: string) { - return (await this.getMemberFromGuild(guildId, userId)) !== null; + let member; + try { + member = await guild.members.fetch(userId); + } catch (err) { + if (isDiscordAPIError(err) && ["10013", "10007"].includes(err.code.toString())) { + // unknown guild, unknown user, unknown member + return null; + } + throw err; } + return member; + } - public async checkUserPermissionInGuild(guildId: string, userId: string, permission: PermissionResolvable) { - const member = await this.getMemberFromGuild(guildId, userId); - if (member === null) { - return false; - } - if (member.guild.roles.cache.size === 0) { - await member.guild.roles.fetch(); - } - return member.permissions.has(permission); - } + public async checkUserPresenceInGuild(guildId: string, userId: string) { + return (await this.getMemberFromGuild(guildId, userId)) !== null; + } - public async getGuildMembers(guildId: string) { - const guild = await this.resolveGuild(guildId); - if (guild === null) { - return null; - } - if (this.fetchedGuildIds.has(BigInt(guildId))) { - return guild.members.cache; - } - this.fetchedGuildIds.add(BigInt(guildId)); - return await guild.members.fetch(); + public async checkUserPermissionInGuild(guildId: string, userId: string, permission: PermissionResolvable) { + const member = await this.getMemberFromGuild(guildId, userId); + if (member === null) { + return false; } - - public async getGuildMemberIds(guildId: string) { - const members = await this.getGuildMembers(guildId); - if (members === null) { - return null; - } - return Array.from(members.keys()); + if (member.guild.roles.cache.size === 0) { + await member.guild.roles.fetch(); } + return member.permissions.has(permission); + } - public async getDefaultGuildConfig() { - return GuildConfigManager.optionsList; + public async getGuildMembers(guildId: string) { + const guild = await this.resolveGuild(guildId); + if (guild === null) { + return null; } - - public async getUserFromOauth(discordToken: string): Promise { - const user: OauthUserData | DiscordAPIError = await fetch("https://discord.com/api/users/@me", { - headers: { - "Authorization": `Bearer ${discordToken}`, - }, - }).then(fres => fres.json()); - - if (isDiscordAPIError(user)) { - console.debug(user); - return null; - } - return user; + if (this.fetchedGuildIds.has(BigInt(guildId))) { + return guild.members.cache; } - - public async getBasicGuildInfo(arg: {oauthGuild: OauthGuildRawData, baseGuild?: undefined, userId?: undefined, } | {baseGuild: AnonymousGuild, userId: string, oauthGuild?: undefined}) { - const commonData = arg.baseGuild || arg.oauthGuild; - let icon: string | null = null; - let banner: string | null = null; - let splash: string | null = null; - let isOwner = false; - let permissions: PermissionsBitField | null = null; - let isAdmin = false; - - const client = await this.getClient(); - await this.waitUntilReady(); - const fetchedGuild = await client.guilds.fetch(commonData.id).catch(() => null); - - if (arg.oauthGuild) { - if (fetchedGuild) { - banner = fetchedGuild.bannerURL(); - splash = fetchedGuild.splashURL(); - } - icon = commonData.icon ? `https://cdn.discordapp.com/icons/${commonData.id}/${commonData.icon}.webp` : null; - isOwner = arg.oauthGuild.owner; - permissions = new PermissionsBitField(BigInt(arg.oauthGuild.permissions)); - isAdmin = arg.oauthGuild.owner || permissions.has("Administrator"); + this.fetchedGuildIds.add(BigInt(guildId)); + return await guild.members.fetch(); + } + + public async getGuildMemberIds(guildId: string) { + const members = await this.getGuildMembers(guildId); + if (members === null) { + return null; + } + return Array.from(members.keys()); + } + + public async getDefaultGuildConfig() { + return GuildConfigManager.optionsList; + } + + public async getUserFromOauth(discordToken: string): Promise { + const user: OauthUserData | DiscordAPIError = await fetch("https://discord.com/api/users/@me", { + headers: { + Authorization: `Bearer ${discordToken}`, + }, + }).then((fres) => fres.json()); + + if (isDiscordAPIError(user)) { + console.debug(user); + return null; + } + return user; + } + + public async getBasicGuildInfo( + arg: + | { oauthGuild: OauthGuildRawData; baseGuild?: undefined; userId?: undefined } + | { baseGuild: AnonymousGuild; userId: string; oauthGuild?: undefined }, + ) { + const commonData = arg.baseGuild || arg.oauthGuild; + let icon: string | null = null; + let banner: string | null = null; + let splash: string | null = null; + let isOwner = false; + let permissions: PermissionsBitField | null = null; + let isAdmin = false; + + const client = await this.getClient(); + await this.waitUntilReady(); + const fetchedGuild = await client.guilds.fetch(commonData.id).catch(() => null); + + if (arg.oauthGuild) { + if (fetchedGuild) { + banner = fetchedGuild.bannerURL(); + splash = fetchedGuild.splashURL(); + } + icon = commonData.icon + ? `https://cdn.discordapp.com/icons/${commonData.id}/${commonData.icon}.webp` + : null; + isOwner = arg.oauthGuild.owner; + permissions = new PermissionsBitField(BigInt(arg.oauthGuild.permissions)); + isAdmin = arg.oauthGuild.owner || permissions.has("Administrator"); + } else { + icon = arg.baseGuild.iconURL(); + banner = arg.baseGuild.bannerURL(); + splash = arg.baseGuild.splashURL(); + if (fetchedGuild) { + isOwner = isAdmin = fetchedGuild.ownerId === arg.userId; + if (isOwner) { + permissions = new PermissionsBitField(BigInt("8")); } else { - icon = arg.baseGuild.iconURL(); - banner = arg.baseGuild.bannerURL(); - splash = arg.baseGuild.splashURL(); - if (fetchedGuild) { - isOwner = isAdmin = fetchedGuild.ownerId === arg.userId; - if (isOwner) { - permissions = new PermissionsBitField(BigInt("8")); - } else { - const member = await this.getMemberFromGuild(commonData.id, arg.userId); - if (member) { - permissions = member.permissions; - isAdmin = member.permissions.has("Administrator"); - } - } - } + const member = await this.getMemberFromGuild(commonData.id, arg.userId); + if (member) { + permissions = member.permissions; + isAdmin = member.permissions.has("Administrator"); + } } - - return { - id: commonData.id, - name: commonData.name, - icon, - banner, - splash, - isOwner, - isAdmin, - permissions, - isBotPresent: fetchedGuild !== null, - features: commonData.features as GuildFeature[], - }; + } } - public async getGuildsFromOauth(discordToken: string): Promise { - const cached = await this.cache.get(`getGuildsFromOauth-${discordToken}`); - if (cached !== undefined) { - return cached; - } - - const data: OauthGuildRawData[] = await fetch("https://discord.com/api/v10/users/@me/guilds", { - headers: { - "Authorization": `Bearer ${discordToken}`, - }, - }).then(fres => fres.json()); - - if (isDiscordAPIError(data)) { - console.debug(data); - if (data.message === "401: Unauthorized") { - return 401; - } - return null; - } - - const guilds = await Promise.all(data.map(async (rawGuild) => await this.getBasicGuildInfo({ oauthGuild: rawGuild }))); - - await this.cache.set(`getGuildsFromOauth-${discordToken}`, guilds); - - return guilds; + return { + id: commonData.id, + name: commonData.name, + icon, + banner, + splash, + isOwner, + isAdmin, + permissions, + isBotPresent: fetchedGuild !== null, + features: commonData.features as GuildFeature[], + }; + } + + public async getGuildsFromOauth(discordToken: string): Promise { + const cached = await this.cache.get(`getGuildsFromOauth-${discordToken}`); + if (cached !== undefined) { + return cached; } - public async getGuildRoleRewards(guildId: bigint): Promise { - const roleRewards = await this.db.getGuildRoleRewards(guildId); - return Promise.all(roleRewards.map(async (roleReward) => { - const role = await this.resolveRole(roleReward.guildId.toString(), roleReward.roleId.toString()); - if (role === null) { - return { - ...roleReward, - role: null, - }; - } - return { - ...roleReward, - role: { - name: role.name, - color: role.color, - }, - }; - })); + const data: OauthGuildRawData[] = await fetch("https://discord.com/api/v10/users/@me/guilds", { + headers: { + Authorization: `Bearer ${discordToken}`, + }, + }).then((fres) => fres.json()); + + if (isDiscordAPIError(data)) { + console.debug(data); + if (data.message === "401: Unauthorized") { + return 401; + } + return null; } -} \ No newline at end of file + const guilds = await Promise.all( + data.map(async (rawGuild) => await this.getBasicGuildInfo({ oauthGuild: rawGuild })), + ); + + await this.cache.set(`getGuildsFromOauth-${discordToken}`, guilds); + + return guilds; + } + + public async getGuildRoleRewards(guildId: bigint): Promise { + const roleRewards = await this.db.getGuildRoleRewards(guildId); + return Promise.all( + roleRewards.map(async (roleReward) => { + const role = await this.resolveRole(roleReward.guildId.toString(), roleReward.roleId.toString()); + if (role === null) { + return { + ...roleReward, + role: null, + }; + } + return { + ...roleReward, + role: { + name: role.name, + color: role.color, + }, + }; + }), + ); + } +} diff --git a/src/database/db.ts b/src/database/db.ts index 3e98151..a3a3e60 100644 --- a/src/database/db.ts +++ b/src/database/db.ts @@ -10,205 +10,330 @@ const BETA = process.env.DISCORD_ENTITY_ID === "1"; const RSS_TABLE = BETA ? "rss_feed_beta" : "rss_feed"; const DB_CONFIG: PoolConfig = { - host: process.env.DATABASE_HOST, - database: process.env.DATABASE_NAME, - user: process.env.DATABASE_USER, - password: process.env.DATABASE_PASSWORD, - port: process.env.DATABASE_PORT ? Number(process.env.DATABASE_PORT) : undefined, - trace: BETA, - timezone: "auto", - - typeCast: function castField(field, useDefaultTypeCasting) { - // We only want to cast bit fields that have a single-bit in them. If the field - // has more than one bit, then we cannot assume it is supposed to be a Boolean. - // FIXME: should use Types.BIT here but mariadb broke its export (https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/347) - if ( ( field.type === "BIT" ) && ( field.columnLength === 1 ) ) { - const bytes = field.buffer(); - // A Buffer in Node represents a collection of 8-bit unsigned integers. - // Therefore, our single "bit field" comes back as the bits '0000 0001', - // which is equivalent to the number 1. - return (bytes !== null && bytes[ 0 ] === 1); - } - - return ( useDefaultTypeCasting() ); - }, + host: process.env.DATABASE_HOST, + database: process.env.DATABASE_NAME, + user: process.env.DATABASE_USER, + password: process.env.DATABASE_PASSWORD, + port: process.env.DATABASE_PORT ? Number(process.env.DATABASE_PORT) : undefined, + trace: BETA, + timezone: "auto", + + typeCast: function castField(field, useDefaultTypeCasting) { + // We only want to cast bit fields that have a single-bit in them. If the field + // has more than one bit, then we cannot assume it is supposed to be a Boolean. + // FIXME: should use Types.BIT here but mariadb broke its export (https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/347) + if (field.type === "BIT" && field.columnLength === 1) { + const bytes = field.buffer(); + // A Buffer in Node represents a collection of 8-bit unsigned integers. + // Therefore, our single "bit field" comes back as the bits '0000 0001', + // which is equivalent to the number 1. + return bytes !== null && bytes[0] === 1; + } + + return useDefaultTypeCasting(); + }, }; export default class Database { - private static instance: Database; - - private axobotPool: Pool; - - private apiPool: Pool; - - private xpPool: Pool; - - public static getInstance(): Database { - if (!Database.instance) { - Database.instance = new Database(DB_CONFIG); - } - return Database.instance; - } - - private constructor(config: PoolConfig) { - this.axobotPool = createPool({ ...config, database: "axobot" }); - this.apiPool = createPool(config); - this.xpPool = createPool({ ...config, database: "axobot-xp" }); - } - - public async getFullGuildConfigOptions(guildId: bigint): Promise<{ option_name: string, value: string }[]> { - return await this.axobotPool.query<{ option_name: string, value: string }[]>("SELECT `option_name`, `value` FROM `serverconfig` WHERE `guild_id` = ? AND `beta` = ?", [guildId, BETA]); - } - - public async getGuildConfigOptionValue(guildId: bigint, optionName: string): Promise { - const result = await this.axobotPool.query<{ value: string }[]>("SELECT `value` FROM `serverconfig` WHERE `guild_id` = ? AND `option_name` = ? AND `beta` = ?", [guildId, optionName, BETA]); - return result[0]?.value ?? null; - } - - public async setGuildConfigOptionValue(guildId: bigint, optionName: string, value: string) { - await this.axobotPool.query("INSERT INTO `serverconfig` (`guild_id`, `option_name`, `value`, `beta`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE `value` = ?", [guildId, optionName, value, BETA, value]); - } - - public async resetGuildConfigOptionValue(guildId: bigint, optionName: string) { - await this.axobotPool.query("DELETE FROM `serverconfig` WHERE `guild_id` = ? AND `option_name` = ? AND `beta` = ?", [guildId, optionName, BETA]); - } - - public async resetGuildConfigOptions(guildId: bigint) { - await this.axobotPool.query("DELETE FROM `serverconfig` WHERE `guild_id` = ? AND `beta` = ?", [guildId, BETA]); - } - - public async addConfigEditionLog(guildId: bigint, userId: bigint, eventType: EditionLogType, data: Record | null) { - await this.axobotPool.query("INSERT INTO `edition_logs` (`guild_id`, `user_id`, `type`, `data`, `origin`, `beta`) VALUES (?, ?, ?, ?, 'website', ?)", [guildId, userId, eventType, JSON.stringify(data), BETA]); - } - - public async getGuildConfigEditionLogs(guildId: bigint, page = 0, limit = 50) { - return await this.axobotPool.query<{ user_id: bigint, type: string, data: string, origin: string, date: Date }[]>("SELECT `id`, `user_id`, `type`, `data`, `origin`, `date` FROM `edition_logs` WHERE `guild_id` = ? AND `beta` = ? ORDER BY `date` DESC LIMIT ?, ?", [guildId, BETA, page * limit, limit]); - } - - public async getGlobalLeaderboard(page = 0, limit = 50): Promise { - return await this.axobotPool.query("SELECT `userID`, `xp` FROM `xp` WHERE banned = 0 ORDER BY `xp` DESC LIMIT ?, ?", [page * limit, limit]); - } - - public async getGlobalLeaderboardCount(): Promise { - const result = await this.axobotPool.query("SELECT COUNT(*) AS `count` FROM `xp` WHERE banned = 0"); - return result[0].count; - } - - public async getFilteredGlobalLeaderboard(userIds: bigint[], page: number | undefined = undefined, limit: number | undefined = undefined): Promise { - if (page === undefined || limit === undefined) { - return await this.axobotPool.query("SELECT `userID`, `xp` FROM `xp` WHERE banned = 0 AND `userID` IN (?) ORDER BY `xp` DESC", [userIds]); - } - return await this.axobotPool.query("SELECT `userID`, `xp` FROM `xp` WHERE banned = 0 AND `userID` IN (?) ORDER BY `xp` DESC LIMIT ?, ?", [userIds, page * limit, limit]); - } - - public async getFilteredGlobalLeaderboardCount(userIds: bigint[]): Promise { - const result = await this.axobotPool.query("SELECT COUNT(*) AS `count` FROM `xp` WHERE banned = 0 AND `userID` IN (?)", [userIds]); - return result[0].count; - } - - public async getGuildLeaderboard(guildId: bigint, page: number | undefined = undefined, limit: number | undefined = undefined): Promise { - if (page === undefined || limit === undefined) { - return await this.xpPool.query("SELECT `userID`, `xp` FROM `" + guildId + "` WHERE banned = 0 ORDER BY `xp` DESC"); - } - return await this.xpPool.query("SELECT `userID`, `xp` FROM `" + guildId + "` WHERE banned = 0 ORDER BY `xp` DESC LIMIT ?, ?", [page * limit, limit]); - } - - public async createGuildLeaderboard(guildId: bigint) { - await this.xpPool.query("CREATE TABLE `" + guildId + "` LIKE `example`;"); - } - - public async deleteGuildLeaderboard(guildId: bigint) { - await this.xpPool.query("DELETE FROM `" + guildId + "`"); - } - - public async setGuildLeaderboard(guildId: bigint, data: { userID: bigint, xp: number }[]) { - await this.xpPool.batch( - "INSERT INTO `" + guildId + "` (`userID`, `xp`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `xp` = VALUES(`xp`)", - data.map((row) => [row.userID, row.xp]), - ); - } - - public async getGuildLeaderboardCount(guildId: bigint): Promise { - const result = await this.xpPool.query("SELECT COUNT(*) AS `count` FROM `" + guildId + "` WHERE banned = 0"); - return result[0].count; - } - - public async getUserDataFromCache(userIds: bigint[]): Promise { - return await this.axobotPool.query("SELECT `user_id`, `username`, `global_name`, `avatar_hash`, `is_bot` from `users_cache` WHERE `user_id` IN (?)", [userIds]); - } - - public async getBotChangelog(): Promise<{version: string, release_date: string, fr: string, en: string}[]> { - return await this.axobotPool.query("SELECT `version`, `release_date`, `fr`, `en` FROM `changelogs` WHERE `beta` = ? ORDER BY `release_date` DESC LIMIT 100", [BETA]); - } - - public async getGuildRoleRewards(guildId: bigint): Promise { - interface RawData { - ID: string; - guild: string; - role: string; - level: string; - added_at: string; - } - const result = await this.axobotPool.query("SELECT `ID`, `guild`, `role`, `level`, `added_at` FROM `roles_rewards` WHERE `guild` = ?", [guildId]); - return result.map((row) => ({ - id: BigInt(row.ID), - guildId: BigInt(row.guild), - roleId: BigInt(row.role), - level: BigInt(row.level), - addedAt: new Date(row.added_at), - })); - } - - public async removeGuildRoleRewards(guildId: bigint, ids: bigint[]) { - await this.axobotPool.query("DELETE FROM `roles_rewards` WHERE `guild` = ? AND `ID` IN (?)", [guildId, ids]); - } - - public async setGuildRoleRewards(guildId: bigint, data: { roleId: bigint, level: bigint }[]) { - await this.axobotPool.batch( - "INSERT INTO `roles_rewards` (`guild`, `role`, `level`) VALUES (?, ?, ?)", - data.map((row) => [guildId, row.roleId, row.level]), - ); - } - - public async getGuildRssFeeds(guildId: bigint): Promise { - const result = await this.axobotPool.query("SELECT `ID`, `channel`, `type`, `link`, `date`, `structure`, `roles`, `use_embed`, `embed`, `silent_mention`, `recent_errors`, `enabled`, `added_at` FROM `" + RSS_TABLE + "` WHERE `guild` = ?", [guildId]); - return result.map(rawToDBRssFeed); - } - - public async getGuildRssFeed(guildId: bigint, feedId: bigint): Promise { - const result = await this.axobotPool.query("SELECT `ID`, `channel`, `type`, `link`, `date`, `structure`, `roles`, `use_embed`, `embed`, `silent_mention`, `recent_errors`, `enabled`, `added_at` FROM `" + RSS_TABLE + "` WHERE `guild` = ? AND `ID` = ?", [guildId, feedId]); - return result[0] ? rawToDBRssFeed(result[0]) : null; - } - - public async checkGuildRssFeedId(guildId: bigint, feedId: bigint): Promise { - const result = await this.axobotPool.query("SELECT COUNT(*) AS `count` FROM `" + RSS_TABLE + "` WHERE `guild` = ? AND `ID` = ?", [guildId, feedId]); - return result[0].count > 0; - } - - public async toggleRssFeed(guildId: bigint, feedId: bigint) { - await this.axobotPool.query("UPDATE `" + RSS_TABLE + "` SET `enabled` = NOT `enabled` WHERE `guild` = ? AND `ID` = ?", [guildId, feedId]); - } - - public async addRssFeed(guildId: bigint, feed: RssFeedForCreation) { - await this.axobotPool.query("INSERT INTO `" + RSS_TABLE + "` (`guild`, `channel`, `type`, `link`, `structure`, `roles`, `use_embed`, `embed`, `silent_mention`, `enabled`) VALUES (?,?,?,?,?,?,?,?,?,?)", [guildId, feed.channelId, feed.type, feed.link, feed.structure, feed.roles.join(";"), feed.useEmbed, JSON.stringify(feed.embed), feed.silentMention, feed.enabled]); - } - - public async editRssFeed(guildId: bigint, feed: RssFeedForEdition) { - await this.axobotPool.query("UPDATE `" + RSS_TABLE + "` SET `channel` = ?, `structure` = ?, `roles` = ?, `use_embed` = ?, `embed` = ?, `silent_mention` = ?, `enabled` = ? WHERE `guild` = ? AND `ID` = ?", [feed.channelId, feed.structure, feed.roles.join(";"), feed.useEmbed, JSON.stringify(feed.embed), feed.silentMention, feed.enabled, guildId, feed.id]); - } - - public async deleteRssFeed(guildId: bigint, feedId: bigint) { - await this.axobotPool.query("DELETE FROM `" + RSS_TABLE + "` WHERE `guild` = ? AND `ID` = ?", [guildId, feedId]); - } - - - public async getTokenInformation(apiToken: string): Promise { - const result = await this.apiPool.query("SELECT `user_id`, `api_token`, `discord_token`, `created_at`, `expires_at` FROM `tokens` WHERE `api_token` = ?", [apiToken]); - return result[0] ?? null; - } - - public async registerToken(userId: bigint, apiToken: string, discordToken: string | null, expiresAt: Date) { - await this.apiPool.query("INSERT INTO `tokens` (`user_id`, `api_token`, `discord_token`, `expires_at`) VALUES (?, ?, ?, ?)", [userId, apiToken, discordToken, expiresAt]); - } - -} \ No newline at end of file + private static instance: Database; + + private axobotPool: Pool; + + private apiPool: Pool; + + private xpPool: Pool; + + public static getInstance(): Database { + if (!Database.instance) { + Database.instance = new Database(DB_CONFIG); + } + return Database.instance; + } + + private constructor(config: PoolConfig) { + this.axobotPool = createPool({ ...config, database: "axobot" }); + this.apiPool = createPool(config); + this.xpPool = createPool({ ...config, database: "axobot-xp" }); + } + + public async getFullGuildConfigOptions(guildId: bigint): Promise<{ option_name: string; value: string }[]> { + return await this.axobotPool.query<{ option_name: string; value: string }[]>( + "SELECT `option_name`, `value` FROM `serverconfig` WHERE `guild_id` = ? AND `beta` = ?", + [guildId, BETA], + ); + } + + public async getGuildConfigOptionValue(guildId: bigint, optionName: string): Promise { + const result = await this.axobotPool.query<{ value: string }[]>( + "SELECT `value` FROM `serverconfig` WHERE `guild_id` = ? AND `option_name` = ? AND `beta` = ?", + [guildId, optionName, BETA], + ); + return result[0]?.value ?? null; + } + + public async setGuildConfigOptionValue(guildId: bigint, optionName: string, value: string) { + await this.axobotPool.query( + "INSERT INTO `serverconfig` (`guild_id`, `option_name`, `value`, `beta`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE `value` = ?", + [guildId, optionName, value, BETA, value], + ); + } + + public async resetGuildConfigOptionValue(guildId: bigint, optionName: string) { + await this.axobotPool.query( + "DELETE FROM `serverconfig` WHERE `guild_id` = ? AND `option_name` = ? AND `beta` = ?", + [guildId, optionName, BETA], + ); + } + + public async resetGuildConfigOptions(guildId: bigint) { + await this.axobotPool.query("DELETE FROM `serverconfig` WHERE `guild_id` = ? AND `beta` = ?", [ + guildId, + BETA, + ]); + } + + public async addConfigEditionLog( + guildId: bigint, + userId: bigint, + eventType: EditionLogType, + data: Record | null, + ) { + await this.axobotPool.query( + "INSERT INTO `edition_logs` (`guild_id`, `user_id`, `type`, `data`, `origin`, `beta`) VALUES (?, ?, ?, ?, 'website', ?)", + [guildId, userId, eventType, JSON.stringify(data), BETA], + ); + } + + public async getGuildConfigEditionLogs(guildId: bigint, page = 0, limit = 50) { + return await this.axobotPool.query< + { user_id: bigint; type: string; data: string; origin: string; date: Date }[] + >( + "SELECT `id`, `user_id`, `type`, `data`, `origin`, `date` FROM `edition_logs` WHERE `guild_id` = ? AND `beta` = ? ORDER BY `date` DESC LIMIT ?, ?", + [guildId, BETA, page * limit, limit], + ); + } + + public async getGlobalLeaderboard(page = 0, limit = 50): Promise { + return await this.axobotPool.query( + "SELECT `userID`, `xp` FROM `xp` WHERE banned = 0 ORDER BY `xp` DESC LIMIT ?, ?", + [page * limit, limit], + ); + } + + public async getGlobalLeaderboardCount(): Promise { + const result = await this.axobotPool.query("SELECT COUNT(*) AS `count` FROM `xp` WHERE banned = 0"); + return result[0].count; + } + + public async getFilteredGlobalLeaderboard( + userIds: bigint[], + page: number | undefined = undefined, + limit: number | undefined = undefined, + ): Promise { + if (page === undefined || limit === undefined) { + return await this.axobotPool.query( + "SELECT `userID`, `xp` FROM `xp` WHERE banned = 0 AND `userID` IN (?) ORDER BY `xp` DESC", + [userIds], + ); + } + return await this.axobotPool.query( + "SELECT `userID`, `xp` FROM `xp` WHERE banned = 0 AND `userID` IN (?) ORDER BY `xp` DESC LIMIT ?, ?", + [userIds, page * limit, limit], + ); + } + + public async getFilteredGlobalLeaderboardCount(userIds: bigint[]): Promise { + const result = await this.axobotPool.query( + "SELECT COUNT(*) AS `count` FROM `xp` WHERE banned = 0 AND `userID` IN (?)", + [userIds], + ); + return result[0].count; + } + + public async getGuildLeaderboard( + guildId: bigint, + page: number | undefined = undefined, + limit: number | undefined = undefined, + ): Promise { + if (page === undefined || limit === undefined) { + return await this.xpPool.query( + "SELECT `userID`, `xp` FROM `" + guildId + "` WHERE banned = 0 ORDER BY `xp` DESC", + ); + } + return await this.xpPool.query( + "SELECT `userID`, `xp` FROM `" + guildId + "` WHERE banned = 0 ORDER BY `xp` DESC LIMIT ?, ?", + [page * limit, limit], + ); + } + + public async createGuildLeaderboard(guildId: bigint) { + await this.xpPool.query("CREATE TABLE `" + guildId + "` LIKE `example`;"); + } + + public async deleteGuildLeaderboard(guildId: bigint) { + await this.xpPool.query("DELETE FROM `" + guildId + "`"); + } + + public async setGuildLeaderboard(guildId: bigint, data: { userID: bigint; xp: number }[]) { + await this.xpPool.batch( + "INSERT INTO `" + + guildId + + "` (`userID`, `xp`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `xp` = VALUES(`xp`)", + data.map((row) => [row.userID, row.xp]), + ); + } + + public async getGuildLeaderboardCount(guildId: bigint): Promise { + const result = await this.xpPool.query( + "SELECT COUNT(*) AS `count` FROM `" + guildId + "` WHERE banned = 0", + ); + return result[0].count; + } + + public async getUserDataFromCache(userIds: bigint[]): Promise { + return await this.axobotPool.query( + "SELECT `user_id`, `username`, `global_name`, `avatar_hash`, `is_bot` from `users_cache` WHERE `user_id` IN (?)", + [userIds], + ); + } + + public async getBotChangelog(): Promise< + { version: string; release_date: string; fr: string; en: string }[] + > { + return await this.axobotPool.query( + "SELECT `version`, `release_date`, `fr`, `en` FROM `changelogs` WHERE `beta` = ? ORDER BY `release_date` DESC LIMIT 100", + [BETA], + ); + } + + public async getGuildRoleRewards(guildId: bigint): Promise { + interface RawData { + ID: string; + guild: string; + role: string; + level: string; + added_at: string; + } + const result = await this.axobotPool.query( + "SELECT `ID`, `guild`, `role`, `level`, `added_at` FROM `roles_rewards` WHERE `guild` = ?", + [guildId], + ); + return result.map((row) => ({ + id: BigInt(row.ID), + guildId: BigInt(row.guild), + roleId: BigInt(row.role), + level: BigInt(row.level), + addedAt: new Date(row.added_at), + })); + } + + public async removeGuildRoleRewards(guildId: bigint, ids: bigint[]) { + await this.axobotPool.query("DELETE FROM `roles_rewards` WHERE `guild` = ? AND `ID` IN (?)", [ + guildId, + ids, + ]); + } + + public async setGuildRoleRewards(guildId: bigint, data: { roleId: bigint; level: bigint }[]) { + await this.axobotPool.batch( + "INSERT INTO `roles_rewards` (`guild`, `role`, `level`) VALUES (?, ?, ?)", + data.map((row) => [guildId, row.roleId, row.level]), + ); + } + + public async getGuildRssFeeds(guildId: bigint): Promise { + const result = await this.axobotPool.query( + "SELECT `ID`, `channel`, `type`, `link`, `date`, `structure`, `roles`, `use_embed`, `embed`, `silent_mention`, `recent_errors`, `enabled`, `added_at` FROM `" + + RSS_TABLE + + "` WHERE `guild` = ?", + [guildId], + ); + return result.map(rawToDBRssFeed); + } + + public async getGuildRssFeed(guildId: bigint, feedId: bigint): Promise { + const result = await this.axobotPool.query( + "SELECT `ID`, `channel`, `type`, `link`, `date`, `structure`, `roles`, `use_embed`, `embed`, `silent_mention`, `recent_errors`, `enabled`, `added_at` FROM `" + + RSS_TABLE + + "` WHERE `guild` = ? AND `ID` = ?", + [guildId, feedId], + ); + return result[0] ? rawToDBRssFeed(result[0]) : null; + } + + public async checkGuildRssFeedId(guildId: bigint, feedId: bigint): Promise { + const result = await this.axobotPool.query( + "SELECT COUNT(*) AS `count` FROM `" + RSS_TABLE + "` WHERE `guild` = ? AND `ID` = ?", + [guildId, feedId], + ); + return result[0].count > 0; + } + + public async toggleRssFeed(guildId: bigint, feedId: bigint) { + await this.axobotPool.query( + "UPDATE `" + RSS_TABLE + "` SET `enabled` = NOT `enabled` WHERE `guild` = ? AND `ID` = ?", + [guildId, feedId], + ); + } + + public async addRssFeed(guildId: bigint, feed: RssFeedForCreation) { + await this.axobotPool.query( + "INSERT INTO `" + + RSS_TABLE + + "` (`guild`, `channel`, `type`, `link`, `structure`, `roles`, `use_embed`, `embed`, `silent_mention`, `enabled`) VALUES (?,?,?,?,?,?,?,?,?,?)", + [ + guildId, + feed.channelId, + feed.type, + feed.link, + feed.structure, + feed.roles.join(";"), + feed.useEmbed, + JSON.stringify(feed.embed), + feed.silentMention, + feed.enabled, + ], + ); + } + + public async editRssFeed(guildId: bigint, feed: RssFeedForEdition) { + await this.axobotPool.query( + "UPDATE `" + + RSS_TABLE + + "` SET `channel` = ?, `structure` = ?, `roles` = ?, `use_embed` = ?, `embed` = ?, `silent_mention` = ?, `enabled` = ? WHERE `guild` = ? AND `ID` = ?", + [ + feed.channelId, + feed.structure, + feed.roles.join(";"), + feed.useEmbed, + JSON.stringify(feed.embed), + feed.silentMention, + feed.enabled, + guildId, + feed.id, + ], + ); + } + + public async deleteRssFeed(guildId: bigint, feedId: bigint) { + await this.axobotPool.query("DELETE FROM `" + RSS_TABLE + "` WHERE `guild` = ? AND `ID` = ?", [ + guildId, + feedId, + ]); + } + + public async getTokenInformation(apiToken: string): Promise { + const result = await this.apiPool.query( + "SELECT `user_id`, `api_token`, `discord_token`, `created_at`, `expires_at` FROM `tokens` WHERE `api_token` = ?", + [apiToken], + ); + return result[0] ?? null; + } + + public async registerToken(userId: bigint, apiToken: string, discordToken: string | null, expiresAt: Date) { + await this.apiPool.query( + "INSERT INTO `tokens` (`user_id`, `api_token`, `discord_token`, `expires_at`) VALUES (?, ?, ?, ?)", + [userId, apiToken, discordToken, expiresAt], + ); + } +} diff --git a/src/database/guild-config/guild-config-manager.ts b/src/database/guild-config/guild-config-manager.ts index 7aea587..8ddced2 100644 --- a/src/database/guild-config/guild-config-manager.ts +++ b/src/database/guild-config/guild-config-manager.ts @@ -4,230 +4,257 @@ import { assertEquals } from "typia"; import Database from "../db"; import GuildConfigOptionsMap from "./guild-config-options.json"; -import { AllRepresentation, GuildConfigOptionCategory, GuildConfigOptionsMapType, GuildConfigOptionValueType, PartialGuildConfig } from "./guild-config-types"; -import { assertBooleanValidity, assertCategoryChannelValidity, assertColorValidity, assertEmojiListValidity, assertEnumValidity, assertLevelupChannelValidity, assertNumberValidity, assertRoleListValidity, assertRoleValidity, assertTextChannelListValidity, assertTextChannelValidity, assertTextValidity, assertVoiceChannelValidity } from "./value-validity-asserts"; +import { + AllRepresentation, + GuildConfigOptionCategory, + GuildConfigOptionsMapType, + GuildConfigOptionValueType, + PartialGuildConfig, +} from "./guild-config-types"; +import { + assertBooleanValidity, + assertCategoryChannelValidity, + assertColorValidity, + assertEmojiListValidity, + assertEnumValidity, + assertLevelupChannelValidity, + assertNumberValidity, + assertRoleListValidity, + assertRoleValidity, + assertTextChannelListValidity, + assertTextChannelValidity, + assertTextValidity, + assertVoiceChannelValidity, +} from "./value-validity-asserts"; export default class GuildConfigManager { - private static instance: GuildConfigManager; + private static instance: GuildConfigManager; - private db: Database = Database.getInstance(); + private db: Database = Database.getInstance(); - private constructor() { } + private constructor() {} - public static getInstance(): GuildConfigManager { - if (!GuildConfigManager.instance) { - GuildConfigManager.instance = new GuildConfigManager(); - } - return GuildConfigManager.instance; + public static getInstance(): GuildConfigManager { + if (!GuildConfigManager.instance) { + GuildConfigManager.instance = new GuildConfigManager(); } + return GuildConfigManager.instance; + } - public static optionsList = assertEquals(GuildConfigOptionsMap); + public static optionsList = assertEquals(GuildConfigOptionsMap); - public async getOptionCategoryFromName(optionName: string): Promise { - for (const [category, options] of Object.entries(GuildConfigManager.optionsList)) { - if (options[optionName]) { - return category as GuildConfigOptionCategory; - } - } + public async getOptionCategoryFromName(optionName: string): Promise { + for (const [category, options] of Object.entries(GuildConfigManager.optionsList)) { + if (options[optionName]) { + return category as GuildConfigOptionCategory; + } } + } - public async getOptionFromName(optionName: string): Promise { - const optionCategory = await this.getOptionCategoryFromName(optionName); - if (!optionCategory) { - return; - } - return GuildConfigManager.optionsList[optionCategory][optionName]; + public async getOptionFromName(optionName: string): Promise { + const optionCategory = await this.getOptionCategoryFromName(optionName); + if (!optionCategory) { + return; } + return GuildConfigManager.optionsList[optionCategory][optionName]; + } - public async convertToType(optionName: string, value: string): Promise { - const option = await this.getOptionFromName(optionName); - if (!option) { - throw new Error(`Option ${optionName} does not exist`); + public async convertToType(optionName: string, value: string): Promise { + const option = await this.getOptionFromName(optionName); + if (!option) { + throw new Error(`Option ${optionName} does not exist`); + } + switch (option.type) { + case "boolean": + return value.toLowerCase() === "true" || value === "1"; + case "int": + case "float": + return Number(value); + case "color": + // check for hex syntax + if (/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(value)) { + return Number("0x" + value); } - switch (option.type) { - case "boolean": - return value.toLowerCase() === "true" || value === "1"; - case "int": - case "float": - return Number(value); - case "color": - // check for hex syntax - if (/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(value)) { - return Number("0x" + value); - } - return Number(value); - case "role": - case "text_channel": - case "voice_channel": - case "category": - case "levelup_channel": - if (option.type === "levelup_channel" && value === "any") { - return value; - } - return BigInt(value); - case "roles_list": - case "text_channels_list": - case "emojis_list": - return JSONbig.parse(value); - case "enum": - case "text": - return value; - default: - // @ts-expect-error option type is not handled - console.warn(`Untreated option type ${option.type}`); - return value; + return Number(value); + case "role": + case "text_channel": + case "voice_channel": + case "category": + case "levelup_channel": + if (option.type === "levelup_channel" && value === "any") { + return value; } + return BigInt(value); + case "roles_list": + case "text_channels_list": + case "emojis_list": + return JSONbig.parse(value); + case "enum": + case "text": + return value; + default: + // @ts-expect-error option type is not handled + console.warn(`Untreated option type ${option.type}`); + return value; } + } - public async convertFromType(optionName: string, value: unknown) { - const option = await this.getOptionFromName(optionName); - if (!option) { - throw new Error(`Option ${optionName} does not exist`); + public async convertFromType(optionName: string, value: unknown) { + const option = await this.getOptionFromName(optionName); + if (!option) { + throw new Error(`Option ${optionName} does not exist`); + } + if (value === null) { + return null; + } + switch (option.type) { + case "int": + case "float": + case "boolean": + case "role": + case "text_channel": + case "voice_channel": + case "category": + case "levelup_channel": + return String(value); + case "enum": + case "text": + if (typeof value !== "string") { + throw new Error(`Value for option ${optionName} should be a string`); } - if (value === null) { - return null; + return value; + case "roles_list": + case "text_channels_list": + case "emojis_list": + if (!Array.isArray(value) || !value.every((item) => typeof item === "string")) { + throw new Error(`Value for option ${optionName} should be an array of strings`); } - switch (option.type) { - case "int": - case "float": - case "boolean": - case "role": - case "text_channel": - case "voice_channel": - case "category": - case "levelup_channel": - return String(value); - case "enum": - case "text": - if (typeof value !== "string") { - throw new Error(`Value for option ${optionName} should be a string`); - } - return value; - case "roles_list": - case "text_channels_list": - case "emojis_list": - if (!Array.isArray(value) || !value.every((item) => typeof item === "string")) { - throw new Error(`Value for option ${optionName} should be an array of strings`); - } - return JSONbig.stringify(value.map(BigInt)); - case "color": - if (typeof value !== "number") { - throw new Error(`Value for option ${optionName} should be a number`); - } - return value.toString(16); - default: - // @ts-expect-error option type is not handled - console.warn(`Untreated option type ${option.type}`); - // @ts-expect-error option type is not handled - throw new Error(`Option type ${option.type} is not supported at the moment`); + return JSONbig.stringify(value.map(BigInt)); + case "color": + if (typeof value !== "number") { + throw new Error(`Value for option ${optionName} should be a number`); } + return value.toString(16); + default: + // @ts-expect-error option type is not handled + console.warn(`Untreated option type ${option.type}`); + // @ts-expect-error option type is not handled + throw new Error(`Option type ${option.type} is not supported at the moment`); } + } - public async assertValueValidity(optionName: string, guild: Guild, value: unknown, allowUnlistedOptions = false) { - const option = await this.getOptionFromName(optionName); - if (!option) { - throw new Error(`Option ${optionName} does not exist`); - } - if (!allowUnlistedOptions && !option.is_listed) { - throw new Error(`Option ${optionName} cannot be edited`); - } - switch (option.type) { - case "boolean": - assertBooleanValidity(optionName, option, value); - break; - case "int": - case "float": - assertNumberValidity(optionName, option, value); - break; - case "enum": - assertEnumValidity(optionName, option, value); - break; - case "text": - assertTextValidity(optionName, option, value); - break; - case "role": - assertRoleValidity(optionName, option, value, guild); - break; - case "roles_list": - assertRoleListValidity(optionName, option, value, guild); - break; - case "text_channel": - assertTextChannelValidity(optionName, option, value, guild); - break; - case "text_channels_list": - assertTextChannelListValidity(optionName, option, value, guild); - break; - case "voice_channel": - assertVoiceChannelValidity(optionName, option, value, guild); - break; - case "category": - assertCategoryChannelValidity(optionName, value, guild); - break; - case "emojis_list": - assertEmojiListValidity(optionName, option, value, guild); - break; - case "color": - assertColorValidity(optionName, value); - break; - case "levelup_channel": - assertLevelupChannelValidity(optionName, value, guild); - break; - default: - // @ts-expect-error option type is not handled - console.warn(`Untreated option type ${option.type}`); - // @ts-expect-error option type is not handled - throw new Error(`Option type ${option.type} is not supported at the moment`); - } + public async assertValueValidity( + optionName: string, + guild: Guild, + value: unknown, + allowUnlistedOptions = false, + ) { + const option = await this.getOptionFromName(optionName); + if (!option) { + throw new Error(`Option ${optionName} does not exist`); } + if (!allowUnlistedOptions && !option.is_listed) { + throw new Error(`Option ${optionName} cannot be edited`); + } + switch (option.type) { + case "boolean": + assertBooleanValidity(optionName, option, value); + break; + case "int": + case "float": + assertNumberValidity(optionName, option, value); + break; + case "enum": + assertEnumValidity(optionName, option, value); + break; + case "text": + assertTextValidity(optionName, option, value); + break; + case "role": + assertRoleValidity(optionName, option, value, guild); + break; + case "roles_list": + assertRoleListValidity(optionName, option, value, guild); + break; + case "text_channel": + assertTextChannelValidity(optionName, option, value, guild); + break; + case "text_channels_list": + assertTextChannelListValidity(optionName, option, value, guild); + break; + case "voice_channel": + assertVoiceChannelValidity(optionName, option, value, guild); + break; + case "category": + assertCategoryChannelValidity(optionName, value, guild); + break; + case "emojis_list": + assertEmojiListValidity(optionName, option, value, guild); + break; + case "color": + assertColorValidity(optionName, value); + break; + case "levelup_channel": + assertLevelupChannelValidity(optionName, value, guild); + break; + default: + // @ts-expect-error option type is not handled + console.warn(`Untreated option type ${option.type}`); + // @ts-expect-error option type is not handled + throw new Error(`Option type ${option.type} is not supported at the moment`); + } + } - public async getGuildConfigOptionValue(guildId: bigint, optionName: string) { - const dbValue = await this.db.getGuildConfigOptionValue(guildId, optionName); - if (dbValue !== null) { - return await this.convertToType(optionName, dbValue); - } - // if unset, return default value - const option = await this.getOptionFromName(optionName); - if (option === undefined) { - throw new Error(`Option ${optionName} does not exist`); - } - return option.default; + public async getGuildConfigOptionValue(guildId: bigint, optionName: string) { + const dbValue = await this.db.getGuildConfigOptionValue(guildId, optionName); + if (dbValue !== null) { + return await this.convertToType(optionName, dbValue); + } + // if unset, return default value + const option = await this.getOptionFromName(optionName); + if (option === undefined) { + throw new Error(`Option ${optionName} does not exist`); } + return option.default; + } - public async getGuildCategoriesConfigOptions(guildId: bigint, categories: readonly GuildConfigOptionCategory[]): Promise { - const setupOptions = await this.db.getFullGuildConfigOptions(guildId); - const defaultConfig = GuildConfigManager.optionsList; - const config: PartialGuildConfig = Object.create(null); - for (const categoryName of categories) { - config[categoryName] = {}; - for (const [optionName, value] of Object.entries(defaultConfig[categoryName])) { - const option = setupOptions.find((item) => item.option_name === optionName); - if (option === undefined) { - config[categoryName]![optionName] = value.default; - } else { - config[categoryName]![optionName] = await this.convertToType(option.option_name, option.value); - } - } + public async getGuildCategoriesConfigOptions( + guildId: bigint, + categories: readonly GuildConfigOptionCategory[], + ): Promise { + const setupOptions = await this.db.getFullGuildConfigOptions(guildId); + const defaultConfig = GuildConfigManager.optionsList; + const config: PartialGuildConfig = Object.create(null); + for (const categoryName of categories) { + config[categoryName] = {}; + for (const [optionName, value] of Object.entries(defaultConfig[categoryName])) { + const option = setupOptions.find((item) => item.option_name === optionName); + if (option === undefined) { + config[categoryName]![optionName] = value.default; + } else { + config[categoryName]![optionName] = await this.convertToType(option.option_name, option.value); } - return config; + } } + return config; + } - public async getGuildConfigOptions(guildId: bigint, optionNames: string[]) { - const setupOptions = await this.db.getFullGuildConfigOptions(guildId); - const defaultConfig = GuildConfigManager.optionsList; - const config: Record = Object.create(null); - for (const categoryOptions of Object.values(defaultConfig)) { - for (const [optionName, value] of Object.entries(categoryOptions)) { - if (optionNames.includes(optionName)) { - const option = setupOptions.find((item) => item.option_name === optionName); - if (option === undefined) { - config[optionName] = value.default; - } else { - config[optionName] = await this.convertToType(option.option_name, option.value); - } - } - } + public async getGuildConfigOptions(guildId: bigint, optionNames: string[]) { + const setupOptions = await this.db.getFullGuildConfigOptions(guildId); + const defaultConfig = GuildConfigManager.optionsList; + const config: Record = Object.create(null); + for (const categoryOptions of Object.values(defaultConfig)) { + for (const [optionName, value] of Object.entries(categoryOptions)) { + if (optionNames.includes(optionName)) { + const option = setupOptions.find((item) => item.option_name === optionName); + if (option === undefined) { + config[optionName] = value.default; + } else { + config[optionName] = await this.convertToType(option.option_name, option.value); + } } - return config; + } } - + return config; + } } diff --git a/src/database/guild-config/guild-config-options.json b/src/database/guild-config/guild-config-options.json index 320ddeb..aee0362 100644 --- a/src/database/guild-config/guild-config-options.json +++ b/src/database/guild-config/guild-config-options.json @@ -1,547 +1,509 @@ { - "core": { - "enable_events": { - "type": "boolean", - "default": true, - "is_listed": true - }, - "language": { - "type": "enum", - "values": [ - "fr", - "en", - "lolcat", - "fi", - "de", - "fr2", - "cs" - ], - "default": "en", - "is_listed": true - }, - "roles_react_max_number": { - "type": "int", - "min": 0, - "max": null, - "default": 20, - "is_listed": false - }, - "rr_max_number": { - "type": "int", - "min": 0, - "max": null, - "default": 10, - "is_listed": false - }, - "rss_max_number": { - "type": "int", - "min": 0, - "max": null, - "default": 10, - "is_listed": false - }, - "quickrss_max_number": { - "type": "int", - "min": 0, - "max": null, - "default": 3, - "is_listed": false - }, - "streamers_max_number": { - "type": "int", - "min": 0, - "max": null, - "default": 20, - "is_listed": false - }, - "ttt_emojis": { - "type": "emojis_list", - "min_count": 2, - "max_count": 2, - "default": [ - "🔴", - "🔵" - ], - "is_listed": true + "core": { + "enable_events": { + "type": "boolean", + "default": true, + "is_listed": true + }, + "language": { + "type": "enum", + "values": ["fr", "en", "lolcat", "fi", "de", "fr2", "cs"], + "default": "en", + "is_listed": true + }, + "roles_react_max_number": { + "type": "int", + "min": 0, + "max": null, + "default": 20, + "is_listed": false + }, + "rr_max_number": { + "type": "int", + "min": 0, + "max": null, + "default": 10, + "is_listed": false + }, + "rss_max_number": { + "type": "int", + "min": 0, + "max": null, + "default": 10, + "is_listed": false + }, + "quickrss_max_number": { + "type": "int", + "min": 0, + "max": null, + "default": 3, + "is_listed": false + }, + "streamers_max_number": { + "type": "int", + "min": 0, + "max": null, + "default": 20, + "is_listed": false + }, + "ttt_emojis": { + "type": "emojis_list", + "min_count": 2, + "max_count": 2, + "default": ["🔴", "🔵"], + "is_listed": true + } + }, + "info": { + "bot_news": { + "type": "text_channel", + "allow_threads": true, + "allow_announcement_channels": true, + "allow_non_nsfw_channels": true, + "default": null, + "is_listed": true + }, + "compress_help": { + "type": "boolean", + "default": false, + "is_listed": true + }, + "description": { + "type": "text", + "min_length": 0, + "max_length": 1000, + "default": null, + "is_listed": true + }, + "help_in_private": { + "type": "boolean", + "default": false, + "is_listed": true + }, + "membercounter": { + "type": "voice_channel", + "allow_stage_channels": false, + "allow_non_nsfw_channels": true, + "default": null, + "is_listed": true + }, + "update_mentions": { + "type": "roles_list", + "min_count": 1, + "max_count": 10, + "allow_integrated_roles": true, + "allow_everyone": true, + "default": null, + "is_listed": false, + "requires": [ + { + "option": "bot_news", + "to_be_defined": true } + ] + } + }, + "moderation": { + "anti_caps_lock": { + "type": "boolean", + "default": false, + "is_listed": true }, - "info": { - "bot_news": { - "type": "text_channel", - "allow_threads": true, - "allow_announcement_channels": true, - "allow_non_nsfw_channels": true, - "default": null, - "is_listed": true - }, - "compress_help": { - "type": "boolean", - "default": false, - "is_listed": true - }, - "description": { - "type": "text", - "min_length": 0, - "max_length": 1000, - "default": null, - "is_listed": true - }, - "help_in_private": { - "type": "boolean", - "default": false, - "is_listed": true - }, - "membercounter": { - "type": "voice_channel", - "allow_stage_channels": false, - "allow_non_nsfw_channels": true, - "default": null, - "is_listed": true - }, - "update_mentions": { - "type": "roles_list", - "min_count": 1, - "max_count": 10, - "allow_integrated_roles": true, - "allow_everyone": true, - "default": null, - "is_listed": false, - "requires": [ - { - "option": "bot_news", - "to_be_defined": true - } - ] + "anti_raid": { + "type": "enum", + "values": ["none", "smooth", "careful", "high", "extreme"], + "default": "none", + "is_listed": true + }, + "anti_raid_ignored_roles": { + "type": "roles_list", + "min_count": 1, + "max_count": 100, + "allow_integrated_roles": true, + "allow_everyone": false, + "default": null, + "is_listed": true, + "requires": [ + { + "option": "anti_raid", + "to_be": ["smooth", "careful", "high", "extreme"] } + ] }, - "moderation": { - "anti_caps_lock": { - "type": "boolean", - "default": false, - "is_listed": true - }, - "anti_raid": { - "type": "enum", - "values": [ - "none", - "smooth", - "careful", - "high", - "extreme" - ], - "default": "none", - "is_listed": true - }, - "anti_raid_ignored_roles": { - "type": "roles_list", - "min_count": 1, - "max_count": 100, - "allow_integrated_roles": true, - "allow_everyone": false, - "default": null, - "is_listed": true, - "requires": [ - { - "option": "anti_raid", - "to_be": [ - "smooth", - "careful", - "high", - "extreme" - ] - } - ] - }, - "anti_scam": { - "type": "boolean", - "default": false, - "is_listed": true - }, - "enable_invites_tracking": { - "type": "boolean", - "default": false, - "is_listed": true - }, - "muted_role": { - "type": "role", - "allow_integrated_roles": false, - "allow_everyone": false, - "default": null, - "is_listed": true + "anti_scam": { + "type": "boolean", + "default": false, + "is_listed": true + }, + "enable_invites_tracking": { + "type": "boolean", + "default": false, + "is_listed": true + }, + "muted_role": { + "type": "role", + "allow_integrated_roles": false, + "allow_everyone": false, + "default": null, + "is_listed": true + } + }, + "partners": { + "partner_channel": { + "type": "text_channel", + "allow_threads": true, + "allow_announcement_channels": true, + "allow_non_nsfw_channels": true, + "default": null, + "is_listed": true + }, + "partner_color": { + "type": "color", + "default": 10949630, + "is_listed": true, + "requires": [ + { + "option": "partner_channel", + "to_be_defined": true } + ] }, - "partners": { - "partner_channel": { - "type": "text_channel", - "allow_threads": true, - "allow_announcement_channels": true, - "allow_non_nsfw_channels": true, - "default": null, - "is_listed": true - }, - "partner_color": { - "type": "color", - "default": 10949630, - "is_listed": true, - "requires": [ - { - "option": "partner_channel", - "to_be_defined": true - } - ] - }, - "partner_role": { - "type": "role", - "allow_integrated_roles": false, - "allow_everyone": false, - "default": null, - "is_listed": true + "partner_role": { + "type": "role", + "allow_integrated_roles": false, + "allow_everyone": false, + "default": null, + "is_listed": true + } + }, + "poll-channels": { + "poll_channels": { + "type": "text_channels_list", + "min_count": 1, + "max_count": 50, + "allow_threads": true, + "allow_announcement_channels": true, + "allow_non_nsfw_channels": true, + "default": null, + "is_listed": true + }, + "vote_emojis": { + "type": "emojis_list", + "min_count": 2, + "max_count": 2, + "default": ["👍", "👎"], + "is_listed": true + } + }, + "streamers": { + "stream_mention": { + "type": "role", + "allow_integrated_roles": true, + "allow_everyone": true, + "default": null, + "is_listed": true, + "requires": [ + { + "option": "streaming_channel", + "to_be_defined": true } + ] }, - "poll-channels": { - "poll_channels": { - "type": "text_channels_list", - "min_count": 1, - "max_count": 50, - "allow_threads": true, - "allow_announcement_channels": true, - "allow_non_nsfw_channels": true, - "default": null, - "is_listed": true - }, - "vote_emojis": { - "type": "emojis_list", - "min_count": 2, - "max_count": 2, - "default": [ - "👍", - "👎" - ], - "is_listed": true + "streaming_channel": { + "type": "text_channel", + "allow_threads": true, + "allow_announcement_channels": true, + "allow_non_nsfw_channels": true, + "default": null, + "is_listed": true + }, + "streaming_role": { + "type": "role", + "allow_integrated_roles": false, + "allow_everyone": false, + "default": null, + "is_listed": true + } + }, + "voice-channels": { + "voice_category": { + "type": "category", + "default": null, + "is_listed": true, + "requires": [ + { + "option": "voice_channel", + "to_be_defined": true } + ] }, - "streamers": { - "stream_mention": { - "type": "role", - "allow_integrated_roles": true, - "allow_everyone": true, - "default": null, - "is_listed": true, - "requires": [ - { - "option": "streaming_channel", - "to_be_defined": true - } - ] - }, - "streaming_channel": { - "type": "text_channel", - "allow_threads": true, - "allow_announcement_channels": true, - "allow_non_nsfw_channels": true, - "default": null, - "is_listed": true - }, - "streaming_role": { - "type": "role", - "allow_integrated_roles": false, - "allow_everyone": false, - "default": null, - "is_listed": true + "voice_channel": { + "type": "voice_channel", + "allow_stage_channels": false, + "allow_non_nsfw_channels": true, + "default": null, + "is_listed": true + }, + "voice_channel_format": { + "type": "text", + "min_length": 1, + "max_length": 50, + "default": "{random}", + "is_listed": true, + "requires": [ + { + "option": "voice_channel", + "to_be_defined": true + }, + { + "option": "voice_category", + "to_be_defined": true } + ] }, - "voice-channels": { - "voice_category": { - "type": "category", - "default": null, - "is_listed": true, - "requires": [ - { - "option": "voice_channel", - "to_be_defined": true - } - ] - }, - "voice_channel": { - "type": "voice_channel", - "allow_stage_channels": false, - "allow_non_nsfw_channels": true, - "default": null, - "is_listed": true - }, - "voice_channel_format": { - "type": "text", - "min_length": 1, - "max_length": 50, - "default": "{random}", - "is_listed": true, - "requires": [ - { - "option": "voice_channel", - "to_be_defined": true - }, - { - "option": "voice_category", - "to_be_defined": true - } - ] - }, - "voice_roles": { - "type": "roles_list", - "min_count": 1, - "max_count": 10, - "allow_integrated_roles": false, - "allow_everyone": false, - "default": null, - "is_listed": true, - "requires": [ - { - "option": "voice_channel", - "to_be_defined": true - }, - { - "option": "voice_category", - "to_be_defined": true - } - ] + "voice_roles": { + "type": "roles_list", + "min_count": 1, + "max_count": 10, + "allow_integrated_roles": false, + "allow_everyone": false, + "default": null, + "is_listed": true, + "requires": [ + { + "option": "voice_channel", + "to_be_defined": true + }, + { + "option": "voice_category", + "to_be_defined": true + } + ] + } + }, + "welcome": { + "delete_welcome_on_quick_leave": { + "type": "boolean", + "default": false, + "is_listed": true, + "requires": [ + { + "option": "welcome_channel", + "to_be_defined": true + } + ] + }, + "leave": { + "type": "text", + "min_length": 0, + "max_length": 1800, + "default": null, + "is_listed": true, + "requires": [ + { + "option": "welcome_channel", + "to_be_defined": true } + ] }, "welcome": { - "delete_welcome_on_quick_leave": { - "type": "boolean", - "default": false, - "is_listed": true, - "requires": [ - { - "option": "welcome_channel", - "to_be_defined": true - } - ] - }, - "leave": { - "type": "text", - "min_length": 0, - "max_length": 1800, - "default": null, - "is_listed": true, - "requires": [ - { - "option": "welcome_channel", - "to_be_defined": true - } - ] - }, - "welcome": { - "type": "text", - "min_length": 0, - "max_length": 1800, - "default": null, - "is_listed": true, - "requires": [ - { - "option": "welcome_channel", - "to_be_defined": true - } - ] - }, - "welcome_channel": { - "type": "text_channel", - "allow_threads": false, - "allow_announcement_channels": true, - "allow_non_nsfw_channels": true, - "default": null, - "is_listed": true - }, - "welcome_roles": { - "type": "roles_list", - "min_count": 1, - "max_count": 100, - "allow_integrated_roles": false, - "allow_everyone": false, - "default": null, - "is_listed": true - }, - "welcome_silent_mention": { - "type": "boolean", - "default": false, - "is_listed": true, - "requires": [ - { - "option": "welcome_channel", - "to_be_defined": true - } - ] + "type": "text", + "min_length": 0, + "max_length": 1800, + "default": null, + "is_listed": true, + "requires": [ + { + "option": "welcome_channel", + "to_be_defined": true } + ] }, - "xp": { - "enable_xp": { - "type": "boolean", - "default": false, - "is_listed": true - }, - "levelup_channel": { - "type": "levelup_channel", - "default": "any", - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - } - ] - }, - "levelup_msg": { - "type": "text", - "min_length": 0, - "max_length": 1800, - "default": null, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - } - ] - }, - "levelup_silent_mention": { - "type": "boolean", - "default": false, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - } - ] - }, - "noxp_channels": { - "type": "text_channels_list", - "min_count": 1, - "max_count": 2000, - "allow_threads": true, - "allow_announcement_channels": true, - "allow_non_nsfw_channels": true, - "default": null, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - } - ] - }, - "noxp_roles": { - "type": "roles_list", - "min_count": 1, - "max_count": 100, - "allow_integrated_roles": true, - "allow_everyone": false, - "default": null, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - } - ] - }, - "private_leaderboard": { - "type": "boolean", - "default": true, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - } - ] - }, - "rank_in_private": { - "type": "boolean", - "default": false, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - } - ] - }, - "voice_xp_per_min": { - "type": "int", - "min": 0, - "max": 100, - "default": 0, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - }, - { - "option": "xp_type", - "to_be": [ - "mee6-like", - "local" - ] - } - ] - }, - "xp_decay": { - "type": "int", - "min": 0, - "max": 200, - "default": 0, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - }, - { - "option": "xp_type", - "to_be": [ - "mee6-like", - "local" - ] - } - ] - }, - "xp_rate": { - "type": "float", - "min": 0.1, - "max": 3.0, - "default": 1.0, - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - }, - { - "option": "xp_type", - "to_be": [ - "mee6-like", - "local" - ] - } - ] - }, - "xp_type": { - "type": "enum", - "values": [ - "global", - "mee6-like", - "local" - ], - "default": "global", - "is_listed": true, - "requires": [ - { - "option": "enable_xp", - "to_be": true - } - ] + "welcome_channel": { + "type": "text_channel", + "allow_threads": false, + "allow_announcement_channels": true, + "allow_non_nsfw_channels": true, + "default": null, + "is_listed": true + }, + "welcome_roles": { + "type": "roles_list", + "min_count": 1, + "max_count": 100, + "allow_integrated_roles": false, + "allow_everyone": false, + "default": null, + "is_listed": true + }, + "welcome_silent_mention": { + "type": "boolean", + "default": false, + "is_listed": true, + "requires": [ + { + "option": "welcome_channel", + "to_be_defined": true + } + ] + } + }, + "xp": { + "enable_xp": { + "type": "boolean", + "default": false, + "is_listed": true + }, + "levelup_channel": { + "type": "levelup_channel", + "default": "any", + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + } + ] + }, + "levelup_msg": { + "type": "text", + "min_length": 0, + "max_length": 1800, + "default": null, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + } + ] + }, + "levelup_silent_mention": { + "type": "boolean", + "default": false, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + } + ] + }, + "noxp_channels": { + "type": "text_channels_list", + "min_count": 1, + "max_count": 2000, + "allow_threads": true, + "allow_announcement_channels": true, + "allow_non_nsfw_channels": true, + "default": null, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + } + ] + }, + "noxp_roles": { + "type": "roles_list", + "min_count": 1, + "max_count": 100, + "allow_integrated_roles": true, + "allow_everyone": false, + "default": null, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + } + ] + }, + "private_leaderboard": { + "type": "boolean", + "default": true, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + } + ] + }, + "rank_in_private": { + "type": "boolean", + "default": false, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + } + ] + }, + "voice_xp_per_min": { + "type": "int", + "min": 0, + "max": 100, + "default": 0, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + }, + { + "option": "xp_type", + "to_be": ["mee6-like", "local"] + } + ] + }, + "xp_decay": { + "type": "int", + "min": 0, + "max": 200, + "default": 0, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + }, + { + "option": "xp_type", + "to_be": ["mee6-like", "local"] + } + ] + }, + "xp_rate": { + "type": "float", + "min": 0.1, + "max": 3.0, + "default": 1.0, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + }, + { + "option": "xp_type", + "to_be": ["mee6-like", "local"] + } + ] + }, + "xp_type": { + "type": "enum", + "values": ["global", "mee6-like", "local"], + "default": "global", + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true } + ] } -} \ No newline at end of file + } +} diff --git a/src/database/guild-config/guild-config-types.ts b/src/database/guild-config/guild-config-types.ts index 5841e4a..483c189 100644 --- a/src/database/guild-config/guild-config-types.ts +++ b/src/database/guild-config/guild-config-types.ts @@ -1,128 +1,141 @@ -type OptionRequirement = { - option: string; - to_be: boolean | number | string | string[] | null; -} | { - option: string; - to_be_defined: true; -} +type OptionRequirement = + | { + option: string; + to_be: boolean | number | string | string[] | null; + } + | { + option: string; + to_be_defined: true; + }; interface BaseOptionRepresentation { - is_listed: boolean; - requires?: OptionRequirement[]; + is_listed: boolean; + requires?: OptionRequirement[]; } export interface IntOptionRepresentation extends BaseOptionRepresentation { - type: "int"; - min: number; - max: number | null; - default: number | null; + type: "int"; + min: number; + max: number | null; + default: number | null; } export interface FloatOptionRepresentation extends BaseOptionRepresentation { - type: "float"; - min: number; - max: number; - default: number | null; + type: "float"; + min: number; + max: number; + default: number | null; } export interface BooleanOptionRepresentation extends BaseOptionRepresentation { - type: "boolean"; - default: boolean | null; + type: "boolean"; + default: boolean | null; } export interface EnumOptionRepresentation extends BaseOptionRepresentation { - type: "enum"; - values: string[]; - default: string | null; + type: "enum"; + values: string[]; + default: string | null; } export interface TextOptionRepresentation extends BaseOptionRepresentation { - type: "text"; - min_length: number; - max_length: number; - default: string | null; + type: "text"; + min_length: number; + max_length: number; + default: string | null; } export interface RoleOptionRepresentation extends BaseOptionRepresentation { - type: "role"; - allow_integrated_roles: boolean; - allow_everyone: boolean; - default: null; + type: "role"; + allow_integrated_roles: boolean; + allow_everyone: boolean; + default: null; } export interface RolesListOptionRepresentation extends BaseOptionRepresentation { - type: "roles_list"; - min_count: number; - max_count: number; - allow_integrated_roles: boolean; - allow_everyone: boolean; - default: null; + type: "roles_list"; + min_count: number; + max_count: number; + allow_integrated_roles: boolean; + allow_everyone: boolean; + default: null; } export interface TextChannelOptionRepresentation extends BaseOptionRepresentation { - type: "text_channel"; - allow_threads: boolean; - allow_announcement_channels: boolean; - allow_non_nsfw_channels: boolean; - default: null; + type: "text_channel"; + allow_threads: boolean; + allow_announcement_channels: boolean; + allow_non_nsfw_channels: boolean; + default: null; } export interface TextChannelsListOptionRepresentation extends BaseOptionRepresentation { - type: "text_channels_list"; - min_count: number; - max_count: number; - allow_threads: boolean; - allow_announcement_channels: boolean; - allow_non_nsfw_channels: boolean; - default: null; + type: "text_channels_list"; + min_count: number; + max_count: number; + allow_threads: boolean; + allow_announcement_channels: boolean; + allow_non_nsfw_channels: boolean; + default: null; } export interface VoiceChannelOptionRepresentation extends BaseOptionRepresentation { - type: "voice_channel"; - allow_stage_channels: boolean; - allow_non_nsfw_channels: boolean; - default: null; + type: "voice_channel"; + allow_stage_channels: boolean; + allow_non_nsfw_channels: boolean; + default: null; } export interface CategoryOptionRepresentation extends BaseOptionRepresentation { - type: "category"; - default: null; + type: "category"; + default: null; } export interface EmojisListOptionRepresentation extends BaseOptionRepresentation { - type: "emojis_list"; - min_count: number; - max_count: number; - default: string[] | null; + type: "emojis_list"; + min_count: number; + max_count: number; + default: string[] | null; } export interface ColorOptionRepresentation extends BaseOptionRepresentation { - type: "color"; - default: number | null; + type: "color"; + default: number | null; } export interface LevelupChannelOptionRepresentation extends BaseOptionRepresentation { - type: "levelup_channel"; - default: string | null; -} - -export type AllRepresentation = IntOptionRepresentation - | FloatOptionRepresentation - | BooleanOptionRepresentation - | EnumOptionRepresentation - | TextOptionRepresentation - | RoleOptionRepresentation - | RolesListOptionRepresentation - | TextChannelOptionRepresentation - | TextChannelsListOptionRepresentation - | VoiceChannelOptionRepresentation - | CategoryOptionRepresentation - | EmojisListOptionRepresentation - | ColorOptionRepresentation - | LevelupChannelOptionRepresentation; - -export const GuildConfigOptionCategoryNames = ["core", "info", "moderation", "partners", "poll-channels", "streamers", "voice-channels", "welcome", "xp"] as const; -export type GuildConfigOptionCategory = typeof GuildConfigOptionCategoryNames[number]; + type: "levelup_channel"; + default: string | null; +} + +export type AllRepresentation = + | IntOptionRepresentation + | FloatOptionRepresentation + | BooleanOptionRepresentation + | EnumOptionRepresentation + | TextOptionRepresentation + | RoleOptionRepresentation + | RolesListOptionRepresentation + | TextChannelOptionRepresentation + | TextChannelsListOptionRepresentation + | VoiceChannelOptionRepresentation + | CategoryOptionRepresentation + | EmojisListOptionRepresentation + | ColorOptionRepresentation + | LevelupChannelOptionRepresentation; + +export const GuildConfigOptionCategoryNames = [ + "core", + "info", + "moderation", + "partners", + "poll-channels", + "streamers", + "voice-channels", + "welcome", + "xp", +] as const; +export type GuildConfigOptionCategory = (typeof GuildConfigOptionCategoryNames)[number]; export type GuildConfigOptionsMapType = Record>; export type GuildConfigOptionValueType = AllRepresentation["default"] | bigint; export type PartialGuildConfig = Partial>>; diff --git a/src/database/guild-config/value-validity-asserts.ts b/src/database/guild-config/value-validity-asserts.ts index 70172eb..4ebfcfd 100644 --- a/src/database/guild-config/value-validity-asserts.ts +++ b/src/database/guild-config/value-validity-asserts.ts @@ -1,218 +1,289 @@ -import { ChannelType, Guild, GuildBasedChannel, NewsChannel, PrivateThreadChannel, PublicThreadChannel, StageChannel, TextChannel, VoiceChannel } from "discord.js"; +import { + ChannelType, + Guild, + GuildBasedChannel, + NewsChannel, + PrivateThreadChannel, + PublicThreadChannel, + StageChannel, + TextChannel, + VoiceChannel, +} from "discord.js"; -import { BooleanOptionRepresentation, EmojisListOptionRepresentation, EnumOptionRepresentation, FloatOptionRepresentation, IntOptionRepresentation, RoleOptionRepresentation, RolesListOptionRepresentation, TextChannelOptionRepresentation, TextChannelsListOptionRepresentation, TextOptionRepresentation, VoiceChannelOptionRepresentation } from "./guild-config-types"; +import { + BooleanOptionRepresentation, + EmojisListOptionRepresentation, + EnumOptionRepresentation, + FloatOptionRepresentation, + IntOptionRepresentation, + RoleOptionRepresentation, + RolesListOptionRepresentation, + TextChannelOptionRepresentation, + TextChannelsListOptionRepresentation, + TextOptionRepresentation, + VoiceChannelOptionRepresentation, +} from "./guild-config-types"; - -export function assertNumberValidity(optionName: string, option: IntOptionRepresentation | FloatOptionRepresentation, value: unknown) { - if (typeof value !== "number") { - throw new Error(`Option ${optionName} should be a number (${option.type})`); - } - if (option.type === "int" && !Number.isInteger(value)) { - throw new Error(`Option ${optionName} should be an integer`); - } - if (value < option.min) { - throw new Error(`Option ${optionName} should be greater than ${option.min}`); - } - if (option.max !== null && value > option.max) { - throw new Error(`Option ${optionName} should be lower than ${option.max}`); - } +export function assertNumberValidity( + optionName: string, + option: IntOptionRepresentation | FloatOptionRepresentation, + value: unknown, +) { + if (typeof value !== "number") { + throw new Error(`Option ${optionName} should be a number (${option.type})`); + } + if (option.type === "int" && !Number.isInteger(value)) { + throw new Error(`Option ${optionName} should be an integer`); + } + if (value < option.min) { + throw new Error(`Option ${optionName} should be greater than ${option.min}`); + } + if (option.max !== null && value > option.max) { + throw new Error(`Option ${optionName} should be lower than ${option.max}`); + } } -export function assertBooleanValidity(optionName: string, option: BooleanOptionRepresentation, value: unknown) { - if (typeof value !== "boolean") { - throw new Error(`Option ${optionName} should be a boolean`); - } +export function assertBooleanValidity( + optionName: string, + option: BooleanOptionRepresentation, + value: unknown, +) { + if (typeof value !== "boolean") { + throw new Error(`Option ${optionName} should be a boolean`); + } } export function assertEnumValidity(optionName: string, option: EnumOptionRepresentation, value: unknown) { - if (typeof value !== "string") { - throw new Error(`Option ${optionName} should be a string`); - } - if (!option.values.includes(value)) { - throw new Error(`Option ${optionName} should be one of ${option.values.join(", ")}`); - } + if (typeof value !== "string") { + throw new Error(`Option ${optionName} should be a string`); + } + if (!option.values.includes(value)) { + throw new Error(`Option ${optionName} should be one of ${option.values.join(", ")}`); + } } export function assertTextValidity(optionName: string, option: TextOptionRepresentation, value: unknown) { - if (typeof value !== "string") { - throw new Error(`Option ${optionName} should be a string`); - } - if (value.length < option.min_length) { - throw new Error(`Option ${optionName} should be at least ${option.min_length} characters long`); - } - if (value.length > option.max_length) { - throw new Error(`Option ${optionName} should be at most ${option.max_length} characters long`); - } + if (typeof value !== "string") { + throw new Error(`Option ${optionName} should be a string`); + } + if (value.length < option.min_length) { + throw new Error(`Option ${optionName} should be at least ${option.min_length} characters long`); + } + if (value.length > option.max_length) { + throw new Error(`Option ${optionName} should be at most ${option.max_length} characters long`); + } } -export function assertRoleValidity(optionName: string, option: RoleOptionRepresentation, value: unknown, guild: Guild) { - if (typeof value !== "string") { - throw new Error(`Option ${optionName} should be a string`); - } - const role = guild.roles.cache.get(value); +export function assertRoleValidity( + optionName: string, + option: RoleOptionRepresentation, + value: unknown, + guild: Guild, +) { + if (typeof value !== "string") { + throw new Error(`Option ${optionName} should be a string`); + } + const role = guild.roles.cache.get(value); + if (role === undefined) { + throw new Error(`Option ${optionName} should be a valid role ID`); + } + if (!option.allow_integrated_roles && role.managed) { + throw new Error(`Option ${optionName} should not be an integrated role`); + } + if (!option.allow_everyone && role.id === guild.id) { + throw new Error(`Option ${optionName} should not be the @everyone role`); + } +} + +export function assertRoleListValidity( + optionName: string, + option: RolesListOptionRepresentation, + value: unknown, + guild: Guild, +) { + if (!Array.isArray(value)) { + throw new Error(`Option ${optionName} should be an array`); + } + if (value.length < option.min_count) { + throw new Error(`Option ${optionName} should have at least ${option.min_count} roles`); + } + if (value.length > option.max_count) { + throw new Error(`Option ${optionName} should have at most ${option.max_count} roles`); + } + for (const roleId of value) { + const role = guild.roles.cache.get(roleId); if (role === undefined) { - throw new Error(`Option ${optionName} should be a valid role ID`); + throw new Error(`Option ${optionName} should be a valid role ID (${roleId})`); } if (!option.allow_integrated_roles && role.managed) { - throw new Error(`Option ${optionName} should not be an integrated role`); + throw new Error(`Option ${optionName} should not contain an integrated role (${roleId})`); } if (!option.allow_everyone && role.id === guild.id) { - throw new Error(`Option ${optionName} should not be the @everyone role`); + throw new Error(`Option ${optionName} should not contain the @everyone role (${roleId})`); } + } } -export function assertRoleListValidity(optionName: string, option: RolesListOptionRepresentation, value: unknown, guild: Guild) { - if (!Array.isArray(value)) { - throw new Error(`Option ${optionName} should be an array`); - } - if (value.length < option.min_count) { - throw new Error(`Option ${optionName} should have at least ${option.min_count} roles`); - } - if (value.length > option.max_count) { - throw new Error(`Option ${optionName} should have at most ${option.max_count} roles`); - } - for (const roleId of value) { - const role = guild.roles.cache.get(roleId); - if (role === undefined) { - throw new Error(`Option ${optionName} should be a valid role ID (${roleId})`); - } - if (!option.allow_integrated_roles && role.managed) { - throw new Error(`Option ${optionName} should not contain an integrated role (${roleId})`); - } - if (!option.allow_everyone && role.id === guild.id) { - throw new Error(`Option ${optionName} should not contain the @everyone role (${roleId})`); - } - } +function isTextChannel( + channel: GuildBasedChannel, +): channel is PublicThreadChannel | NewsChannel | TextChannel | PrivateThreadChannel { + return [ + ChannelType.AnnouncementThread, + ChannelType.GuildAnnouncement, + ChannelType.GuildText, + ChannelType.PrivateThread, + ChannelType.PublicThread, + ].includes(channel.type); } -function isTextChannel(channel: GuildBasedChannel): channel is PublicThreadChannel | NewsChannel | TextChannel | PrivateThreadChannel { - return [ - ChannelType.AnnouncementThread, - ChannelType.GuildAnnouncement, - ChannelType.GuildText, - ChannelType.PrivateThread, - ChannelType.PublicThread, - ].includes(channel.type); +function isVoiceChannel(channel: GuildBasedChannel): channel is VoiceChannel | StageChannel { + return [ChannelType.GuildVoice, ChannelType.GuildStageVoice].includes(channel.type); } -function isVoiceChannel(channel: GuildBasedChannel): channel is VoiceChannel | StageChannel { - return [ - ChannelType.GuildVoice, - ChannelType.GuildStageVoice, - ].includes(channel.type); +export function assertTextChannelValidity( + optionName: string, + option: TextChannelOptionRepresentation, + value: unknown, + guild: Guild, +) { + if (typeof value !== "string") { + throw new Error(`Option ${optionName} should be a string`); + } + const channel = guild.channels.cache.get(value); + if (channel === undefined || !isTextChannel(channel)) { + throw new Error(`Option ${optionName} should be a valid text channel ID`); + } + if (!option.allow_threads && channel.isThread()) { + throw new Error(`Option ${optionName} should not be a thread channel`); + } + if (!option.allow_announcement_channels && channel.type === ChannelType.GuildAnnouncement) { + throw new Error(`Option ${optionName} should not be an announcement channel`); + } + if (!option.allow_non_nsfw_channels) { + if (("nsfw" in channel && channel.nsfw) || (channel.isThread() && channel.parent?.nsfw)) { + throw new Error(`Option ${optionName} cannot be a NSFW channel`); + } + } } -export function assertTextChannelValidity(optionName: string, option: TextChannelOptionRepresentation, value: unknown, guild: Guild) { - if (typeof value !== "string") { - throw new Error(`Option ${optionName} should be a string`); - } - const channel = guild.channels.cache.get(value); - if (channel === undefined || !isTextChannel(channel)) { - throw new Error(`Option ${optionName} should be a valid text channel ID`); +export function assertTextChannelListValidity( + optionName: string, + option: TextChannelsListOptionRepresentation, + value: unknown, + guild: Guild, +) { + if (!Array.isArray(value)) { + throw new Error(`Option ${optionName} should be an array`); + } + if (value.length < option.min_count) { + throw new Error(`Option ${optionName} should have at least ${option.min_count} channels`); + } + if (value.length > option.max_count) { + throw new Error(`Option ${optionName} should have at most ${option.max_count} channels`); + } + for (const channelId of value) { + const channel = guild.channels.cache.get(channelId); + if (channel === undefined || !(isTextChannel(channel) || isVoiceChannel(channel))) { + throw new Error(`Option ${optionName} should be a valid list of text channel IDs (${channelId})`); } if (!option.allow_threads && channel.isThread()) { - throw new Error(`Option ${optionName} should not be a thread channel`); + throw new Error(`Option ${optionName} should not contain a thread channel (${channelId})`); } if (!option.allow_announcement_channels && channel.type === ChannelType.GuildAnnouncement) { - throw new Error(`Option ${optionName} should not be an announcement channel`); + throw new Error(`Option ${optionName} should not contain an announcement channel (${channelId})`); } if (!option.allow_non_nsfw_channels) { - if (("nsfw" in channel && channel.nsfw) || (channel.isThread() && channel.parent?.nsfw)) { - throw new Error(`Option ${optionName} cannot be a NSFW channel`); - } - } -} - -export function assertTextChannelListValidity(optionName: string, option: TextChannelsListOptionRepresentation, value: unknown, guild: Guild) { - if (!Array.isArray(value)) { - throw new Error(`Option ${optionName} should be an array`); - } - if (value.length < option.min_count) { - throw new Error(`Option ${optionName} should have at least ${option.min_count} channels`); - } - if (value.length > option.max_count) { - throw new Error(`Option ${optionName} should have at most ${option.max_count} channels`); - } - for (const channelId of value) { - const channel = guild.channels.cache.get(channelId); - if (channel === undefined || !(isTextChannel(channel) || isVoiceChannel(channel))) { - throw new Error(`Option ${optionName} should be a valid list of text channel IDs (${channelId})`); - } - if (!option.allow_threads && channel.isThread()) { - throw new Error(`Option ${optionName} should not contain a thread channel (${channelId})`); - } - if (!option.allow_announcement_channels && channel.type === ChannelType.GuildAnnouncement) { - throw new Error(`Option ${optionName} should not contain an announcement channel (${channelId})`); - } - if (!option.allow_non_nsfw_channels) { - if (("nsfw" in channel && channel.nsfw) || (channel.isThread() && channel.parent?.nsfw)) { - throw new Error(`Option ${optionName} cannot contain a NSFW channel (${channelId})`); - } - } + if (("nsfw" in channel && channel.nsfw) || (channel.isThread() && channel.parent?.nsfw)) { + throw new Error(`Option ${optionName} cannot contain a NSFW channel (${channelId})`); + } } + } } -export function assertVoiceChannelValidity(optionName: string, option: VoiceChannelOptionRepresentation, value: unknown, guild: Guild) { - if (typeof value !== "string") { - throw new Error(`Option ${optionName} should be a string`); - } - const channel = guild.channels.cache.get(value); - if (channel === undefined || (channel.type !== ChannelType.GuildVoice && channel.type !== ChannelType.GuildStageVoice)) { - throw new Error(`Option ${optionName} should be a valid voice channel ID`); - } - if (!option.allow_stage_channels && channel.type === ChannelType.GuildStageVoice) { - throw new Error(`Option ${optionName} should not be a stage channel`); - } - if (!option.allow_non_nsfw_channels && channel.nsfw) { - throw new Error(`Option ${optionName} cannot be a NSFW channel`); - } +export function assertVoiceChannelValidity( + optionName: string, + option: VoiceChannelOptionRepresentation, + value: unknown, + guild: Guild, +) { + if (typeof value !== "string") { + throw new Error(`Option ${optionName} should be a string`); + } + const channel = guild.channels.cache.get(value); + if ( + channel === undefined || + (channel.type !== ChannelType.GuildVoice && channel.type !== ChannelType.GuildStageVoice) + ) { + throw new Error(`Option ${optionName} should be a valid voice channel ID`); + } + if (!option.allow_stage_channels && channel.type === ChannelType.GuildStageVoice) { + throw new Error(`Option ${optionName} should not be a stage channel`); + } + if (!option.allow_non_nsfw_channels && channel.nsfw) { + throw new Error(`Option ${optionName} cannot be a NSFW channel`); + } } export function assertCategoryChannelValidity(optionName: string, value: unknown, guild: Guild) { - if (typeof value !== "string") { - throw new Error(`Option ${optionName} should be a string`); - } - const channel = guild.channels.cache.get(value); - if (channel === undefined || channel.type !== ChannelType.GuildCategory) { - throw new Error(`Option ${optionName} should be a valid category channel ID`); - } + if (typeof value !== "string") { + throw new Error(`Option ${optionName} should be a string`); + } + const channel = guild.channels.cache.get(value); + if (channel === undefined || channel.type !== ChannelType.GuildCategory) { + throw new Error(`Option ${optionName} should be a valid category channel ID`); + } } -export function assertEmojiListValidity(optionName: string, option: EmojisListOptionRepresentation, value: unknown, guild: Guild) { - if (!Array.isArray(value)) { - throw new Error(`Option ${optionName} should be an array`); - } - for (const emojiId of value) { - if (typeof emojiId !== "string") { - throw new Error(`Option ${optionName} should be an array of strings`); - } - const emoji = guild.emojis.cache.get(emojiId); - if (emoji === undefined && !/^[\p{Extended_Pictographic}\u{1F3FB}-\u{1F3FF}\u{1F9B0}-\u{1F9B3}\u{200D}]+$/u.test(emojiId)) { - throw new Error(`Option ${optionName} should be a valid Unicode emoji or custom emoji ID (${emojiId})`); - } - } +export function assertEmojiListValidity( + optionName: string, + option: EmojisListOptionRepresentation, + value: unknown, + guild: Guild, +) { + if (!Array.isArray(value)) { + throw new Error(`Option ${optionName} should be an array`); + } + for (const emojiId of value) { + if (typeof emojiId !== "string") { + throw new Error(`Option ${optionName} should be an array of strings`); + } + const emoji = guild.emojis.cache.get(emojiId); + if ( + emoji === undefined && + !/^[\p{Extended_Pictographic}\u{1F3FB}-\u{1F3FF}\u{1F9B0}-\u{1F9B3}\u{200D}]+$/u.test(emojiId) + ) { + throw new Error(`Option ${optionName} should be a valid Unicode emoji or custom emoji ID (${emojiId})`); + } + } } export function assertColorValidity(optionName: string, value: unknown) { - if (typeof value !== "number") { - throw new Error(`Option ${optionName} should be a number`); - } - if (value < 0 || value > 0xFFFFFF) { - throw new Error(`Option ${optionName} should be a number between 0 and 0xFFFFFF`); - } + if (typeof value !== "number") { + throw new Error(`Option ${optionName} should be a number`); + } + if (value < 0 || value > 0xffffff) { + throw new Error(`Option ${optionName} should be a number between 0 and 0xFFFFFF`); + } } export function assertLevelupChannelValidity(optionName: string, value: unknown, guild: Guild) { - if (typeof value !== "string") { - throw new Error(`Option ${optionName} should be a string`); - } - if (["any", "none", "dm"].includes(value)) { - return; - } - assertTextChannelValidity( - optionName, - { type: "text_channel", "allow_threads": true, "allow_announcement_channels": true, "allow_non_nsfw_channels": true, "default": null, "is_listed": true }, - value, - guild - ); -} \ No newline at end of file + if (typeof value !== "string") { + throw new Error(`Option ${optionName} should be a string`); + } + if (["any", "none", "dm"].includes(value)) { + return; + } + assertTextChannelValidity( + optionName, + { + type: "text_channel", + allow_threads: true, + allow_announcement_channels: true, + allow_non_nsfw_channels: true, + default: null, + is_listed: true, + }, + value, + guild, + ); +} diff --git a/src/database/models/auth.d.ts b/src/database/models/auth.d.ts index 15ea9c3..51adff6 100644 --- a/src/database/models/auth.d.ts +++ b/src/database/models/auth.d.ts @@ -1,7 +1,7 @@ export interface TokenInformation { - user_id: bigint; - api_token: string; - discord_token: string | null; - created_at: Date; - expires_at: Date; -} \ No newline at end of file + user_id: bigint; + api_token: string; + discord_token: string | null; + created_at: Date; + expires_at: Date; +} diff --git a/src/database/models/misc-db-types.ts b/src/database/models/misc-db-types.ts index d45d2dd..24101f6 100644 --- a/src/database/models/misc-db-types.ts +++ b/src/database/models/misc-db-types.ts @@ -1,10 +1,10 @@ export enum EditionLogType { - SCONFIG_OPTION_SET = "sconfig_option_set", - SCONFIG_OPTION_RESET = "sconfig_option_reset", - SCONFIG_RESET_ALL = "sconfig_reset_all", - LEADERBOARD_PUT = "leaderboard_put", - ROLE_REWARDS_PUT = "role_rewards_put", - RSS_ADDED = "rss_added", - RSS_EDITED = "rss_edited", - RSS_DELETED = "rss_deleted", -} \ No newline at end of file + SCONFIG_OPTION_SET = "sconfig_option_set", + SCONFIG_OPTION_RESET = "sconfig_option_reset", + SCONFIG_RESET_ALL = "sconfig_reset_all", + LEADERBOARD_PUT = "leaderboard_put", + ROLE_REWARDS_PUT = "role_rewards_put", + RSS_ADDED = "rss_added", + RSS_EDITED = "rss_edited", + RSS_DELETED = "rss_deleted", +} diff --git a/src/database/models/rss.ts b/src/database/models/rss.ts index e227fad..38a1d88 100644 --- a/src/database/models/rss.ts +++ b/src/database/models/rss.ts @@ -1,99 +1,99 @@ export interface RawRssFeed { - ID: bigint; - channel: bigint; - type: string; - link: string; - date: string; - structure: string; - roles: string; - use_embed: boolean; - embed: string; - silent_mention: boolean; - recent_errors: number; - enabled: boolean; - added_at: string; + ID: bigint; + channel: bigint; + type: string; + link: string; + date: string; + structure: string; + roles: string; + use_embed: boolean; + embed: string; + silent_mention: boolean; + recent_errors: number; + enabled: boolean; + added_at: string; } export const VALID_RSS_FEED_TYPES = ["bluesky", "deviantart", "twitch", "web", "yt"] as const; -export type VALID_RSS_FEED_TYPES = (typeof VALID_RSS_FEED_TYPES)[number]; +export type T_VALID_RSS_FEED_TYPES = (typeof VALID_RSS_FEED_TYPES)[number]; export interface RssFeedForCreation { - channelId: string; - type: VALID_RSS_FEED_TYPES; - link: string; - structure: string; - roles: string[]; - useEmbed: boolean; - embed: { - author_text?: string; - title?: string; - footer_text?: string; - color?: number; - show_date_in_footer?: boolean; - enable_link_in_title?: boolean; - image_location?: "thumbnail" | "banner" | "none"; - }; - silentMention: boolean; - enabled: boolean; + channelId: string; + type: T_VALID_RSS_FEED_TYPES; + link: string; + structure: string; + roles: string[]; + useEmbed: boolean; + embed: { + author_text?: string; + title?: string; + footer_text?: string; + color?: number; + show_date_in_footer?: boolean; + enable_link_in_title?: boolean; + image_location?: "thumbnail" | "banner" | "none"; + }; + silentMention: boolean; + enabled: boolean; } export interface RssFeedForEdition { - id: string; - channelId: string; - structure: string; - roles: string[]; - useEmbed: boolean; - embed: { - author_text?: string; - title?: string; - footer_text?: string; - color?: number; - show_date_in_footer?: boolean; - enable_link_in_title?: boolean; - image_location?: "thumbnail" | "banner" | "none"; - }; - silentMention: boolean; - enabled: boolean; + id: string; + channelId: string; + structure: string; + roles: string[]; + useEmbed: boolean; + embed: { + author_text?: string; + title?: string; + footer_text?: string; + color?: number; + show_date_in_footer?: boolean; + enable_link_in_title?: boolean; + image_location?: "thumbnail" | "banner" | "none"; + }; + silentMention: boolean; + enabled: boolean; } export interface DBRssFeed { - id: bigint; - channelId: bigint; - type: string; - link: string; - date: Date; - structure: string; - roles: bigint[]; - useEmbed: boolean; - embed: { - author_text?: string; - title?: string; - footer_text?: string; - color?: number; - show_date_in_footer?: boolean; - enable_link_in_title?: boolean; - image_location?: "thumbnail" | "banner" | "none"; - }; - silentMention: boolean; - recentErrors: number; - enabled: boolean; - addedAt: Date; + id: bigint; + channelId: bigint; + type: string; + link: string; + date: Date; + structure: string; + roles: bigint[]; + useEmbed: boolean; + embed: { + author_text?: string; + title?: string; + footer_text?: string; + color?: number; + show_date_in_footer?: boolean; + enable_link_in_title?: boolean; + image_location?: "thumbnail" | "banner" | "none"; + }; + silentMention: boolean; + recentErrors: number; + enabled: boolean; + addedAt: Date; } export function rawToDBRssFeed(raw: RawRssFeed): DBRssFeed { - return { - id: raw.ID, - channelId: raw.channel, - type: raw.type, - link: raw.link, - date: new Date(raw.date), - structure: raw.structure, - roles: raw.roles ? raw.roles.split(";").map(BigInt) : [], - useEmbed: Boolean(raw.use_embed), - embed: JSON.parse(raw.embed), - silentMention: Boolean(raw.silent_mention), - recentErrors: raw.recent_errors, - enabled: Boolean(raw.enabled), - addedAt: new Date(raw.added_at), - }; -} \ No newline at end of file + return { + id: raw.ID, + channelId: raw.channel, + type: raw.type, + link: raw.link, + date: new Date(raw.date), + structure: raw.structure, + roles: raw.roles ? raw.roles.split(";").map(BigInt) : [], + useEmbed: Boolean(raw.use_embed), + embed: JSON.parse(raw.embed), + silentMention: Boolean(raw.silent_mention), + recentErrors: raw.recent_errors, + enabled: Boolean(raw.enabled), + addedAt: new Date(raw.added_at), + }; +} diff --git a/src/database/models/users.d.ts b/src/database/models/users.d.ts index 0985bc7..e975c7d 100644 --- a/src/database/models/users.d.ts +++ b/src/database/models/users.d.ts @@ -1,7 +1,7 @@ export interface DBRawUserData { - user_id: bigint; - username: string; - global_name: string | null; - avatar_hash: string | null; - is_bot: boolean; -} \ No newline at end of file + user_id: bigint; + username: string; + global_name: string | null; + avatar_hash: string | null; + is_bot: boolean; +} diff --git a/src/database/models/xp.d.ts b/src/database/models/xp.d.ts index 248bee6..349c5e5 100644 --- a/src/database/models/xp.d.ts +++ b/src/database/models/xp.d.ts @@ -1,19 +1,19 @@ export interface DBRoleReward { - id: bigint; - guildId: bigint; - roleId: bigint; - level: bigint; - addedAt: Date; + id: bigint; + guildId: bigint; + roleId: bigint; + level: bigint; + addedAt: Date; } -export interface PopulatedRoleReward extends DBRoleReward{ - role: { - name: string; - color: number; - } | null; +export interface PopulatedRoleReward extends DBRoleReward { + role: { + name: string; + color: number; + } | null; } export interface LeaderboardPlayer { - userID: bigint; - xp: bigint; -} \ No newline at end of file + userID: bigint; + xp: bigint; +} diff --git a/src/index.ts b/src/index.ts index 7e98297..8931018 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,30 +19,32 @@ import { checkEnvironmentVariables } from "./utils/env_checks"; const app = express(); if (!checkEnvironmentVariables()) { - process.exit(1); + process.exit(1); } if (process.env.PROXY_LEVEL && Number(process.env.PROXY_LEVEL) > 0) { - app.set("trust proxy", Number(process.env.PROXY_LEVEL)); + app.set("trust proxy", Number(process.env.PROXY_LEVEL)); } const port = Number(process.env.PORT) || 3000; // custom console log format ConsoleStamp(console, { - format: ":date(dd/mm/yyyy HH:MM:ss).blueBright :label(7)", - extend: { - debug: 5, - fatal: 0, - }, - include: ["debug", "info", "log", "warn", "error", "fatal"], - level: "debug", + format: ":date(dd/mm/yyyy HH:MM:ss).blueBright :label(7)", + extend: { + debug: 5, + fatal: 0, + }, + include: ["debug", "info", "log", "warn", "error", "fatal"], + level: "debug", }); // Set up CORS -app.use(cors({ +app.use( + cors({ origin: process.env.CORS_ACCEPTED_DOMAINS.split(","), -})); + }), +); // Remove x-powered-by header app.disable("x-powered-by"); @@ -53,29 +55,29 @@ app.use(compression()); // Allow BigInt in JSON responses // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unreachable code error -BigInt.prototype.toJSON = function() { - return this.toString(); +BigInt.prototype.toJSON = function () { + return this.toString(); }; app.use(bodyParser.json()); // set-up global rate limit const globalLimiter = rateLimit({ - windowMs: 10 * 1000, // 10 seconds - max: 15, // Limit each IP to 15 requests per windowMs - standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers + windowMs: 10 * 1000, // 10 seconds + max: 15, // Limit each IP to 15 requests per windowMs + standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers }); app.use(globalLimiter); - // log every request to the console morgan.token("date", (req) => formatDate(req._startTime)); morgan.token("err", (req, res) => (res._err ? ` - [${res._err}]` : "\u200b")); -app.use(morgan("\x1b[94m[:date]\x1b[0m \x1b[93m:remote-addr\x1b[0m :method :status :url:err - :response-time ms")); - +app.use( + morgan("\x1b[94m[:date]\x1b[0m \x1b[93m:remote-addr\x1b[0m :method :status :url:err - :response-time ms"), +); app.get("/", (req, res) => { - res.send({ success: true, version: process.env.npm_package_version }); + res.send({ success: true, version: process.env.npm_package_version }); }); app.use("/auth", AuthRouter); @@ -85,16 +87,15 @@ app.use("/docker", DockerRouter); app.use("/rss", RssRouter); // Middleware to return a clean error message when the body is not a valid JSON -// eslint-disable-next-line @typescript-eslint/no-unused-vars -app.use(function(error: Error, req: Request, res: Response, next: NextFunction) { - if (error instanceof SyntaxError) { - res.status(400).send("Invalid JSON body"); - } else { - console.error(error.stack); - res.status(500).send("Internal server error"); - } +app.use(function (error: Error, req: Request, res: Response, next: NextFunction) { + if (error instanceof SyntaxError) { + res.status(400).send("Invalid JSON body"); + } else { + console.error(error.stack); + res.status(500).send("Internal server error"); + } }); app.listen(port, () => { - console.info(`App V${process.env.npm_package_version} is running on http://localhost:${port} !`); + console.info(`App V${process.env.npm_package_version} is running on http://localhost:${port} !`); }); diff --git a/src/modules/auth/controler.ts b/src/modules/auth/controler.ts index 754a57f..3d4f962 100644 --- a/src/modules/auth/controler.ts +++ b/src/modules/auth/controler.ts @@ -3,85 +3,84 @@ import { NextFunction, Request, Response } from "express"; import DiscordClient from "../../bot/client"; import { createToken } from "./tokens"; - const discordClient = DiscordClient.getInstance(); export async function getDiscordCallback(req: Request, res: Response, next: NextFunction) { - const code = req.query.code; - if (typeof code !== "string") { - res.status(400).send("Invalid code"); - return; - } + const code = req.query.code; + if (typeof code !== "string") { + res.status(400).send("Invalid code"); + return; + } - const token = await fetch("https://discord.com/api/oauth2/token", { - method: "POST", - headers: { - "Content-Type": "application/x-www-form-urlencoded", - }, - body: new URLSearchParams({ - "client_id": process.env.DISCORD_CLIENT_ID, - "client_secret": process.env.DISCORD_CLIENT_SECRET, - code, - "grant_type": "authorization_code", - "redirect_uri": process.env.DISCORD_REDIRECT_URI, - scope: "identify", - }), - }).then(fres => fres.json()); - if (token.error) { - console.warn("Invalid answer while getting Discord token from code: ", token); - if (token.error_description === "Invalid \"code\" in request.") { - res.status(400).send("Invalid code"); - } else { - res.status(500).send("Internal server error"); - } - return; + const token = await fetch("https://discord.com/api/oauth2/token", { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + body: new URLSearchParams({ + client_id: process.env.DISCORD_CLIENT_ID, + client_secret: process.env.DISCORD_CLIENT_SECRET, + code, + grant_type: "authorization_code", + redirect_uri: process.env.DISCORD_REDIRECT_URI, + scope: "identify", + }), + }).then((fres) => fres.json()); + if (token.error) { + console.warn("Invalid answer while getting Discord token from code: ", token); + if (token.error_description === 'Invalid "code" in request.') { + res.status(400).send("Invalid code"); + } else { + res.status(500).send("Internal server error"); } + return; + } - const user = await discordClient.getUserFromOauth(token.access_token); + const user = await discordClient.getUserFromOauth(token.access_token); - if (user === null) { - res._err = "Invalid token"; - res.status(500).send(res._err); - return; - } + if (user === null) { + res._err = "Invalid token"; + res.status(500).send(res._err); + return; + } - let apiToken; - try { - apiToken = await createToken(user.id, token.access_token); - } catch (err) { - next(err); - return; - } + let apiToken; + try { + apiToken = await createToken(user.id, token.access_token); + } catch (err) { + next(err); + return; + } - const response: AuthenticatedUserObject & {token: string} = { - token: apiToken, - id: user.id, - username: user.username, - globalName: user.global_name, - avatar: discordClient.getAvatarUrlFromHash(user.avatar, user.id), - }; + const response: AuthenticatedUserObject & { token: string } = { + token: apiToken, + id: user.id, + username: user.username, + globalName: user.global_name, + avatar: discordClient.getAvatarUrlFromHash(user.avatar, user.id), + }; - res.json(response); + res.json(response); } export async function getMe(req: Request, res: Response) { - if (res.locals.user === undefined) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return; - } - const userId = res.locals.user.user_id; - const user = await discordClient.resolveUser(userId.toString()); - if (user === null) { - res._err = "User not found"; - res.status(500).send(res._err); - return; - } - const response: AuthenticatedUserObject = { - id: user.id, - username: user.username, - globalName: user.globalName, - avatar: discordClient.getAvatarUrlFromHash(user.avatar, user.id), - }; - res.json(response); + if (res.locals.user === undefined) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return; + } + const userId = res.locals.user.user_id; + const user = await discordClient.resolveUser(userId.toString()); + if (user === null) { + res._err = "User not found"; + res.status(500).send(res._err); + return; + } + const response: AuthenticatedUserObject = { + id: user.id, + username: user.username, + globalName: user.globalName, + avatar: discordClient.getAvatarUrlFromHash(user.avatar, user.id), + }; + res.json(response); } diff --git a/src/modules/auth/ratelimits.ts b/src/modules/auth/ratelimits.ts index f3759fb..e81c30e 100644 --- a/src/modules/auth/ratelimits.ts +++ b/src/modules/auth/ratelimits.ts @@ -1,7 +1,7 @@ import rateLimit from "express-rate-limit"; export const postDiscordCallbackRateLimiter = rateLimit({ - windowMs: 60 * 1000, - max: 5, - standardHeaders: true, -}); \ No newline at end of file + windowMs: 60 * 1000, + max: 5, + standardHeaders: true, +}); diff --git a/src/modules/auth/router.ts b/src/modules/auth/router.ts index e71d44c..ebfd1f5 100644 --- a/src/modules/auth/router.ts +++ b/src/modules/auth/router.ts @@ -10,4 +10,4 @@ router.get("/me", tokenCheckMiddleware, getMe); router.post("/discord-callback", postDiscordCallbackRateLimiter, postDiscordCallback); -export default router; \ No newline at end of file +export default router; diff --git a/src/modules/auth/tokens.ts b/src/modules/auth/tokens.ts index 2f17fae..7190938 100644 --- a/src/modules/auth/tokens.ts +++ b/src/modules/auth/tokens.ts @@ -10,49 +10,51 @@ const JWT_SECRET_TOKEN = process.env.JWT_SECRET_TOKEN; const JWT_TOKEN_EXPIRATION_DAYS = Number(process.env.JWT_TOKEN_EXPIRATION_DAYS ?? "14"); export async function checkToken(token: string) { - // Token validity - try { - verify(token, JWT_SECRET_TOKEN); - } catch (err) { - return null; - } - // Check if token exists in database - return await db.getTokenInformation(token); + // Token validity + try { + verify(token, JWT_SECRET_TOKEN); + } catch (err) { + return null; + } + // Check if token exists in database + return await db.getTokenInformation(token); } export async function tokenCheck(req: Request): Promise { - const token = req.get("authorization"); - // Token existence - if (!token) { - return [401, "No authentication token found in request headers"]; - } - try { - const info = await checkToken(token); - if (info === null) { - return [401, "Authentication token is invalid"]; - } - return info; - } catch (err) { - return [500, "Database error"]; + const token = req.get("authorization"); + // Token existence + if (!token) { + return [401, "No authentication token found in request headers"]; + } + try { + const info = await checkToken(token); + if (info === null) { + return [401, "Authentication token is invalid"]; } + return info; + } catch (err) { + return [500, "Database error"]; + } } export async function tokenCheckMiddleware(req: Request, res: Response, next: NextFunction) { - const checkResult = await tokenCheck(req); - if (Array.isArray(checkResult)) { - res._err = checkResult[1]; - res.status(checkResult[0]).send(res._err); - } else { - res.locals.user = checkResult; - next(); - } + const checkResult = await tokenCheck(req); + if (Array.isArray(checkResult)) { + res._err = checkResult[1]; + res.status(checkResult[0]).send(res._err); + } else { + res.locals.user = checkResult; + next(); + } } export async function createToken(userId: bigint | string, discordToken: string | null) { - const numericUserId = BigInt(userId); - const apiToken = sign({ result: userId.toString() }, JWT_SECRET_TOKEN, { expiresIn: `${JWT_TOKEN_EXPIRATION_DAYS}d` }); - const expirationDate = new Date(); - expirationDate.setDate(expirationDate.getDate() + JWT_TOKEN_EXPIRATION_DAYS); - await db.registerToken(numericUserId, apiToken, discordToken, expirationDate); - return apiToken; -} \ No newline at end of file + const numericUserId = BigInt(userId); + const apiToken = sign({ result: userId.toString() }, JWT_SECRET_TOKEN, { + expiresIn: `${JWT_TOKEN_EXPIRATION_DAYS}d`, + }); + const expirationDate = new Date(); + expirationDate.setDate(expirationDate.getDate() + JWT_TOKEN_EXPIRATION_DAYS); + await db.registerToken(numericUserId, apiToken, discordToken, expirationDate); + return apiToken; +} diff --git a/src/modules/crowdin/controler.ts b/src/modules/crowdin/controler.ts index 3e92d6e..caac245 100644 --- a/src/modules/crowdin/controler.ts +++ b/src/modules/crowdin/controler.ts @@ -1,200 +1,210 @@ import { Request, Response } from "express"; import { MapWithDefault } from "../../utils/defaut_map"; -import { AnyCrowdinEvent, CrowdinBatchEvents, CrowdinFileEvent, CrowdinStringEvent, isFileEvent } from "./types"; -import { CrowdinFileAddedEvent, CrowdinFileFullyTranslatedEvent, CrowdinFileUpdatedEvent, CrowdinSourceStringAddedEvent, CrowdinSourceStringDeletedEvent, CrowdinSourceStringUpdatedEvent } from "./types/events"; +import { + AnyCrowdinEvent, + CrowdinBatchEvents, + CrowdinFileEvent, + CrowdinStringEvent, + isFileEvent, +} from "./types"; +import { + CrowdinFileAddedEvent, + CrowdinFileFullyTranslatedEvent, + CrowdinFileUpdatedEvent, + CrowdinSourceStringAddedEvent, + CrowdinSourceStringDeletedEvent, + CrowdinSourceStringUpdatedEvent, +} from "./types/events"; import { authorFromProject, footerFromUser, sendToDiscord } from "./utils"; const EMBED_COLOR = 0x66bb6a; -export async function postWebhookNotification(req: Request<{ webhook_id: string, webhook_token: string }, unknown, AnyCrowdinEvent | CrowdinBatchEvents>, res: Response) { - const webhookPath = req.params.webhook_id + "/" + req.params.webhook_token; - if (!/^\d+\/[\w-]+$/.test(webhookPath)) { - res.status(400).send("Invalid webhook path"); - return; +export async function postWebhookNotification( + req: Request<{ webhook_id: string; webhook_token: string }, unknown, AnyCrowdinEvent | CrowdinBatchEvents>, + res: Response, +) { + const webhookPath = req.params.webhook_id + "/" + req.params.webhook_token; + if (!/^\d+\/[\w-]+$/.test(webhookPath)) { + res.status(400).send("Invalid webhook path"); + return; + } + // assign events to our lists + const stringEvents: CrowdinStringEvent[] = []; + const fileEvents: CrowdinFileEvent[] = []; + if ("events" in req.body) { + for (const event of req.body.events) { + if (isFileEvent(event)) { + fileEvents.push(event); + } else { + stringEvents.push(event); + } } - // assign events to our lists - const stringEvents: CrowdinStringEvent[] = []; - const fileEvents: CrowdinFileEvent[] = []; - if ("events" in req.body) { - for (const event of req.body.events) { - if (isFileEvent(event)) { - fileEvents.push(event); - } else { - stringEvents.push(event); - } - } - } else if (isFileEvent(req.body)) { - fileEvents.push(req.body); - } else { - stringEvents.push(req.body); - } - // handle string events - if (stringEvents.length > 0) { - await handleBatchStringsUpdate(webhookPath, stringEvents); + } else if (isFileEvent(req.body)) { + fileEvents.push(req.body); + } else { + stringEvents.push(req.body); + } + // handle string events + if (stringEvents.length > 0) { + await handleBatchStringsUpdate(webhookPath, stringEvents); + } + // handle file events + for (const event of fileEvents) { + switch (event.event) { + case "file.added": + await handleFileAddedEvent(webhookPath, event); + break; + case "file.translated": + await handleFileTranslatedEvent(webhookPath, event); + break; + case "file.updated": + await handleFileUpdatedEvent(webhookPath, event); + break; } - // handle file events - for (const event of fileEvents) { - switch (event.event) { - case "file.added": - await handleFileAddedEvent(webhookPath, event); - break; - case "file.translated": - await handleFileTranslatedEvent(webhookPath, event); - break; - case "file.updated": - await handleFileUpdatedEvent(webhookPath, event); - break; - } - } - res.send("ok"); + } + res.send("ok"); } - async function handleFileAddedEvent(webhookPath: string, event: CrowdinFileAddedEvent) { - const projectUrl = event.file.project.url; - const embed = { - title: "New file added", - description: `File: ${event.file.path}\n\n[Go to project](${projectUrl})`, - color: EMBED_COLOR, - footer: footerFromUser(event.user), - author: authorFromProject(event.file.project), - }; - await sendToDiscord(webhookPath, { embeds: [embed] }); + const projectUrl = event.file.project.url; + const embed = { + title: "New file added", + description: `File: ${event.file.path}\n\n[Go to project](${projectUrl})`, + color: EMBED_COLOR, + footer: footerFromUser(event.user), + author: authorFromProject(event.file.project), + }; + await sendToDiscord(webhookPath, { embeds: [embed] }); } async function handleFileTranslatedEvent(webhookPath: string, event: CrowdinFileFullyTranslatedEvent) { - const projectUrl = event.file.project.url; - const embed = { - title: "File fully translated", - description: `File: ${event.file.path}\nLanguage: ${event.targetLanguage.name}\n\n[Go to project](${projectUrl})`, - color: EMBED_COLOR, - author: authorFromProject(event.file.project), - }; - await sendToDiscord(webhookPath, { embeds: [embed] }); + const projectUrl = event.file.project.url; + const embed = { + title: "File fully translated", + description: `File: ${event.file.path}\nLanguage: ${event.targetLanguage.name}\n\n[Go to project](${projectUrl})`, + color: EMBED_COLOR, + author: authorFromProject(event.file.project), + }; + await sendToDiscord(webhookPath, { embeds: [embed] }); } async function handleFileUpdatedEvent(webhookPath: string, event: CrowdinFileUpdatedEvent) { - const projectUrl = event.file.project.url; - const embed = { - title: "File updated", - description: `File: ${event.file.path}\n\n[Go to project](${projectUrl})`, - color: EMBED_COLOR, - footer: footerFromUser(event.user), - author: authorFromProject(event.file.project), - }; - await sendToDiscord(webhookPath, { embeds: [embed] }); + const projectUrl = event.file.project.url; + const embed = { + title: "File updated", + description: `File: ${event.file.path}\n\n[Go to project](${projectUrl})`, + color: EMBED_COLOR, + footer: footerFromUser(event.user), + author: authorFromProject(event.file.project), + }; + await sendToDiscord(webhookPath, { embeds: [embed] }); } - async function handleBatchStringsUpdate(webhookPath: string, events: CrowdinStringEvent[]) { - if (events.length === 1) { - const event = events[0]; - switch (event.event) { - case "string.added": - await handleStringAdded(webhookPath, event); - break; - case "string.updated": - await handleStringUpdated(webhookPath, event); - break; - case "string.deleted": - await handleStringDeleted(webhookPath, event); - break; - } - return; + if (events.length === 1) { + const event = events[0]; + switch (event.event) { + case "string.added": + await handleStringAdded(webhookPath, event); + break; + case "string.updated": + await handleStringUpdated(webhookPath, event); + break; + case "string.deleted": + await handleStringDeleted(webhookPath, event); + break; } - const project = events[0].string.project; - // assign each string to its event category - const eventsMap = new MapWithDefault>(() => new Set()); - for (const event of events) { - const file = event.string.file.path; - const stringId = event.string.identifier; - switch (event.event) { - case "string.added": - // if the string has been marked as deleted, mark it as updated - if (eventsMap.get("deleted-" + file).has(stringId)) { - eventsMap.get("deleted-" + file).delete(stringId); - eventsMap.get("updated-" + file).add(stringId); - } else { - eventsMap.get("added-" + file).add(stringId); - } - break; - case "string.updated": - eventsMap.get("updated-" + file).add(stringId); - break; - case "string.deleted": - // if the string has been marked as added, mark it as updated - if (eventsMap.get("added-" + file).has(stringId)) { - eventsMap.get("added-" + file).delete(stringId); - eventsMap.get("updated-" + file).add(stringId); - } else { - eventsMap.get("deleted-" + file).add(stringId); - } - break; + return; + } + const project = events[0].string.project; + // assign each string to its event category + const eventsMap = new MapWithDefault>(() => new Set()); + for (const event of events) { + const file = event.string.file.path; + const stringId = event.string.identifier; + switch (event.event) { + case "string.added": + // if the string has been marked as deleted, mark it as updated + if (eventsMap.get("deleted-" + file).has(stringId)) { + eventsMap.get("deleted-" + file).delete(stringId); + eventsMap.get("updated-" + file).add(stringId); + } else { + eventsMap.get("added-" + file).add(stringId); } + break; + case "string.updated": + eventsMap.get("updated-" + file).add(stringId); + break; + case "string.deleted": + // if the string has been marked as added, mark it as updated + if (eventsMap.get("added-" + file).has(stringId)) { + eventsMap.get("added-" + file).delete(stringId); + eventsMap.get("updated-" + file).add(stringId); + } else { + eventsMap.get("deleted-" + file).add(stringId); + } + break; } - let text = ""; - for (const [eventKey, event] of eventsMap.entries()) { - if (event.size === 0) continue; - const [eventType, file] = eventKey.split("-", 2); - const strings = [...event]; - const _strings = strings.length === 1 ? "string" : "strings"; - text += `${strings.length} ${_strings} ${eventType} in ${file}\n`; - } - text += `\n[Go to project](${project.url})`; - const _strings = events.length === 1 ? "string" : "strings"; - const embed = { - title: `${events.length} ${_strings} edited`, - description: text, - color: EMBED_COLOR, - footer: footerFromUser(events[0].user), - author: authorFromProject(project), - }; - await sendToDiscord(webhookPath, { embeds: [embed] }); + } + let text = ""; + for (const [eventKey, event] of eventsMap.entries()) { + if (event.size === 0) continue; + const [eventType, file] = eventKey.split("-", 2); + const strings = [...event]; + const _strings = strings.length === 1 ? "string" : "strings"; + text += `${strings.length} ${_strings} ${eventType} in ${file}\n`; + } + text += `\n[Go to project](${project.url})`; + const _strings = events.length === 1 ? "string" : "strings"; + const embed = { + title: `${events.length} ${_strings} edited`, + description: text, + color: EMBED_COLOR, + footer: footerFromUser(events[0].user), + author: authorFromProject(project), + }; + await sendToDiscord(webhookPath, { embeds: [embed] }); } async function handleStringAdded(webhookPath: string, event: CrowdinSourceStringAddedEvent) { - const stringText = event.string.text.length < 200 ? event.string.text : event.string.text.substring(0, 200) + "..."; - const embed = { - title: "Source string added", - description: `File: ${event.string.file.path}\nKey: ${event.string.key}\n\n[Go to project](${event.string.url})`, - fields: [ - { name: "Text", value: stringText }, - ], - color: EMBED_COLOR, - footer: footerFromUser(event.user), - author: authorFromProject(event.string.project), - }; - await sendToDiscord(webhookPath, { embeds: [embed] }); + const stringText = + event.string.text.length < 200 ? event.string.text : event.string.text.substring(0, 200) + "..."; + const embed = { + title: "Source string added", + description: `File: ${event.string.file.path}\nKey: ${event.string.key}\n\n[Go to project](${event.string.url})`, + fields: [{ name: "Text", value: stringText }], + color: EMBED_COLOR, + footer: footerFromUser(event.user), + author: authorFromProject(event.string.project), + }; + await sendToDiscord(webhookPath, { embeds: [embed] }); } async function handleStringUpdated(webhookPath: string, event: CrowdinSourceStringUpdatedEvent) { - const stringText = event.string.text.length < 200 ? event.string.text : event.string.text.substring(0, 200) + "..."; - const embed = { - title: "Source string updated", - description: `File: ${event.string.file.path}\nKey: ${event.string.key}\n\n[Go to project](${event.string.url})`, - fields: [ - { name: "Text", value: stringText }, - ], - color: EMBED_COLOR, - footer: footerFromUser(event.user), - author: authorFromProject(event.string.project), - }; - await sendToDiscord(webhookPath, { embeds: [embed] }); + const stringText = + event.string.text.length < 200 ? event.string.text : event.string.text.substring(0, 200) + "..."; + const embed = { + title: "Source string updated", + description: `File: ${event.string.file.path}\nKey: ${event.string.key}\n\n[Go to project](${event.string.url})`, + fields: [{ name: "Text", value: stringText }], + color: EMBED_COLOR, + footer: footerFromUser(event.user), + author: authorFromProject(event.string.project), + }; + await sendToDiscord(webhookPath, { embeds: [embed] }); } async function handleStringDeleted(webhookPath: string, event: CrowdinSourceStringDeletedEvent) { - const stringText = event.string.text.length < 200 ? event.string.text : event.string.text.substring(0, 200) + "..."; - const embed = { - title: "Source string deleted", - description: `File: ${event.string.file.path}\nKey: ${event.string.key}\n\n[Go to project](${event.string.url})`, - fields: [ - { name: "Text", value: stringText }, - ], - color: EMBED_COLOR, - footer: footerFromUser(event.user), - author: authorFromProject(event.string.project), - }; - await sendToDiscord(webhookPath, { embeds: [embed] }); + const stringText = + event.string.text.length < 200 ? event.string.text : event.string.text.substring(0, 200) + "..."; + const embed = { + title: "Source string deleted", + description: `File: ${event.string.file.path}\nKey: ${event.string.key}\n\n[Go to project](${event.string.url})`, + fields: [{ name: "Text", value: stringText }], + color: EMBED_COLOR, + footer: footerFromUser(event.user), + author: authorFromProject(event.string.project), + }; + await sendToDiscord(webhookPath, { embeds: [embed] }); } - diff --git a/src/modules/crowdin/router.ts b/src/modules/crowdin/router.ts index 7a6ea14..a2af9e3 100644 --- a/src/modules/crowdin/router.ts +++ b/src/modules/crowdin/router.ts @@ -6,4 +6,4 @@ const router = express.Router(); router.post("/webhook/:webhook_id/:webhook_token", postWebhookNotification); -export default router; \ No newline at end of file +export default router; diff --git a/src/modules/crowdin/types/commons.d.ts b/src/modules/crowdin/types/commons.d.ts index 97cd751..786ebd1 100644 --- a/src/modules/crowdin/types/commons.d.ts +++ b/src/modules/crowdin/types/commons.d.ts @@ -1,58 +1,58 @@ export interface CrowdinProject { - id: string; - userId: string; - sourceLanguageId: string; - targetLanguageIds: string[]; - identifier: string; - name: string; - createdAt: Date; - updatedAt: Date; - lastActivity: Date; - description: string; - url: string; - cname: null; - languageAccessPolicy: string; - visibility: string; - publicDownloads: boolean; + id: string; + userId: string; + sourceLanguageId: string; + targetLanguageIds: string[]; + identifier: string; + name: string; + createdAt: Date; + updatedAt: Date; + lastActivity: Date; + description: string; + url: string; + cname: null; + languageAccessPolicy: string; + visibility: string; + publicDownloads: boolean; } export interface CrowdinFile { - id: string; - name: string; - title: string; - type: string; - path: string; - status: string; - revision: string; - branchId: string; - directoryId: string; - project: Project + id: string; + name: string; + title: string; + type: string; + path: string; + status: string; + revision: string; + branchId: string; + directoryId: string; + project: Project; } export interface CrowdinUser { - id: string; - username: string; - fullName: string; - avatarUrl: string; + id: string; + username: string; + fullName: string; + avatarUrl: string; } export interface CrowdinString { - id: string; - identifier: string; - key: string; - text: string; - type: string; - context: string; - maxLength: string; - isHidden: boolean; - isDuplicate: boolean; - masterStringId: string; - revision: string; - hasPlurals: boolean; - labelIds: int[]; - url: string; - createdAt: Date; - updatedAt: Date; - file: CrowdinFile; - project: Project; + id: string; + identifier: string; + key: string; + text: string; + type: string; + context: string; + maxLength: string; + isHidden: boolean; + isDuplicate: boolean; + masterStringId: string; + revision: string; + hasPlurals: boolean; + labelIds: int[]; + url: string; + createdAt: Date; + updatedAt: Date; + file: CrowdinFile; + project: Project; } diff --git a/src/modules/crowdin/types/events.d.ts b/src/modules/crowdin/types/events.d.ts index ec07db5..00622d2 100644 --- a/src/modules/crowdin/types/events.d.ts +++ b/src/modules/crowdin/types/events.d.ts @@ -1,49 +1,49 @@ import { CrowdinFile, CrowdinString, CrowdinUser } from "./commons"; export interface CrowdinFileAddedEvent { - event: "file.added"; - file: CrowdinFile; - user: CrowdinUser; + event: "file.added"; + file: CrowdinFile; + user: CrowdinUser; } export interface CrowdinFileFullyTranslatedEvent { - event: "file.translated"; - file: CrowdinFile; - targetLanguage: { - id: string; - name: string; - editorCode: string; - twoLettersCode: string; - threeLettersCode: string; - locale: string; - androidCode: string; - osxCode: string; - osxLocale: string; - textDirection: string; - dialectOf: null; - } + event: "file.translated"; + file: CrowdinFile; + targetLanguage: { + id: string; + name: string; + editorCode: string; + twoLettersCode: string; + threeLettersCode: string; + locale: string; + androidCode: string; + osxCode: string; + osxLocale: string; + textDirection: string; + dialectOf: null; + }; } export interface CrowdinFileUpdatedEvent { - event: "file.updated"; - file: CrowdinFile; - user: CrowdinUser; + event: "file.updated"; + file: CrowdinFile; + user: CrowdinUser; } export interface CrowdinSourceStringAddedEvent { - event: "string.added"; - string: CrowdinString; - user: CrowdinUser; + event: "string.added"; + string: CrowdinString; + user: CrowdinUser; } export interface CrowdinSourceStringUpdatedEvent { - event: "string.updated"; - string: CrowdinString; - user: CrowdinUser; + event: "string.updated"; + string: CrowdinString; + user: CrowdinUser; } export interface CrowdinSourceStringDeletedEvent { - event: "string.deleted"; - string: CrowdinString; - user: CrowdinUser; -} \ No newline at end of file + event: "string.deleted"; + string: CrowdinString; + user: CrowdinUser; +} diff --git a/src/modules/crowdin/types/index.ts b/src/modules/crowdin/types/index.ts index d3fb33c..9e4978a 100644 --- a/src/modules/crowdin/types/index.ts +++ b/src/modules/crowdin/types/index.ts @@ -1,19 +1,32 @@ -import { CrowdinFileAddedEvent, CrowdinFileFullyTranslatedEvent, CrowdinFileUpdatedEvent, CrowdinSourceStringAddedEvent, CrowdinSourceStringDeletedEvent, CrowdinSourceStringUpdatedEvent } from "./events"; +import { + CrowdinFileAddedEvent, + CrowdinFileFullyTranslatedEvent, + CrowdinFileUpdatedEvent, + CrowdinSourceStringAddedEvent, + CrowdinSourceStringDeletedEvent, + CrowdinSourceStringUpdatedEvent, +} from "./events"; -export type CrowdinFileEvent = CrowdinFileAddedEvent | CrowdinFileFullyTranslatedEvent | CrowdinFileUpdatedEvent; +export type CrowdinFileEvent = + | CrowdinFileAddedEvent + | CrowdinFileFullyTranslatedEvent + | CrowdinFileUpdatedEvent; -export type CrowdinStringEvent = CrowdinSourceStringAddedEvent | CrowdinSourceStringUpdatedEvent | CrowdinSourceStringDeletedEvent; +export type CrowdinStringEvent = + | CrowdinSourceStringAddedEvent + | CrowdinSourceStringUpdatedEvent + | CrowdinSourceStringDeletedEvent; export type AnyCrowdinEvent = CrowdinFileEvent | CrowdinStringEvent; export interface CrowdinBatchEvents { - events: AnyCrowdinEvent[]; + events: AnyCrowdinEvent[]; } export function isFileEvent(object: AnyCrowdinEvent): object is CrowdinFileEvent { - return object.event.startsWith("file."); + return object.event.startsWith("file."); } export function isStringEvent(object: AnyCrowdinEvent): object is CrowdinStringEvent { - return object.event.startsWith("string."); + return object.event.startsWith("string."); } diff --git a/src/modules/crowdin/utils.ts b/src/modules/crowdin/utils.ts index ffd8539..59ceab9 100644 --- a/src/modules/crowdin/utils.ts +++ b/src/modules/crowdin/utils.ts @@ -7,11 +7,10 @@ import { CrowdinProject, CrowdinUser } from "./types/commons"; * @returns The embed footer object */ export function footerFromUser(user: CrowdinUser) { - return { - text: `Pushed by ${user.username}`, - // eslint-disable-next-line camelcase - icon_url: user.avatarUrl, - }; + return { + text: `Pushed by ${user.username}`, + icon_url: user.avatarUrl, + }; } /** @@ -20,10 +19,10 @@ export function footerFromUser(user: CrowdinUser) { * @returns The embed author object */ export function authorFromProject(project: CrowdinProject) { - return { - name: project.name, - url: project.url, - }; + return { + name: project.name, + url: project.url, + }; } /** @@ -33,14 +32,14 @@ export function authorFromProject(project: CrowdinProject) { * @returns The webhook response */ export function sendToDiscord(webhookPath: string, data: DiscordMessage) { - if (!/^\d+\/\w+$/.test(webhookPath)) { - return Promise.reject(new Error("Invalid webhook path")); - } - return fetch(`https://discord.com/api/webhooks/${webhookPath}`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(data), - }); + if (!/^\d+\/\w+$/.test(webhookPath)) { + return Promise.reject(new Error("Invalid webhook path")); + } + return fetch(`https://discord.com/api/webhooks/${webhookPath}`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + }); } diff --git a/src/modules/discord/controler.ts b/src/modules/discord/controler.ts index d231e06..2d9393b 100644 --- a/src/modules/discord/controler.ts +++ b/src/modules/discord/controler.ts @@ -7,15 +7,21 @@ import { equals, is } from "typia"; import DiscordClient from "../../bot/client"; import Database from "../../database/db"; import GuildConfigManager from "../../database/guild-config/guild-config-manager"; -import { GuildConfigOptionCategory, GuildConfigOptionCategoryNames } from "../../database/guild-config/guild-config-types"; +import { + GuildConfigOptionCategory, + GuildConfigOptionCategoryNames, +} from "../../database/guild-config/guild-config-types"; import { EditionLogType } from "../../database/models/misc-db-types"; import { DBRssFeed } from "../../database/models/rss"; import { LeaderboardPlayer } from "../../database/models/xp"; import RssExternalApisManager from "../../rss/rss-external-apis-manager"; import setCacheControl from "../../utils/cache_control"; import { LeaderboardImportUserData, RoleRewardsPUTData, RssFeedPUTData } from "./types/guilds"; -import { checkUserAuthentificationAndPermission, getGuildInfo, transformLeaderboard } from "./utils/leaderboard"; - +import { + checkUserAuthentificationAndPermission, + getGuildInfo, + transformLeaderboard, +} from "./utils/leaderboard"; const db = Database.getInstance(); const discordClient = DiscordClient.getInstance(); @@ -23,716 +29,762 @@ const configManager = GuildConfigManager.getInstance(); const rssExternalApisManager = RssExternalApisManager.getInstance(); function parseCategoriesParameter(category: unknown) { - if (category === "all") { - return "all"; - } - if (typeof category !== "string") { - return null; - } - const splitted = category.split(","); - if (!is(splitted)) { - return null; - } - return splitted; + if (category === "all") { + return "all"; + } + if (typeof category !== "string") { + return null; + } + const splitted = category.split(","); + if (!is(splitted)) { + return null; + } + return splitted; } export async function getDefaultGuildConfigOptions(req: Request, res: Response) { - const optionsList = await discordClient.getDefaultGuildConfig(); - res.send(optionsList); + const optionsList = await discordClient.getDefaultGuildConfig(); + res.send(optionsList); } export async function getGuildConfig(req: Request, res: Response) { - const categoriesQuery = parseCategoriesParameter(req.query.categories); - if (categoriesQuery === null) { - res.status(400).send("Invalid category"); - return; - } - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const categories = ( - categoriesQuery === "all" - ? GuildConfigOptionCategoryNames - : categoriesQuery - ); - const config = await configManager.getGuildCategoriesConfigOptions(guildId, categories); - res.send(config); + const categoriesQuery = parseCategoriesParameter(req.query.categories); + if (categoriesQuery === null) { + res.status(400).send("Invalid category"); + return; + } + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const categories = categoriesQuery === "all" ? GuildConfigOptionCategoryNames : categoriesQuery; + const config = await configManager.getGuildCategoriesConfigOptions(guildId, categories); + res.send(config); } export async function getGuildConfigEditionLogs(req: Request, res: Response) { - const page = parseInt(req.query.page as string) || 0; - const limit = parseInt(req.query.limit as string) || 100; - if (page < 0 || limit < 0 || limit > 500) { - res.status(400).send("Invalid page or limit"); - return; - } - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const editionLogs = await Promise.all( - (await db.getGuildConfigEditionLogs(guildId, page, limit)).map(async (log) => { - const user = await discordClient.getRawUserData(log.user_id.toString()); - return { - ...log, - data: JSON.parse(log.data), - "username": user?.global_name ?? user?.username ?? null, - "avatar": discordClient.getAvatarUrlFromHash(user?.avatar_hash ?? null, log.user_id), - }; - }) - ); - res.json(editionLogs); + const page = parseInt(req.query.page as string) || 0; + const limit = parseInt(req.query.limit as string) || 100; + if (page < 0 || limit < 0 || limit > 500) { + res.status(400).send("Invalid page or limit"); + return; + } + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const editionLogs = await Promise.all( + (await db.getGuildConfigEditionLogs(guildId, page, limit)).map(async (log) => { + const user = await discordClient.getRawUserData(log.user_id.toString()); + return { + ...log, + data: JSON.parse(log.data), + username: user?.global_name ?? user?.username ?? null, + avatar: discordClient.getAvatarUrlFromHash(user?.avatar_hash ?? null, log.user_id), + }; + }), + ); + res.json(editionLogs); } export async function getGuildRoleRewards(req: Request, res: Response) { - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const roleRewards = await db.getGuildRoleRewards(guildId); - res.json(roleRewards); + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const roleRewards = await db.getGuildRoleRewards(guildId); + res.json(roleRewards); } export async function getGlobalLeaderboard(req: Request, res: Response, next: NextFunction) { - const page = parseInt(req.query.page as string) || 0; - const limit = parseInt(req.query.limit as string) || 50; - if (page < 0 || limit < 0 || limit > 100) { - res.status(400).send("Invalid page or limit"); - return; - } - let players, playersCount; - try { - const leaderboard = await db.getGlobalLeaderboard(page, limit); - players = await transformLeaderboard(leaderboard, page * limit, false); - playersCount = await db.getGlobalLeaderboardCount(); - } catch (e) { - next(e); - return; - } - res.send({ - "guild": null, - "players": players, - "players_count": playersCount, - "xp_type": "global", - "xp_rate": 1.0, - "xp_decay": 0, - }); + const page = parseInt(req.query.page as string) || 0; + const limit = parseInt(req.query.limit as string) || 50; + if (page < 0 || limit < 0 || limit > 100) { + res.status(400).send("Invalid page or limit"); + return; + } + let players, playersCount; + try { + const leaderboard = await db.getGlobalLeaderboard(page, limit); + players = await transformLeaderboard(leaderboard, page * limit, false); + playersCount = await db.getGlobalLeaderboardCount(); + } catch (e) { + next(e); + return; + } + res.send({ + guild: null, + players: players, + players_count: playersCount, + xp_type: "global", + xp_rate: 1.0, + xp_decay: 0, + }); } -export async function getGuildLeaderboard(req: Request, res: Response, next: NextFunction) { - const page = parseInt(req.query.page as string) || 0; - const limit = parseInt(req.query.limit as string) || 50; - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const guild = await discordClient.resolveGuild(guildId.toString()); - if (guild === null) { - res._err = "Guild not found"; - res.status(404).send(res._err); - return; - } - const isXpEnabled = await configManager.getGuildConfigOptionValue(guildId, "enable_xp"); - if (!isXpEnabled) { - res.status(400).send("XP is not enabled for this guild"); - return; - } - const isPrivateLeaderboard = await configManager.getGuildConfigOptionValue(guildId, "private_leaderboard"); - if (isPrivateLeaderboard && !(await checkUserAuthentificationAndPermission(req, res))) { - return; - } - const xpType = await configManager.getGuildConfigOptionValue(guildId, "xp_type") as string; - let players, playersCount; - try { - if (xpType === "global") { - const stringMemberIds = await discordClient.getGuildMemberIds(guildId.toString()); - if (stringMemberIds === null) { - res.status(500).send("Failed to get guild members"); - return; - } - const memberIds = stringMemberIds.map((id) => BigInt(id)); - const leaderboard = await db.getFilteredGlobalLeaderboard(memberIds, page, limit); - players = await transformLeaderboard(leaderboard, page * limit, false); - playersCount = await db.getFilteredGlobalLeaderboardCount(memberIds); - } else { - const leaderboard = await db.getGuildLeaderboard(guildId, page, limit); - players = await transformLeaderboard(leaderboard, page * limit, xpType === "mee6-like"); - playersCount = await db.getGuildLeaderboardCount(guildId); - } - } catch (e) { - next(e); - return; - } - const guildData = await getGuildInfo(guild); - const xpRate = xpType === "global" ? 1.0 : await configManager.getGuildConfigOptionValue(guildId, "xp_rate") as number; - const xpDecay = xpType === "global" ? 0 : await configManager.getGuildConfigOptionValue(guildId, "xp_decay") as number; - const roleRewards = await discordClient.getGuildRoleRewards(guildId); - res.send({ - "guild": guildData, - "players": players, - "players_count": playersCount, - "xp_type": xpType, - "xp_rate": xpRate, - "xp_decay": xpDecay, - "role_rewards": roleRewards, - }); +export async function getGuildLeaderboard( + req: Request, + res: Response, + next: NextFunction, +) { + const page = parseInt(req.query.page as string) || 0; + const limit = parseInt(req.query.limit as string) || 50; + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const guild = await discordClient.resolveGuild(guildId.toString()); + if (guild === null) { + res._err = "Guild not found"; + res.status(404).send(res._err); + return; + } + const isXpEnabled = await configManager.getGuildConfigOptionValue(guildId, "enable_xp"); + if (!isXpEnabled) { + res.status(400).send("XP is not enabled for this guild"); + return; + } + const isPrivateLeaderboard = await configManager.getGuildConfigOptionValue(guildId, "private_leaderboard"); + if (isPrivateLeaderboard && !(await checkUserAuthentificationAndPermission(req, res))) { + return; + } + const xpType = (await configManager.getGuildConfigOptionValue(guildId, "xp_type")) as string; + let players, playersCount; + try { + if (xpType === "global") { + const stringMemberIds = await discordClient.getGuildMemberIds(guildId.toString()); + if (stringMemberIds === null) { + res.status(500).send("Failed to get guild members"); + return; + } + const memberIds = stringMemberIds.map((id) => BigInt(id)); + const leaderboard = await db.getFilteredGlobalLeaderboard(memberIds, page, limit); + players = await transformLeaderboard(leaderboard, page * limit, false); + playersCount = await db.getFilteredGlobalLeaderboardCount(memberIds); + } else { + const leaderboard = await db.getGuildLeaderboard(guildId, page, limit); + players = await transformLeaderboard(leaderboard, page * limit, xpType === "mee6-like"); + playersCount = await db.getGuildLeaderboardCount(guildId); + } + } catch (e) { + next(e); + return; + } + const guildData = await getGuildInfo(guild); + const xpRate = + xpType === "global" + ? 1.0 + : ((await configManager.getGuildConfigOptionValue(guildId, "xp_rate")) as number); + const xpDecay = + xpType === "global" + ? 0 + : ((await configManager.getGuildConfigOptionValue(guildId, "xp_decay")) as number); + const roleRewards = await discordClient.getGuildRoleRewards(guildId); + res.send({ + guild: guildData, + players: players, + players_count: playersCount, + xp_type: xpType, + xp_rate: xpRate, + xp_decay: xpDecay, + role_rewards: roleRewards, + }); } -export async function getGuildLeaderboardAsJson(req: Request, res: Response, next: NextFunction) { - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const guild = await discordClient.resolveGuild(guildId.toString()); - if (guild === null) { - res._err = "Guild not found"; - res.status(404).send(res._err); - return; - } - const isXpEnabled = await configManager.getGuildConfigOptionValue(guildId, "enable_xp"); - if (!isXpEnabled) { - res.status(400).send("XP is not enabled for this guild"); - return; - } - const isPrivateLeaderboard = await configManager.getGuildConfigOptionValue(guildId, "private_leaderboard"); - if (isPrivateLeaderboard && !(await checkUserAuthentificationAndPermission(req, res))) { - return; - } - const xpType = await configManager.getGuildConfigOptionValue(guildId, "xp_type") as string; - let leaderboard: LeaderboardPlayer[]; - try { - if (xpType === "global") { - const stringMemberIds = await discordClient.getGuildMemberIds(guildId.toString()); - if (stringMemberIds === null) { - res.status(500).send("Failed to get guild members"); - return; - } - const memberIds = stringMemberIds.map((id) => BigInt(id)); - leaderboard = await db.getFilteredGlobalLeaderboard(memberIds); - } else { - leaderboard = await db.getGuildLeaderboard(guildId); - } - } catch (e) { - next(e); - return; - } - const parsedLeaderboard = leaderboard.map(player => ({ - "user_id": player.userID.toString(), - xp: player.xp, - })); - res.send(parsedLeaderboard); +export async function getGuildLeaderboardAsJson( + req: Request, + res: Response, + next: NextFunction, +) { + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const guild = await discordClient.resolveGuild(guildId.toString()); + if (guild === null) { + res._err = "Guild not found"; + res.status(404).send(res._err); + return; + } + const isXpEnabled = await configManager.getGuildConfigOptionValue(guildId, "enable_xp"); + if (!isXpEnabled) { + res.status(400).send("XP is not enabled for this guild"); + return; + } + const isPrivateLeaderboard = await configManager.getGuildConfigOptionValue(guildId, "private_leaderboard"); + if (isPrivateLeaderboard && !(await checkUserAuthentificationAndPermission(req, res))) { + return; + } + const xpType = (await configManager.getGuildConfigOptionValue(guildId, "xp_type")) as string; + let leaderboard: LeaderboardPlayer[]; + try { + if (xpType === "global") { + const stringMemberIds = await discordClient.getGuildMemberIds(guildId.toString()); + if (stringMemberIds === null) { + res.status(500).send("Failed to get guild members"); + return; + } + const memberIds = stringMemberIds.map((id) => BigInt(id)); + leaderboard = await db.getFilteredGlobalLeaderboard(memberIds); + } else { + leaderboard = await db.getGuildLeaderboard(guildId); + } + } catch (e) { + next(e); + return; + } + const parsedLeaderboard = leaderboard.map((player) => ({ + user_id: player.userID.toString(), + xp: player.xp, + })); + res.send(parsedLeaderboard); } export async function getBotChangelog(req: Request, res: Response) { - if (!is<"en" | "fr">(req.query.language)) { - res.status(400).send("Invalid language"); - return; - } - const changelog = await db.getBotChangelog(); - setCacheControl(res, 86400); - res.send( - changelog.map((entry) => ({ - "version": entry.version, - "release_date": entry.release_date, - "content": entry[req.query.language as "en" | "fr"], - })) - ); + if (!is<"en" | "fr">(req.query.language)) { + res.status(400).send("Invalid language"); + return; + } + const changelog = await db.getBotChangelog(); + setCacheControl(res, 86400); + res.send( + changelog.map((entry) => ({ + version: entry.version, + release_date: entry.release_date, + content: entry[req.query.language as "en" | "fr"], + })), + ); } export async function getBotInfo(req: Request, res: Response) { - const guildCount = await discordClient.getGuildCount(); - const flooringIndex = guildCount < 50 ? 1 : (guildCount < 1000 ? 10 : 50); - const data = { - "approximate_guild_count": Math.floor(guildCount / flooringIndex) * flooringIndex, - }; - setCacheControl(res, 86400); - res.send(data); + const guildCount = await discordClient.getGuildCount(); + const flooringIndex = guildCount < 50 ? 1 : guildCount < 1000 ? 10 : 50; + const data = { + approximate_guild_count: Math.floor(guildCount / flooringIndex) * flooringIndex, + }; + setCacheControl(res, 86400); + res.send(data); } export async function getUserGuilds(req: Request, res: Response) { - if (!res.locals.user?.discord_token) { - res.status(401).send("Invalid token"); - return; - } - const userGuilds = await discordClient.getGuildsFromOauth(res.locals.user.discord_token); + if (!res.locals.user?.discord_token) { + res.status(401).send("Invalid token"); + return; + } + const userGuilds = await discordClient.getGuildsFromOauth(res.locals.user.discord_token); - if (userGuilds === 401) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return; - } + if (userGuilds === 401) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return; + } - if (userGuilds === null) { - res._err = "Unable to get user guilds"; - res.status(500).send(res._err); - return; - } + if (userGuilds === null) { + res._err = "Unable to get user guilds"; + res.status(500).send(res._err); + return; + } - res.send(userGuilds); + res.send(userGuilds); } export async function getBasicGuildInfo(req: Request, res: Response) { - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const guild = await discordClient.resolveGuild(guildId.toString()); - if (guild === null) { - res._err = "Guild not found"; - res.status(404).send(res._err); - return; - } - res.json(await discordClient.getBasicGuildInfo({ baseGuild: guild, userId: res.locals.user!.user_id.toString() })); + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const guild = await discordClient.resolveGuild(guildId.toString()); + if (guild === null) { + res._err = "Guild not found"; + res.status(404).send(res._err); + return; + } + res.json( + await discordClient.getBasicGuildInfo({ baseGuild: guild, userId: res.locals.user!.user_id.toString() }), + ); } export async function getGuildRoles(req: Request, res: Response) { - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const guild = await discordClient.resolveGuild(guildId.toString()); - if (guild === null) { - res._err = "Guild not found"; - res.status(404).send(res._err); - return; - } - if (guild.roles.cache.size === 0) { - await guild.roles.fetch(); - } - const roles = guild.roles.cache.map((role) => ({ - "id": role.id, - "name": role.name, - "color": role.color, - "position": role.position, - "permissions": role.permissions.bitfield, - "managed": role.managed, - })).sort((a, b) => a.position - b.position); - res.json(roles); + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const guild = await discordClient.resolveGuild(guildId.toString()); + if (guild === null) { + res._err = "Guild not found"; + res.status(404).send(res._err); + return; + } + if (guild.roles.cache.size === 0) { + await guild.roles.fetch(); + } + const roles = guild.roles.cache + .map((role) => ({ + id: role.id, + name: role.name, + color: role.color, + position: role.position, + permissions: role.permissions.bitfield, + managed: role.managed, + })) + .sort((a, b) => a.position - b.position); + res.json(roles); } export async function getGuildChannels(req: Request, res: Response) { - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const guild = await discordClient.resolveGuild(guildId.toString()); - if (guild === null) { - res._err = "Guild not found"; - res.status(404).send(res._err); - return; - } - if (guild.channels.cache.size === 0) { - await guild.channels.fetch(); - } - const channelsList = Array.from(guild.channels.cache.values()); - const channelIds = new Set(channelsList.map((channel) => channel.id)); - const threadsList = Array.from((await guild.channels.fetchActiveThreads()).threads.values()).filter((thread) => !channelIds.has(thread.id)); + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const guild = await discordClient.resolveGuild(guildId.toString()); + if (guild === null) { + res._err = "Guild not found"; + res.status(404).send(res._err); + return; + } + if (guild.channels.cache.size === 0) { + await guild.channels.fetch(); + } + const channelsList = Array.from(guild.channels.cache.values()); + const channelIds = new Set(channelsList.map((channel) => channel.id)); + const threadsList = Array.from((await guild.channels.fetchActiveThreads()).threads.values()).filter( + (thread) => !channelIds.has(thread.id), + ); - function createPositionId(channel: GuildBasedChannel): number { - if (channel.type === ChannelType.GuildCategory) { - return (channel.position + 1) * 100000; - } - const parentPosition = channel.parent ? createPositionId(channel.parent) : 0; - let channelPosition: number; - if (channel.isThread()) { - channelPosition = 1; - } else if (channel.isVoiceBased()) { - channelPosition = (1000 + (channel.position + 1)) * 10; - } else { - channelPosition = (channel.position + 1) * 10; - } - return parentPosition + channelPosition; - } + function createPositionId(channel: GuildBasedChannel): number { + if (channel.type === ChannelType.GuildCategory) { + return (channel.position + 1) * 100000; + } + const parentPosition = channel.parent ? createPositionId(channel.parent) : 0; + let channelPosition: number; + if (channel.isThread()) { + channelPosition = 1; + } else if (channel.isVoiceBased()) { + channelPosition = (1000 + (channel.position + 1)) * 10; + } else { + channelPosition = (channel.position + 1) * 10; + } + return parentPosition + channelPosition; + } - const channels = [...channelsList, ...threadsList].map((channel) => ({ - "id": channel.id, - "name": channel.name, - "type": channel.type, - "isText": channel.isTextBased(), - "isVoice": channel.isVoiceBased(), - "isThread": channel.isThread(), - "isNSFW": "nsfw" in channel ? channel.nsfw : channel.parent?.nsfw ?? false, - "position": "position" in channel ? channel.position : null, - "parentId": "parentId" in channel ? channel.parentId : null, - "positionId": createPositionId(channel), + const channels = [...channelsList, ...threadsList] + .map((channel) => ({ + id: channel.id, + name: channel.name, + type: channel.type, + isText: channel.isTextBased(), + isVoice: channel.isVoiceBased(), + isThread: channel.isThread(), + isNSFW: "nsfw" in channel ? channel.nsfw : (channel.parent?.nsfw ?? false), + position: "position" in channel ? channel.position : null, + parentId: "parentId" in channel ? channel.parentId : null, + positionId: createPositionId(channel), })) - .sort((a, b) => a.positionId - b.positionId) - .map((channel) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { positionId, ...cleanObject } = channel; - return cleanObject; - }); - res.json(channels); + .sort((a, b) => a.positionId - b.positionId) + .map((channel) => { + const { positionId, ...cleanObject } = channel; + return cleanObject; + }); + res.json(channels); } - -export async function putGuildLeaderboard(req: Request, res: Response, next: NextFunction) { - // check guild ID validity - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const guild = await discordClient.resolveGuild(guildId.toString()); - if (guild === null) { - res._err = "Guild not found"; - res.status(404).send(res._err); - return; - } - // check user ID validity - if (res.locals.user === undefined) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return; - } - // check xp configuration in guild - const isXpEnabled = await configManager.getGuildConfigOptionValue(guildId, "enable_xp"); - if (!isXpEnabled) { - res._err = "XP is not enabled for this guild"; - res.status(400).send(res._err); - return; - } - const xpType = await configManager.getGuildConfigOptionValue(guildId, "xp_type") as string; - if (xpType === "global") { - res._err = "Cannot edit global leaderboard"; - res.status(400).send(res._err); - return; - } - // check data validity - const data = req.body; - if (!is(data) || data.length === 0) { - res._err = "Invalid data"; - res.status(400).send(res._err); - return; - } - // remove previous leaderboard - try { - await db.deleteGuildLeaderboard(guildId); - } catch (err) { - if (!(err instanceof SqlError) || err.code !== "ER_NO_SUCH_TABLE") { - next(err); - return; - } - await db.createGuildLeaderboard(guildId); - } - // store new leaderboard - const leaderboardData = data.map((entry) => ({ userID: BigInt(entry.user_id), xp: entry.xp })); - await db.setGuildLeaderboard(guildId, leaderboardData); - // send success code - await db.addConfigEditionLog(guildId, res.locals.user.user_id, EditionLogType.LEADERBOARD_PUT, null); - console.log(`Leaderboard for guild ${guildId} has been edited by ${res.locals.user.user_id}`); - res.sendStatus(204); +export async function putGuildLeaderboard( + req: Request, + res: Response, + next: NextFunction, +) { + // check guild ID validity + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const guild = await discordClient.resolveGuild(guildId.toString()); + if (guild === null) { + res._err = "Guild not found"; + res.status(404).send(res._err); + return; + } + // check user ID validity + if (res.locals.user === undefined) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return; + } + // check xp configuration in guild + const isXpEnabled = await configManager.getGuildConfigOptionValue(guildId, "enable_xp"); + if (!isXpEnabled) { + res._err = "XP is not enabled for this guild"; + res.status(400).send(res._err); + return; + } + const xpType = (await configManager.getGuildConfigOptionValue(guildId, "xp_type")) as string; + if (xpType === "global") { + res._err = "Cannot edit global leaderboard"; + res.status(400).send(res._err); + return; + } + // check data validity + const data = req.body; + if (!is(data) || data.length === 0) { + res._err = "Invalid data"; + res.status(400).send(res._err); + return; + } + // remove previous leaderboard + try { + await db.deleteGuildLeaderboard(guildId); + } catch (err) { + if (!(err instanceof SqlError) || err.code !== "ER_NO_SUCH_TABLE") { + next(err); + return; + } + await db.createGuildLeaderboard(guildId); + } + // store new leaderboard + const leaderboardData = data.map((entry) => ({ userID: BigInt(entry.user_id), xp: entry.xp })); + await db.setGuildLeaderboard(guildId, leaderboardData); + // send success code + await db.addConfigEditionLog(guildId, res.locals.user.user_id, EditionLogType.LEADERBOARD_PUT, null); + console.log(`Leaderboard for guild ${guildId} has been edited by ${res.locals.user.user_id}`); + res.sendStatus(204); } export async function putRoleRewards(req: Request, res: Response) { - // check user and guild ID validity - if (res.locals.user === undefined) { - res.status(401).send("Invalid token"); - return; - } - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const guild = await discordClient.resolveGuild(guildId.toString()); - if (guild === null) { - res._err = "Guild not found"; - res.status(404).send(res._err); - return; - } - // check data validity - const data = req.body; - if (!Array.isArray(data) || !is(data)) { - res._err = "Invalid data"; - res.status(400).send(res._err); - return; - } - const parsedData = data.map(row => ({ ...row, roleId: BigInt(row.roleId), level: BigInt(row.level) })); - // check for max rewards limit - const rewardsLimit = await configManager.getGuildConfigOptionValue(guildId, "rr_max_number") as number; - if (data.length > rewardsLimit) { - res._err = `Too many role-rewards, max is ${rewardsLimit}`; - res.status(400).send(res._err); - return; - } - // remove previous rewards - const previousRewards = await db.getGuildRoleRewards(guildId); - const rewardsToRemove = previousRewards.filter( - (reward) => !parsedData.some((newReward) => reward.level === newReward.level && reward.roleId === newReward.roleId) - ).map(reward => reward.id); - const rewardsToAdd = parsedData.filter( - (newReward) => !previousRewards.some((reward) => reward.level === newReward.level && reward.roleId === newReward.roleId) - ); - // remove outdated rewards - if (rewardsToRemove.length > 0) { - await db.removeGuildRoleRewards(guildId, rewardsToRemove); - } - // add new rewards - if (rewardsToAdd.length > 0) { - await db.setGuildRoleRewards(guildId, rewardsToAdd); - } - await db.addConfigEditionLog(guildId, res.locals.user.user_id, EditionLogType.ROLE_REWARDS_PUT, { newRewards: parsedData }); - console.log(`Role-rewards for guild ${guildId} has been edited by ${res.locals.user.user_id}`); - const newRewards = await db.getGuildRoleRewards(guildId); - res.send(newRewards); + // check user and guild ID validity + if (res.locals.user === undefined) { + res.status(401).send("Invalid token"); + return; + } + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const guild = await discordClient.resolveGuild(guildId.toString()); + if (guild === null) { + res._err = "Guild not found"; + res.status(404).send(res._err); + return; + } + // check data validity + const data = req.body; + if (!Array.isArray(data) || !is(data)) { + res._err = "Invalid data"; + res.status(400).send(res._err); + return; + } + const parsedData = data.map((row) => ({ ...row, roleId: BigInt(row.roleId), level: BigInt(row.level) })); + // check for max rewards limit + const rewardsLimit = (await configManager.getGuildConfigOptionValue(guildId, "rr_max_number")) as number; + if (data.length > rewardsLimit) { + res._err = `Too many role-rewards, max is ${rewardsLimit}`; + res.status(400).send(res._err); + return; + } + // remove previous rewards + const previousRewards = await db.getGuildRoleRewards(guildId); + const rewardsToRemove = previousRewards + .filter( + (reward) => + !parsedData.some( + (newReward) => reward.level === newReward.level && reward.roleId === newReward.roleId, + ), + ) + .map((reward) => reward.id); + const rewardsToAdd = parsedData.filter( + (newReward) => + !previousRewards.some( + (reward) => reward.level === newReward.level && reward.roleId === newReward.roleId, + ), + ); + // remove outdated rewards + if (rewardsToRemove.length > 0) { + await db.removeGuildRoleRewards(guildId, rewardsToRemove); + } + // add new rewards + if (rewardsToAdd.length > 0) { + await db.setGuildRoleRewards(guildId, rewardsToAdd); + } + await db.addConfigEditionLog(guildId, res.locals.user.user_id, EditionLogType.ROLE_REWARDS_PUT, { + newRewards: parsedData, + }); + console.log(`Role-rewards for guild ${guildId} has been edited by ${res.locals.user.user_id}`); + const newRewards = await db.getGuildRoleRewards(guildId); + res.send(newRewards); } export async function editGuildConfig(req: Request, res: Response) { - // check user and guild ID validity - if (res.locals.user === undefined) { - res.status(401).send("Invalid token"); - return; - } - let guildId; + // check user and guild ID validity + if (res.locals.user === undefined) { + res.status(401).send("Invalid token"); + return; + } + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const guild = await discordClient.resolveGuild(guildId.toString()); + if (guild === null) { + res._err = "Guild not found"; + res.status(404).send(res._err); + return; + } + // check config validity + const config = req.body; + if (!is>(config) || Object.keys(config).length === 0) { + res._err = "Invalid config"; + res.status(400).send(res._err); + return; + } + const errors: string[] = []; + for (const [optionName, value] of Object.entries(config)) { + if (value === null) continue; try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const guild = await discordClient.resolveGuild(guildId.toString()); - if (guild === null) { - res._err = "Guild not found"; - res.status(404).send(res._err); - return; - } - // check config validity - const config = req.body; - if (!is>(config) || Object.keys(config).length === 0) { - res._err = "Invalid config"; - res.status(400).send(res._err); - return; - } - const errors: string[] = []; - for (const [optionName, value] of Object.entries(config)) { - if (value === null) continue; - try { - await configManager.assertValueValidity(optionName, guild, value); - } catch (err) { - errors.push(`${err}`); - } - } - if (errors.length > 0) { - res.status(400).send(errors); - return; - } - // store new config into database and log the config change - for (const [optionName, value] of Object.entries(config)) { - const rawValue = await configManager.convertFromType(optionName, value); - if (rawValue === null) { - await db.resetGuildConfigOptionValue(guildId, optionName); - await db.addConfigEditionLog(guildId, res.locals.user.user_id, EditionLogType.SCONFIG_OPTION_RESET, { option: optionName }); - } else { - await db.setGuildConfigOptionValue(guildId, optionName, rawValue); - await db.addConfigEditionLog(guildId, res.locals.user.user_id, EditionLogType.SCONFIG_OPTION_SET, { option: optionName, value: rawValue }); - } - } - // send updated config - const updatedConfig = await configManager.getGuildConfigOptions(guildId, Object.keys(config)); - res.send(updatedConfig); + await configManager.assertValueValidity(optionName, guild, value); + } catch (err) { + errors.push(`${err}`); + } + } + if (errors.length > 0) { + res.status(400).send(errors); + return; + } + // store new config into database and log the config change + for (const [optionName, value] of Object.entries(config)) { + const rawValue = await configManager.convertFromType(optionName, value); + if (rawValue === null) { + await db.resetGuildConfigOptionValue(guildId, optionName); + await db.addConfigEditionLog(guildId, res.locals.user.user_id, EditionLogType.SCONFIG_OPTION_RESET, { + option: optionName, + }); + } else { + await db.setGuildConfigOptionValue(guildId, optionName, rawValue); + await db.addConfigEditionLog(guildId, res.locals.user.user_id, EditionLogType.SCONFIG_OPTION_SET, { + option: optionName, + value: rawValue, + }); + } + } + // send updated config + const updatedConfig = await configManager.getGuildConfigOptions(guildId, Object.keys(config)); + res.send(updatedConfig); } export async function getGuildRssFeeds(req: Request, res: Response) { - let guildId; - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const rssFeeds = await Promise.all((await db.getGuildRssFeeds(guildId)).map(async (feed) => { - const displayName = await rssExternalApisManager.getRssFeedDisplayName(feed); - return { - ...feed, - "displayName": displayName, - }; - })); - res.json(rssFeeds); + let guildId; + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const rssFeeds = await Promise.all( + (await db.getGuildRssFeeds(guildId)).map(async (feed) => { + const displayName = await rssExternalApisManager.getRssFeedDisplayName(feed); + return { + ...feed, + displayName: displayName, + }; + }), + ); + res.json(rssFeeds); } -async function registerRssFeedsEdition(guildId: bigint, userId: bigint, eventType: EditionLogType.RSS_ADDED | EditionLogType.RSS_EDITED | EditionLogType.RSS_DELETED, feed: (DBRssFeed & {displayName?: string})) { - const feedIdsAndName = { - id: feed.id, - channelId: feed.channelId, - link: feed.link, - type: feed.type, - displayName: feed.displayName, - }; - await db.addConfigEditionLog(guildId, userId, eventType, { feed: feedIdsAndName }); +async function registerRssFeedsEdition( + guildId: bigint, + userId: bigint, + eventType: EditionLogType.RSS_ADDED | EditionLogType.RSS_EDITED | EditionLogType.RSS_DELETED, + feed: DBRssFeed & { displayName?: string }, +) { + const feedIdsAndName = { + id: feed.id, + channelId: feed.channelId, + link: feed.link, + type: feed.type, + displayName: feed.displayName, + }; + await db.addConfigEditionLog(guildId, userId, eventType, { feed: feedIdsAndName }); } export async function toggleRssFeed(req: Request, res: Response) { - let guildId, feedId; - // check guild ID validity - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - // check user ID validity - if (res.locals.user === undefined) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return; - } - // check feed ID type validity - try { - feedId = BigInt(req.params.feedId); - } catch (e) { - res._err = "Invalid feed ID"; - res.status(400).send(res._err); - return; - } - // check if feed actually exists - const currentFeed = await db.getGuildRssFeed(guildId, feedId); - if (!currentFeed || currentFeed.type === "tw") { - res._err = "Invalid feed ID"; - res.status(400).send(res._err); - return; - } - await db.toggleRssFeed(guildId, feedId); - const updatedFeed = await db.getGuildRssFeed(guildId, feedId); - if (updatedFeed === null) { - res._err = "Missing feed"; - res.status(500).send(res._err); - return; - } - const displayName = await rssExternalApisManager.getRssFeedDisplayName(updatedFeed); - const updatedFeedWithDisplayName = { ...updatedFeed, displayName }; - await registerRssFeedsEdition(guildId, res.locals.user.user_id, EditionLogType.RSS_EDITED, updatedFeedWithDisplayName); - res.json(updatedFeedWithDisplayName); + let guildId, feedId; + // check guild ID validity + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + // check user ID validity + if (res.locals.user === undefined) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return; + } + // check feed ID type validity + try { + feedId = BigInt(req.params.feedId); + } catch (e) { + res._err = "Invalid feed ID"; + res.status(400).send(res._err); + return; + } + // check if feed actually exists + const currentFeed = await db.getGuildRssFeed(guildId, feedId); + if (!currentFeed || currentFeed.type === "tw") { + res._err = "Invalid feed ID"; + res.status(400).send(res._err); + return; + } + await db.toggleRssFeed(guildId, feedId); + const updatedFeed = await db.getGuildRssFeed(guildId, feedId); + if (updatedFeed === null) { + res._err = "Missing feed"; + res.status(500).send(res._err); + return; + } + const displayName = await rssExternalApisManager.getRssFeedDisplayName(updatedFeed); + const updatedFeedWithDisplayName = { ...updatedFeed, displayName }; + await registerRssFeedsEdition( + guildId, + res.locals.user.user_id, + EditionLogType.RSS_EDITED, + updatedFeedWithDisplayName, + ); + res.json(updatedFeedWithDisplayName); } export async function editRssFeed(req: Request, res: Response) { - let guildId, feedId; - // check guild ID validity - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - // check user ID validity - if (res.locals.user === undefined) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return; - } - // check data validity - const data = req.body; - if (!is(data) || !equals(data.embed)) { - res._err = "Invalid data"; - res.status(400).send(res._err); - return; - } - // check feed ID type validity - try { - feedId = BigInt(req.params.feedId); - } catch (e) { - res._err = "Invalid feed ID"; - res.status(400).send(res._err); - return; - } - // check if feed actually exists - const currentFeed = await db.getGuildRssFeed(guildId, feedId); - if (!currentFeed) { - res._err = "Invalid feed ID"; - res.status(400).send(res._err); - return; - } - // prevent enabling twitter feeds - if (data.enabled && currentFeed.type === "tw") { - data.enabled = false; - } - // edit feed - await db.editRssFeed(guildId, data); - const updatedFeed = await db.getGuildRssFeed(guildId, feedId); - if (!updatedFeed) { - res._err = "Missing feed"; - res.status(500).send(res._err); - return; - } - await registerRssFeedsEdition(guildId, res.locals.user.user_id, EditionLogType.RSS_EDITED, updatedFeed); - res.json(updatedFeed); + let guildId, feedId; + // check guild ID validity + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + // check user ID validity + if (res.locals.user === undefined) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return; + } + // check data validity + const data = req.body; + if (!is(data) || !equals(data.embed)) { + res._err = "Invalid data"; + res.status(400).send(res._err); + return; + } + // check feed ID type validity + try { + feedId = BigInt(req.params.feedId); + } catch (e) { + res._err = "Invalid feed ID"; + res.status(400).send(res._err); + return; + } + // check if feed actually exists + const currentFeed = await db.getGuildRssFeed(guildId, feedId); + if (!currentFeed) { + res._err = "Invalid feed ID"; + res.status(400).send(res._err); + return; + } + // prevent enabling twitter feeds + if (data.enabled && currentFeed.type === "tw") { + data.enabled = false; + } + // edit feed + await db.editRssFeed(guildId, data); + const updatedFeed = await db.getGuildRssFeed(guildId, feedId); + if (!updatedFeed) { + res._err = "Missing feed"; + res.status(500).send(res._err); + return; + } + await registerRssFeedsEdition(guildId, res.locals.user.user_id, EditionLogType.RSS_EDITED, updatedFeed); + res.json(updatedFeed); } export async function deleteRssFeed(req: Request, res: Response) { - let guildId, feedId; - // check guild ID validity - try { - guildId = BigInt(req.params.guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - // check user ID validity - if (res.locals.user === undefined) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return; - } - // check feed ID type validity - try { - feedId = BigInt(req.params.feedId); - } catch (e) { - res._err = "Invalid feed ID"; - res.status(400).send(res._err); - return; - } - // check if feed actually exists - const currentFeed = await db.getGuildRssFeed(guildId, feedId); - if (!currentFeed || currentFeed.type === "tw") { - res._err = "Invalid feed ID"; - res.status(400).send(res._err); - return; - } - await db.deleteRssFeed(guildId, feedId); - await registerRssFeedsEdition(guildId, res.locals.user.user_id, EditionLogType.RSS_DELETED, currentFeed); - res.sendStatus(204); + let guildId, feedId; + // check guild ID validity + try { + guildId = BigInt(req.params.guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + // check user ID validity + if (res.locals.user === undefined) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return; + } + // check feed ID type validity + try { + feedId = BigInt(req.params.feedId); + } catch (e) { + res._err = "Invalid feed ID"; + res.status(400).send(res._err); + return; + } + // check if feed actually exists + const currentFeed = await db.getGuildRssFeed(guildId, feedId); + if (!currentFeed || currentFeed.type === "tw") { + res._err = "Invalid feed ID"; + res.status(400).send(res._err); + return; + } + await db.deleteRssFeed(guildId, feedId); + await registerRssFeedsEdition(guildId, res.locals.user.user_id, EditionLogType.RSS_DELETED, currentFeed); + res.sendStatus(204); } diff --git a/src/modules/discord/middlewares.ts b/src/modules/discord/middlewares.ts index 5914f00..53c3ce5 100644 --- a/src/modules/discord/middlewares.ts +++ b/src/modules/discord/middlewares.ts @@ -5,50 +5,58 @@ import DiscordClient from "../../bot/client"; const discordClient = DiscordClient.getInstance(); -export async function isDiscordServerMember(req: Request, res: Response, next: NextFunction) { - if (res.locals.user === undefined) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return; - } - const userId = res.locals.user.user_id.toString(); - const guildId = req.params.guildId; - try { - BigInt(guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const result = await discordClient.checkUserPresenceInGuild(guildId, userId); - if (!result) { - res._err = "User is not a member of this guild"; - res.status(401).send(res._err); - return; - } - next(); +export async function isDiscordServerMember( + req: Request, + res: Response, + next: NextFunction, +) { + if (res.locals.user === undefined) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return; + } + const userId = res.locals.user.user_id.toString(); + const guildId = req.params.guildId; + try { + BigInt(guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const result = await discordClient.checkUserPresenceInGuild(guildId, userId); + if (!result) { + res._err = "User is not a member of this guild"; + res.status(401).send(res._err); + return; + } + next(); } -export async function isDiscordServerAdmin(req: Request, res: Response, next: NextFunction) { - if (res.locals.user === undefined) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return; - } - const userId = res.locals.user.user_id.toString(); - const guildId = req.params.guildId; - try { - BigInt(guildId); - } catch (e) { - res._err = "Invalid guild ID"; - res.status(400).send(res._err); - return; - } - const result = await discordClient.checkUserPermissionInGuild(guildId, userId, "Administrator"); - if (!result) { - res._err = "User is not an admin of this guild"; - res.status(401).send(res._err); - return; - } - next(); -} \ No newline at end of file +export async function isDiscordServerAdmin( + req: Request, + res: Response, + next: NextFunction, +) { + if (res.locals.user === undefined) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return; + } + const userId = res.locals.user.user_id.toString(); + const guildId = req.params.guildId; + try { + BigInt(guildId); + } catch (e) { + res._err = "Invalid guild ID"; + res.status(400).send(res._err); + return; + } + const result = await discordClient.checkUserPermissionInGuild(guildId, userId, "Administrator"); + if (!result) { + res._err = "User is not an admin of this guild"; + res.status(401).send(res._err); + return; + } + next(); +} diff --git a/src/modules/discord/ratelimits.ts b/src/modules/discord/ratelimits.ts index fed865f..c41b8b9 100644 --- a/src/modules/discord/ratelimits.ts +++ b/src/modules/discord/ratelimits.ts @@ -1,61 +1,61 @@ import rateLimit from "express-rate-limit"; export const getDefaultGuildConfigRateLimiter = rateLimit({ - windowMs: 20 * 1000, - max: 5, - standardHeaders: true, + windowMs: 20 * 1000, + max: 5, + standardHeaders: true, }); export const getBotInfoRateLimiter = rateLimit({ - windowMs: 20 * 1000, - max: 10, - standardHeaders: true, + windowMs: 20 * 1000, + max: 10, + standardHeaders: true, }); export const getGuildConfigRateLimiter = rateLimit({ - windowMs: 20 * 1000, - max: 10, - standardHeaders: true, + windowMs: 20 * 1000, + max: 10, + standardHeaders: true, }); export const getGuildConfigLogsRateLimiter = rateLimit({ - windowMs: 20 * 1000, - max: 5, - standardHeaders: true, + windowMs: 20 * 1000, + max: 5, + standardHeaders: true, }); export const getLeaderboardRateLimiter = rateLimit({ - windowMs: 15 * 1000, - max: 6, - standardHeaders: true, + windowMs: 15 * 1000, + max: 6, + standardHeaders: true, }); export const getGuildsListRateLimiter = rateLimit({ - windowMs: 15 * 1000, - max: 3, - standardHeaders: true, + windowMs: 15 * 1000, + max: 3, + standardHeaders: true, }); export const getGuildChannelAndRolesRateLimiter = rateLimit({ - windowMs: 20 * 1000, - max: 8, - standardHeaders: true, + windowMs: 20 * 1000, + max: 8, + standardHeaders: true, }); export const editLeaderboardRateLimiter = rateLimit({ - windowMs: 60 * 1000, - max: 2, - standardHeaders: true, + windowMs: 60 * 1000, + max: 2, + standardHeaders: true, }); export const editRoleRewardsRateLimiter = rateLimit({ - windowMs: 20 * 1000, - max: 4, - standardHeaders: true, + windowMs: 20 * 1000, + max: 4, + standardHeaders: true, }); export const editRssFeedRateLimiter = rateLimit({ - windowMs: 20 * 1000, - max: 8, - standardHeaders: true, + windowMs: 20 * 1000, + max: 8, + standardHeaders: true, }); diff --git a/src/modules/discord/router.ts b/src/modules/discord/router.ts index 81e02d8..ec8e8cc 100644 --- a/src/modules/discord/router.ts +++ b/src/modules/discord/router.ts @@ -1,9 +1,41 @@ import express from "express"; import { tokenCheckMiddleware } from "../auth/tokens"; -import { deleteRssFeed, editGuildConfig, editRssFeed, getBasicGuildInfo, getBotChangelog, getBotInfo, getDefaultGuildConfigOptions, getGlobalLeaderboard, getGuildChannels, getGuildConfig, getGuildConfigEditionLogs, getGuildLeaderboard, getGuildLeaderboardAsJson, getGuildRoleRewards, getGuildRoles, getGuildRssFeeds, getUserGuilds, putGuildLeaderboard, putRoleRewards, toggleRssFeed } from "./controler"; +import { + deleteRssFeed, + editGuildConfig, + editRssFeed, + getBasicGuildInfo, + getBotChangelog, + getBotInfo, + getDefaultGuildConfigOptions, + getGlobalLeaderboard, + getGuildChannels, + getGuildConfig, + getGuildConfigEditionLogs, + getGuildLeaderboard, + getGuildLeaderboardAsJson, + getGuildRoleRewards, + getGuildRoles, + getGuildRssFeeds, + getUserGuilds, + putGuildLeaderboard, + putRoleRewards, + toggleRssFeed, +} from "./controler"; import { isDiscordServerAdmin, isDiscordServerMember } from "./middlewares"; -import { editLeaderboardRateLimiter, editRoleRewardsRateLimiter, editRssFeedRateLimiter, getBotInfoRateLimiter, getDefaultGuildConfigRateLimiter, getGuildChannelAndRolesRateLimiter, getGuildConfigLogsRateLimiter, getGuildConfigRateLimiter, getGuildsListRateLimiter, getLeaderboardRateLimiter } from "./ratelimits"; +import { + editLeaderboardRateLimiter, + editRoleRewardsRateLimiter, + editRssFeedRateLimiter, + getBotInfoRateLimiter, + getDefaultGuildConfigRateLimiter, + getGuildChannelAndRolesRateLimiter, + getGuildConfigLogsRateLimiter, + getGuildConfigRateLimiter, + getGuildsListRateLimiter, + getLeaderboardRateLimiter, +} from "./ratelimits"; const router = express.Router(); @@ -13,39 +45,116 @@ router.get("/changelog", getBotInfoRateLimiter, getBotChangelog); router.get("/bot-info", getBotInfoRateLimiter, getBotInfo); -router.get("/guild/:guildId/config", getGuildConfigRateLimiter, tokenCheckMiddleware, isDiscordServerMember, getGuildConfig); - -router.get("/guild/:guildId/config-logs", getGuildConfigLogsRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, getGuildConfigEditionLogs); - -router.get("/guild/:guildId/role-rewards", getGuildConfigRateLimiter, tokenCheckMiddleware, isDiscordServerMember, getGuildRoleRewards); +router.get( + "/guild/:guildId/config", + getGuildConfigRateLimiter, + tokenCheckMiddleware, + isDiscordServerMember, + getGuildConfig, +); + +router.get( + "/guild/:guildId/config-logs", + getGuildConfigLogsRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + getGuildConfigEditionLogs, +); + +router.get( + "/guild/:guildId/role-rewards", + getGuildConfigRateLimiter, + tokenCheckMiddleware, + isDiscordServerMember, + getGuildRoleRewards, +); router.get("/guild/:guildId/leaderboard", getLeaderboardRateLimiter, getGuildLeaderboard); router.get("/guild/:guildId/leaderboard.json", getLeaderboardRateLimiter, getGuildLeaderboardAsJson); -router.get("/guild/:guildId/rss-feeds", getGuildConfigRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, getGuildRssFeeds); - -router.get("/guild/:guildId/roles", getGuildChannelAndRolesRateLimiter, tokenCheckMiddleware, isDiscordServerMember, getGuildRoles); - -router.get("/guild/:guildId/channels", getGuildChannelAndRolesRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, getGuildChannels); - -router.get("/guild/:guildId", getGuildsListRateLimiter, tokenCheckMiddleware, isDiscordServerMember, getBasicGuildInfo); +router.get( + "/guild/:guildId/rss-feeds", + getGuildConfigRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + getGuildRssFeeds, +); + +router.get( + "/guild/:guildId/roles", + getGuildChannelAndRolesRateLimiter, + tokenCheckMiddleware, + isDiscordServerMember, + getGuildRoles, +); + +router.get( + "/guild/:guildId/channels", + getGuildChannelAndRolesRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + getGuildChannels, +); + +router.get( + "/guild/:guildId", + getGuildsListRateLimiter, + tokenCheckMiddleware, + isDiscordServerMember, + getBasicGuildInfo, +); router.get("/leaderboard/global", getLeaderboardRateLimiter, getGlobalLeaderboard); router.get("/@me/guilds", getGuildsListRateLimiter, tokenCheckMiddleware, getUserGuilds); - -router.put("/guild/:guildId/leaderboard", editLeaderboardRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, putGuildLeaderboard); - -router.put("/guild/:guildId/role-rewards", editRoleRewardsRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, putRoleRewards); - -router.patch("/guild/:guildId/config", getGuildConfigRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, editGuildConfig); - -router.post("/guild/:guildId/rss-feeds/:feedId/toggle", editRssFeedRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, toggleRssFeed); - -router.put("/guild/:guildId/rss-feeds/:feedId", editRssFeedRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, editRssFeed); - -router.delete("/guild/:guildId/rss-feeds/:feedId", editRssFeedRateLimiter, tokenCheckMiddleware, isDiscordServerAdmin, deleteRssFeed); - -export default router; \ No newline at end of file +router.put( + "/guild/:guildId/leaderboard", + editLeaderboardRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + putGuildLeaderboard, +); + +router.put( + "/guild/:guildId/role-rewards", + editRoleRewardsRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + putRoleRewards, +); + +router.patch( + "/guild/:guildId/config", + getGuildConfigRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + editGuildConfig, +); + +router.post( + "/guild/:guildId/rss-feeds/:feedId/toggle", + editRssFeedRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + toggleRssFeed, +); + +router.put( + "/guild/:guildId/rss-feeds/:feedId", + editRssFeedRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + editRssFeed, +); + +router.delete( + "/guild/:guildId/rss-feeds/:feedId", + editRssFeedRateLimiter, + tokenCheckMiddleware, + isDiscordServerAdmin, + deleteRssFeed, +); + +export default router; diff --git a/src/modules/discord/types/guilds.d.ts b/src/modules/discord/types/guilds.d.ts index e0866af..a53d318 100644 --- a/src/modules/discord/types/guilds.d.ts +++ b/src/modules/discord/types/guilds.d.ts @@ -1,58 +1,58 @@ import { GuildFeature, PermissionsBitField } from "discord.js"; interface LeaderboardGuildData { - id: string; - name: string; - icon: string | null; + id: string; + name: string; + icon: string | null; } interface OauthGuildRawData { - id: string; - name: string; - icon: string | null; - owner: boolean; - permissions: string; - features: GuildFeature[]; + id: string; + name: string; + icon: string | null; + owner: boolean; + permissions: string; + features: GuildFeature[]; } interface OauthGuildData { - id: string; - name: string; - icon: string | null; - banner: string | null; - splash: string | null; - isOwner: boolean; - isAdmin: boolean; - isBotPresent: boolean; - permissions: PermissionsBitField | null; - features: GuildFeature[]; + id: string; + name: string; + icon: string | null; + banner: string | null; + splash: string | null; + isOwner: boolean; + isAdmin: boolean; + isBotPresent: boolean; + permissions: PermissionsBitField | null; + features: GuildFeature[]; } interface LeaderboardImportUserData { - user_id: string; - xp: number; + user_id: string; + xp: number; } interface RoleRewardsPUTData { - roleId: string; - level: string; + roleId: string; + level: string; } interface RssFeedPUTData { - id: string; - channelId: string; - structure: string; - roles: string[]; - useEmbed: boolean; - embed: { - author_text?: string; - title?: string; - footer_text?: string; - color?: number; - show_date_in_footer?: boolean; - enable_link_in_title?: boolean; - image_location?: "thumbnail" | "banner" | "none"; - }; - silentMention: boolean; - enabled: boolean; -} \ No newline at end of file + id: string; + channelId: string; + structure: string; + roles: string[]; + useEmbed: boolean; + embed: { + author_text?: string; + title?: string; + footer_text?: string; + color?: number; + show_date_in_footer?: boolean; + enable_link_in_title?: boolean; + image_location?: "thumbnail" | "banner" | "none"; + }; + silentMention: boolean; + enabled: boolean; +} diff --git a/src/modules/discord/types/typeguards.ts b/src/modules/discord/types/typeguards.ts index 95a2928..d161a93 100644 --- a/src/modules/discord/types/typeguards.ts +++ b/src/modules/discord/types/typeguards.ts @@ -1,5 +1,5 @@ import { DiscordAPIError } from "discord.js"; export function isDiscordAPIError(obj: unknown): obj is DiscordAPIError { - return typeof obj === "object" && obj !== null && (obj as DiscordAPIError).code !== undefined; -} \ No newline at end of file + return typeof obj === "object" && obj !== null && (obj as DiscordAPIError).code !== undefined; +} diff --git a/src/modules/discord/types/users.d.ts b/src/modules/discord/types/users.d.ts index 120a6c5..da921c8 100644 --- a/src/modules/discord/types/users.d.ts +++ b/src/modules/discord/types/users.d.ts @@ -1,15 +1,15 @@ interface AuthenticatedUserObject { - id: string; - username: string; - globalName: string | null; - avatar: string; + id: string; + username: string; + globalName: string | null; + avatar: string; } interface OauthUserData { - id: string; - avatar: string | null; - global_name: string | null; - locale: string; - public_flags: number; - username: string; -} \ No newline at end of file + id: string; + avatar: string | null; + global_name: string | null; + locale: string; + public_flags: number; + username: string; +} diff --git a/src/modules/discord/utils/leaderboard.ts b/src/modules/discord/utils/leaderboard.ts index 7aef21b..452f356 100644 --- a/src/modules/discord/utils/leaderboard.ts +++ b/src/modules/discord/utils/leaderboard.ts @@ -9,54 +9,64 @@ import { getLevelFromGeneralXp, getLevelFromMEE6Xp, getXpFromGeneralLevel, getXp const discordClient = DiscordClient.getInstance(); -export async function transformLeaderboard(leaderboard: {userID: bigint;xp: bigint;}[], firstRank: number, useMEE6: boolean) { - const getLevelFromXp = useMEE6 ? getLevelFromMEE6Xp : getLevelFromGeneralXp; - const getXpFromLevel = useMEE6 ? getXpFromMEE6Level : getXpFromGeneralLevel; - return await Promise.all(leaderboard.map(async (entry, index) => { - const user = await discordClient.getRawUserData(entry.userID.toString()); - const level = getLevelFromXp(Number(entry.xp)); - const xpToCurrentLevel = getXpFromLevel(level); - const xpToNextLevel = getXpFromLevel(level + 1); - return { - "ranking": firstRank + index, - "user_id": entry.userID, - "xp": Number(entry.xp), - "level": level, - "xp_to_current_level": xpToCurrentLevel, - "xp_to_next_level": xpToNextLevel, - "username": user?.global_name ?? user?.username ?? null, - "avatar": discordClient.getAvatarUrlFromHash(user?.avatar_hash ?? null, entry.userID), - }; - })); +export async function transformLeaderboard( + leaderboard: { userID: bigint; xp: bigint }[], + firstRank: number, + useMEE6: boolean, +) { + const getLevelFromXp = useMEE6 ? getLevelFromMEE6Xp : getLevelFromGeneralXp; + const getXpFromLevel = useMEE6 ? getXpFromMEE6Level : getXpFromGeneralLevel; + return await Promise.all( + leaderboard.map(async (entry, index) => { + const user = await discordClient.getRawUserData(entry.userID.toString()); + const level = getLevelFromXp(Number(entry.xp)); + const xpToCurrentLevel = getXpFromLevel(level); + const xpToNextLevel = getXpFromLevel(level + 1); + return { + ranking: firstRank + index, + user_id: entry.userID, + xp: Number(entry.xp), + level: level, + xp_to_current_level: xpToCurrentLevel, + xp_to_next_level: xpToNextLevel, + username: user?.global_name ?? user?.username ?? null, + avatar: discordClient.getAvatarUrlFromHash(user?.avatar_hash ?? null, entry.userID), + }; + }), + ); } export async function getGuildInfo(guild: Guild): Promise { - return { - id: guild.id, - name: guild.name, - icon: guild.iconURL({ size: 256 }), - }; + return { + id: guild.id, + name: guild.name, + icon: guild.iconURL({ size: 256 }), + }; } -export async function checkUserAuthentificationAndPermission(req: Request, res: Response): Promise { - const tokenCheckResult = await tokenCheck(req); - if (Array.isArray(tokenCheckResult)) { // is an error code and message - res._err = tokenCheckResult[1]; - res.status(tokenCheckResult[0]).send(res._err); - return false; - } - res.locals.user = tokenCheckResult; - if (res.locals.user === undefined) { - res._err = "Invalid token"; - res.status(401).send(res._err); - return false; - } - const userId = res.locals.user.user_id.toString(); - const guildId = req.params.guildId; - if (!await discordClient.checkUserPresenceInGuild(guildId, userId)) { - res._err = "User is not a member of this guild"; - res.status(401).send(res._err); - return false; - } - return true; +export async function checkUserAuthentificationAndPermission( + req: Request, + res: Response, +): Promise { + const tokenCheckResult = await tokenCheck(req); + if (Array.isArray(tokenCheckResult)) { + // is an error code and message + res._err = tokenCheckResult[1]; + res.status(tokenCheckResult[0]).send(res._err); + return false; + } + res.locals.user = tokenCheckResult; + if (res.locals.user === undefined) { + res._err = "Invalid token"; + res.status(401).send(res._err); + return false; + } + const userId = res.locals.user.user_id.toString(); + const guildId = req.params.guildId; + if (!(await discordClient.checkUserPresenceInGuild(guildId, userId))) { + res._err = "User is not a member of this guild"; + res.status(401).send(res._err); + return false; + } + return true; } diff --git a/src/modules/discord/utils/xp.ts b/src/modules/discord/utils/xp.ts index 8b54e6f..875eb6e 100644 --- a/src/modules/discord/utils/xp.ts +++ b/src/modules/discord/utils/xp.ts @@ -1,23 +1,23 @@ export function getLevelFromGeneralXp(xp: number) { - const approxLevel = 1 + Math.pow(xp, 13 / 20) * 7 / 125; - return Math.floor(Math.round(approxLevel * 100) / 100); + const approxLevel = 1 + (Math.pow(xp, 13 / 20) * 7) / 125; + return Math.floor(Math.round(approxLevel * 100) / 100); } export function getXpFromGeneralLevel(level: number) { - return Math.ceil(Math.pow((level - 1) * 125 / 7, 20 / 13)); + return Math.ceil(Math.pow(((level - 1) * 125) / 7, 20 / 13)); } export function getLevelFromMEE6Xp(xp: number) { - let level = 0; - let levelXp = 0; - while (xp >= levelXp) { - levelXp += 5 * Math.pow(level, 2) + 50 * level + 100; - level++; - } - return level - 1; + let level = 0; + let levelXp = 0; + while (xp >= levelXp) { + levelXp += 5 * Math.pow(level, 2) + 50 * level + 100; + level++; + } + return level - 1; } export function getXpFromMEE6Level(level: number) { - const approxXp = 5 / 3 * Math.pow(level, 3) + 22.5 * Math.pow(level, 2) + 151515 / 1998 * level; - return Math.floor(Math.round(approxXp * 100) / 100); -} \ No newline at end of file + const approxXp = (5 / 3) * Math.pow(level, 3) + 22.5 * Math.pow(level, 2) + (151515 / 1998) * level; + return Math.floor(Math.round(approxXp * 100) / 100); +} diff --git a/src/modules/docker/controler.ts b/src/modules/docker/controler.ts index a0cb2d0..9516aea 100644 --- a/src/modules/docker/controler.ts +++ b/src/modules/docker/controler.ts @@ -7,60 +7,60 @@ import { MinimalDockerPushEvent } from "./types"; const EMBED_COLOR = 0x0c49c2; function sendToDiscord(webhookPath: string, data: DiscordMessage) { - return fetch(`https://discord.com/api/webhooks/${webhookPath}`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(data), - }); + return fetch(`https://discord.com/api/webhooks/${webhookPath}`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + }); } function callbackDockerhub(callbackUrl: string) { - if (!callbackUrl.startsWith("https://registry.hub.docker.com/")) { - return Promise.reject(new Error("Invalid callback domain")); - } - return fetch(callbackUrl, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - state: "success", - description: "The webhook has been forwarded to Discord", - context: "Discord webhook forwarder", - }), - }); + if (!callbackUrl.startsWith("https://registry.hub.docker.com/")) { + return Promise.reject(new Error("Invalid callback domain")); + } + return fetch(callbackUrl, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + state: "success", + description: "The webhook has been forwarded to Discord", + context: "Discord webhook forwarder", + }), + }); } export async function postWebhookNotification(req: Request, res: Response) { - const webhookPath = req.params.webhook_id + "/" + req.params.webhook_token; - if (!/^\d+\/[\w-]+$/.test(webhookPath)) { - res._err = "Invalid webhook path"; - res.status(400).send(res._err); - return; - } - if (!is(req.body)) { - res._err = "Invalid request body"; - res.status(400).send(res._err); - return; - } - const repo = req.body.repository; - const pushData = req.body.push_data; - const callbackUrl = req.body.callback_url; - const embed = { - title: `New push on ${repo.repo_name}:${pushData.tag}`, - description: `Pushed by ${pushData.pusher}\n\nLink: ${repo.repo_url}`, - color: EMBED_COLOR, - }; - await sendToDiscord(webhookPath, { embeds: [embed] }); - try { - await callbackDockerhub(callbackUrl); - } catch (err) { - console.error("Failed to send callback:", err); - res._err = "Failed to send callback"; - res.status(400).send(res._err); - return; - } - res.send("ok"); -} \ No newline at end of file + const webhookPath = req.params.webhook_id + "/" + req.params.webhook_token; + if (!/^\d+\/[\w-]+$/.test(webhookPath)) { + res._err = "Invalid webhook path"; + res.status(400).send(res._err); + return; + } + if (!is(req.body)) { + res._err = "Invalid request body"; + res.status(400).send(res._err); + return; + } + const repo = req.body.repository; + const pushData = req.body.push_data; + const callbackUrl = req.body.callback_url; + const embed = { + title: `New push on ${repo.repo_name}:${pushData.tag}`, + description: `Pushed by ${pushData.pusher}\n\nLink: ${repo.repo_url}`, + color: EMBED_COLOR, + }; + await sendToDiscord(webhookPath, { embeds: [embed] }); + try { + await callbackDockerhub(callbackUrl); + } catch (err) { + console.error("Failed to send callback:", err); + res._err = "Failed to send callback"; + res.status(400).send(res._err); + return; + } + res.send("ok"); +} diff --git a/src/modules/docker/router.ts b/src/modules/docker/router.ts index 7a6ea14..a2af9e3 100644 --- a/src/modules/docker/router.ts +++ b/src/modules/docker/router.ts @@ -6,4 +6,4 @@ const router = express.Router(); router.post("/webhook/:webhook_id/:webhook_token", postWebhookNotification); -export default router; \ No newline at end of file +export default router; diff --git a/src/modules/docker/types/index.d.ts b/src/modules/docker/types/index.d.ts index 575d0b2..a851c15 100644 --- a/src/modules/docker/types/index.d.ts +++ b/src/modules/docker/types/index.d.ts @@ -1,31 +1,32 @@ export interface DockerPushEvent { - callback_url: string; - push_data: { - pushed_at: number; - pusher: string; - tag: string; - }; - repository: { - comment_count: number; - date_created: number; - description: string; - dockerfile: string; - full_description: string | null; - is_official: boolean; - is_private: boolean; - is_trusted: boolean; - name: string; - namespace: string; - owner: string; - repo_name: string; - repo_url: string; - star_count: number; - status: string; - }; + callback_url: string; + push_data: { + pushed_at: number; + pusher: string; + tag: string; + }; + repository: { + comment_count: number; + date_created: number; + description: string; + dockerfile: string; + full_description: string | null; + is_official: boolean; + is_private: boolean; + is_trusted: boolean; + name: string; + namespace: string; + owner: string; + repo_name: string; + repo_url: string; + star_count: number; + status: string; + }; } export interface MinimalDockerPushEvent extends Partial { - callback_url: string; - push_data: Pick & Partial; - repository: Pick & Partial; -} \ No newline at end of file + callback_url: string; + push_data: Pick & Partial; + repository: Pick & + Partial; +} diff --git a/src/modules/rss/controler.ts b/src/modules/rss/controler.ts index 1760058..eeb493b 100644 --- a/src/modules/rss/controler.ts +++ b/src/modules/rss/controler.ts @@ -5,35 +5,34 @@ import RssExternalApisManager from "../../rss/rss-external-apis-manager"; import setCacheControl from "../../utils/cache_control"; import { TestRssFeedInput } from "./types/api-input"; - const rssExternalApisManager = RssExternalApisManager.getInstance(); export async function testRssFeed(req: Request, res: Response) { - const data = req.query; - if (!is(data)) { - res._err = "Invalid data"; - res.status(400).send(res._err); - return; - } - if (data.type === "web" && !checkWebUrl(data.url)) { - res._err = "Invalid web URL"; - res.status(400).send(res._err); - } - const result = await rssExternalApisManager.testRssFeed(data.type, data.url); - if (!result) { - res._err = "No data found"; - res.status(400).send(res._err); - return; - } - setCacheControl(res, 86400); - res.json(result); + const data = req.query; + if (!is(data)) { + res._err = "Invalid data"; + res.status(400).send(res._err); + return; + } + if (data.type === "web" && !checkWebUrl(data.url)) { + res._err = "Invalid web URL"; + res.status(400).send(res._err); + } + const result = await rssExternalApisManager.testRssFeed(data.type, data.url); + if (!result) { + res._err = "No data found"; + res.status(400).send(res._err); + return; + } + setCacheControl(res, 86400); + res.json(result); } function checkWebUrl(url: string) { - try { - new URL(url); - } catch (err) { - return false; - } - return url.startsWith("https://"); -} \ No newline at end of file + try { + new URL(url); + } catch (err) { + return false; + } + return url.startsWith("https://"); +} diff --git a/src/modules/rss/ratelimits.ts b/src/modules/rss/ratelimits.ts index 1c5f803..dc027fe 100644 --- a/src/modules/rss/ratelimits.ts +++ b/src/modules/rss/ratelimits.ts @@ -1,7 +1,7 @@ import rateLimit from "express-rate-limit"; export const getRssTestRateLimiter = rateLimit({ - windowMs: 10 * 1000, - max: 2, - standardHeaders: true, + windowMs: 10 * 1000, + max: 2, + standardHeaders: true, }); diff --git a/src/modules/rss/router.ts b/src/modules/rss/router.ts index 155fe26..2ff8d32 100644 --- a/src/modules/rss/router.ts +++ b/src/modules/rss/router.ts @@ -7,4 +7,4 @@ const router = express.Router(); router.get("/test", getRssTestRateLimiter, testRssFeed); -export default router; \ No newline at end of file +export default router; diff --git a/src/modules/rss/types/api-input.d.ts b/src/modules/rss/types/api-input.d.ts index 10111bc..0b3a36e 100644 --- a/src/modules/rss/types/api-input.d.ts +++ b/src/modules/rss/types/api-input.d.ts @@ -1,6 +1,6 @@ -import { VALID_RSS_FEED_TYPES } from "../../../database/models/rss"; +import { T_VALID_RSS_FEED_TYPES } from "../../../database/models/rss"; export interface TestRssFeedInput { - type: VALID_RSS_FEED_TYPES; - url: string; -} \ No newline at end of file + type: T_VALID_RSS_FEED_TYPES; + url: string; +} diff --git a/src/rss/modules/parsed-entry.ts b/src/rss/modules/parsed-entry.ts index 9365394..ef5582b 100644 --- a/src/rss/modules/parsed-entry.ts +++ b/src/rss/modules/parsed-entry.ts @@ -1,12 +1,12 @@ export interface ParsedEntry { - url: string; - title: string; - pubDate: string; - entryId: string | null; - author: string | null; - channel: string | null; - image: string | null; - imageAlt: string | null; - postText: string | null; - postDescription: string | null; + url: string; + title: string; + pubDate: string; + entryId: string | null; + author: string | null; + channel: string | null; + image: string | null; + imageAlt: string | null; + postText: string | null; + postDescription: string | null; } diff --git a/src/rss/modules/web-rss.ts b/src/rss/modules/web-rss.ts index d1d6399..99dd177 100644 --- a/src/rss/modules/web-rss.ts +++ b/src/rss/modules/web-rss.ts @@ -4,95 +4,99 @@ import Parser from "rss-parser"; import { ParsedEntry } from "./parsed-entry"; export default class WebRss { + private parser = new Parser({ + timeout: 9e3, // 9 seconds + headers: { "User-Agent": "Axobot feedparser" }, + cache: createCache( + memoryStore({ + max: 1_000, + ttl: 60 * 60 * 1000, // 1 hour + }), + ), + }); - private parser = new Parser({ - timeout: 9e3, // 9 seconds - headers: { "User-Agent": "Axobot feedparser" }, - cache: createCache(memoryStore({ - max: 1_000, - ttl: 60 * 60 * 1000, // 1 hour - })), - }); + private imageUrlRegex = new RegExp( + ["(http(s?):)", "([/|.\\w\\s-])*", "\\.(?:jpe?g|gif|png|webp)"].join(""), + "i", + ); - private imageUrlRegex = new RegExp( - [ - "(http(s?):)", - "([/|.\\w\\s-])*", - "\\.(?:jpe?g|gif|png|webp)", - ].join(""), - "i" - ); + private imageAltRegex = new RegExp(/]*?(?:title="([^"]+)"|alt="([^"]+)")[^>]*?>/, "i"); - private imageAltRegex = new RegExp(/]*?(?:title="([^"]+)"|alt="([^"]+)")[^>]*?>/, "i"); - - async getLastPost(url: string): Promise { - const feed = await this.getFeed(url); - if (!feed) { - return undefined; - } - const entry = feed.items[0]; - return this.parseEntry(feed, entry, url); + async getLastPost(url: string): Promise { + const feed = await this.getFeed(url); + if (!feed) { + return undefined; } + const entry = feed.items[0]; + return this.parseEntry(feed, entry, url); + } - /** - * Parse an RSS feed from a given URL - * @returns The parsed feed - */ - private async getFeed(url: string): Promise | null> { - let feed: Parser.Output; - try { - feed = await this.parser.parseURL(url); - } catch (err) { - const sanitizedUrl = url.replace(/[\n\r]/g, "").slice(0, 100); - console.warn(`Error while fetching RSS feed from ${sanitizedUrl}: ${err}`); - return null; - } - if (!feed || feed.items.length === 0) { - console.debug(!feed ? "No feed found" : "No items found in feed"); - return null; - } - feed.items = await this.filterPinnedPosts(feed.items); - return feed; + /** + * Parse an RSS feed from a given URL + * @returns The parsed feed + */ + private async getFeed(url: string): Promise | null> { + let feed: Parser.Output; + try { + feed = await this.parser.parseURL(url); + } catch (err) { + const sanitizedUrl = url.replace(/[\n\r]/g, "").slice(0, 100); + console.warn(`Error while fetching RSS feed from ${sanitizedUrl}: ${err}`); + return null; } - - /** - * Remove pinned posts from a feed entries - */ - private async filterPinnedPosts(entries: Parser.Item[]) { - while (entries.length >= 2 && (!entries[0].isoDate || !entries[1].isoDate || entries[0].isoDate < entries[1].isoDate)) { - entries.shift(); - } - return entries; + if (!feed || feed.items.length === 0) { + console.debug(!feed ? "No feed found" : "No items found in feed"); + return null; } + feed.items = await this.filterPinnedPosts(feed.items); + return feed; + } - private parseEntry(feed: Parser.Output, entry: Parser.Item, feedUrl: string): ParsedEntry { - return { - url: entry.link || feed.link || feedUrl, - title: entry.title || "?", - pubDate: entry.isoDate!, - entryId: entry.id || entry.guid || entry.title || null, - author: entry.creator || entry.author || feed.title || null, - channel: feed.title || null, - image: entry.mediaThumbnail?.url || this.extractImageFromEnclosure(entry) || this.extractFirstImageFromContent(entry.content || "") || null, - imageAlt: this.extractFirstImageAltFromContent(entry.content || "") || null, - postText: entry.contentSnippet || null, - postDescription: entry.summary || null, - }; + /** + * Remove pinned posts from a feed entries + */ + private async filterPinnedPosts(entries: Parser.Item[]) { + while ( + entries.length >= 2 && + (!entries[0].isoDate || !entries[1].isoDate || entries[0].isoDate < entries[1].isoDate) + ) { + entries.shift(); } + return entries; + } - private extractImageFromEnclosure(entry: Parser.Item): string | null { - if (entry.enclosure?.type?.startsWith("image/")) { - return entry.enclosure.url; - } - return null; - } + private parseEntry(feed: Parser.Output, entry: Parser.Item, feedUrl: string): ParsedEntry { + return { + url: entry.link || feed.link || feedUrl, + title: entry.title || "?", + pubDate: entry.isoDate!, + entryId: entry.id || entry.guid || entry.title || null, + author: entry.creator || entry.author || feed.title || null, + channel: feed.title || null, + image: + entry.mediaThumbnail?.url || + this.extractImageFromEnclosure(entry) || + this.extractFirstImageFromContent(entry.content || "") || + null, + imageAlt: this.extractFirstImageAltFromContent(entry.content || "") || null, + postText: entry.contentSnippet || null, + postDescription: entry.summary || null, + }; + } - private extractFirstImageFromContent(content: string): string | null { - return content.match(this.imageUrlRegex)?.[0] || null; + private extractImageFromEnclosure(entry: Parser.Item): string | null { + if (entry.enclosure?.type?.startsWith("image/")) { + return entry.enclosure.url; } + return null; + } - private extractFirstImageAltFromContent(content: string): string | null { - const match = content.match(this.imageAltRegex); - return match?.[1] || match?.[2] || null; - } -} \ No newline at end of file + private extractFirstImageFromContent(content: string): string | null { + return content.match(this.imageUrlRegex)?.[0] || null; + } + + private extractFirstImageAltFromContent(content: string): string | null { + const match = content.match(this.imageAltRegex); + return match?.[1] || match?.[2] || null; + } +} diff --git a/src/rss/modules/youtube-rss.ts b/src/rss/modules/youtube-rss.ts index c356684..7908c08 100644 --- a/src/rss/modules/youtube-rss.ts +++ b/src/rss/modules/youtube-rss.ts @@ -5,145 +5,150 @@ import { is } from "typia"; import { ParsedEntry } from "./parsed-entry"; export default class YouTubeRss { + private channelByAnyTermCache: MemoryCache; - private channelByAnyTermCache: MemoryCache; + private urlPattern = new RegExp( + /(?:https?:\/\/)?(?:www\.|m\.)?(?:youtube\.com|youtu\.be)\/(?:channel\/|user\/|c\/)?@?([^/\s?]+).*$/, + ); - private urlPattern = new RegExp(/(?:https?:\/\/)?(?:www\.|m\.)?(?:youtube\.com|youtu\.be)\/(?:channel\/|user\/|c\/)?@?([^/\s?]+).*$/); + private parser = new Parser({ + timeout: 7e3, // 7 seconds + headers: { "User-Agent": "Axobot feedparser" }, + }); - private parser = new Parser({ - timeout: 7e3, // 7 seconds - headers: { "User-Agent": "Axobot feedparser" }, - }); + constructor() { + this.channelByAnyTermCache = createCache( + memoryStore({ + max: 1_000, + ttl: 12 * 60 * 60 * 1000, // 12 hour + }), + ); + } - constructor() { - this.channelByAnyTermCache = createCache(memoryStore({ - max: 1_000, - ttl: 12 * 60 * 60 * 1000, // 12 hour - })); + async getDisplayName(channelId: string): Promise { + if (channelId.length < 15 || channelId.length > 25) { + console.warn(`Invalid YouTube channel ID: ${channelId}`); + return undefined; } - - async getDisplayName(channelId: string): Promise { - if (channelId.length < 15 || channelId.length > 25) { - console.warn(`Invalid YouTube channel ID: ${channelId}`); - return undefined; - } - const result = await fetch( - "https://www.googleapis.com/youtube/v3/channels?" + new URLSearchParams({ - key: process.env.YOUTUBE_API_KEY, - id: channelId, - part: "snippet", - maxResults: "1", - fields: "items(snippet(title))", - }).toString() - ); - if (!result.ok) { - console.warn(`Failed to fetch YouTube channel name for ${channelId}: ${result.status}`); - console.debug(await result.text()); - return undefined; - } - const json = await result.json(); - if (!json.items || json.items.length === 0) { - console.warn(`No YouTube channel found for ${channelId}`); - return undefined; - } - return json.items[0].snippet.title; + const result = await fetch( + "https://www.googleapis.com/youtube/v3/channels?" + + new URLSearchParams({ + key: process.env.YOUTUBE_API_KEY, + id: channelId, + part: "snippet", + maxResults: "1", + fields: "items(snippet(title))", + }).toString(), + ); + if (!result.ok) { + console.warn(`Failed to fetch YouTube channel name for ${channelId}: ${result.status}`); + console.debug(await result.text()); + return undefined; } - - async getLastPost(UrlOrChannelId: string): Promise { - const channelId = await this.getChannelByAnyTerm(UrlOrChannelId); - if (!channelId) { - return undefined; - } - const feed = await this.getFeed(channelId); - if (!feed) { - return undefined; - } - const entry = feed.items[0]; - return this.parseEntry(entry); + const json = await result.json(); + if (!json.items || json.items.length === 0) { + console.warn(`No YouTube channel found for ${channelId}`); + return undefined; } + return json.items[0].snippet.title; + } - private async getChannelByAnyTerm(term: string): Promise { - if (typeof term !== "string" || term.length < 3 || term.length > 100) { - console.warn("Invalid search term"); - return undefined; - } - const urlMatch = this.urlPattern.exec(term); - if (urlMatch) { - term = urlMatch[1]; - } - const cached = await this.channelByAnyTermCache.get(term); - if (cached) { - return cached; - } - const channelId = (await this.isValidChannelId(term)) ? term : (await this.apiFindChannelByHandle(term)); - if (channelId) { - this.channelByAnyTermCache.set(term, channelId); - return channelId; - } - return undefined; + async getLastPost(UrlOrChannelId: string): Promise { + const channelId = await this.getChannelByAnyTerm(UrlOrChannelId); + if (!channelId) { + return undefined; + } + const feed = await this.getFeed(channelId); + if (!feed) { + return undefined; } + const entry = feed.items[0]; + return this.parseEntry(entry); + } - private async isValidChannelId(channelId: string) { - if (!/^[a-zA-Z\d]{10,25}$/.test(channelId)) { - return false; - } - const url = `https://www.youtube.com/channel/${channelId}`; - const result = await fetch(url); - return result.ok; + private async getChannelByAnyTerm(term: string): Promise { + if (typeof term !== "string" || term.length < 3 || term.length > 100) { + console.warn("Invalid search term"); + return undefined; + } + const urlMatch = this.urlPattern.exec(term); + if (urlMatch) { + term = urlMatch[1]; + } + const cached = await this.channelByAnyTermCache.get(term); + if (cached) { + return cached; } + const channelId = (await this.isValidChannelId(term)) ? term : await this.apiFindChannelByHandle(term); + if (channelId) { + this.channelByAnyTermCache.set(term, channelId); + return channelId; + } + return undefined; + } - private async apiFindChannelByHandle(term: string) { - const result = await fetch( - "https://www.googleapis.com/youtube/v3/channels?" + new URLSearchParams({ - key: process.env.YOUTUBE_API_KEY, - forHandle: term, - part: "id", - type: "channel", - maxResults: "5", - }).toString() - ); - if (!result.ok) { - console.warn(`Failed to fetch YouTube channel name: ${result.status}`); - console.debug(await result.text()); - return undefined; - } - const json = await result.json(); - if (!is<{items: {id: string}[]}>(json)) { - const sanitizedTerm = term.replace(/\n|\r/g, "").slice(0, 100); - console.warn(`Invalid YouTube API response for ${sanitizedTerm}`); - return undefined; - } - return json.items[0].id; + private async isValidChannelId(channelId: string) { + if (!/^[a-zA-Z\d]{10,25}$/.test(channelId)) { + return false; } + const url = `https://www.youtube.com/channel/${channelId}`; + const result = await fetch(url); + return result.ok; + } - private async getFeed(channelId: string): Promise | null> { - let feed: Parser.Output; - const url = `https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}`; - try { - feed = await this.parser.parseURL(url); - } catch (err) { - const sanitizedUrl = url.replace(/\n|\r/g, "").slice(0, 100); - console.warn(`Error while fetching RSS feed from ${sanitizedUrl}: ${err}`); - return null; - } - if (!feed || feed.items.length === 0) { - return null; - } - return feed; + private async apiFindChannelByHandle(term: string) { + const result = await fetch( + "https://www.googleapis.com/youtube/v3/channels?" + + new URLSearchParams({ + key: process.env.YOUTUBE_API_KEY, + forHandle: term, + part: "id", + type: "channel", + maxResults: "5", + }).toString(), + ); + if (!result.ok) { + console.warn(`Failed to fetch YouTube channel name: ${result.status}`); + console.debug(await result.text()); + return undefined; + } + const json = await result.json(); + if (!is<{ items: { id: string }[] }>(json)) { + const sanitizedTerm = term.replace(/\n|\r/g, "").slice(0, 100); + console.warn(`Invalid YouTube API response for ${sanitizedTerm}`); + return undefined; } + return json.items[0].id; + } - private parseEntry(entry: Parser.Item): ParsedEntry { - return { - url: entry.link!, - title: entry.title!, - pubDate: entry.isoDate!, - entryId: entry.id!, - author: entry.author!, - channel: entry.author!, - image: entry.mediaThumbnail?.url || null, - imageAlt: null, - postText: entry.contentSnippet || null, - postDescription: null, - }; + private async getFeed(channelId: string): Promise | null> { + let feed: Parser.Output; + const url = `https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}`; + try { + feed = await this.parser.parseURL(url); + } catch (err) { + const sanitizedUrl = url.replace(/\n|\r/g, "").slice(0, 100); + console.warn(`Error while fetching RSS feed from ${sanitizedUrl}: ${err}`); + return null; } -} \ No newline at end of file + if (!feed || feed.items.length === 0) { + return null; + } + return feed; + } + + private parseEntry(entry: Parser.Item): ParsedEntry { + return { + url: entry.link!, + title: entry.title!, + pubDate: entry.isoDate!, + entryId: entry.id!, + author: entry.author!, + channel: entry.author!, + image: entry.mediaThumbnail?.url || null, + imageAlt: null, + postText: entry.contentSnippet || null, + postDescription: null, + }; + } +} diff --git a/src/rss/rss-external-apis-manager.ts b/src/rss/rss-external-apis-manager.ts index b95efaa..8387be7 100644 --- a/src/rss/rss-external-apis-manager.ts +++ b/src/rss/rss-external-apis-manager.ts @@ -1,76 +1,75 @@ import { createCache, MemoryCache, memoryStore } from "cache-manager"; -import { DBRssFeed, VALID_RSS_FEED_TYPES } from "../database/models/rss"; +import { DBRssFeed, T_VALID_RSS_FEED_TYPES } from "../database/models/rss"; import { ParsedEntry } from "./modules/parsed-entry"; import WebRss from "./modules/web-rss"; import YouTubeRss from "./modules/youtube-rss"; export default class RssExternalApisManager { - private static instance: RssExternalApisManager; + private static instance: RssExternalApisManager; - private displayNameCache: MemoryCache; + private displayNameCache: MemoryCache; - private youtubeRss: YouTubeRss; + private youtubeRss: YouTubeRss; - private webRss: WebRss; + private webRss: WebRss; + private constructor() { + this.displayNameCache = createCache( + memoryStore({ + max: 100, + ttl: 12 * 60 * 60 * 1000, // 12 hour + }), + ); + this.youtubeRss = new YouTubeRss(); + this.webRss = new WebRss(); + } - private constructor() { - this.displayNameCache = createCache(memoryStore({ - max: 100, - ttl: 12 * 60 * 60 * 1000, // 12 hour - })); - this.youtubeRss = new YouTubeRss(); - this.webRss = new WebRss(); + public static getInstance(): RssExternalApisManager { + if (!RssExternalApisManager.instance) { + RssExternalApisManager.instance = new RssExternalApisManager(); } + return RssExternalApisManager.instance; + } - public static getInstance(): RssExternalApisManager { - if (!RssExternalApisManager.instance) { - RssExternalApisManager.instance = new RssExternalApisManager(); - } - return RssExternalApisManager.instance; + async getRssFeedDisplayName(feed: Pick): Promise { + const cacheKey = `${feed.type}:${feed.link}`; + const cached = await this.displayNameCache.get(cacheKey); + if (cached) { + return cached; } - - async getRssFeedDisplayName(feed: Pick): Promise { - const cacheKey = `${feed.type}:${feed.link}`; - const cached = await this.displayNameCache.get(cacheKey); - if (cached) { - return cached; - } - let displayName: string | undefined; - switch (feed.type) { - case "yt": - displayName = await this.youtubeRss.getDisplayName(feed.link); - break; - case "mc": - displayName = this.getMinecraftDisplayName(feed.link); - break; - default: - return undefined; - } - if (displayName) { - this.displayNameCache.set(cacheKey, displayName); - } - return displayName; + let displayName: string | undefined; + switch (feed.type) { + case "yt": + displayName = await this.youtubeRss.getDisplayName(feed.link); + break; + case "mc": + displayName = this.getMinecraftDisplayName(feed.link); + break; + default: + return undefined; } - - async testRssFeed(type: VALID_RSS_FEED_TYPES, url: string): Promise { - switch (type) { - case "yt": - return this.youtubeRss.getLastPost(url); - case "web": - return this.webRss.getLastPost(url); - default: - return undefined; - } + if (displayName) { + this.displayNameCache.set(cacheKey, displayName); } + return displayName; + } - private getMinecraftDisplayName(link: string): string { - if (link.endsWith(":")) { - return link.slice(0, -1); - } - return link; + async testRssFeed(type: T_VALID_RSS_FEED_TYPES, url: string): Promise { + switch (type) { + case "yt": + return this.youtubeRss.getLastPost(url); + case "web": + return this.webRss.getLastPost(url); + default: + return undefined; } + } + private getMinecraftDisplayName(link: string): string { + if (link.endsWith(":")) { + return link.slice(0, -1); + } + return link; + } } - diff --git a/src/types.d.ts b/src/types.d.ts index 0137d30..48a82f3 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,46 +1,46 @@ import { TokenInformation } from "./database/models/auth"; declare module "http" { - interface IncomingMessage { - _startTime: Date - } - interface ServerResponse { - _err?: string - } + interface IncomingMessage { + _startTime: Date; + } + interface ServerResponse { + _err?: string; + } } declare global { - namespace NodeJS { - interface ProcessEnv { - NODE_ENV?: "development" | "production"; - PORT?: string; - BETA: boolean; - DISCORD_CLIENT_ID: string; - DISCORD_CLIENT_SECRET: string; - DISCORD_REDIRECT_URI: string; - DISCORD_BOT_TOKEN: string; - DISCORD_ENTITY_ID: "0" | "1" | "2"; - DATABASE_HOST: string; - DATABASE_PORT?: string; - DATABASE_NAME: string; - DATABASE_USER: string; - DATABASE_PASSWORD: string; - JWT_SECRET_TOKEN: string; - CORS_ACCEPTED_DOMAINS: string; - JWT_TOKEN_EXPIRATION_DAYS?: string; - PROXY_LEVEL?: string; - YOUTUBE_API_KEY: string; - } + namespace NodeJS { + interface ProcessEnv { + NODE_ENV?: "development" | "production"; + PORT?: string; + BETA: boolean; + DISCORD_CLIENT_ID: string; + DISCORD_CLIENT_SECRET: string; + DISCORD_REDIRECT_URI: string; + DISCORD_BOT_TOKEN: string; + DISCORD_ENTITY_ID: "0" | "1" | "2"; + DATABASE_HOST: string; + DATABASE_PORT?: string; + DATABASE_NAME: string; + DATABASE_USER: string; + DATABASE_PASSWORD: string; + JWT_SECRET_TOKEN: string; + CORS_ACCEPTED_DOMAINS: string; + JWT_TOKEN_EXPIRATION_DAYS?: string; + PROXY_LEVEL?: string; + YOUTUBE_API_KEY: string; } + } } declare module "express" { - interface Response { - _err?: string - locals: { - user?: TokenInformation; - } - } + interface Response { + _err?: string; + locals: { + user?: TokenInformation; + }; + } } export {}; diff --git a/src/utils/cache_control.ts b/src/utils/cache_control.ts index c9ec023..4972d0e 100644 --- a/src/utils/cache_control.ts +++ b/src/utils/cache_control.ts @@ -1,5 +1,5 @@ import { Response } from "express"; export default function setCacheControl(res: Response, maxAge: number, staleWhileRevalidate = 86400) { - res.setHeader("Cache-Control", `public, max-age=${maxAge}, stale-while-revalidate=${staleWhileRevalidate}`); + res.setHeader("Cache-Control", `public, max-age=${maxAge}, stale-while-revalidate=${staleWhileRevalidate}`); } diff --git a/src/utils/date_formatter.ts b/src/utils/date_formatter.ts index c8ff4d1..49ee083 100644 --- a/src/utils/date_formatter.ts +++ b/src/utils/date_formatter.ts @@ -4,10 +4,10 @@ * @returns The formatted date */ export function formatDate(date: Date) { - const paddedDay = date.getDate().toString().padStart(2, "0"); - const paddedMonth = (date.getMonth() + 1).toString().padStart(2, "0"); - const paddedHours = date.getHours().toString().padStart(2, "0"); - const paddedMinutes = date.getMinutes().toString().padStart(2, "0"); - const paddedSeconds = date.getSeconds().toString().padStart(2, "0"); - return `${paddedDay}/${paddedMonth}/${date.getFullYear()} ${paddedHours}:${paddedMinutes}:${paddedSeconds}`; -} \ No newline at end of file + const paddedDay = date.getDate().toString().padStart(2, "0"); + const paddedMonth = (date.getMonth() + 1).toString().padStart(2, "0"); + const paddedHours = date.getHours().toString().padStart(2, "0"); + const paddedMinutes = date.getMinutes().toString().padStart(2, "0"); + const paddedSeconds = date.getSeconds().toString().padStart(2, "0"); + return `${paddedDay}/${paddedMonth}/${date.getFullYear()} ${paddedHours}:${paddedMinutes}:${paddedSeconds}`; +} diff --git a/src/utils/defaut_map.ts b/src/utils/defaut_map.ts index bba5fbf..5c2070b 100644 --- a/src/utils/defaut_map.ts +++ b/src/utils/defaut_map.ts @@ -1,15 +1,15 @@ export class MapWithDefault extends Map { - default: () => V; + default: () => V; - get(key: K): V { - if (!this.has(key)) { - this.set(key, this.default()); - } - return super.get(key) || this.default(); + get(key: K): V { + if (!this.has(key)) { + this.set(key, this.default()); } + return super.get(key) || this.default(); + } - constructor(defaultFunction: () => V) { - super(); - this.default = defaultFunction; - } + constructor(defaultFunction: () => V) { + super(); + this.default = defaultFunction; + } } diff --git a/src/utils/discord_message.d.ts b/src/utils/discord_message.d.ts index 9fe7b1f..ceab355 100644 --- a/src/utils/discord_message.d.ts +++ b/src/utils/discord_message.d.ts @@ -1,35 +1,34 @@ export interface DiscordEmbed { - title?: string; - description?: string; + title?: string; + description?: string; + url?: string; + timestamp?: Date; + color?: number; + footer?: { + text: string; + icon_url?: string; + }; + image?: { + url: string; + }; + thumbnail?: { + url: string; + }; + author?: { + name: string; url?: string; - timestamp?: Date; - color?: number; - footer?: { - text: string; - icon_url?: string; - }; - image?: { - url: string; - }; - thumbnail?: { - url: string; - }; - author?: { - name: string; - url?: string; - icon_url?: string; - }; - fields?: { - name: string; - value: string; - inline?: boolean; - }[]; + icon_url?: string; + }; + fields?: { + name: string; + value: string; + inline?: boolean; + }[]; } - export interface DiscordMessage { - content?: string; - embeds?: DiscordEmbed[]; - tts?: boolean; - flags?: number; -} \ No newline at end of file + content?: string; + embeds?: DiscordEmbed[]; + tts?: boolean; + flags?: number; +} diff --git a/src/utils/env_checks.ts b/src/utils/env_checks.ts index 4deea8e..62a354c 100644 --- a/src/utils/env_checks.ts +++ b/src/utils/env_checks.ts @@ -1,16 +1,16 @@ const requiredEnvVariables = [ - "DISCORD_CLIENT_ID", - "DISCORD_CLIENT_SECRET", - "DISCORD_REDIRECT_URI", - "DISCORD_ENTITY_ID", - "DISCORD_BOT_TOKEN", - "DATABASE_HOST", - "DATABASE_NAME", - "DATABASE_USER", - "DATABASE_PASSWORD", - "JWT_SECRET_TOKEN", - "CORS_ACCEPTED_DOMAINS", - "YOUTUBE_API_KEY", + "DISCORD_CLIENT_ID", + "DISCORD_CLIENT_SECRET", + "DISCORD_REDIRECT_URI", + "DISCORD_ENTITY_ID", + "DISCORD_BOT_TOKEN", + "DATABASE_HOST", + "DATABASE_NAME", + "DATABASE_USER", + "DATABASE_PASSWORD", + "JWT_SECRET_TOKEN", + "CORS_ACCEPTED_DOMAINS", + "YOUTUBE_API_KEY", ]; /** @@ -18,36 +18,36 @@ const requiredEnvVariables = [ * @returns true if all required environment variables are set, false otherwise. */ export function checkEnvironmentVariables() { - const missingVariables = requiredEnvVariables.filter(key => process.env[key] === undefined); - if (missingVariables.length > 0) { - console.error("FATAL ERROR: Missing environment variables:", missingVariables); - return false; - } + const missingVariables = requiredEnvVariables.filter((key) => process.env[key] === undefined); + if (missingVariables.length > 0) { + console.error("FATAL ERROR: Missing environment variables:", missingVariables); + return false; + } - if (process.env.PORT && isNaN(Number(process.env.PORT))) { - console.error("FATAL ERROR: PORT is not a number"); - return false; - } + if (process.env.PORT && isNaN(Number(process.env.PORT))) { + console.error("FATAL ERROR: PORT is not a number"); + return false; + } - if (process.env.DATABASE_PORT && isNaN(Number(process.env.DATABASE_PORT))) { - console.error("FATAL ERROR: DATABASE_PORT is not a number"); - return false; - } + if (process.env.DATABASE_PORT && isNaN(Number(process.env.DATABASE_PORT))) { + console.error("FATAL ERROR: DATABASE_PORT is not a number"); + return false; + } - if (![0, 1, 2].includes(Number(process.env.DISCORD_ENTITY_ID))) { - console.error("FATAL ERROR: DISCORD_ENTITY_ID is not 0, 1 or 2"); - return false; - } + if (![0, 1, 2].includes(Number(process.env.DISCORD_ENTITY_ID))) { + console.error("FATAL ERROR: DISCORD_ENTITY_ID is not 0, 1 or 2"); + return false; + } - if (process.env.JWT_SECRET_TOKEN.length < 15) { - console.error("FATAL ERROR: JWT_SECRET_TOKEN is too short"); - return false; - } + if (process.env.JWT_SECRET_TOKEN.length < 15) { + console.error("FATAL ERROR: JWT_SECRET_TOKEN is too short"); + return false; + } - if (process.env.PROXY_LEVEL && isNaN(Number(process.env.PROXY_LEVEL))) { - console.error("FATAL ERROR: PROXY_LEVEL is not a number"); - return false; - } + if (process.env.PROXY_LEVEL && isNaN(Number(process.env.PROXY_LEVEL))) { + console.error("FATAL ERROR: PROXY_LEVEL is not a number"); + return false; + } - return true; -} \ No newline at end of file + return true; +} diff --git a/tsconfig.json b/tsconfig.json index 84cd73c..8aeee20 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,11 +9,11 @@ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, "lib": [ "es2022", "DOM" - ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ @@ -25,8 +25,8 @@ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ - "rootDir": "src", /* Specify the root folder within your source files. */ + "module": "commonjs" /* Specify what module code is generated. */, + "rootDir": "src" /* Specify the root folder within your source files. */, // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ @@ -39,7 +39,7 @@ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ - "resolveJsonModule": true, /* Enable importing .json files. */ + "resolveJsonModule": true /* Enable importing .json files. */, // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ /* JavaScript Support */ @@ -53,7 +53,7 @@ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "build", /* Specify an output folder for all emitted files. */ + "outDir": "build" /* Specify an output folder for all emitted files. */, // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -74,20 +74,20 @@ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ + "strict": true /* Enable all strict type-checking options. */, // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + "strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */, // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedLocals": true /* Enable error reporting when local variables aren't read. */, // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ @@ -99,11 +99,11 @@ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true, /* Skip type checking all .d.ts files. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */, "plugins": [ { "transform": "typia/lib/transform" } ] } -} \ No newline at end of file +} From 57262618ecda05a14a6cf9a6f48a54e022e4cb90 Mon Sep 17 00:00:00 2001 From: ZRunner Date: Sat, 10 Oct 2026 00:31:11 +0200 Subject: [PATCH 08/13] feat(config): add rr_highest_only option --- src/database/guild-config/guild-config-options.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/database/guild-config/guild-config-options.json b/src/database/guild-config/guild-config-options.json index aee0362..73205f3 100644 --- a/src/database/guild-config/guild-config-options.json +++ b/src/database/guild-config/guild-config-options.json @@ -442,6 +442,17 @@ } ] }, + "rr_highest_only": { + "type": "boolean", + "default": false, + "is_listed": true, + "requires": [ + { + "option": "enable_xp", + "to_be": true + } + ] + }, "voice_xp_per_min": { "type": "int", "min": 0, From 9f737cec28e07de2dc860f6fad5d614676f0ac0c Mon Sep 17 00:00:00 2001 From: Z_runner Date: Mon, 19 Oct 2026 18:46:09 +0200 Subject: [PATCH 09/13] improve callback URL validation in docker endpoint Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/modules/docker/controler.ts | 45 ++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/modules/docker/controler.ts b/src/modules/docker/controler.ts index 9516aea..e8cdc14 100644 --- a/src/modules/docker/controler.ts +++ b/src/modules/docker/controler.ts @@ -5,6 +5,8 @@ import { DiscordMessage } from "../../utils/discord_message"; import { MinimalDockerPushEvent } from "./types"; const EMBED_COLOR = 0x0c49c2; +const DOCKER_HUB_ORIGIN = "https://registry.hub.docker.com"; +const DOCKER_HOOK_PATH_REGEX = /^\/u\/[^/]+\/[^/]+\/hook\/[^/]+\/?$/; function sendToDiscord(webhookPath: string, data: DiscordMessage) { return fetch(`https://discord.com/api/webhooks/${webhookPath}`, { @@ -16,12 +18,43 @@ function sendToDiscord(webhookPath: string, data: DiscordMessage) { }); } -function callbackDockerhub(callbackUrl: string) { - if (!callbackUrl.startsWith("https://registry.hub.docker.com/")) { - return Promise.reject(new Error("Invalid callback domain")); +function parseDockerHubUrl(input: string): URL { + if (input.length > 2000 || input !== input.trim()) { + throw new Error("Invalid callback URL"); } - return fetch(callbackUrl, { + + let url: URL; + try { + url = new URL(input); + } catch { + throw new Error("Invalid callback URL"); + } + + if ( + url.origin !== DOCKER_HUB_ORIGIN || + url.username !== "" || + url.password !== "" || + url.search !== "" || + url.hash !== "" + ) { + throw new Error("Invalid callback URL"); + } + + // Use allowlists for each path segment based on Docker Hub's actual callback format. + if (!DOCKER_HOOK_PATH_REGEX.test(url.pathname)) { + throw new Error("Invalid callback path"); + } + + return url; +} + +async function callbackDockerhub(callbackUrl: string) { + const safeCallbackUrl = parseDockerHubUrl(callbackUrl); + + const response = await fetch(safeCallbackUrl.toString(), { method: "POST", + redirect: "error", + signal: AbortSignal.timeout(5000), headers: { "Content-Type": "application/json", }, @@ -31,6 +64,10 @@ function callbackDockerhub(callbackUrl: string) { context: "Discord webhook forwarder", }), }); + + if (!response.ok) { + throw new Error(`Docker Hub callback failed with status ${response.status}`); + } } export async function postWebhookNotification(req: Request, res: Response) { From 9723c2eb2ad133e59b9ff0701df4d92c6b6fe72b Mon Sep 17 00:00:00 2001 From: ZRunner Date: Tue, 20 Oct 2026 19:04:15 +0200 Subject: [PATCH 10/13] feat(security): add robots.txt file --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index 8931018..9155fdb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -76,6 +76,10 @@ app.use( morgan("\x1b[94m[:date]\x1b[0m \x1b[93m:remote-addr\x1b[0m :method :status :url:err - :response-time ms"), ); +app.get("/robots.txt", (req, res) => { + res.type("text/plain").send("User-agent: *\nDisallow: /\n"); +}); + app.get("/", (req, res) => { res.send({ success: true, version: process.env.npm_package_version }); }); From cc600aecbdf03bc44151f1f25ea04203928b9e6d Mon Sep 17 00:00:00 2001 From: ZRunner Date: Tue, 20 Oct 2026 19:09:46 +0200 Subject: [PATCH 11/13] feat(security): only listen to localhost --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 9155fdb..6b72795 100644 --- a/src/index.ts +++ b/src/index.ts @@ -100,6 +100,6 @@ app.use(function (error: Error, req: Request, res: Response, next: NextFunction) } }); -app.listen(port, () => { +app.listen(port, "localhost", () => { console.info(`App V${process.env.npm_package_version} is running on http://localhost:${port} !`); }); From de5056346610e9e694d4fc36c1516ab88311e22a Mon Sep 17 00:00:00 2001 From: ZRunner Date: Tue, 20 Oct 2026 19:31:39 +0200 Subject: [PATCH 12/13] refact(index.ts): cleanup code --- src/index.ts | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/index.ts b/src/index.ts index 6b72795..bb152f2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,8 @@ -import bodyParser from "body-parser"; import ConsoleStamp from "console-stamp"; import dotenv from "dotenv"; dotenv.config(); +import { STATUS_CODES } from "http"; + import compression from "compression"; import cors from "cors"; import express, { NextFunction, Request, Response } from "express"; @@ -59,12 +60,12 @@ BigInt.prototype.toJSON = function () { return this.toString(); }; -app.use(bodyParser.json()); +app.use(express.json({ limit: "10kb" })); // set-up global rate limit const globalLimiter = rateLimit({ windowMs: 10 * 1000, // 10 seconds - max: 15, // Limit each IP to 15 requests per windowMs + limit: 15, // Limit each IP to 15 requests per windowMs standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers }); app.use(globalLimiter); @@ -81,7 +82,8 @@ app.get("/robots.txt", (req, res) => { }); app.get("/", (req, res) => { - res.send({ success: true, version: process.env.npm_package_version }); + console.info(`Received request for root endpoint; app version is ${process.env.npm_package_version}`); + res.send({ success: true }); }); app.use("/auth", AuthRouter); @@ -90,16 +92,26 @@ app.use("/discord", DiscordRouter); app.use("/docker", DockerRouter); app.use("/rss", RssRouter); -// Middleware to return a clean error message when the body is not a valid JSON -app.use(function (error: Error, req: Request, res: Response, next: NextFunction) { - if (error instanceof SyntaxError) { - res.status(400).send("Invalid JSON body"); - } else { - console.error(error.stack); - res.status(500).send("Internal server error"); - } +app.use((req, res) => { + res.status(404).json({ error: "Not found" }); }); +// Error handler (must stay last) +app.use( + (error: Error & { status?: number; type?: string }, req: Request, res: Response, next: NextFunction) => { + // Malformed JSON: keep the existing behaviour + if (error.type === "entity.parse.failed") { + res.status(400).send("Invalid JSON body"); + return; + } + + // Other client errors (413, 415...): status line only, no details + const status = error.status && error.status < 500 ? error.status : 500; + if (status === 500) console.error(error.stack); + res.status(status).send(status === 500 ? "Internal server error" : STATUS_CODES[status]); + }, +); + app.listen(port, "localhost", () => { console.info(`App V${process.env.npm_package_version} is running on http://localhost:${port} !`); }); From 31449d76ef9da93fba0374d3c723dd326d2b1d96 Mon Sep 17 00:00:00 2001 From: ZRunner Date: Tue, 20 Oct 2026 19:34:55 +0200 Subject: [PATCH 13/13] fix(security): use rate limiter before JSON parser --- src/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index bb152f2..3de510e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,6 +53,14 @@ app.disable("x-powered-by"); // compress all responses app.use(compression()); +// set-up global rate limit +const globalLimiter = rateLimit({ + windowMs: 10 * 1000, // 10 seconds + limit: 15, // Limit each IP to 15 requests per windowMs + standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers +}); +app.use(globalLimiter); + // Allow BigInt in JSON responses // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unreachable code error @@ -62,14 +70,6 @@ BigInt.prototype.toJSON = function () { app.use(express.json({ limit: "10kb" })); -// set-up global rate limit -const globalLimiter = rateLimit({ - windowMs: 10 * 1000, // 10 seconds - limit: 15, // Limit each IP to 15 requests per windowMs - standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers -}); -app.use(globalLimiter); - // log every request to the console morgan.token("date", (req) => formatDate(req._startTime)); morgan.token("err", (req, res) => (res._err ? ` - [${res._err}]` : "\u200b"));