diff --git a/.github/workflows/upload-sdk-artifact.yml b/.github/workflows/upload-sdk-artifact.yml index 5596e09d1..b580b88a1 100644 --- a/.github/workflows/upload-sdk-artifact.yml +++ b/.github/workflows/upload-sdk-artifact.yml @@ -4,6 +4,9 @@ on: push: branches: - master + pull_request: + branches: + - master env: NODE_VERSION: 20.x @@ -75,6 +78,17 @@ jobs: ) - uses: actions/upload-artifact@v4 + if: github.event_name == 'push' with: name: sdk-${{ matrix.generator }}-${{ github.sha }} path: ./sdk + + cleanup-artifacts: + runs-on: ubuntu-latest + needs: + - generate-and-upload-sdk + if: github.event_name != 'push' + steps: + - uses: geekyeggo/delete-artifact@v5 + with: + name: swagger-* diff --git a/CI/E2E/frontend.config.json b/CI/E2E/frontend.config.json index 187a3bfe5..d56484821 100644 --- a/CI/E2E/frontend.config.json +++ b/CI/E2E/frontend.config.json @@ -120,6 +120,8 @@ "searchPublicDataEnabled": true, "searchSamples": true, "sftpHost": "login.esss.dk", + "sourceFolder": "/data/test", + "maxFileSizeWarning": "", "shareEnabled": true, "shoppingCartEnabled": true, "shoppingCartOnHeader": true, diff --git a/README.md b/README.md index dd85794f1..1c4105bff 100644 --- a/README.md +++ b/README.md @@ -185,8 +185,8 @@ Valid environment variables for the .env file. See [.env.example](/.env.example) | `ES_REFRESH` | string | | If set to `wait_for`, Elasticsearch will wait till data is inserted into the specified index before returning a response. | false | | `LOGGERS_CONFIG_FILE` | string | | The file name for loggers configuration, located in the project root directory. | "loggers.json" | | `PROPOSAL_TYPES_FILE` | string | | The file name for proposal types configuration, located in the project root directory. | "proposalTypes.json" | -| `SWAGGER_PATH` | string | Yes | swaggerPath is the path where the swagger UI will be available| "explorer"| -| `MAX_FILE_UPLOAD_SIZE` | string | Yes | Maximum allowed file upload size | "16mb"| +| `SWAGGER_PATH` | string | Yes | swaggerPath is the path where the swagger UI will be available. | "explorer"| +| `MAX_FILE_UPLOAD_SIZE` | string | Yes | Maximum allowed file upload size. | "16mb"| ## Migrating from the old SciCat Backend diff --git a/package-lock.json b/package-lock.json index 57000c30c..ebb870a5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,11 +80,11 @@ "concurrently": "^9.0.0", "eslint": "^9.0.0", "eslint-config-loopback": "^13.1.0", - "eslint-config-prettier": "^9.0.0", + "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.0.0", "globals": "^15.12.0", "jest": "27.0.6", - "mocha": "^10.0.0", + "mocha": "^11.0.1", "prettier": "^3.0.3", "sinon": "^19.0.2", "supertest": "^7.0.0", @@ -1206,10 +1206,13 @@ } }, "node_modules/@eslint/core": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", - "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz", + "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.15" + }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -1272,9 +1275,9 @@ "dev": true }, "node_modules/@eslint/js": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", - "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.18.0.tgz", + "integrity": "sha512-fK6L7rxcq6/z+AaQMtiFTkvbHkBLNlwyRxHpKawP0x3u9+NC6MQTnFW+AdpwC6gfHTW0051cokQgtTN2FqlxQA==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1290,11 +1293,12 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", - "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz", + "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", "dev": true, "dependencies": { + "@eslint/core": "^0.10.0", "levn": "^0.4.1" }, "engines": { @@ -2817,9 +2821,9 @@ "dev": true }, "node_modules/@stylistic/eslint-plugin": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-2.12.1.tgz", - "integrity": "sha512-fubZKIHSPuo07FgRTn6S4Nl0uXPRPYVNpyZzIDGfp7Fny6JjNus6kReLD7NI380JXi4HtUTSOZ34LBuNPO1XLQ==", + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-2.13.0.tgz", + "integrity": "sha512-RnO1SaiCFHn666wNz2QfZEFxvmiNRqhzaMXHXxXXKt+MEP7aajlPxUSMIQpKAaJfverpovEYqjBOXDq6dDcaOQ==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^8.13.0", @@ -3184,9 +3188,9 @@ "optional": true }, "node_modules/@types/mocha": { - "version": "10.0.9", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.9.tgz", - "integrity": "sha512-sicdRoWtYevwxjOHNMPTl3vSfJM6oyW8o1wXeI7uww6b6xHg8eBznQDNSGBCDJmsE8UMxP05JgZRtsKbTqt//Q==", + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", "dev": true }, "node_modules/@types/node": { @@ -3411,15 +3415,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.0.tgz", - "integrity": "sha512-6M8taKyOETY1TKHp0x8ndycipTVgmp4xtg5QpEZzXxDhNvvHOJi5rLRkLr8SK3jTgD5l4fTlvBiRdfsuWydxBw==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.1.tgz", + "integrity": "sha512-67gbfv8rAwawjYx3fYArwldTQKoYfezNUT4D5ioWetr/xCrxXxvleo3uuiFuKfejipvq+og7mjz3b0G2bVyUCw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/typescript-estree": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", + "@typescript-eslint/scope-manager": "8.19.1", + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/typescript-estree": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", "debug": "^4.3.4" }, "engines": { @@ -3434,6 +3438,127 @@ "typescript": ">=4.8.4 <5.8.0" } }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.1.tgz", + "integrity": "sha512-60L9KIuN/xgmsINzonOcMDSB8p82h95hoBfSBtXuO4jlR1R9L1xSkmVZKgCPVfavDlXihh4ARNjXhh1gGnLC7Q==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.1.tgz", + "integrity": "sha512-JBVHMLj7B1K1v1051ZaMMgLW4Q/jre5qGK0Ew6UgXz1Rqh+/xPzV1aW581OM00X6iOfyr1be+QyW8LOUf19BbA==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.1.tgz", + "integrity": "sha512-jk/TZwSMJlxlNnqhy0Eod1PNEvCkpY6MXOXE/WLlblZ6ibb32i2We4uByoKPv1d0OD2xebDv4hbs3fm11SMw8Q==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.0.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 <5.8.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.1.tgz", + "integrity": "sha512-fzmjU8CHK853V/avYZAvuVut3ZTfwN5YtMaoi+X9Y9MA9keaWNHC3zEQ9zvyX/7Hj+5JkNyK1l7TOR2hevHB6Q==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.19.1", + "eslint-visitor-keys": "^4.2.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/parser/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@typescript-eslint/parser/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, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/ts-api-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", + "dev": true, + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "8.19.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz", @@ -4230,9 +4355,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", - "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -6190,18 +6315,18 @@ } }, "node_modules/eslint": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", - "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.18.0.tgz", + "integrity": "sha512-+waTfRWQlSbpt3KWE+CjrPPYnbq9kfZIYUqapc0uBXyjTp8aYXZDsUH16m39Ryq3NjAVP4tjuF7KaukeqoCoaA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.19.0", - "@eslint/core": "^0.9.0", + "@eslint/core": "^0.10.0", "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.17.0", - "@eslint/plugin-kit": "^0.2.3", + "@eslint/js": "9.18.0", + "@eslint/plugin-kit": "^0.2.5", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.1", @@ -6258,12 +6383,12 @@ } }, "node_modules/eslint-config-prettier": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", - "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.0.1.tgz", + "integrity": "sha512-lZBts941cyJyeaooiKxAtzoPHTN+GbQTJFAIdQbRhA4/8whaAraEh47Whw/ZFfrjNSnlAxqfm9i0XVAEkULjCw==", "dev": true, "bin": { - "eslint-config-prettier": "bin/cli.js" + "eslint-config-prettier": "build/bin/cli.js" }, "peerDependencies": { "eslint": ">=7.0.0" @@ -10401,9 +10526,9 @@ } }, "node_modules/mocha": { - "version": "10.8.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", - "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.0.1.tgz", + "integrity": "sha512-+3GkODfsDG71KSCQhc4IekSW+ItCK/kiez1Z28ksWvYhKXV/syxMlerR/sC7whDp7IyreZ4YxceMLdTs5hQE8A==", "dev": true, "dependencies": { "ansi-colors": "^4.1.3", @@ -10413,7 +10538,7 @@ "diff": "^5.2.0", "escape-string-regexp": "^4.0.0", "find-up": "^5.0.0", - "glob": "^8.1.0", + "glob": "^10.4.5", "he": "^1.2.0", "js-yaml": "^4.1.0", "log-symbols": "^4.1.0", @@ -10432,7 +10557,16 @@ "mocha": "bin/mocha.js" }, "engines": { - "node": ">= 14.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" } }, "node_modules/mocha/node_modules/cliui": { @@ -10446,25 +10580,6 @@ "wrap-ansi": "^7.0.0" } }, - "node_modules/mocha/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/mocha/node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", @@ -10477,15 +10592,6 @@ "node": ">=10" } }, - "node_modules/mocha/node_modules/minimatch/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/mocha/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -10637,9 +10743,9 @@ } }, "node_modules/mongoose": { - "version": "8.9.3", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.3.tgz", - "integrity": "sha512-G50GNPdMqhoiRAJ/24GYAzg13yxXDD3FOOFeYiFwtHmHpAJem3hxbYIxAhLJGWbYEiUZL0qFMu2LXYkgGAmo+Q==", + "version": "8.9.5", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.5.tgz", + "integrity": "sha512-SPhOrgBm0nKV3b+IIHGqpUTOmgVL5Z3OO9AwkFEmvOZznXTvplbomstCnPOGAyungtRXE5pJTgKpKcZTdjeESg==", "dependencies": { "bson": "^6.10.1", "kareem": "2.6.3", @@ -13489,9 +13595,9 @@ } }, "node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", + "version": "9.5.2", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.2.tgz", + "integrity": "sha512-Qo4piXvOTWcMGIgRiuFa6nHNm+54HbYaZCKqc9eeZCLRy3XqafQgwX2F7mofrbJG3g7EEb+lkiR+z2Lic2s3Zw==", "dev": true, "dependencies": { "chalk": "^4.1.0", @@ -13971,12 +14077,12 @@ } }, "node_modules/wait-on": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-8.0.1.tgz", - "integrity": "sha512-1wWQOyR2LVVtaqrcIL2+OM+x7bkpmzVROa0Nf6FryXkS+er5Sa1kzFGjzZRqLnHa3n1rACFLeTwUqE1ETL9Mig==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-8.0.2.tgz", + "integrity": "sha512-qHlU6AawrgAIHlueGQHQ+ETcPLAauXbnoTKl3RKq20W0T8x0DKVAo5xWIYjHSyvHxQlcYbFdR0jp4T9bDVITFA==", "dev": true, "dependencies": { - "axios": "^1.7.7", + "axios": "^1.7.9", "joi": "^17.13.3", "lodash": "^4.17.21", "minimist": "^1.2.8", diff --git a/package.json b/package.json index 737cf9ac0..142e369d4 100644 --- a/package.json +++ b/package.json @@ -109,11 +109,11 @@ "concurrently": "^9.0.0", "eslint": "^9.0.0", "eslint-config-loopback": "^13.1.0", - "eslint-config-prettier": "^9.0.0", + "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.0.0", "globals": "^15.12.0", "jest": "27.0.6", - "mocha": "^10.0.0", + "mocha": "^11.0.1", "prettier": "^3.0.3", "sinon": "^19.0.2", "supertest": "^7.0.0", diff --git a/src/config/frontend.config.json b/src/config/frontend.config.json index 213c69a5e..c67c5d296 100644 --- a/src/config/frontend.config.json +++ b/src/config/frontend.config.json @@ -29,7 +29,6 @@ "lbBaseURL": "http://localhost:3000", "logbookEnabled": true, "loginFormEnabled": true, - "maxDirectDownloadSize": 5000000000, "metadataPreviewEnabled": true, "metadataStructure": "", "multipleDownloadAction": "http:/127.0.0.1:3012/zip", @@ -48,6 +47,9 @@ "searchPublicDataEnabled": true, "searchSamples": true, "sftpHost": "login.esss.dk", + "sourceFolder": "/data/ess", + "maxDirectDownloadSize": 5000000000, + "maxFileSizeWarning": "Some files are above and cannot be downloaded directly. These file can be downloaded via sftp host: in directory: ", "shareEnabled": true, "shoppingCartEnabled": true, "shoppingCartOnHeader": true, diff --git a/src/datasets/datasets.service.ts b/src/datasets/datasets.service.ts index 26582443e..b327aa5aa 100644 --- a/src/datasets/datasets.service.ts +++ b/src/datasets/datasets.service.ts @@ -287,7 +287,7 @@ export class DatasetsService { const datasets = this.datasetModel.find({}, { _id: 0 }).lean().exec(); return datasets; } catch (error) { - throw new NotFoundException(); + throw new NotFoundException(error); } } // Get metadata keys diff --git a/src/datasets/dto/create-derived-dataset-obsolete.dto.ts b/src/datasets/dto/create-derived-dataset-obsolete.dto.ts index f6fcc180f..2432c379e 100644 --- a/src/datasets/dto/create-derived-dataset-obsolete.dto.ts +++ b/src/datasets/dto/create-derived-dataset-obsolete.dto.ts @@ -24,4 +24,13 @@ export class CreateDerivedDatasetObsoleteDto extends UpdateDerivedDatasetObsolet @IsOptional() @IsString() readonly version?: string; + + @ApiProperty({ + type: String, + required: true, + description: + "A name for the dataset, given by the creator to carry some semantic meaning. Useful for display purposes e.g. instead of displaying the pid.", + }) + @IsString() + declare readonly datasetName: string; } diff --git a/src/datasets/dto/create-raw-dataset-obsolete.dto.ts b/src/datasets/dto/create-raw-dataset-obsolete.dto.ts index 57f7d6ba9..5de0df978 100644 --- a/src/datasets/dto/create-raw-dataset-obsolete.dto.ts +++ b/src/datasets/dto/create-raw-dataset-obsolete.dto.ts @@ -24,4 +24,13 @@ export class CreateRawDatasetObsoleteDto extends UpdateRawDatasetObsoleteDto { @IsOptional() @IsString() readonly version?: string; + + @ApiProperty({ + type: String, + required: true, + description: + "A name for the dataset, given by the creator to carry some semantic meaning. Useful for display purposes e.g. instead of displaying the pid.", + }) + @IsString() + declare readonly datasetName: string; } diff --git a/src/datasets/dto/output-dataset-obsolete.dto.ts b/src/datasets/dto/output-dataset-obsolete.dto.ts index f99a7fe94..68de0887e 100644 --- a/src/datasets/dto/output-dataset-obsolete.dto.ts +++ b/src/datasets/dto/output-dataset-obsolete.dto.ts @@ -17,7 +17,7 @@ import { Datablock } from "src/datablocks/schemas/datablock.schema"; export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { @ApiProperty({ type: String, - required: false, + required: true, description: "Persistent identifier of the dataset.", }) @IsString() @@ -44,7 +44,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { @ApiProperty({ type: String, - required: true, + required: false, description: "First name and last name of principal investigator(s). If multiple PIs are present, use a semicolon separated list. This field is required if the dataset is a Raw dataset.", }) @@ -74,7 +74,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { @ApiProperty({ type: String, - required: true, + required: false, description: "Unique location identifier where data was taken, usually in the form /Site-name/facility-name/instrumentOrBeamline-name. This field is required if the dataset is a Raw dataset.", }) @@ -112,7 +112,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { @ApiProperty({ type: String, - required: true, + required: false, description: "First name and last name of the person or people pursuing the data analysis. The string may contain a list of names, which should then be separated by semicolons.", }) @@ -122,7 +122,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { @ApiProperty({ type: [String], - required: true, + required: false, description: "Array of input dataset identifiers used in producing the derived dataset. Ideally these are the global identifier to existing datasets inside this or federated data catalogs.", }) @@ -134,7 +134,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { @ApiProperty({ type: [String], - required: true, + required: false, description: "A list of links to software repositories which uniquely identifies the pieces of software, including versions, used for yielding the derived data.", }) @@ -183,6 +183,9 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { description: "Containers that list all files and their attributes which make up a dataset. Usually filled at the time the dataset's metadata is created in the data catalog. Can be used by subsequent archiving processes to create the archived datasets.", }) + @IsOptional() + @IsArray() + @Type(() => OrigDatablock) origdatablocks?: OrigDatablock[]; @ApiProperty({ @@ -192,6 +195,9 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { description: "When archiving a dataset, all files contained in the dataset are listed here together with their checksum information. Several datablocks can be created if the file listing is too long for a single datablock. This partitioning decision is done by the archiving system to allow for chunks of datablocks with manageable sizes. E.g a datasets consisting of 10 TB of data could be split into 10 datablocks of about 1 TB each. The upper limit set by the data catalog system itself is given by the fact that documents must be smaller than 16 MB, which typically allows for datasets of about 100000 files.", }) + @IsOptional() + @IsArray() + @Type(() => Datablock) datablocks?: Datablock[]; @ApiProperty({ @@ -200,6 +206,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { description: "Indicate the user who created this record. This property is added and maintained by the system.", }) + @IsString() createdBy: string; @ApiProperty({ @@ -208,6 +215,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { description: "Indicate the user who updated this record last. This property is added and maintained by the system.", }) + @IsString() updatedBy: string; @ApiProperty({ @@ -216,6 +224,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { description: "Date and time when this record was created. This field is managed by mongoose with through the timestamp settings. The field should be a string containing a date in ISO 8601 format (2024-02-27T12:26:57.313Z)", }) + @IsDateString() createdAt: Date; @ApiProperty({ @@ -224,5 +233,6 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto { description: "Date and time when this record was updated last. This field is managed by mongoose with through the timestamp settings. The field should be a string containing a date in ISO 8601 format (2024-02-27T12:26:57.313Z)", }) + @IsDateString() updatedAt: Date; } diff --git a/src/datasets/dto/update-dataset-obsolete.dto.ts b/src/datasets/dto/update-dataset-obsolete.dto.ts index 853e50752..52417fa9f 100644 --- a/src/datasets/dto/update-dataset-obsolete.dto.ts +++ b/src/datasets/dto/update-dataset-obsolete.dto.ts @@ -123,12 +123,12 @@ export class UpdateDatasetObsoleteDto extends OwnableDto { @ApiProperty({ type: Number, default: 0, - required: true, + required: false, description: "Total number of files in all Datablocks for this dataset.", }) @IsOptional() @IsInt() - readonly numberOfFilesArchived?: number; + readonly numberOfFilesArchived?: number = 0; @ApiProperty({ type: Date, diff --git a/src/datasets/dto/update-dataset.dto.ts b/src/datasets/dto/update-dataset.dto.ts index 1dc67f0e7..8e58a35fe 100644 --- a/src/datasets/dto/update-dataset.dto.ts +++ b/src/datasets/dto/update-dataset.dto.ts @@ -30,7 +30,7 @@ import { HistoryClass } from "../schemas/history.schema"; export class UpdateDatasetDto extends OwnableDto { @ApiProperty({ type: String, - required: true, + required: false, description: "Owner or custodian of the dataset, usually first name + last name. The string may contain a list of persons, which should then be separated by semicolons.", }) @@ -125,7 +125,7 @@ export class UpdateDatasetDto extends OwnableDto { @ApiProperty({ type: Number, default: 0, - required: true, + required: false, description: "Total number of files in all Datablocks for this dataset.", }) @IsOptional() @@ -152,7 +152,8 @@ export class UpdateDatasetDto extends OwnableDto { readonly validationStatus?: string; @ApiProperty({ - type: [String], + type: String, + isArray: true, required: false, description: "Array of tags associated with the meaning or contents of this dataset. Values should ideally come from defined vocabularies, taxonomies, ontologies or knowledge graphs.", @@ -226,7 +227,8 @@ export class UpdateDatasetDto extends OwnableDto { // it needs to be discussed if this fields is managed by the user or by the system @ApiProperty({ - type: [String], + type: String, + isArray: true, required: false, default: [], description: "List of users that the dataset has been shared with.", @@ -342,7 +344,8 @@ export class UpdateDatasetDto extends OwnableDto { readonly dataFormat?: string; @ApiProperty({ - type: [String], + type: String, + isArray: true, required: false, description: "ID of the proposal or proposals which the dataset belongs to.
This dataset might have been acquired under the listed proposals or is derived from datasets acquired from datasets belonging to the listed datasets.", @@ -354,7 +357,8 @@ export class UpdateDatasetDto extends OwnableDto { readonly proposalIds?: string[]; @ApiProperty({ - type: [String], + type: String, + isArray: true, required: false, description: "ID of the sample or samples used when collecting the data included or used in this dataset.", @@ -367,6 +371,7 @@ export class UpdateDatasetDto extends OwnableDto { @ApiProperty({ type: String, + isArray: true, required: false, description: "ID of the instrument or instruments where the data included or used in this datasets was collected on.", @@ -378,8 +383,9 @@ export class UpdateDatasetDto extends OwnableDto { readonly instrumentIds?: string[]; @ApiProperty({ - type: [String], - required: true, + type: String, + isArray: true, + required: false, description: "Array of input dataset identifiers used in producing the derived dataset. Ideally these are the global identifier to existing datasets inside this or federated data catalogs.", }) @@ -390,7 +396,8 @@ export class UpdateDatasetDto extends OwnableDto { readonly inputDatasets?: string[]; @ApiProperty({ - type: [String], + type: String, + isArray: true, required: false, description: "A list of links to software repositories which uniquely identifies the pieces of software, including versions, used for yielding the derived data.", diff --git a/src/datasets/schemas/dataset.schema.ts b/src/datasets/schemas/dataset.schema.ts index 723816a56..59b42e27c 100644 --- a/src/datasets/schemas/dataset.schema.ts +++ b/src/datasets/schemas/dataset.schema.ts @@ -3,7 +3,6 @@ import { ApiProperty, getSchemaPath } from "@nestjs/swagger"; import { Document } from "mongoose"; import { OwnableClass } from "src/common/schemas/ownable.schema"; import { v4 as uuidv4 } from "uuid"; -import { DatasetType } from "../dataset-type.enum"; import { HistoryClass, HistorySchema } from "./history.schema"; import { LifecycleClass, LifecycleSchema } from "./lifecycle.schema"; import { RelationshipClass, RelationshipSchema } from "./relationship.schema"; diff --git a/src/proposals/dto/update-proposal.dto.ts b/src/proposals/dto/update-proposal.dto.ts index c16ef17cb..2e5fc2e06 100644 --- a/src/proposals/dto/update-proposal.dto.ts +++ b/src/proposals/dto/update-proposal.dto.ts @@ -4,7 +4,6 @@ import { IsArray, IsDateString, IsEmail, - IsEnum, IsObject, IsOptional, IsString, diff --git a/src/proposals/proposals.controller.ts b/src/proposals/proposals.controller.ts index 6b28b4d21..d95cb1e03 100644 --- a/src/proposals/proposals.controller.ts +++ b/src/proposals/proposals.controller.ts @@ -54,8 +54,10 @@ import { import { plainToInstance } from "class-transformer"; import { validate, ValidatorOptions } from "class-validator"; import { + CountApiResponse, filterDescription, filterExample, + FullFacetFilters, FullFacetResponse, fullQueryExampleLimits, FullQueryFilters, @@ -164,7 +166,7 @@ export class ProposalsController { return false; } } catch (error) { - throw new InternalServerErrorException(); + throw new InternalServerErrorException(error); } } @@ -368,6 +370,38 @@ export class ProposalsController { return this.proposalsService.findAll(proposalFilters); } + // GET /proposals/count + @UseGuards(PoliciesGuard) + @CheckPolicies("proposals", (ability: AppAbility) => + ability.can(Action.ProposalsRead, ProposalClass), + ) + @Get("/count") + @ApiOperation({ + summary: "It returns the number of proposals.", + description: + "It returns a number of proposals matching the where filter if provided.", + }) + @ApiQuery({ + name: "filters", + description: + "Database filters to apply when retrieving count for proposals", + required: false, + type: String, + example: '{"where": {"proposalId": "189691"}}', + }) + @ApiResponse({ + status: 200, + type: CountApiResponse, + description: + "Return the number of proposals in the following format: { count: integer }", + }) + async count(@Req() request: Request, @Query("filters") filters?: string) { + const proposalFilters: IFilters = + this.updateFiltersForList(request, JSON.parse(filters ?? "{}")); + + return this.proposalsService.count(proposalFilters); + } + // GET /proposals/fullquery @UseGuards(PoliciesGuard) @CheckPolicies("proposals", (ability: AppAbility) => @@ -454,7 +488,7 @@ export class ProposalsController { "Full facet query filters to apply when retrieving proposals\n" + proposalsFullQueryDescriptionFields, required: false, - type: String, + type: FullFacetFilters, example: proposalsFullQueryExampleFields, }) @ApiResponse({ diff --git a/src/proposals/proposals.service.ts b/src/proposals/proposals.service.ts index 09258fdc0..7509798df 100644 --- a/src/proposals/proposals.service.ts +++ b/src/proposals/proposals.service.ts @@ -57,6 +57,16 @@ export class ProposalsService { .exec(); } + async count( + filter: IFilters, + ): Promise<{ count: number }> { + const whereFilter: FilterQuery = filter.where ?? {}; + + const count = await this.proposalModel.countDocuments(whereFilter).exec(); + + return { count }; + } + async fullquery( filter: IFilters, ): Promise { diff --git a/src/samples/samples.controller.ts b/src/samples/samples.controller.ts index 048dab555..807b78438 100644 --- a/src/samples/samples.controller.ts +++ b/src/samples/samples.controller.ts @@ -160,7 +160,7 @@ export class SamplesController { return false; } } catch (error) { - throw new InternalServerErrorException(); + throw new InternalServerErrorException(error); } } @@ -410,7 +410,6 @@ export class SamplesController { required: false, type: String, // NOTE: This is custom example because the service function metadataKeys expects input like the following. - // eslint-disable-next-line @/quotes example: '{ "fields": { "metadataKey": "chemical_formula" } }', }) @ApiResponse({ diff --git a/test/Proposal.js b/test/Proposal.js index e74155869..2ad0858af 100644 --- a/test/Proposal.js +++ b/test/Proposal.js @@ -176,6 +176,32 @@ describe("1500: Proposal: Simple Proposal", () => { }); }); + it("0091: should get proposal count", async () => { + return request(appUrl) + .get("/api/v3/Proposals/count") + .set({ Authorization: `Bearer ${accessTokenProposalIngestor}` }) + .set("Accept", "application/json") + .expect(TestData.SuccessfulGetStatusCode) + .expect("Content-Type", /json/) + .then((res) => { + res.body["count"].should.be.greaterThan(0); + }); + }); + + it("0091: should get proposal count using filters", async () => { + const query = { where: { proposalId: { $in: [proposalId] } } }; + return request(appUrl) + .get("/api/v3/Proposals/count") + .set({ Authorization: `Bearer ${accessTokenProposalIngestor}` }) + .query("filter=" + encodeURIComponent(JSON.stringify(query))) + .set("Accept", "application/json") + .expect(TestData.SuccessfulGetStatusCode) + .expect("Content-Type", /json/) + .then((res) => { + res.body["count"].should.be.equal(1); + }); + }); + it("0100: should add a new attachment to this proposal", async () => { let testAttachment = { ...TestData.AttachmentCorrect }; testAttachment.proposalId = defaultProposalId;