diff --git a/package-lock.json b/package-lock.json index 6db4b74..64aecde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,26 +9,26 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@fontsource/vollkorn": "^5.0.9", + "@fontsource/vollkorn": "^5.0.12", "clean-deep": "^3.4.0", "cross-env": "^7.0.3", "language-tags": "^1.0.9", - "luxon": "^3.4.0", - "payload": "^1.14.0", - "styled-components": "^6.0.7" + "luxon": "^3.4.3", + "payload": "^1.15.6", + "styled-components": "^6.0.8" }, "devDependencies": { "@types/dotenv": "^8.2.0", - "@types/express": "^4.17.17", - "@types/language-tags": "^1.0.1", - "@types/luxon": "^3.3.1", - "@types/qs": "^6.9.7", + "@types/express": "^4.17.18", + "@types/language-tags": "^1.0.2", + "@types/luxon": "^3.3.2", + "@types/qs": "^6.9.8", "@types/react-router-dom": "^5.3.3", "copyfiles": "^2.4.1", "nodemon": "^3.0.1", - "prettier": "^3.0.2", + "prettier": "^3.0.3", "ts-node": "^10.9.1", - "typescript": "^5.1.6" + "typescript": "^5.2.2" } }, "node_modules/@ampproject/remapping": { @@ -3687,9 +3687,9 @@ } }, "node_modules/@fontsource/vollkorn": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/@fontsource/vollkorn/-/vollkorn-5.0.9.tgz", - "integrity": "sha512-JEXK96OZ11PJ+cqbeqK2kTqLNyvPPLgL7bf1B/1RIWjOf1R1B2fqnyDwaJ1IdXdSjKu2YNhU1scV+CWD7pyqXg==" + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/@fontsource/vollkorn/-/vollkorn-5.0.12.tgz", + "integrity": "sha512-KjWzn/iQfN/PpgAYSX6Hzxqfgpt79f87aFVG0QazSVuSn3Lia6e9nDI46+nev2dD2UySwL9yUSx175IMvBt7FA==" }, "node_modules/@hapi/hoek": { "version": "9.3.0", @@ -4375,9 +4375,9 @@ } }, "node_modules/@swc/core": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.77.tgz", - "integrity": "sha512-CiLD2NGTdhE8JnWFHeRAglaCAcvwOxvpeWNtCIT261GrxTKCXHPAn4eqIWiBzXnwWDmZ6XdyrCL4/GmPESNnrg==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.78.tgz", + "integrity": "sha512-y6DQP571v7fbUUY7nz5G4lNIRGofuO48K5pGhD9VnuOCTuptfooCdi8wnigIrIhM/M4zQ53m/YCMDCbOtDgEww==", "hasInstallScript": true, "engines": { "node": ">=10" @@ -4387,16 +4387,16 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.3.77", - "@swc/core-darwin-x64": "1.3.77", - "@swc/core-linux-arm-gnueabihf": "1.3.77", - "@swc/core-linux-arm64-gnu": "1.3.77", - "@swc/core-linux-arm64-musl": "1.3.77", - "@swc/core-linux-x64-gnu": "1.3.77", - "@swc/core-linux-x64-musl": "1.3.77", - "@swc/core-win32-arm64-msvc": "1.3.77", - "@swc/core-win32-ia32-msvc": "1.3.77", - "@swc/core-win32-x64-msvc": "1.3.77" + "@swc/core-darwin-arm64": "1.3.78", + "@swc/core-darwin-x64": "1.3.78", + "@swc/core-linux-arm-gnueabihf": "1.3.78", + "@swc/core-linux-arm64-gnu": "1.3.78", + "@swc/core-linux-arm64-musl": "1.3.78", + "@swc/core-linux-x64-gnu": "1.3.78", + "@swc/core-linux-x64-musl": "1.3.78", + "@swc/core-win32-arm64-msvc": "1.3.78", + "@swc/core-win32-ia32-msvc": "1.3.78", + "@swc/core-win32-x64-msvc": "1.3.78" }, "peerDependencies": { "@swc/helpers": "^0.5.0" @@ -4408,9 +4408,9 @@ } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.77.tgz", - "integrity": "sha512-l4KGQAGB4Ih1Al2tWoUBrtVJCF/xZRjH3jCMCRD52KZDRAnRVDq42JKek7+aHjjH8juzTISaqzsI8Ipv6zvKhA==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.78.tgz", + "integrity": "sha512-596KRua/d5Gx1buHKKchSyHuwoIL4S1BRD/wCvYNLNZ3xOzcuBBmXOjrDVigKi1ztNDeS07p30RO5UyYur0XAA==", "cpu": [ "arm64" ], @@ -4423,9 +4423,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.77.tgz", - "integrity": "sha512-eFCkZg/BzObOn5IWn7t/Ywz+jlZKff/1XBymT7Arh/UkO39Agh+rYdBqjbylp4JQMl0qGRBfxD3wPgDRoViNVQ==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.78.tgz", + "integrity": "sha512-w0RsD1onQAj0vuLAoOVi48HgnW6D6oBEIZP17l0HYejCDBZ+FRZLjml7wgNAWMqHcd2qNRqgtZ+v7aLza2JtBQ==", "cpu": [ "x64" ], @@ -4438,9 +4438,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.77.tgz", - "integrity": "sha512-+1BueyGcCQAtxSORJml0CU8aKQNssQ5E3ABMFJwCbcec+lUCiGYK1fBfqj4FmWQMbXuQ+mn1SMeXSZAtaXoQ3w==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.78.tgz", + "integrity": "sha512-v1CpRn+H6fha1WIqmdRvJM40pFdjUHrGfhf4Ygci72nlAU41l5XimN8Iwkm8FgIwf2wnv0lLzedSM4IHvpq/yA==", "cpu": [ "arm" ], @@ -4453,9 +4453,9 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.77.tgz", - "integrity": "sha512-3smbzVcuuCiWWPFeUIp1c0aAXd+fGsc8x8rUcYvoJAWBgLJ45JymOI5WSUjIybl3rk0prdkbFylZuR0t1Rue3A==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.78.tgz", + "integrity": "sha512-Sis17dz9joJRFVvR/gteOZSUNrrrioo81RQzani0Zr5ZZOfWLMTB9DA+0MVlfnVa2taYcsJHJZFoAv9JkLwbzg==", "cpu": [ "arm64" ], @@ -4468,9 +4468,9 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.77.tgz", - "integrity": "sha512-e81+i4ef5vDeu9AkMY2AamPcmtPVPUqeqq3aNWM1tcHCaUej1DwY4xhRxrd1OvEoYyVBLtiMb5nenF3V9OzXIQ==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.78.tgz", + "integrity": "sha512-E5F8/qp+QupnfBnsP4vN1PKyCmAHYHDG1GMyPE/zLFOUYLgw+jK4C9rfyLBR0o2bWo1ay2WCIjusBZD9XHGOSA==", "cpu": [ "arm64" ], @@ -4483,9 +4483,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.77.tgz", - "integrity": "sha512-gl3+9VESckZ/GYCmGClGgXqB2tAA2MivEV/51Wde+2alo2lPSSujEhxE6Q3TNYkXOLAHSupYyDZ0ou9RfXufOw==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.78.tgz", + "integrity": "sha512-iDxa+RknnTQlyy+WfPor1FM6y44ERNI2E0xiUV6gV6uPwegCngi8LFC+E7IvP6+p+yXtAkesunAaiZ8nn0s+rw==", "cpu": [ "x64" ], @@ -4498,9 +4498,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.77.tgz", - "integrity": "sha512-AqQLZAMYTaNrA4i/Nv/GhXdildDZyRv6xsK8u2actevv5PPjD/69yYB3Z4uaptwh/4ys4W/Y2vnt+OPCNH4OQg==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.78.tgz", + "integrity": "sha512-dWtIYUFL5sMTE2UKshkXTusHcK8+zAhhGzvqWq1wJS45pqTlrAbzpyqB780fle880x3A6DMitWmsAFARdNzpuQ==", "cpu": [ "x64" ], @@ -4513,9 +4513,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.77.tgz", - "integrity": "sha512-Wdw++6w7WyavxZ3WruElCrRJ6EO0iHS0Mts4qHnbKgD08GJqIMTZPtZ5qhRe9zCf6sj2rQqhAMf/HKhYrHoF+w==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.78.tgz", + "integrity": "sha512-CXFaGEc2M9Su3UoUMC8AnzKb9g+GwPxXfakLWZsjwS448h6jcreExq3nwtBNdVGzQ26xqeVLMFfb1l/oK99Hwg==", "cpu": [ "arm64" ], @@ -4528,9 +4528,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.77.tgz", - "integrity": "sha512-ObNVpdtLdXDpmVKuMZh87yBYL4ti64WX95o2j5Oq3r0e0RqwIGqGvPDxvJVEiyCnaXHfl8eSNKWuiOxPHPkMNQ==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.78.tgz", + "integrity": "sha512-FaH1jwWnJpWkdImpMoiZpMg9oy9UUyZwltzN7hFwjR48e3Li82cRFb+9PifIBHCUSBM+CrrsJXbHP213IMVAyw==", "cpu": [ "ia32" ], @@ -4543,9 +4543,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.3.77", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.77.tgz", - "integrity": "sha512-Ew6jg/qr0v/2ixeJXvIUBuAPMKTz8HRoDBO/nHkvlnDFmkhsyH7h5YwJS1rLBwAEhWuJaVYjYi7cibZTI/QRYQ==", + "version": "1.3.78", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.78.tgz", + "integrity": "sha512-oYxa+tPdhlx1aH14AIoF6kvVjo49tEOW0drNqoEaVHufvgH0y43QU2Jum3b2+xXztmMRtzK2CSN3GPOAXDKKKg==", "cpu": [ "x64" ], @@ -4663,9 +4663,9 @@ "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==" }, "node_modules/@types/express": { - "version": "4.17.17", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", - "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", + "version": "4.17.18", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.18.tgz", + "integrity": "sha512-Sxv8BSLLgsBYmcnGdGjjEjqET2U+AKAdCRODmMiq02FgjwuV75Ut85DRpvFjyw/Mk0vgUOliGRU0UUmuuZHByQ==", "dev": true, "dependencies": { "@types/body-parser": "*", @@ -4744,9 +4744,9 @@ "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==" }, "node_modules/@types/language-tags": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/language-tags/-/language-tags-1.0.1.tgz", - "integrity": "sha512-rTtRNIewaBrkMUfsCe7ES3xsTRQcEVgic2yoDY9hM3D/nwmABcG2du4l4+dTbWvfO8pUYwL4/2TbWFJa/AGc2g==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/language-tags/-/language-tags-1.0.2.tgz", + "integrity": "sha512-yrpbdlA+8vK2s2Xhyt+DOy0QptYR7OI7yLsUuyySAAuieNtTqslmLCmnQFLF+Z/HeatYg2FfkfiP7gIQRBg9wQ==", "dev": true }, "node_modules/@types/lodash": { @@ -4755,9 +4755,9 @@ "integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==" }, "node_modules/@types/luxon": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.3.1.tgz", - "integrity": "sha512-XOS5nBcgEeP2PpcqJHjCWhUCAzGfXIU8ILOSLpx2FhxqMW9KdxgCGXNOEKGVBfveKtIpztHzKK5vSRVLyW/NqA==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.3.2.tgz", + "integrity": "sha512-l5cpE57br4BIjK+9BSkFBOsWtwv6J9bJpC7gdXIzZyI0vuKvNTk0wZZrkQxMGsUAuGW9+WMNWF2IJMD7br2yeQ==", "dev": true }, "node_modules/@types/mime": { @@ -4792,9 +4792,9 @@ "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" }, "node_modules/@types/qs": { - "version": "6.9.7", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "version": "6.9.8", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.8.tgz", + "integrity": "sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg==", "dev": true }, "node_modules/@types/range-parser": { @@ -8912,9 +8912,9 @@ } }, "node_modules/luxon": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.4.0.tgz", - "integrity": "sha512-7eDo4Pt7aGhoCheGFIuq4Xa2fJm4ZpmldpGhjTYBNUYNCN6TIEP6v7chwwwt3KRp7YR+rghbfvjyo3V5y9hgBw==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.4.3.tgz", + "integrity": "sha512-tFWBiv3h7z+T/tDaoxA8rqTxy1CHV6gHS//QdaH4pulbq/JuBSGgQspQQqcgnwdAx6pNI7cmvz5Sv/addzHmUg==", "engines": { "node": ">=12" } @@ -9862,9 +9862,9 @@ "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==" }, "node_modules/payload": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/payload/-/payload-1.14.0.tgz", - "integrity": "sha512-2FjYIAsMHRsP/THGmDMarWhHN7N88KvLwP8Hmpl2AzuMxoBsz0EXy0tHhsbS9OXtoPURNy+/bHsUPdUPTlZs8A==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/payload/-/payload-1.15.6.tgz", + "integrity": "sha512-rK73rUbEcvnSr6q69vD/U5MiH0uXcEL9KIsTnSjX4hGaG3VLXyp/xJ9oq8FF+M15XG4LEGzNyHbqqG2R8yBLtQ==", "dependencies": { "@date-io/date-fns": "^2.16.0", "@dnd-kit/core": "^6.0.7", @@ -9873,8 +9873,8 @@ "@faceless-ui/scroll-info": "^1.3.0", "@faceless-ui/window-info": "^2.1.1", "@monaco-editor/react": "^4.5.1", - "@swc/core": "^1.3.76", - "@swc/register": "^0.1.10", + "@swc/core": "1.3.78", + "@swc/register": "0.1.10", "@types/sharp": "^0.31.1", "body-parser": "^1.20.1", "bson-objectid": "^2.0.4", @@ -11444,9 +11444,9 @@ } }, "node_modules/prettier": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.2.tgz", - "integrity": "sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -12811,9 +12811,9 @@ } }, "node_modules/styled-components": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.0.7.tgz", - "integrity": "sha512-xIwWuiRMYR43mskVsW9MGTRjSo7ol4bcVjT595fGUp3OLBJOlOgaiKaxsHdC4a2HqWKqKnh0CmcRbk5ogyDjTg==", + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.0.8.tgz", + "integrity": "sha512-AwI02MTWZwqjzfXgR5QcbmcSn5xVjY4N2TLjSuYnmuBGF3y7GicHz3ysbpUq2EMJP5M8/Nc22vcmF3V3WNZDFA==", "dependencies": { "@babel/cli": "^7.21.0", "@babel/core": "^7.21.0", @@ -13428,9 +13428,9 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index 6623cbd..a36ca26 100644 --- a/package.json +++ b/package.json @@ -21,25 +21,25 @@ "start": "sudo docker compose up" }, "dependencies": { - "@fontsource/vollkorn": "^5.0.9", + "@fontsource/vollkorn": "^5.0.12", "clean-deep": "^3.4.0", "cross-env": "^7.0.3", "language-tags": "^1.0.9", - "luxon": "^3.4.0", - "payload": "^1.14.0", - "styled-components": "^6.0.7" + "luxon": "^3.4.3", + "payload": "^1.15.6", + "styled-components": "^6.0.8" }, "devDependencies": { "@types/dotenv": "^8.2.0", - "@types/express": "^4.17.17", - "@types/language-tags": "^1.0.1", - "@types/luxon": "^3.3.1", - "@types/qs": "^6.9.7", + "@types/express": "^4.17.18", + "@types/language-tags": "^1.0.2", + "@types/luxon": "^3.3.2", + "@types/qs": "^6.9.8", "@types/react-router-dom": "^5.3.3", "copyfiles": "^2.4.1", "nodemon": "^3.0.1", - "prettier": "^3.0.2", + "prettier": "^3.0.3", "ts-node": "^10.9.1", - "typescript": "^5.1.6" + "typescript": "^5.2.2" } } diff --git a/src/collections/Keys/Keys.ts b/src/collections/Keys/Keys.ts index 72e4268..38826fc 100644 --- a/src/collections/Keys/Keys.ts +++ b/src/collections/Keys/Keys.ts @@ -19,6 +19,8 @@ const fields = { const keysTypesWithShort: (keyof typeof KeysTypes)[] = ["Categories", "GamePlatforms"]; +// TODO: Maybe make sure there is at least one English translation as a fallback + export const Keys = buildCollectionConfig({ slug: Collections.Keys, labels: { diff --git a/src/collections/Weapons/endpoints/getBySlugEndpoint.ts b/src/collections/Weapons/endpoints/getBySlugEndpoint.ts index 1fd8be6..26c2c11 100644 --- a/src/collections/Weapons/endpoints/getBySlugEndpoint.ts +++ b/src/collections/Weapons/endpoints/getBySlugEndpoint.ts @@ -1,8 +1,8 @@ import { Collections } from "../../../constants"; import { createGetByEndpoint } from "../../../endpoints/createGetByEndpoint"; -import { EndpointBasicWeapon, EndpointWeapon } from "../../../sdk"; +import { EndpointBasicWeapon, EndpointWeapon, PayloadImage } from "../../../sdk"; import { Key, Language, Recorder, Weapon, WeaponsThumbnail } from "../../../types/collections"; -import { isDefined, isUndefined } from "../../../utils/asserts"; +import { isDefined, isUndefined, isValidPayloadImage } from "../../../utils/asserts"; export const getBySlugEndpoint = createGetByEndpoint( Collections.Weapons, @@ -78,9 +78,29 @@ const getThumbnail = (thumbnail?: string | WeaponsThumbnail): WeaponsThumbnail | return thumbnail; }; +const getPayloadImage = ( + image: Partial | undefined, + fallback: PayloadImage +): PayloadImage => + isValidPayloadImage(image) + ? { + filename: image.filename, + height: image.height, + mimeType: image.mimeType, + width: image.width, + url: image.url, + } + : { + filename: fallback.filename, + height: fallback.height, + mimeType: fallback.mimeType, + width: fallback.width, + url: fallback.url, + }; + const convertWeaponToEndpointBasicWeapon = ({ slug, - thumbnail, + thumbnail: rawThumbnail, type, appearances, }: Weapon): EndpointBasicWeapon => { @@ -114,9 +134,20 @@ const convertWeaponToEndpointBasicWeapon = ({ } ); + const thumbnail = getThumbnail(rawThumbnail); + const images: EndpointBasicWeapon["images"] = + isValidPayloadImage(thumbnail) && isDefined(thumbnail.sizes) + ? { + openGraph: getPayloadImage(thumbnail.sizes.og, thumbnail), + previewCard: getPayloadImage(thumbnail.sizes.small, thumbnail), + thumbnailHeader: getPayloadImage(thumbnail.sizes.medium, thumbnail), + lightBox: getPayloadImage(thumbnail, thumbnail), + } + : undefined; + return { slug, - thumbnail: getThumbnail(thumbnail), + images, type: getKeyId(type), categories: [...categories.values()], translations, diff --git a/src/payload.config.ts b/src/payload.config.ts index e914a20..3644b0a 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -25,7 +25,7 @@ import { WeaponsThumbnails } from "./collections/WeaponsThumbnails/WeaponsThumbn import { Icon } from "./components/Icon"; import { Logo } from "./components/Logo"; import { Collections } from "./constants"; -import { gridViewPlugin } from "./plugins/payload-grid-view"; +import { payloadGridView } from "./plugins/payload-grid-view"; export default buildConfig({ serverURL: process.env.PAYLOAD_URI, @@ -71,5 +71,5 @@ export default buildConfig({ graphQL: { disable: true, }, - plugins: [gridViewPlugin], + plugins: [payloadGridView], }); diff --git a/src/plugins/payload-grid-view/components/UploadsGridView/Grid/index.scss b/src/plugins/payload-grid-view/components/Grid/index.scss similarity index 100% rename from src/plugins/payload-grid-view/components/UploadsGridView/Grid/index.scss rename to src/plugins/payload-grid-view/components/Grid/index.scss diff --git a/src/plugins/payload-grid-view/components/UploadsGridView/Grid/index.tsx b/src/plugins/payload-grid-view/components/Grid/index.tsx similarity index 100% rename from src/plugins/payload-grid-view/components/UploadsGridView/Grid/index.tsx rename to src/plugins/payload-grid-view/components/Grid/index.tsx diff --git a/src/plugins/payload-grid-view/components/UploadsGridView/UploadsGridView.tsx b/src/plugins/payload-grid-view/components/List/index.tsx similarity index 98% rename from src/plugins/payload-grid-view/components/UploadsGridView/UploadsGridView.tsx rename to src/plugins/payload-grid-view/components/List/index.tsx index 0b122b7..5b46770 100644 --- a/src/plugins/payload-grid-view/components/UploadsGridView/UploadsGridView.tsx +++ b/src/plugins/payload-grid-view/components/List/index.tsx @@ -21,8 +21,8 @@ import formatFilesize from "payload/dist/uploads/formatFilesize"; import { getTranslation } from "payload/dist/utilities/getTranslation"; import React, { Fragment, useState } from "react"; import { useTranslation } from "react-i18next"; -import Grid from "./Grid"; -import ListControls, { ViewMode } from "./ListControls"; +import Grid from "../Grid"; +import ListControls, { ViewMode } from "../ListControls"; const baseClass = "collection-list"; @@ -31,7 +31,7 @@ export type UploadsGridViewOptions = { grid?: boolean; }; -export const UploadsGridView = +export const DefaultList = (options: UploadsGridViewOptions) => (props: Props): JSX.Element => { const { diff --git a/src/plugins/payload-grid-view/components/UploadsGridView/ListControls.tsx b/src/plugins/payload-grid-view/components/ListControls.tsx similarity index 100% rename from src/plugins/payload-grid-view/components/UploadsGridView/ListControls.tsx rename to src/plugins/payload-grid-view/components/ListControls.tsx diff --git a/src/plugins/payload-grid-view/index.ts b/src/plugins/payload-grid-view/index.ts index a1f3101..dd57041 100644 --- a/src/plugins/payload-grid-view/index.ts +++ b/src/plugins/payload-grid-view/index.ts @@ -1,7 +1,7 @@ import { Plugin } from "payload/config"; import { CollectionAdminOptions } from "payload/dist/collections/config/types"; import { CollectionConfig } from "payload/types"; -import { UploadsGridView, UploadsGridViewOptions } from "./components/UploadsGridView/UploadsGridView"; +import { DefaultList, UploadsGridViewOptions } from "./components/List"; type Components = Required["components"]; type ViewsComponents = Required["components"]>["views"]; @@ -15,7 +15,7 @@ export type CollectionConfigWithGridView = CollectionConfig & { custom?: { gridView?: UploadsGridViewOptions }; }; -export const gridViewPlugin: Plugin = ({ collections, ...others }) => ({ +export const payloadGridView: Plugin = ({ collections, ...others }) => ({ collections: collections?.map(handleCollection), ...others, }); @@ -49,5 +49,5 @@ const handleViewsComponents = ( { isUploadEnabled, gridView }: Options ): ViewsComponents => ({ ...others, - List: isUploadEnabled ? UploadsGridView(gridView) : List, + List: isUploadEnabled ? DefaultList(gridView) : List, }); diff --git a/src/sdk.ts b/src/sdk.ts index 6ac212b..088cefd 100644 --- a/src/sdk.ts +++ b/src/sdk.ts @@ -1,5 +1,4 @@ import { Collections } from "./constants"; -import { WeaponsThumbnail } from "./types/collections"; class NodeCache { constructor(_params: any) {} @@ -118,7 +117,20 @@ export type EndpointBasicWeapon = { type: string; categories: string[]; translations: { language: string; name: string; aliases: string[] }[]; - thumbnail?: WeaponsThumbnail; + images?: { + previewCard: PayloadImage; + thumbnailHeader: PayloadImage; + lightBox: PayloadImage; + openGraph: PayloadImage; + }; +}; + +export type PayloadImage = { + url: string; + width: number; + height: number; + mimeType: string; + filename: string; }; export const payload = { diff --git a/src/utils/asserts.ts b/src/utils/asserts.ts index cf8314d..8254970 100644 --- a/src/utils/asserts.ts +++ b/src/utils/asserts.ts @@ -1,3 +1,5 @@ +import { PayloadImage } from "../sdk"; + export const isDefined = (value: T | null | undefined): value is T => value !== null && value !== undefined; @@ -24,3 +26,15 @@ export const hasNoIntersection = (a: Span, b: Span): boolean => { export const hasIntersection = (a: Span, b: Span): boolean => !hasNoIntersection(a, b); export const hasDuplicates = (list: T[]): boolean => list.length !== new Set(list).size; + +export const isValidPayloadImage = ( + image: Partial | undefined +): image is PayloadImage => { + if (isUndefined(image)) return false; + if (isEmpty(image.filename)) return false; + if (isEmpty(image.url)) return false; + if (isEmpty(image.mimeType)) return false; + if (isUndefined(image.width)) return false; + if (isUndefined(image.height)) return false; + return true; +}; diff --git a/src/utils/imageCollectionConfig.ts b/src/utils/imageCollectionConfig.ts index 4652dad..5476490 100644 --- a/src/utils/imageCollectionConfig.ts +++ b/src/utils/imageCollectionConfig.ts @@ -1,5 +1,6 @@ import { ImageSize } from "payload/dist/uploads/types"; import { CollectionConfig } from "payload/types"; +import { publicAccess } from "../accesses/publicAccess"; import { CollectionGroups } from "../constants"; import { createImageRegenerationEndpoint } from "../endpoints/createImageRegenerationEndpoint"; import { BuildCollectionConfig, buildCollectionConfig } from "./collectionConfig"; @@ -22,6 +23,9 @@ export const buildImageCollectionConfig = ({ group: CollectionGroups.Media, ...admin, }, + access: { + read: publicAccess, + }, endpoints: [createImageRegenerationEndpoint(otherConfig.slug)], upload: { staticDir: `../uploads/${otherConfig.slug}`,