diff --git a/package-lock.json b/package-lock.json index f6231d9f5..aef2e8157 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "dependencies": { "@faker-js/faker": "7.6.0", - "@iqss/dataverse-client-javascript": "2.0.0-pr92.3fbf381", + "@iqss/dataverse-client-javascript": "2.0.0-pr93.8996380", "@iqss/dataverse-design-system": "*", "@istanbuljs/nyc-config-typescript": "1.0.2", "@tanstack/react-table": "8.9.2", @@ -3588,9 +3588,9 @@ }, "node_modules/@iqss/dataverse-client-javascript": { "name": "@IQSS/dataverse-client-javascript", - "version": "2.0.0-pr92.3fbf381", - "resolved": "https://npm.pkg.github.com/download/@IQSS/dataverse-client-javascript/2.0.0-pr92.3fbf381/c65e21a842363935d5ca632de9077063382f8800", - "integrity": "sha512-eexOP5sAKyaJc3Lj1xw8qFpYAh7R0de85VPRKoG8pPkON0LjMAql7heVGMP/MO1gvy159XSSdl2WCrtl/qLuJQ==", + "version": "2.0.0-pr93.8996380", + "resolved": "https://npm.pkg.github.com/download/@IQSS/dataverse-client-javascript/2.0.0-pr93.8996380/e2b872620f16a08f5cb3e94dbf7afd0afc55e1d2", + "integrity": "sha512-hlSKtjPhpASVZD5RQsk2sRTrLWPbucY7G7uDcjWIWpg0NiHxhvz3Tny5q8yIAzQ44v+8K/n5K0fr8gv9PUBeiQ==", "license": "MIT", "dependencies": { "@types/node": "^18.15.11", @@ -4697,26 +4697,6 @@ "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", "dev": true }, - "node_modules/@jest/reporters/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@jest/reporters/node_modules/jest-haste-map": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-28.1.3.tgz", @@ -5048,26 +5028,6 @@ } } }, - "node_modules/@joshwooding/vite-plugin-react-docgen-typescript/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -12703,6 +12663,52 @@ "url": "https://opencollective.com/storybook" } }, + "node_modules/@storybook/core-common/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/@storybook/core-common/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@storybook/core-common/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@storybook/core-events": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-7.1.0.tgz", @@ -18759,6 +18765,37 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/cacache/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/cacache/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/cacache/node_modules/lru-cache": { "version": "7.18.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", @@ -18768,6 +18805,21 @@ "node": ">=12" } }, + "node_modules/cacache/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/cacache/node_modules/ssri": { "version": "10.0.5", "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.5.tgz", @@ -23755,26 +23807,6 @@ "node": ">=4" } }, - "node_modules/get-monorepo-packages/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/get-monorepo-packages/node_modules/globby": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz", @@ -24158,22 +24190,19 @@ "dev": true }, "node_modules/glob": { - "version": "10.3.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.7.tgz", - "integrity": "sha512-wCMbE1m9Nx5yD9LYtgsVWq5VhHlk5WzJirw594qZR6AIvQYuHrdDtIktUVjQItalD53y7dqoedu9xP0u0WaxIQ==", - "dev": true, + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -24230,26 +24259,6 @@ "node": ">= 0.10" } }, - "node_modules/glob-stream/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/glob-stream/node_modules/glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -24314,30 +24323,6 @@ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dev": true }, - "node_modules/glob/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/glob/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/global-dirs": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.1.tgz", @@ -26425,9 +26410,9 @@ } }, "node_modules/jackspeak": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.3.tgz", - "integrity": "sha512-R2bUw+kVZFS/h1AZqBKrSgDmdmjApzgY0AlCPumopFiAlbUxE2gf+SCuBzQ0cP5hHmUmFYF5yw55T97Th5Kstg==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" @@ -26980,26 +26965,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/jest-config/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/jest-config/node_modules/jest-get-type": { "version": "28.0.2", "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", @@ -28143,26 +28108,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/jest-runtime/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/jest-runtime/node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -32315,26 +32260,6 @@ "node-gyp-build-test": "build-test.js" } }, - "node_modules/node-gyp/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -33087,26 +33012,6 @@ "node": ">=8.0.0" } }, - "node_modules/nyc/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/nyc/node_modules/istanbul-lib-instrument": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", @@ -35317,26 +35222,6 @@ "ms": "2.0.0" } }, - "node_modules/puppeteer-core/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/puppeteer-core/node_modules/https-proxy-agent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", @@ -35939,6 +35824,37 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/read-package-json/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/read-package-json/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/read-package-json/node_modules/hosted-git-info": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-6.1.1.tgz", @@ -35969,6 +35885,21 @@ "node": ">=12" } }, + "node_modules/read-package-json/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/read-package-json/node_modules/normalize-package-data": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-5.0.0.tgz", @@ -37002,26 +36933,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/rollup": { "version": "3.29.3", "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.3.tgz", @@ -37452,26 +37363,6 @@ "node": ">=4" } }, - "node_modules/shelljs/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -39193,26 +39084,6 @@ "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", "dev": true }, - "node_modules/stylelint-config-rational-order/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/stylelint-config-rational-order/node_modules/glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -40543,26 +40414,6 @@ "node": ">=4" } }, - "node_modules/temp/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/temp/node_modules/rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -40657,25 +40508,6 @@ "node": ">=8" } }, - "node_modules/test-exclude/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/text-extensions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", diff --git a/package.json b/package.json index 82c145df6..14c9f0157 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@faker-js/faker": "7.6.0", - "@iqss/dataverse-client-javascript": "2.0.0-pr92.3fbf381", + "@iqss/dataverse-client-javascript": "2.0.0-pr93.8996380", "@iqss/dataverse-design-system": "*", "@istanbuljs/nyc-config-typescript": "1.0.2", "@tanstack/react-table": "8.9.2", diff --git a/src/files/domain/repositories/FileRepository.ts b/src/files/domain/repositories/FileRepository.ts index 41d802c8a..4ce01579a 100644 --- a/src/files/domain/repositories/FileRepository.ts +++ b/src/files/domain/repositories/FileRepository.ts @@ -14,7 +14,8 @@ export interface FileRepository { ) => Promise getFilesCountInfoByDatasetPersistentId: ( datasetPersistentId: string, - datasetVersion: DatasetVersion + datasetVersion: DatasetVersion, + criteria: FileCriteria ) => Promise getFilesTotalDownloadSizeByDatasetPersistentId: ( datasetPersistentId: string, diff --git a/src/files/domain/useCases/getFilesCountInfoByDatasetPersistentId.ts b/src/files/domain/useCases/getFilesCountInfoByDatasetPersistentId.ts index 518897809..13b5dfda7 100644 --- a/src/files/domain/useCases/getFilesCountInfoByDatasetPersistentId.ts +++ b/src/files/domain/useCases/getFilesCountInfoByDatasetPersistentId.ts @@ -1,14 +1,16 @@ import { FileRepository } from '../repositories/FileRepository' import { FilesCountInfo } from '../models/FilesCountInfo' import { DatasetVersion } from '../../../dataset/domain/models/Dataset' +import { FileCriteria } from '../models/FileCriteria' export async function getFilesCountInfoByDatasetPersistentId( fileRepository: FileRepository, datasetPersistentId: string, - datasetVersion: DatasetVersion + datasetVersion: DatasetVersion, + criteria: FileCriteria = new FileCriteria() ): Promise { return fileRepository - .getFilesCountInfoByDatasetPersistentId(datasetPersistentId, datasetVersion) + .getFilesCountInfoByDatasetPersistentId(datasetPersistentId, datasetVersion, criteria) .catch((error: Error) => { throw new Error(error.message) }) diff --git a/src/files/infrastructure/FileJSDataverseRepository.ts b/src/files/infrastructure/FileJSDataverseRepository.ts index cc9b88cad..a722f3185 100644 --- a/src/files/infrastructure/FileJSDataverseRepository.ts +++ b/src/files/infrastructure/FileJSDataverseRepository.ts @@ -38,7 +38,8 @@ export class FileJSDataverseRepository implements FileRepository { includeDeaccessioned, jsPagination.limit, jsPagination.offset, - DomainFileMapper.toJSFileCriteria(criteria) + DomainFileMapper.toJSFileSearchCriteria(criteria), + DomainFileMapper.toJSFileOrderCriteria(criteria.sortBy) ) .then((jsFiles) => jsFiles.map((jsFile) => JSFileMapper.toFile(jsFile, datasetVersion))) .then((files) => FileJSDataverseRepository.getAllWithDownloadCount(files)) @@ -100,11 +101,16 @@ export class FileJSDataverseRepository implements FileRepository { getFilesCountInfoByDatasetPersistentId( datasetPersistentId: string, - datasetVersion: DatasetVersion + datasetVersion: DatasetVersion, + criteria: FileCriteria ): Promise { - // TODO - Take into account the FileCriteria https://github.com/IQSS/dataverse-frontend/issues/172 return getDatasetFileCounts - .execute(datasetPersistentId, datasetVersion.toString(), includeDeaccessioned) + .execute( + datasetPersistentId, + datasetVersion.toString(), + includeDeaccessioned, + DomainFileMapper.toJSFileSearchCriteria(criteria) + ) .then((jsFilesCountInfo) => { return JSFileMapper.toFilesCountInfo(jsFilesCountInfo) }) diff --git a/src/files/infrastructure/mappers/DomainFileMapper.ts b/src/files/infrastructure/mappers/DomainFileMapper.ts index 45d93715b..cda15bf92 100644 --- a/src/files/infrastructure/mappers/DomainFileMapper.ts +++ b/src/files/infrastructure/mappers/DomainFileMapper.ts @@ -7,7 +7,7 @@ import { } from '../../domain/models/FileCriteria' import { FileAccessStatus as JSFileAccessStatus, - FileCriteria as JSFileCriteria, + FileSearchCriteria as JSFileSearchCriteria, FileOrderCriteria as JSFileOrderCriteria } from '@iqss/dataverse-client-javascript' import { FileType } from '../../domain/models/File' @@ -20,17 +20,17 @@ export class DomainFileMapper { } } - static toJSFileCriteria(criteria: FileCriteria): JSFileCriteria { - return new JSFileCriteria( - this.toJSOrderCriteria(criteria.sortBy), + static toJSFileSearchCriteria(criteria: FileCriteria): JSFileSearchCriteria { + return new JSFileSearchCriteria( this.toJSContentType(criteria.filterByType), this.toJSAccessStatus(criteria.filterByAccess), this.toJSCategoryName(criteria.filterByTag), + undefined, // This filter is not used in the UI this.toJSSearchText(criteria.searchText) ) } - static toJSOrderCriteria(sortBy: FileSortByOption): JSFileOrderCriteria { + static toJSFileOrderCriteria(sortBy: FileSortByOption): JSFileOrderCriteria { switch (sortBy) { case FileSortByOption.NAME_AZ: return JSFileOrderCriteria.NAME_AZ diff --git a/src/sections/dataset/dataset-files/useFiles.tsx b/src/sections/dataset/dataset-files/useFiles.tsx index 7babb384d..476d9cd20 100644 --- a/src/sections/dataset/dataset-files/useFiles.tsx +++ b/src/sections/dataset/dataset-files/useFiles.tsx @@ -24,48 +24,68 @@ export function useFiles( const [isLoading, setIsLoading] = useState(true) const [filesCountInfo, setFilesCountInfo] = useState() const [filesTotalDownloadSize, setFilesTotalDownloadSize] = useState(0) - - useEffect(() => { - getFilesCountInfoByDatasetPersistentId(filesRepository, datasetPersistentId, datasetVersion) + const getFilesCountInfo = () => { + return getFilesCountInfoByDatasetPersistentId( + filesRepository, + datasetPersistentId, + datasetVersion, + criteria + ) .then((filesCountInfo: FilesCountInfo) => { setFilesCountInfo(filesCountInfo) - onPaginationInfoChange(paginationInfo.withTotal(filesCountInfo.total)) + if (filesCountInfo.total !== paginationInfo.totalFiles) { + onPaginationInfoChange(paginationInfo.withTotal(filesCountInfo.total)) + } + return filesCountInfo }) - .catch((error) => { - console.error('There was an error getting the files count info', error) + .catch(() => { + throw new Error('There was an error getting the files count info') }) - }, [filesRepository, datasetPersistentId, datasetVersion]) + } + + const getFiles = (filesCount: FilesCountInfo) => { + if (filesCount) { + if (filesCount.total === 0) { + setIsLoading(false) + return + } + return getFilesByDatasetPersistentId( + filesRepository, + datasetPersistentId, + datasetVersion, + paginationInfo.withTotal(filesCount.total), + criteria + ) + .then((files: File[]) => { + setFiles(files) + return files + }) + .then((files: File[]) => + fetchFilesPermission(FilePermission.DOWNLOAD_FILE, files).then(() => setIsLoading(false)) + ) + .catch(() => { + throw new Error('There was an error getting the files') + }) + } + } useEffect(() => { setIsLoading(true) - if (filesCountInfo) { - if (filesCountInfo.total === 0) { + getFilesCountInfo() + .then((filesCount) => getFiles(filesCount)) + .catch(() => { + console.error('There was an error getting the files') setIsLoading(false) - } else { - getFilesByDatasetPersistentId( - filesRepository, - datasetPersistentId, - datasetVersion, - paginationInfo, - criteria - ) - .then((files: File[]) => { - setFiles(files) - return files - }) - .then((files: File[]) => - fetchFilesPermission(FilePermission.DOWNLOAD_FILE, files).then(() => - setIsLoading(false) - ) - ) - .catch((error) => { - console.error('There was an error getting the files', error) - setIsLoading(false) - }) - } - } - }, [filesRepository, datasetPersistentId, datasetVersion, paginationInfo, criteria]) + }) + }, [ + filesRepository, + datasetPersistentId, + datasetVersion, + paginationInfo.page, + paginationInfo.pageSize, + criteria + ]) useEffect(() => { getFilesTotalDownloadSize(filesRepository, datasetPersistentId, datasetVersion) diff --git a/src/stories/dataset/DatasetMockDataDraftVersion.ts b/src/stories/dataset/DatasetMockDataDraftVersion.ts deleted file mode 100644 index a3f7dbbd3..000000000 --- a/src/stories/dataset/DatasetMockDataDraftVersion.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { - ANONYMIZED_FIELD_VALUE, - DatasetPublishingStatus, - DatasetVersion, - DatasetLabelSemanticMeaning, - DatasetLabelValue, - DatasetMetadataBlocks -} from '../../dataset/domain/models/Dataset' -import { MetadataBlockName } from '../../dataset/domain/models/Dataset' -import { Dataset } from '../../dataset/domain/models/Dataset' - -export const DatasetMockDataDraftVersion = ( - props?: Partial, - anonymized = false -): Dataset => { - const dataset = { - persistentId: 'doi:10.5072/FK2/ABC123', - citation: `${ - anonymized ? 'Author name(s) withheld' : 'Bennet, Elizabeth; Darcy, Fitzwilliam' - }, 2023, "Dataset Title", https://doi.org/10.5072/FK2/BUDNRV, Root, V1`, - version: new DatasetVersion(1, DatasetPublishingStatus.DRAFT, 1, 0), - labels: [ - { value: 'Version 1.0', semanticMeaning: DatasetLabelSemanticMeaning.FILE }, - { value: DatasetLabelValue.DRAFT, semanticMeaning: DatasetLabelSemanticMeaning.DATASET } - ], - license: { - name: 'CC0 1.0', - uri: 'https://creativecommons.org/publicdomain/zero/1.0/', - iconUri: 'https://licensebuttons.net/p/zero/1.0/88x31.png' - }, - summaryFields: [ - { - name: MetadataBlockName.CITATION, - fields: { - dsDescription: [ - { - dsDescriptionValue: - 'This text is *italic* and this is **bold**. Here is an image ![Alt text](https://picsum.photos/id/10/20/20) ' - } - ], - keyword: 'Malaria, Tuberculosis, Drug Resistant', - subject: 'Medicine, Health and Life Sciences, Social Sciences', - publication: 'CNN Journal [CNN.com](https://cnn.com)', - notesText: 'Here is an image ![Alt text](https://picsum.photos/id/10/40/40)' - } - } - ], - metadataBlocks: [ - { - name: MetadataBlockName.CITATION, - fields: { - alternativePersistentId: 'doi:10.5072/FK2/ABC123', - publicationDate: anonymized ? ANONYMIZED_FIELD_VALUE : '2021-01-01', - citationDate: '2023-01-01', - title: 'Dataset Title', - subject: ['Subject1', 'Subject2'], - author: anonymized - ? ANONYMIZED_FIELD_VALUE - : [ - { - authorName: 'Admin, Dataverse', - authorAffiliation: 'Dataverse.org', - authorIdentifierScheme: 'ORCID', - authorIdentifier: '0000-0002-1825-1097' - }, - { - authorName: 'Owner, Dataverse', - authorAffiliation: 'Dataverse.org', - authorIdentifierScheme: 'ORCID', - authorIdentifier: '0000-0032-1825-0098' - } - ], - datasetContact: anonymized - ? ANONYMIZED_FIELD_VALUE - : [ - { - datasetContactName: 'Admin, Dataverse' - } - ], - dsDescription: [ - { - dsDescriptionValue: - 'This text is *italic* and this is **bold**. Here is an image ![Alt text](https://picsum.photos/id/10/20/20) ' - } - ] - } - }, - { - name: MetadataBlockName.GEOSPATIAL, - fields: { - geographicUnit: 'km', - geographicCoverage: anonymized - ? ANONYMIZED_FIELD_VALUE - : { - geographicCoverageCountry: 'United States', - geographicCoverageCity: 'Cambridge' - } - } - } - ] as DatasetMetadataBlocks, - ...props - } - return new Dataset.Builder( - dataset.persistentId, - dataset.version, - dataset.citation, - dataset.summaryFields, - dataset.license, - dataset.metadataBlocks - ).build() -} diff --git a/src/stories/dataset/DatasetMockDraftVersionRepository.ts b/src/stories/dataset/DatasetMockDraftVersionRepository.ts deleted file mode 100644 index bff2952d6..000000000 --- a/src/stories/dataset/DatasetMockDraftVersionRepository.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { DatasetRepository } from '../../dataset/domain/repositories/DatasetRepository' -import { Dataset as DatasetModel } from '../../dataset/domain/models/Dataset' -import { DatasetMockDataDraftVersion } from './DatasetMockDataDraftVersion' - -export class DatasetMockDraftVersionRepository implements DatasetRepository { - getByPersistentId(persistentId: string): Promise { - return new Promise((resolve) => { - setTimeout(() => { - resolve(DatasetMockDataDraftVersion({ persistentId: persistentId })) - }, 1000) - }) - } - - // eslint-disable-next-line unused-imports/no-unused-vars - getByPrivateUrlToken(privateUrlToken: string): Promise { - return new Promise((resolve) => { - setTimeout(() => { - resolve(DatasetMockDataDraftVersion({}, true)) - }, 1000) - }) - } -} diff --git a/src/stories/files/FileMockLoadingRepository.ts b/src/stories/files/FileMockLoadingRepository.ts index 76543f5b2..f505c33ef 100644 --- a/src/stories/files/FileMockLoadingRepository.ts +++ b/src/stories/files/FileMockLoadingRepository.ts @@ -4,6 +4,7 @@ import { FilesCountInfo } from '../../files/domain/models/FilesCountInfo' import { FileUserPermissions } from '../../files/domain/models/FileUserPermissions' import { FileUserPermissionsMother } from '../../../tests/component/files/domain/models/FileUserPermissionsMother' import { DatasetVersion } from '../../dataset/domain/models/Dataset' +import { FileCriteria } from '../../files/domain/models/FileCriteria' export class FileMockLoadingRepository implements FileRepository { getAllByDatasetPersistentId( @@ -23,7 +24,9 @@ export class FileMockLoadingRepository implements FileRepository { // eslint-disable-next-line unused-imports/no-unused-vars datasetPersistentId: string, // eslint-disable-next-line unused-imports/no-unused-vars - datasetVersion: DatasetVersion + datasetVersion: DatasetVersion, + // eslint-disable-next-line unused-imports/no-unused-vars + criteria: FileCriteria ): Promise { return new Promise(() => { setTimeout(() => { diff --git a/src/stories/files/FileMockNoFiltersRepository.ts b/src/stories/files/FileMockNoFiltersRepository.ts index 227af8de4..1566b876d 100644 --- a/src/stories/files/FileMockNoFiltersRepository.ts +++ b/src/stories/files/FileMockNoFiltersRepository.ts @@ -6,6 +6,7 @@ import { FilesMockData } from './FileMockData' import { FileUserPermissions } from '../../files/domain/models/FileUserPermissions' import { FileUserPermissionsMother } from '../../../tests/component/files/domain/models/FileUserPermissionsMother' import { DatasetVersion } from '../../dataset/domain/models/Dataset' +import { FileCriteria } from '../../files/domain/models/FileCriteria' export class FileMockNoFiltersRepository implements FileRepository { getAllByDatasetPersistentId( @@ -25,7 +26,9 @@ export class FileMockNoFiltersRepository implements FileRepository { // eslint-disable-next-line unused-imports/no-unused-vars datasetPersistentId: string, // eslint-disable-next-line unused-imports/no-unused-vars - datasetVersion: DatasetVersion + datasetVersion: DatasetVersion, + // eslint-disable-next-line unused-imports/no-unused-vars + criteria: FileCriteria ): Promise { return new Promise((resolve) => { setTimeout(() => { diff --git a/tests/component/sections/dataset/dataset-files/useFiles.spec.tsx b/tests/component/sections/dataset/dataset-files/useFiles.spec.tsx index 75de6ab84..9f9d9a5d0 100644 --- a/tests/component/sections/dataset/dataset-files/useFiles.spec.tsx +++ b/tests/component/sections/dataset/dataset-files/useFiles.spec.tsx @@ -10,6 +10,7 @@ import { DatasetPublishingStatus, DatasetVersion } from '../../../../../src/dataset/domain/models/Dataset' +import { FileCriteria, FileSortByOption } from '../../../../../src/files/domain/models/FileCriteria' const files = FileMother.createMany(100) const filesCountInfo = FilesCountInfoMother.create({ total: 100 }) @@ -26,12 +27,14 @@ const datasetVersion = new DatasetVersion( const FilesTableTestComponent = ({ datasetPersistentId }: { datasetPersistentId: string }) => { const [paginationInfo, setPaginationInfo] = useState(new FilePaginationInfo()) + const [criteria, setCriteria] = useState(new FileCriteria()) const { isLoading, files, filesTotalDownloadSize } = useFiles( fileRepository, datasetPersistentId, datasetVersion, setPaginationInfo, - paginationInfo + paginationInfo, + criteria ) if (isLoading) { @@ -39,6 +42,12 @@ const FilesTableTestComponent = ({ datasetPersistentId }: { datasetPersistentId: } return ( <> +
Files count: {paginationInfo.totalFiles}
Files total download size: {filesTotalDownloadSize}
@@ -96,7 +105,7 @@ describe('useFiles', () => { 'persistentId', datasetVersion, new FilePaginationInfo(1, 10, 100), - undefined + new FileCriteria() ) cy.findByText('Files count: 100').should('exist') @@ -123,7 +132,7 @@ describe('useFiles', () => { cy.wrap(fileRepository.getAllByDatasetPersistentId).should('be.calledOnceWith', 'persistentId') cy.findByText('Loading...').should('exist') - cy.wrap(fileRepository.getUserPermissionsById).should('be.calledWith', files[0].id) + cy.wrap(fileRepository.getUserPermissionsById).should('be.called') cy.findByText('Loading...').should('exist') cy.findByText('Files count: 100').should('exist') @@ -149,4 +158,26 @@ describe('useFiles', () => { 'persistentId' ) }) + + it('calls the file repository to get the files total count on file criteria change', () => { + cy.customMount() + + cy.findByText('Files count: 100').should('exist') + cy.wrap(fileRepository.getFilesCountInfoByDatasetPersistentId).should( + 'be.calledOnceWith', + 'persistentId', + datasetVersion, + new FileCriteria() + ) + + cy.findByText('Sort by name Z-A').click() + + cy.findByText('Files count: 100').should('exist') + cy.wrap(fileRepository.getFilesCountInfoByDatasetPersistentId).should( + 'be.calledWith', + 'persistentId', + datasetVersion, + new FileCriteria().withSortBy(FileSortByOption.NAME_ZA) + ) + }) }) diff --git a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx index 95dd87efa..ef743d439 100644 --- a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx +++ b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx @@ -300,8 +300,7 @@ describe('Dataset', () => { }) }) - it.skip('applies filters to the Files Table in the correct order', () => { - // TODO - Restore this test once fileCountsInfo use case takes into account the filtered results https://github.com/IQSS/dataverse-frontend/issues/172 + it('applies filters to the Files Table in the correct order', () => { const files = [ FileHelper.create('csv', { description: 'Some description', @@ -362,7 +361,7 @@ describe('Dataset', () => { cy.findByText('blob-4').should('exist') cy.findByText('blob-5').should('exist') - cy.findByRole('button', { name: 'Filter Tag: All' }).click({ force: true }) + cy.findByRole('button', { name: 'File Tags: All' }).click({ force: true }) cy.findByText('Category (4)').should('exist').click({ force: true }) cy.findByText('1 to 4 of 4 Files').should('exist') @@ -384,7 +383,7 @@ describe('Dataset', () => { cy.findByText('blob-4').should('exist') cy.findByText('blob-5').should('exist') - cy.findByRole('button', { name: 'Filter Type: All' }).click({ force: true }) + cy.findByRole('button', { name: 'File Type: All' }).click({ force: true }) cy.findByText('Text/csv (2)').should('exist').click({ force: true }) cy.findByText('1 to 2 of 2 Files').should('exist') diff --git a/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts b/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts index 341b0f374..b550bb026 100644 --- a/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts +++ b/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts @@ -459,7 +459,8 @@ describe('File JSDataverse Repository', () => { }) describe('Get FilesCountInfo by dataset persistentId', () => { - it('gets FilesCountInfo by dataset persistentId', async () => { + let datasetPersistentId = '' + before(async () => { const files = [ FileHelper.create('csv', { description: 'Some description', @@ -493,9 +494,13 @@ describe('File JSDataverse Repository', () => { tabIngest: 'false' }) ] - const dataset = await DatasetHelper.createWithFiles(files).then((datasetResponse) => - datasetRepository.getByPersistentId(datasetResponse.persistentId) - ) + await DatasetHelper.createWithFiles(files).then((datasetResponse) => { + datasetPersistentId = datasetResponse.persistentId + }) + }) + + it('gets FilesCountInfo by dataset persistentId', async () => { + const dataset = await datasetRepository.getByPersistentId(datasetPersistentId) if (!dataset) throw new Error('Dataset not found') const expectedFilesCountInfo: FilesCountInfo = { @@ -533,7 +538,84 @@ describe('File JSDataverse Repository', () => { } await fileRepository - .getFilesCountInfoByDatasetPersistentId(dataset.persistentId, dataset.version) + .getFilesCountInfoByDatasetPersistentId( + dataset.persistentId, + dataset.version, + new FileCriteria() + ) + .then((filesCountInfo) => { + expect(filesCountInfo.total).to.deep.equal(expectedFilesCountInfo.total) + + const filesCountInfoPerAccessSorted = filesCountInfo.perAccess.sort((a, b) => + a.access.localeCompare(b.access) + ) + const expectedFilesCountInfoPerAccessSorted = expectedFilesCountInfo.perAccess.sort( + (a, b) => a.access.localeCompare(b.access) + ) + expect(filesCountInfoPerAccessSorted).to.deep.equal(expectedFilesCountInfoPerAccessSorted) + + const filesCountInfoPerFileTypeSorted = filesCountInfo.perFileType.sort((a, b) => + a.type.value.localeCompare(b.type.value) + ) + const expectedFilesCountInfoPerFileTypeSorted = expectedFilesCountInfo.perFileType.sort( + (a, b) => a.type.value.localeCompare(b.type.value) + ) + expect(filesCountInfoPerFileTypeSorted).to.deep.equal( + expectedFilesCountInfoPerFileTypeSorted + ) + + const filesCountInfoPerFileTagSorted = filesCountInfo.perFileTag.sort((a, b) => + a.tag.value.localeCompare(b.tag.value) + ) + const expectedFilesCountInfoPerFileTagSorted = expectedFilesCountInfo.perFileTag.sort( + (a, b) => a.tag.value.localeCompare(b.tag.value) + ) + expect(filesCountInfoPerFileTagSorted).to.deep.equal( + expectedFilesCountInfoPerFileTagSorted + ) + }) + }) + + it('gets FilesCountInfo by dataset persistentId when passing filterByType criteria', async () => { + const dataset = await datasetRepository.getByPersistentId(datasetPersistentId) + if (!dataset) throw new Error('Dataset not found') + + const expectedFilesCountInfo: FilesCountInfo = { + total: 3, + perAccess: [ + { + access: FileAccessOption.RESTRICTED, + count: 2 + }, + { + access: FileAccessOption.PUBLIC, + count: 1 + } + ], + perFileType: [ + { + type: new FileType('text/csv'), + count: 3 + } + ], + perFileTag: [ + { + tag: new FileTag('category_1'), + count: 1 + }, + { + tag: new FileTag('category'), + count: 2 + } + ] + } + + await fileRepository + .getFilesCountInfoByDatasetPersistentId( + dataset.persistentId, + dataset.version, + new FileCriteria().withFilterByType('text/csv') + ) .then((filesCountInfo) => { expect(filesCountInfo.total).to.deep.equal(expectedFilesCountInfo.total)