From 86eab5ced8b264b743fbf3502d3581eb144c8401 Mon Sep 17 00:00:00 2001 From: yash12991 Date: Mon, 5 Jan 2026 22:59:39 +0530 Subject: [PATCH] feat: Add multi-format file upload support for RAG (PDF, TXT, JSON, TSV) - Add support for PDF, TXT, JSON, and TSV file formats in addition to CSV - Implement FileLoaderUtils class for handling multiple file formats - Add file upload functionality using multer middleware - Create comprehensive validation for uploaded files (type, size, format) - Update DataSet controller with automatic file format detection - Add new endpoint GET /api/v1/dataset/formats to list supported formats - Change upload endpoint from GET to POST with multipart/form-data - Add TypeScript types and interfaces for better type safety - Include test sample files for each supported format - Add comprehensive documentation in README.md - Implement automatic file cleanup after processing Dependencies added: - pdf-parse: For PDF document parsing - multer: For handling file uploads - @types/multer: TypeScript types for multer Breaking changes: - Upload endpoint changed from GET /upload to POST /upload - Now requires file upload via form-data instead of hardcoded path --- LocalMind-Backend/package-lock.json | 1559 ++++++++++++++++- LocalMind-Backend/package.json | 4 +- .../api/v1/DataSet/v1/DataSet.controller.ts | 97 +- .../api/v1/DataSet/v1/DataSet.fileLoader.ts | 237 +++ .../src/api/v1/DataSet/v1/DataSet.multer.ts | 59 + .../src/api/v1/DataSet/v1/DataSet.routes.ts | 22 +- .../src/api/v1/DataSet/v1/DataSet.type.ts | 48 + .../api/v1/DataSet/v1/DataSet.validator.ts | 119 ++ .../src/api/v1/DataSet/v1/README.md | 345 ++++ .../v1/DataSet/v1/test-samples/sample-qa.csv | 6 + .../v1/DataSet/v1/test-samples/sample-qa.json | 22 + .../v1/DataSet/v1/test-samples/sample-qa.tsv | 6 + .../v1/DataSet/v1/test-samples/sample-qa.txt | 14 + 13 files changed, 2502 insertions(+), 36 deletions(-) create mode 100644 LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.fileLoader.ts create mode 100644 LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.multer.ts create mode 100644 LocalMind-Backend/src/api/v1/DataSet/v1/README.md create mode 100644 LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.csv create mode 100644 LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.json create mode 100644 LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.tsv create mode 100644 LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.txt diff --git a/LocalMind-Backend/package-lock.json b/LocalMind-Backend/package-lock.json index 1a0cf64..84d816d 100644 --- a/LocalMind-Backend/package-lock.json +++ b/LocalMind-Backend/package-lock.json @@ -19,6 +19,7 @@ "@types/jsonwebtoken": "^9.0.10", "@types/mongoose": "^5.11.97", "@types/morgan": "^1.9.10", + "@types/multer": "^2.0.0", "argon2": "^0.44.0", "axios": "^1.12.2", "bcrypt": "^6.0.0", @@ -33,24 +34,30 @@ "langchain": "^0.3.36", "mongoose": "^8.19.1", "morgan": "^1.10.1", + "multer": "^2.0.2", "ngrok": "5.0.0-beta.2", "nodemailer": "^7.0.10", "ora": "^9.0.0", + "pdf-parse": "^2.4.5", "zod": "^4.1.12" }, "devDependencies": { "@babel/preset-typescript": "^7.27.1", + "@eslint/js": "^9.36.0", "@types/argon2": "^0.15.4", "@types/bcrypt": "^6.0.0", "@types/express": "^5.0.3", "@types/node": "^24.7.2", "@types/nodemailer": "^7.0.3", + "eslint": "^9.36.0", + "globals": "^16.4.0", "jest": "^30.2.0", "prettier": "3.6.2", "ts-jest": "^29.4.5", "ts-node": "^10.9.2", "ts-node-dev": "^2.0.0", - "typescript": "^5.9.3" + "typescript": "^5.9.3", + "typescript-eslint": "^8.45.0" } }, "node_modules/@aws-crypto/sha256-browser": { @@ -1479,6 +1486,211 @@ "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==", "license": "MIT" }, + "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==", + "dev": true, + "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==", + "dev": true, + "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==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.2.tgz", + "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@google/generative-ai": { "version": "0.24.1", "resolved": "https://registry.npmjs.org/@google/generative-ai/-/generative-ai-0.24.1.tgz", @@ -1528,6 +1740,58 @@ "node": ">=6" } }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.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==", + "dev": true, + "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==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -3037,6 +3301,190 @@ "sparse-bitfield": "^3.0.3" } }, + "node_modules/@napi-rs/canvas": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas/-/canvas-0.1.80.tgz", + "integrity": "sha512-DxuT1ClnIPts1kQx8FBmkk4BQDTfI5kIzywAaMjQSXfNnra5UFU9PwurXrl+Je3bJ6BGsp/zmshVVFbCmyI+ww==", + "license": "MIT", + "workspaces": [ + "e2e/*" + ], + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@napi-rs/canvas-android-arm64": "0.1.80", + "@napi-rs/canvas-darwin-arm64": "0.1.80", + "@napi-rs/canvas-darwin-x64": "0.1.80", + "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.80", + "@napi-rs/canvas-linux-arm64-gnu": "0.1.80", + "@napi-rs/canvas-linux-arm64-musl": "0.1.80", + "@napi-rs/canvas-linux-riscv64-gnu": "0.1.80", + "@napi-rs/canvas-linux-x64-gnu": "0.1.80", + "@napi-rs/canvas-linux-x64-musl": "0.1.80", + "@napi-rs/canvas-win32-x64-msvc": "0.1.80" + } + }, + "node_modules/@napi-rs/canvas-android-arm64": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-android-arm64/-/canvas-android-arm64-0.1.80.tgz", + "integrity": "sha512-sk7xhN/MoXeuExlggf91pNziBxLPVUqF2CAVnB57KLG/pz7+U5TKG8eXdc3pm0d7Od0WreB6ZKLj37sX9muGOQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-darwin-arm64": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-arm64/-/canvas-darwin-arm64-0.1.80.tgz", + "integrity": "sha512-O64APRTXRUiAz0P8gErkfEr3lipLJgM6pjATwavZ22ebhjYl/SUbpgM0xcWPQBNMP1n29afAC/Us5PX1vg+JNQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-darwin-x64": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-x64/-/canvas-darwin-x64-0.1.80.tgz", + "integrity": "sha512-FqqSU7qFce0Cp3pwnTjVkKjjOtxMqRe6lmINxpIZYaZNnVI0H5FtsaraZJ36SiTHNjZlUB69/HhxNDT1Aaa9vA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-arm-gnueabihf": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm-gnueabihf/-/canvas-linux-arm-gnueabihf-0.1.80.tgz", + "integrity": "sha512-eyWz0ddBDQc7/JbAtY4OtZ5SpK8tR4JsCYEZjCE3dI8pqoWUC8oMwYSBGCYfsx2w47cQgQCgMVRVTFiiO38hHQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-arm64-gnu": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-gnu/-/canvas-linux-arm64-gnu-0.1.80.tgz", + "integrity": "sha512-qwA63t8A86bnxhuA/GwOkK3jvb+XTQaTiVML0vAWoHyoZYTjNs7BzoOONDgTnNtr8/yHrq64XXzUoLqDzU+Uuw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-arm64-musl": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-musl/-/canvas-linux-arm64-musl-0.1.80.tgz", + "integrity": "sha512-1XbCOz/ymhj24lFaIXtWnwv/6eFHXDrjP0jYkc6iHQ9q8oXKzUX1Lc6bu+wuGiLhGh2GS/2JlfORC5ZcXimRcg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-riscv64-gnu": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-riscv64-gnu/-/canvas-linux-riscv64-gnu-0.1.80.tgz", + "integrity": "sha512-XTzR125w5ZMs0lJcxRlS1K3P5RaZ9RmUsPtd1uGt+EfDyYMu4c6SEROYsxyatbbu/2+lPe7MPHOO/0a0x7L/gw==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-x64-gnu": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-gnu/-/canvas-linux-x64-gnu-0.1.80.tgz", + "integrity": "sha512-BeXAmhKg1kX3UCrJsYbdQd3hIMDH/K6HnP/pG2LuITaXhXBiNdh//TVVVVCBbJzVQaV5gK/4ZOCMrQW9mvuTqA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-x64-musl": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-musl/-/canvas-linux-x64-musl-0.1.80.tgz", + "integrity": "sha512-x0XvZWdHbkgdgucJsRxprX/4o4sEed7qo9rCQA9ugiS9qE2QvP0RIiEugtZhfLH3cyI+jIRFJHV4Fuz+1BHHMg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-win32-x64-msvc": { + "version": "0.1.80", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-win32-x64-msvc/-/canvas-win32-x64-msvc-0.1.80.tgz", + "integrity": "sha512-Z8jPsM6df5V8B1HrCHB05+bDiCxjE9QA//3YrkKIdVDEwn5RKaqOxCJDRJkl48cJbylcrJbW4HxZbTte8juuPg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@napi-rs/wasm-runtime": { "version": "0.2.12", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz", @@ -4148,7 +4596,6 @@ "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": "*", @@ -4180,7 +4627,6 @@ "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": "*" @@ -4195,11 +4641,17 @@ "@types/express": "*" } }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, "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": { "@types/body-parser": "*", @@ -4211,7 +4663,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.1.0.tgz", "integrity": "sha512-jnHMsrd0Mwa9Cf4IdOzbz543y4XJepXrbia2T4b6+spXC2We3t1y6K44D3mR8XMFSXMCf3/l7rCgddfx7UNVBA==", - "dev": true, "license": "MIT", "dependencies": { "@types/node": "*", @@ -4230,7 +4681,6 @@ "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/@types/istanbul-lib-coverage": { @@ -4257,6 +4707,13 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/jsonwebtoken": { "version": "9.0.10", "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz", @@ -4301,6 +4758,15 @@ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, + "node_modules/@types/multer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/multer/-/multer-2.0.0.tgz", + "integrity": "sha512-C3Z9v9Evij2yST3RSBktxP9STm6OdMc5uR1xF1SGr98uv8dUlAL2hqwrZ3GVB3uyMyiegnscEK6PGtYvNrjTjw==", + "license": "MIT", + "dependencies": { + "@types/express": "*" + } + }, "node_modules/@types/node": { "version": "24.10.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.4.tgz", @@ -4335,14 +4801,12 @@ "version": "6.14.0", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", - "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/responselike": { @@ -4364,7 +4828,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", "integrity": "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==", - "dev": true, "license": "MIT", "dependencies": { "@types/node": "*" @@ -4374,7 +4837,6 @@ "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": { "@types/http-errors": "*", @@ -4431,20 +4893,279 @@ "@types/yargs-parser": "*" } }, - "node_modules/@types/yargs-parser": { - "version": "21.0.3", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", - "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", - "license": "MIT" - }, - "node_modules/@types/yauzl": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", - "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "license": "MIT" + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.52.0.tgz", + "integrity": "sha512-okqtOgqu2qmZJ5iN4TWlgfF171dZmx2FzdOv2K/ixL2LZWDStL8+JgQerI2sa8eAEfoydG9+0V96m7V+P8yE1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.52.0", + "@typescript-eslint/type-utils": "8.52.0", + "@typescript-eslint/utils": "8.52.0", + "@typescript-eslint/visitor-keys": "8.52.0", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.4.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.52.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.52.0.tgz", + "integrity": "sha512-iIACsx8pxRnguSYhHiMn2PvhvfpopO9FXHyn1mG5txZIsAaB6F0KwbFnUQN3KCiG3Jcuad/Cao2FAs1Wp7vAyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.52.0", + "@typescript-eslint/types": "8.52.0", + "@typescript-eslint/typescript-estree": "8.52.0", + "@typescript-eslint/visitor-keys": "8.52.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": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.52.0.tgz", + "integrity": "sha512-xD0MfdSdEmeFa3OmVqonHi+Cciab96ls1UhIF/qX/O/gPu5KXD0bY9lu33jj04fjzrXHcuvjBcBC+D3SNSadaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.52.0", + "@typescript-eslint/types": "^8.52.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.0.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.52.0.tgz", + "integrity": "sha512-ixxqmmCcc1Nf8S0mS0TkJ/3LKcC8mruYJPOU6Ia2F/zUUR4pApW7LzrpU3JmtePbRUTes9bEqRc1Gg4iyRnDzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.52.0", + "@typescript-eslint/visitor-keys": "8.52.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.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.52.0.tgz", + "integrity": "sha512-jl+8fzr/SdzdxWJznq5nvoI7qn2tNYV/ZBAEcaFMVXf+K6jmXvAFrgo/+5rxgnL152f//pDEAYAhhBAZGrVfwg==", + "dev": true, + "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.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.52.0.tgz", + "integrity": "sha512-JD3wKBRWglYRQkAtsyGz1AewDu3mTc7NtRjR/ceTyGoPqmdS5oCdx/oZMWD5Zuqmo6/MpsYs0wp6axNt88/2EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.52.0", + "@typescript-eslint/typescript-estree": "8.52.0", + "@typescript-eslint/utils": "8.52.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.4.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", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.52.0.tgz", + "integrity": "sha512-LWQV1V4q9V4cT4H5JCIx3481iIFxH1UkVk+ZkGGAV1ZGcjGI9IoFOfg3O6ywz8QqCDEp7Inlg6kovMofsNRaGg==", + "dev": true, + "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.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.52.0.tgz", + "integrity": "sha512-XP3LClsCc0FsTK5/frGjolyADTh3QmsLp6nKd476xNI9CsSsLnmn4f0jrzNoAulmxlmNIpeXuHYeEQv61Q6qeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.52.0", + "@typescript-eslint/tsconfig-utils": "8.52.0", + "@typescript-eslint/types": "8.52.0", + "@typescript-eslint/visitor-keys": "8.52.0", + "debug": "^4.4.3", + "minimatch": "^9.0.5", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.4.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.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.52.0.tgz", + "integrity": "sha512-wYndVMWkweqHpEpwPhwqE2lnD2DxC6WVLupU/DOt/0/v+/+iQbbzO3jOHjmBMnhu0DgLULvOaU4h4pwHYi2oRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.52.0", + "@typescript-eslint/types": "8.52.0", + "@typescript-eslint/typescript-estree": "8.52.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", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.52.0.tgz", + "integrity": "sha512-ink3/Zofus34nmBsPjow63FP5M7IGff0RKAgqR6+CFpdk22M7aLwC9gOcLGYqr7MczLPzZVERW9hRog3O4n1sQ==", + "dev": true, "license": "MIT", - "optional": true, "dependencies": { - "@types/node": "*" + "@typescript-eslint/types": "8.52.0", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, "node_modules/@ungap/structured-clone": { @@ -4765,6 +5486,16 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/acorn-walk": { "version": "8.3.4", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", @@ -4789,6 +5520,23 @@ "node": ">= 8.0.0" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "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", @@ -4844,6 +5592,12 @@ "node": ">= 8" } }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -5286,9 +6040,19 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, "license": "MIT" }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -5662,6 +6426,21 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "license": "MIT" }, + "node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, "node_modules/console-table-printer": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/console-table-printer/-/console-table-printer-2.15.0.tgz", @@ -5863,6 +6642,13 @@ } } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/deepmerge": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", @@ -6128,6 +6914,246 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint": { + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.2.tgz", + "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.2", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "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", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "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/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -6141,6 +7167,52 @@ "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==", + "dev": true, + "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==", + "dev": true, + "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==", + "dev": true, + "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==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -6310,6 +7382,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", @@ -6332,6 +7411,13 @@ "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==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-xml-parser": { "version": "5.2.5", "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.2.5.tgz", @@ -6378,6 +7464,24 @@ "pend": "~1.2.0" } }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, "node_modules/figlet": { "version": "1.9.4", "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.9.4.tgz", @@ -6402,6 +7506,19 @@ "node": ">=20" } }, + "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==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -6466,6 +7583,27 @@ "flat": "cli.js" } }, + "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==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, "node_modules/follow-redirects": { "version": "1.15.11", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", @@ -6744,6 +7882,19 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/globals": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -7048,6 +8199,33 @@ "node": ">= 4" } }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "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/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", @@ -8687,6 +9865,20 @@ "dev": true, "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", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "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==", + "dev": true, + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -8984,6 +10176,20 @@ "node": ">=6" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -9092,6 +10298,13 @@ "dev": true, "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==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", @@ -9324,7 +10537,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9501,6 +10713,79 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, + "node_modules/multer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-2.0.2.tgz", + "integrity": "sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.6.0", + "concat-stream": "^2.0.0", + "mkdirp": "^0.5.6", + "object-assign": "^4.1.1", + "type-is": "^1.6.18", + "xtend": "^4.0.2" + }, + "engines": { + "node": ">= 10.16.0" + } + }, + "node_modules/multer/node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/multer/node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mustache": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", @@ -12642,6 +13927,15 @@ "inBundle": true, "license": "ISC" }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", @@ -12745,6 +14039,24 @@ "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==", "license": "MIT" }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "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": "9.0.0", "resolved": "https://registry.npmjs.org/ora/-/ora-9.0.0.tgz", @@ -12929,6 +14241,19 @@ "dev": true, "license": "BlueOak-1.0.0" }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -13037,6 +14362,38 @@ "node": ">=8" } }, + "node_modules/pdf-parse": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/pdf-parse/-/pdf-parse-2.4.5.tgz", + "integrity": "sha512-mHU89HGh7v+4u2ubfnevJ03lmPgQ5WU4CxAVmTSh/sxVTEDYd1er/dKS/A6vg77NX47KTEoihq8jZBLr8Cxuwg==", + "license": "Apache-2.0", + "dependencies": { + "@napi-rs/canvas": "0.1.80", + "pdfjs-dist": "5.4.296" + }, + "bin": { + "pdf-parse": "bin/cli.mjs" + }, + "engines": { + "node": ">=20.16.0 <21 || >=22.3.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/mehmet-kozan" + } + }, + "node_modules/pdfjs-dist": { + "version": "5.4.296", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-5.4.296.tgz", + "integrity": "sha512-DlOzet0HO7OEnmUmB6wWGJrrdvbyJKftI1bhMitK7O2N8W2gc757yyYBbINy9IDafXAV9wmKr9t7xsTaNKRG5Q==", + "license": "Apache-2.0", + "engines": { + "node": ">=20.16.0 || >=22.3.0" + }, + "optionalDependencies": { + "@napi-rs/canvas": "^0.1.80" + } + }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -13092,6 +14449,16 @@ "node": ">=8" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/prettier": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", @@ -13294,6 +14661,20 @@ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "license": "MIT" }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -13942,6 +15323,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -14182,6 +15580,36 @@ "node": "*" } }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -14231,6 +15659,19 @@ "tree-kill": "cli.js" } }, + "node_modules/ts-api-utils": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.4.0.tgz", + "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/ts-error": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/ts-error/-/ts-error-1.0.6.tgz", @@ -14445,6 +15886,19 @@ "node": "*" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -14480,6 +15934,12 @@ "node": ">= 0.6" } }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, "node_modules/typescript": { "version": "5.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", @@ -14494,6 +15954,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.52.0.tgz", + "integrity": "sha512-atlQQJ2YkO4pfTVQmQ+wvYQwexPDOIgo+RaVcD7gHgzy/IQA+XTyuxNM9M9TVXvttkF7koBHmcwisKdOAf2EcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.52.0", + "@typescript-eslint/parser": "8.52.0", + "@typescript-eslint/typescript-estree": "8.52.0", + "@typescript-eslint/utils": "8.52.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", + "typescript": ">=4.8.4 <6.0.0" + } + }, "node_modules/uglify-js": { "version": "3.19.3", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", @@ -14588,6 +16072,22 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "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", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, "node_modules/uuid": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", @@ -14745,6 +16245,16 @@ "node": ">=8" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -14841,7 +16351,6 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.4" diff --git a/LocalMind-Backend/package.json b/LocalMind-Backend/package.json index bb5d7bf..464c700 100644 --- a/LocalMind-Backend/package.json +++ b/LocalMind-Backend/package.json @@ -54,8 +54,8 @@ "@types/jsonwebtoken": "^9.0.10", "@types/mongoose": "^5.11.97", "@types/morgan": "^1.9.10", + "@types/multer": "^2.0.0", "argon2": "^0.44.0", - "bcrypt": "^5.1.1", "axios": "^1.12.2", "bcrypt": "^6.0.0", "chalk": "^5.6.2", @@ -69,9 +69,11 @@ "langchain": "^0.3.36", "mongoose": "^8.19.1", "morgan": "^1.10.1", + "multer": "^2.0.2", "ngrok": "5.0.0-beta.2", "nodemailer": "^7.0.10", "ora": "^9.0.0", + "pdf-parse": "^2.4.5", "zod": "^4.1.12" } } diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.controller.ts b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.controller.ts index 834f41c..9a1e1a0 100644 --- a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.controller.ts +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.controller.ts @@ -1,27 +1,106 @@ import { Request, Response } from 'express' - -import { CSVLoader } from '@langchain/community/document_loaders/fs/csv' import path from 'path' +import * as fs from 'fs' import { SendResponse } from '../../../../utils/SendResponse.utils' import DataSetService from './DataSet.service' +import FileLoaderUtils from './DataSet.fileLoader' +import { FileFormat } from './DataSet.type' class DataSetController { + /** + * Upload and process dataset with support for multiple file formats + * Supports: CSV, PDF, TXT, JSON, TSV + */ public async uploadDataSet(req: Request, res: Response): Promise { try { - const filePath = path.join(path.resolve(), 'src', 'data', 'Sample.csv') + // Check if file was uploaded + if (!req.file) { + SendResponse.error(res, 'No file uploaded', 400) + return + } + + const uploadedFile = req.file + const filePath = uploadedFile.path + + // Detect file format + const fileFormat = FileLoaderUtils.detectFileFormat( + uploadedFile.originalname, + uploadedFile.mimetype + ) + + if (!fileFormat) { + // Clean up uploaded file + if (fs.existsSync(filePath)) { + fs.unlinkSync(filePath) + } + SendResponse.error( + res, + 'Unsupported file format. Supported formats: CSV, PDF, TXT, JSON, TSV', + 400 + ) + return + } + + // Load documents from file + const documents = await FileLoaderUtils.loadFile(filePath, fileFormat) + + if (!documents || documents.length === 0) { + if (fs.existsSync(filePath)) { + fs.unlinkSync(filePath) + } + SendResponse.error(res, 'No data found in the uploaded file', 400) + return + } - const loader = new CSVLoader(filePath) - const documents = await loader.load() + // Process the dataset + const processedData = await DataSetService.Prepate_DataSet(documents) - const Prepare_dataSet = await DataSetService.Prepate_DataSet(documents) + // Clean up uploaded file after processing + if (fs.existsSync(filePath)) { + fs.unlinkSync(filePath) + } SendResponse.success( res, - 'Dataset uploaded and processed successfully', - JSON.parse(Prepare_dataSet) + `Dataset uploaded and processed successfully (Format: ${fileFormat.toUpperCase()})`, + JSON.parse(processedData) ) } catch (error: any) { - SendResponse.error(res, 'Failed to upload dataset', 500, error) + // Clean up uploaded file on error + if (req.file && fs.existsSync(req.file.path)) { + fs.unlinkSync(req.file.path) + } + SendResponse.error( + res, + 'Failed to upload and process dataset', + 500, + error.message + ) + } + } + + /** + * Get list of supported file formats + */ + public async getSupportedFormats( + req: Request, + res: Response + ): Promise { + try { + const formats = Object.values(FileFormat) + SendResponse.success(res, 'Supported file formats', { + formats, + description: { + csv: 'Comma-separated values file', + xlsx: 'Excel spreadsheet (not yet fully supported)', + tsv: 'Tab-separated values file', + json: 'JSON file with Q&A pairs', + pdf: 'PDF document', + txt: 'Plain text file', + }, + }) + } catch (error: any) { + SendResponse.error(res, 'Failed to get supported formats', 500, error) } } } diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.fileLoader.ts b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.fileLoader.ts new file mode 100644 index 0000000..f8717b1 --- /dev/null +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.fileLoader.ts @@ -0,0 +1,237 @@ +import { CSVLoader } from '@langchain/community/document_loaders/fs/csv' +import { PDFLoader } from '@langchain/community/document_loaders/fs/pdf' +import { Document } from '@langchain/core/documents' +import { FileFormat, UploadedFileMetadata } from './DataSet.type' +import * as fs from 'fs' +import * as path from 'path' + +/** + * File loader class to handle different file formats + */ +class FileLoaderUtils { + /** + * Detect file format from file extension or MIME type + */ + public detectFileFormat(filename: string, mimeType?: string): FileFormat | null { + const extension = path.extname(filename).toLowerCase().slice(1) + + const formatMap: Record = { + csv: FileFormat.CSV, + xlsx: FileFormat.XLSX, + xls: FileFormat.XLSX, + tsv: FileFormat.TSV, + json: FileFormat.JSON, + pdf: FileFormat.PDF, + txt: FileFormat.TXT, + } + + // Try by extension first + if (formatMap[extension]) { + return formatMap[extension] + } + + // Try by MIME type + if (mimeType) { + const mimeFormatMap: Record = { + 'text/csv': FileFormat.CSV, + 'application/vnd.ms-excel': FileFormat.XLSX, + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': + FileFormat.XLSX, + 'text/tab-separated-values': FileFormat.TSV, + 'application/json': FileFormat.JSON, + 'application/pdf': FileFormat.PDF, + 'text/plain': FileFormat.TXT, + } + + if (mimeFormatMap[mimeType]) { + return mimeFormatMap[mimeType] + } + } + + return null + } + + /** + * Load documents from a CSV file + */ + private async loadCSV(filePath: string): Promise { + const loader = new CSVLoader(filePath) + return await loader.load() + } + + /** + * Load documents from a PDF file + */ + private async loadPDF(filePath: string): Promise { + const loader = new PDFLoader(filePath, { + splitPages: false, // Load entire PDF as one document + }) + return await loader.load() + } + + /** + * Load documents from a TXT file + */ + private async loadTXT(filePath: string): Promise { + try { + const fileContent = fs.readFileSync(filePath, 'utf-8') + + // Split by double newlines to separate Q&A pairs or paragraphs + const sections = fileContent + .split(/\n\n+/) + .filter((section) => section.trim().length > 0) + + if (sections.length === 0) { + // If no double newlines, treat entire content as one document + return [ + new Document({ + pageContent: fileContent, + metadata: { source: filePath }, + }), + ] + } + + // Create a document for each section + const documents = sections.map((section, index) => { + return new Document({ + pageContent: section.trim(), + metadata: { source: filePath, section: index }, + }) + }) + + return documents + } catch (error) { + throw new Error(`Failed to load TXT file: ${error}`) + } + } + + /** + * Load documents from a JSON file + */ + private async loadJSON(filePath: string): Promise { + try { + // Read the JSON file + const fileContent = fs.readFileSync(filePath, 'utf-8') + const jsonData = JSON.parse(fileContent) + + // Check if it's an array of Q&A pairs + if (Array.isArray(jsonData)) { + // Convert array to documents + const documents = jsonData.map((item, index) => { + const pageContent = JSON.stringify(item) + return new Document({ + pageContent, + metadata: { source: filePath, row: index }, + }) + }) + return documents + } + + // If it's a single object, wrap it in an array + const pageContent = JSON.stringify(jsonData) + return [ + new Document({ + pageContent, + metadata: { source: filePath }, + }), + ] + } catch (error) { + throw new Error(`Failed to parse JSON file: ${error}`) + } + } + + /** + * Load documents from a TSV file + */ + private async loadTSV(filePath: string): Promise { + // TSV is similar to CSV but with tab delimiter + const loader = new CSVLoader(filePath, { + separator: '\t', + }) + return await loader.load() + } + + /** + * Main method to load file based on format + */ + public async loadFile( + filePath: string, + format: FileFormat + ): Promise { + // Validate file exists + if (!fs.existsSync(filePath)) { + throw new Error(`File not found: ${filePath}`) + } + + try { + switch (format) { + case FileFormat.CSV: + return await this.loadCSV(filePath) + + case FileFormat.PDF: + return await this.loadPDF(filePath) + + case FileFormat.TXT: + return await this.loadTXT(filePath) + + case FileFormat.JSON: + return await this.loadJSON(filePath) + + case FileFormat.TSV: + return await this.loadTSV(filePath) + + case FileFormat.XLSX: + // For Excel files, you'll need to convert to CSV first + // or use a library like 'xlsx' to parse them + throw new Error( + 'XLSX format not yet implemented. Please convert to CSV.' + ) + + default: + throw new Error(`Unsupported file format: ${format}`) + } + } catch (error) { + throw new Error(`Failed to load file: ${error}`) + } + } + + /** + * Get file metadata + */ + public getFileMetadata(filePath: string): UploadedFileMetadata { + const stats = fs.statSync(filePath) + const filename = path.basename(filePath) + const format = this.detectFileFormat(filename) + + if (!format) { + throw new Error(`Unable to detect file format for: ${filename}`) + } + + return { + originalName: filename, + mimeType: this.getMimeType(format), + size: stats.size, + path: filePath, + format, + } + } + + /** + * Get MIME type from file format + */ + private getMimeType(format: FileFormat): string { + const mimeTypes: Record = { + [FileFormat.CSV]: 'text/csv', + [FileFormat.XLSX]: + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + [FileFormat.TSV]: 'text/tab-separated-values', + [FileFormat.JSON]: 'application/json', + [FileFormat.PDF]: 'application/pdf', + [FileFormat.TXT]: 'text/plain', + } + + return mimeTypes[format] || 'application/octet-stream' + } +} + +export default new FileLoaderUtils() diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.multer.ts b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.multer.ts new file mode 100644 index 0000000..c28a3e3 --- /dev/null +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.multer.ts @@ -0,0 +1,59 @@ +import multer from 'multer' +import path from 'path' +import * as fs from 'fs' + +// Ensure uploads directory exists +const uploadsDir = path.join(process.cwd(), 'uploads', 'datasets') +if (!fs.existsSync(uploadsDir)) { + fs.mkdirSync(uploadsDir, { recursive: true }) +} + +// Configure storage +const storage = multer.diskStorage({ + destination: (req, file, cb) => { + cb(null, uploadsDir) + }, + filename: (req, file, cb) => { + // Generate unique filename with timestamp + const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1e9) + const ext = path.extname(file.originalname) + const basename = path.basename(file.originalname, ext) + cb(null, `${basename}-${uniqueSuffix}${ext}`) + }, +}) + +// File filter to accept only specific file types +const fileFilter = ( + req: Express.Request, + file: Express.Multer.File, + cb: multer.FileFilterCallback +) => { + const allowedMimeTypes = [ + 'text/csv', + 'application/pdf', + 'text/plain', + 'application/json', + 'text/tab-separated-values', + 'application/vnd.ms-excel', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + ] + + if (allowedMimeTypes.includes(file.mimetype)) { + cb(null, true) + } else { + cb( + new Error( + 'Invalid file type. Only CSV, PDF, TXT, JSON, and TSV files are allowed.' + ) + ) + } +} + +// Configure multer +export const upload = multer({ + storage, + fileFilter, + limits: { + fileSize: 10 * 1024 * 1024, // 10MB max file size + }, +}) diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.routes.ts b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.routes.ts index 4fe3502..c453523 100644 --- a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.routes.ts +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.routes.ts @@ -1,7 +1,27 @@ import { Router } from 'express' import DataSetController from './DataSet.controller' +import DataSetValidator from './DataSet.validator' +import { upload } from './DataSet.multer' + const router: Router = Router() -router.get('/upload', DataSetController.uploadDataSet) +/** + * @route POST /api/v1/dataset/upload + * @desc Upload and process a dataset file (CSV, PDF, TXT, JSON, TSV) + * @access Public (add authentication if needed) + */ +router.post( + '/upload', + upload.single('file'), // 'file' is the field name for the uploaded file + DataSetValidator.validateFileUpload, + DataSetController.uploadDataSet +) + +/** + * @route GET /api/v1/dataset/formats + * @desc Get list of supported file formats + * @access Public + */ +router.get('/formats', DataSetController.getSupportedFormats) export { router as DataSetRoutes } diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.type.ts b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.type.ts index e69de29..7061a17 100644 --- a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.type.ts +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.type.ts @@ -0,0 +1,48 @@ +/** + * Supported file formats for dataset upload + */ +export enum FileFormat { + CSV = 'csv', + XLSX = 'xlsx', + TSV = 'tsv', + JSON = 'json', + PDF = 'pdf', + TXT = 'txt', +} + +/** + * Interface for question-answer pair extracted from dataset + */ +export interface QuestionAnswerPair { + question: string + answer: string +} + +/** + * Interface for validation error + */ +export interface ValidationError { + row?: number + fieldName: string + error_message: string +} + +/** + * Interface for dataset processing result + */ +export interface DataSetProcessingResult { + success: boolean + data?: QuestionAnswerPair[] + errors?: ValidationError[] +} + +/** + * Interface for file upload metadata + */ +export interface UploadedFileMetadata { + originalName: string + mimeType: string + size: number + path: string + format: FileFormat +} diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.validator.ts b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.validator.ts index e69de29..9395e65 100644 --- a/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.validator.ts +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/DataSet.validator.ts @@ -0,0 +1,119 @@ +import { Request, Response, NextFunction } from 'express' +import { SendResponse } from '../../../../utils/SendResponse.utils' +import { FileFormat } from './DataSet.type' + +/** + * File upload validation middleware + */ +class DataSetValidator { + /** + * Allowed file extensions + */ + private readonly ALLOWED_EXTENSIONS = ['.csv', '.pdf', '.txt', '.json', '.tsv'] + + /** + * Allowed MIME types + */ + private readonly ALLOWED_MIME_TYPES = [ + 'text/csv', + 'application/pdf', + 'text/plain', + 'application/json', + 'text/tab-separated-values', + 'application/vnd.ms-excel', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + ] + + /** + * Maximum file size (10MB) + */ + private readonly MAX_FILE_SIZE = 10 * 1024 * 1024 // 10MB in bytes + + /** + * Validate uploaded file + */ + public validateFileUpload = ( + req: Request, + res: Response, + next: NextFunction + ): void => { + try { + // Check if file exists in request + if (!req.file) { + SendResponse.error(res, 'No file uploaded', 400) + return + } + + const file = req.file + + // Validate file size + if (file.size > this.MAX_FILE_SIZE) { + SendResponse.error( + res, + `File size exceeds maximum limit of ${this.MAX_FILE_SIZE / (1024 * 1024)}MB`, + 400 + ) + return + } + + // Validate file size (minimum) + if (file.size === 0) { + SendResponse.error(res, 'Uploaded file is empty', 400) + return + } + + // Validate file extension + const fileExtension = file.originalname + .toLowerCase() + .substring(file.originalname.lastIndexOf('.')) + + if (!this.ALLOWED_EXTENSIONS.includes(fileExtension)) { + SendResponse.error( + res, + `Invalid file extension. Allowed extensions: ${this.ALLOWED_EXTENSIONS.join(', ')}`, + 400 + ) + return + } + + // Validate MIME type + if (!this.ALLOWED_MIME_TYPES.includes(file.mimetype)) { + SendResponse.error( + res, + `Invalid file type. Allowed types: ${this.ALLOWED_MIME_TYPES.join(', ')}`, + 400 + ) + return + } + + // All validations passed + next() + } catch (error: any) { + SendResponse.error(res, 'File validation failed', 400, error.message) + } + } + + /** + * Validate file format parameter + */ + public validateFileFormat = ( + req: Request, + res: Response, + next: NextFunction + ): void => { + const { format } = req.query + + if (format && !Object.values(FileFormat).includes(format as FileFormat)) { + SendResponse.error( + res, + `Invalid format. Supported formats: ${Object.values(FileFormat).join(', ')}`, + 400 + ) + return + } + + next() + } +} + +export default new DataSetValidator() diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/README.md b/LocalMind-Backend/src/api/v1/DataSet/v1/README.md new file mode 100644 index 0000000..07debf3 --- /dev/null +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/README.md @@ -0,0 +1,345 @@ +# RAG Dataset Enhancement - Multi-Format File Upload Support + +## ๐ŸŽฏ Overview + +This feature adds support for multiple file formats to the LocalMind RAG (Retrieval-Augmented Generation) system, enabling users to upload and process datasets in various formats beyond the original CSV support. + +## โœจ New Features + +### Supported File Formats + +| Format | Extension | Description | Status | +|--------|-----------|-------------|--------| +| **CSV** | `.csv` | Comma-separated values | โœ… Supported | +| **JSON** | `.json` | JSON file with Q&A pairs | โœ… **NEW** | +| **PDF** | `.pdf` | PDF documents | โœ… **NEW** | +| **TXT** | `.txt` | Plain text files | โœ… **NEW** | +| **TSV** | `.tsv` | Tab-separated values | โœ… **NEW** | +| **XLSX** | `.xlsx` | Excel spreadsheet | ๐Ÿ”œ Coming Soon | + +## ๐Ÿ—๏ธ Architecture + +### New Files Created + +``` +LocalMind-Backend/src/api/v1/DataSet/v1/ +โ”œโ”€โ”€ DataSet.type.ts # TypeScript interfaces and enums (NEW) +โ”œโ”€โ”€ DataSet.fileLoader.ts # File loader utility for all formats (NEW) +โ”œโ”€โ”€ DataSet.multer.ts # Multer configuration for file uploads (NEW) +โ”œโ”€โ”€ DataSet.validator.ts # File validation middleware (UPDATED) +โ”œโ”€โ”€ DataSet.controller.ts # Updated controller with multi-format support (UPDATED) +โ”œโ”€โ”€ DataSet.routes.ts # Updated routes with POST endpoint (UPDATED) +โ”œโ”€โ”€ DataSet.service.ts # Service layer (EXISTING) +โ”œโ”€โ”€ DataSet.utils.ts # Utility functions (EXISTING) +โ””โ”€โ”€ test-samples/ # Sample test files (NEW) + โ”œโ”€โ”€ sample-qa.csv + โ”œโ”€โ”€ sample-qa.json + โ”œโ”€โ”€ sample-qa.txt + โ””โ”€โ”€ sample-qa.tsv +``` + +## ๐Ÿ“ฆ New Dependencies + +- `pdf-parse` - PDF parsing library +- `multer` - File upload middleware +- `@types/multer` - TypeScript types for multer + +## ๐Ÿš€ Usage + +### API Endpoints + +#### 1. Upload Dataset + +**Endpoint:** `POST /api/v1/dataset/upload` + +**Description:** Upload and process a dataset file + +**Request:** +- Method: `POST` +- Content-Type: `multipart/form-data` +- Body: Form data with `file` field + +**Example using cURL:** + +```bash +# Upload CSV file +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.csv" + +# Upload JSON file +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.json" + +# Upload PDF file +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.pdf" + +# Upload TXT file +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.txt" + +# Upload TSV file +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.tsv" +``` + +**Example using JavaScript (Fetch API):** + +```javascript +const formData = new FormData(); +formData.append('file', fileInput.files[0]); + +fetch('http://localhost:5000/api/v1/dataset/upload', { + method: 'POST', + body: formData +}) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); +``` + +**Response (Success):** + +```json +{ + "success": true, + "message": "Dataset uploaded and processed successfully (Format: JSON)", + "data": [ + { + "question": "What is React?", + "answer": "React is a JavaScript library for building user interfaces..." + } + ] +} +``` + +**Response (Error):** + +```json +{ + "success": false, + "message": "No file uploaded", + "error": null +} +``` + +#### 2. Get Supported Formats + +**Endpoint:** `GET /api/v1/dataset/formats` + +**Description:** Get list of all supported file formats + +**Example:** + +```bash +curl http://localhost:5000/api/v1/dataset/formats +``` + +**Response:** + +```json +{ + "success": true, + "message": "Supported file formats", + "data": { + "formats": ["csv", "xlsx", "tsv", "json", "pdf", "txt"], + "description": { + "csv": "Comma-separated values file", + "xlsx": "Excel spreadsheet (not yet fully supported)", + "tsv": "Tab-separated values file", + "json": "JSON file with Q&A pairs", + "pdf": "PDF document", + "txt": "Plain text file" + } + } +} +``` + +## ๐Ÿ“‹ File Format Requirements + +### CSV Format + +```csv +question,answer +"What is AI?","Artificial intelligence is..." +``` + +### JSON Format + +```json +[ + { + "question": "What is AI?", + "answer": "Artificial intelligence is..." + } +] +``` + +### TXT Format + +```text +Q: What is AI? +A: Artificial intelligence is... + +Q: What is ML? +A: Machine learning is... +``` + +### TSV Format + +```tsv +question answer +What is AI? Artificial intelligence is... +``` + +### PDF Format + +Any standard PDF document. The text will be extracted and processed. + +## ๐Ÿ”’ Validation Rules + +- **Maximum file size:** 10MB +- **Minimum file size:** Must not be empty +- **Allowed extensions:** `.csv`, `.pdf`, `.txt`, `.json`, `.tsv` +- **Allowed MIME types:** + - `text/csv` + - `application/pdf` + - `text/plain` + - `application/json` + - `text/tab-separated-values` + +## ๐Ÿงช Testing + +### Manual Testing + +1. Start the backend server: +```bash +cd LocalMind-Backend +npm run dev +``` + +2. Test with sample files: +```bash +# From the test-samples directory +cd src/api/v1/DataSet/v1/test-samples + +# Test CSV +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.csv" + +# Test JSON +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.json" + +# Test TXT +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.txt" + +# Test TSV +curl -X POST http://localhost:5000/api/v1/dataset/upload \ + -F "file=@sample-qa.tsv" +``` + +### Using Postman + +1. Open Postman +2. Create a new POST request to `http://localhost:5000/api/v1/dataset/upload` +3. Go to Body โ†’ form-data +4. Add key `file` with type `File` +5. Choose a file from test-samples +6. Send the request + +## ๐Ÿ› ๏ธ Code Structure + +### FileLoaderUtils Class + +Handles loading different file formats: + +```typescript +class FileLoaderUtils { + detectFileFormat(filename: string, mimeType?: string): FileFormat | null + loadFile(filePath: string, format: FileFormat): Promise + getFileMetadata(filePath: string): UploadedFileMetadata +} +``` + +### DataSetValidator Class + +Validates uploaded files: + +```typescript +class DataSetValidator { + validateFileUpload(req, res, next): void + validateFileFormat(req, res, next): void +} +``` + +### Updated DataSetController + +```typescript +class DataSetController { + uploadDataSet(req, res): Promise // Updated with multi-format support + getSupportedFormats(req, res): Promise // New endpoint +} +``` + +## ๐Ÿšจ Error Handling + +The system handles various error scenarios: + +- **No file uploaded:** Returns 400 error +- **File too large:** Returns 400 error with size limit info +- **Invalid file type:** Returns 400 error with allowed types +- **Empty file:** Returns 400 error +- **File processing error:** Returns 500 error with details +- **File upload cleanup:** Automatically removes uploaded files after processing or on error + +## ๐Ÿ”„ Migration Notes + +### Breaking Changes + +- **Route change:** The upload endpoint changed from `GET /upload` to `POST /upload` +- **File upload required:** Now requires file upload via multipart/form-data instead of hardcoded file path + +### Backward Compatibility + +The old CSV functionality is fully preserved and enhanced with new formats. + +## ๐Ÿ“ˆ Future Enhancements + +- [ ] Full Excel (.xlsx) support with xlsx library +- [ ] Support for Word documents (.docx) +- [ ] Support for markdown files (.md) +- [ ] Batch file upload +- [ ] File preview before processing +- [ ] Progress tracking for large files +- [ ] Database storage for uploaded datasets +- [ ] Dataset versioning +- [ ] Export processed data + +## ๐Ÿค Contributing + +To contribute to this feature: + +1. Follow the branch naming convention: `username-feature-name` +2. Test all file formats before submitting PR +3. Update documentation if adding new formats +4. Ensure TypeScript types are properly defined +5. Add error handling for edge cases + +## ๐Ÿ“ License + +This feature is part of LocalMind and follows the same license (MIT). + +## ๐Ÿ‘ค Author + +- **GitHub:** @yash12991 +- **Branch:** `yash12991-add-pdf-txt-json-rag-support` +- **Feature:** RAG Multi-Format File Upload Support + +## ๐Ÿ“ž Support + +For issues or questions: +- Open an issue on GitHub +- Check existing documentation +- Review test samples for format examples diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.csv b/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.csv new file mode 100644 index 0000000..8e5676b --- /dev/null +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.csv @@ -0,0 +1,6 @@ +question,answer +"What is artificial intelligence?","Artificial intelligence (AI) is the simulation of human intelligence processes by machines, especially computer systems." +"What is machine learning?","Machine learning is a subset of AI that enables systems to learn and improve from experience without being explicitly programmed." +"What is deep learning?","Deep learning is a subset of machine learning that uses neural networks with multiple layers to analyze various factors of data." +"What is natural language processing?","Natural language processing (NLP) is a branch of AI that helps computers understand, interpret, and manipulate human language." +"What is computer vision?","Computer vision is a field of AI that trains computers to interpret and understand the visual world from digital images or videos." diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.json b/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.json new file mode 100644 index 0000000..af22ccc --- /dev/null +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.json @@ -0,0 +1,22 @@ +[ + { + "question": "What is React?", + "answer": "React is a JavaScript library for building user interfaces, developed by Facebook." + }, + { + "question": "What is Node.js?", + "answer": "Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine that allows you to run JavaScript on the server." + }, + { + "question": "What is TypeScript?", + "answer": "TypeScript is a typed superset of JavaScript that compiles to plain JavaScript, adding optional static typing." + }, + { + "question": "What is MongoDB?", + "answer": "MongoDB is a NoSQL database that stores data in flexible, JSON-like documents." + }, + { + "question": "What is Express.js?", + "answer": "Express.js is a minimal and flexible Node.js web application framework that provides robust features for web and mobile applications." + } +] diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.tsv b/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.tsv new file mode 100644 index 0000000..74d115f --- /dev/null +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.tsv @@ -0,0 +1,6 @@ +question answer +What is Python? Python is a high-level, interpreted programming language known for its simplicity and readability. +What is Java? Java is a class-based, object-oriented programming language designed to have as few implementation dependencies as possible. +What is C++? C++ is a general-purpose programming language created as an extension of C with object-oriented features. +What is JavaScript? JavaScript is a high-level, interpreted programming language that is one of the core technologies of the World Wide Web. +What is Go? Go (or Golang) is a statically typed, compiled programming language designed at Google for building scalable systems. diff --git a/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.txt b/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.txt new file mode 100644 index 0000000..e3e306c --- /dev/null +++ b/LocalMind-Backend/src/api/v1/DataSet/v1/test-samples/sample-qa.txt @@ -0,0 +1,14 @@ +Q: What is Docker? +A: Docker is a platform that uses containerization to make it easier to create, deploy, and run applications by using containers. + +Q: What is Kubernetes? +A: Kubernetes is an open-source container orchestration platform that automates deploying, scaling, and managing containerized applications. + +Q: What is Git? +A: Git is a distributed version control system for tracking changes in source code during software development. + +Q: What is REST API? +A: REST (Representational State Transfer) API is an architectural style for designing networked applications using HTTP requests to access and manipulate data. + +Q: What is GraphQL? +A: GraphQL is a query language for APIs and a runtime for executing those queries with your existing data.