diff --git a/backend/functions/src/schema/core/helpers/typeDef.ts b/backend/functions/src/schema/core/helpers/typeDef.ts index fe1decd..86619da 100644 --- a/backend/functions/src/schema/core/helpers/typeDef.ts +++ b/backend/functions/src/schema/core/helpers/typeDef.ts @@ -700,13 +700,9 @@ function validateFieldPath( // returns resolver object instead of a typeDef because it is also used to generate the rootResolver export function generatePaginatorPivotResolverObject(params: { pivotService: PaginatedService; - currentService?: NormalService; + filterByField?: string; }) { - const { pivotService, currentService } = params; - - const filterByField = currentService - ? currentService.typename.toLowerCase() + ".id" - : null; + const { pivotService, filterByField } = params; // if filterByField, ensure that filterByField is a valid filterField on pivotService if (filterByField && !pivotService.filterFieldsMap[filterByField]) { @@ -718,12 +714,7 @@ export function generatePaginatorPivotResolverObject(params: { // generate sortByKey ScalarDefinition const sortByScalarDefinition: ScalarDefinition = { name: pivotService.typename + "SortByKey", - types: Object.entries(pivotService.sortFieldsMap).map(([key, value]) => { - // ensure the path exists - validateFieldPath(pivotService.getTypeDef(), value.field ?? key); - - return `"${key}"`; - }), + types: [], parseValue: (value) => { if (typeof value !== "string" || !(value in pivotService.sortFieldsMap)) throw true; @@ -731,6 +722,17 @@ export function generatePaginatorPivotResolverObject(params: { }, }; + process.nextTick(() => { + sortByScalarDefinition.types = Object.entries( + pivotService.sortFieldsMap + ).map(([key, value]) => { + // ensure the path exists + validateFieldPath(pivotService.getTypeDef(), value.field ?? key); + + return `"${key}"`; + }); + }); + const groupByScalarDefinition: ScalarDefinition = { name: pivotService.typename + "GroupByKey", types: Object.entries(pivotService.groupByFieldsMap).map(([key, value]) => { diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 58f8262..468f583 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -3179,22 +3179,6 @@ } } }, - "@nuxt/typescript-runtime": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@nuxt/typescript-runtime/-/typescript-runtime-2.0.0.tgz", - "integrity": "sha512-jF//aTclzhdaExENtLbWFpBAGcg9Aj0V4rEWnNGTdWfqurMMdzC96U+oa8UJIMMZgTp9MW3vaqbKuzTq8btz/A==", - "requires": { - "ts-node": "^9.0.0", - "typescript": "~4.0" - }, - "dependencies": { - "typescript": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.7.tgz", - "integrity": "sha512-yi7M4y74SWvYbnazbn8/bmJmX4Zlej39ZOqwG/8dut/MYoSQ119GY9ZFbbGsD4PFZYWxqik/XsP3vk3+W5H3og==" - } - } - }, "@nuxt/utils": { "version": "2.15.4", "resolved": "https://registry.npmjs.org/@nuxt/utils/-/utils-2.15.4.tgz", @@ -4437,11 +4421,6 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -4986,15 +4965,15 @@ } }, "browserslist": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.3.tgz", - "integrity": "sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw==", + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.4.tgz", + "integrity": "sha512-d7rCxYV8I9kj41RH8UKYnvDYCRENUlHRgyXy/Rhr/1BaeLGfiCptEdFE8MIrvGfWbBFNjVYx76SQWvNX1j+/cQ==", "requires": { - "caniuse-lite": "^1.0.30001181", - "colorette": "^1.2.1", - "electron-to-chromium": "^1.3.649", + "caniuse-lite": "^1.0.30001208", + "colorette": "^1.2.2", + "electron-to-chromium": "^1.3.712", "escalade": "^3.1.1", - "node-releases": "^1.1.70" + "node-releases": "^1.1.71" } }, "buffer": { @@ -5169,9 +5148,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001208", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001208.tgz", - "integrity": "sha512-OE5UE4+nBOro8Dyvv0lfx+SRtfVIOM9uhKqFmJeUbGriqhhStgp1A0OyBpgy3OUF8AhYCT+PVwPC1gMl2ZcQMA==" + "version": "1.0.30001209", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001209.tgz", + "integrity": "sha512-2Ktt4OeRM7EM/JaOZjuLzPYAIqmbwQMNnYbgooT+icoRGrKOyAxA1xhlnotBD1KArRSPsuJp3TdYcZYrL7qNxA==" }, "chalk": { "version": "2.4.2", @@ -6046,11 +6025,6 @@ "resolved": "https://registry.npmjs.org/devalue/-/devalue-2.0.1.tgz", "integrity": "sha512-I2TiqT5iWBEyB8GRfTDP0hiLZ0YeDJZ+upDxjBfOC2lebO5LezQMv7QvIUTzdb64jQyAKLf1AHADtGN+jw6v8Q==" }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" - }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -6212,9 +6186,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "electron-to-chromium": { - "version": "1.3.712", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.712.tgz", - "integrity": "sha512-3kRVibBeCM4vsgoHHGKHmPocLqtFAGTrebXxxtgKs87hNUzXrX2NuS3jnBys7IozCnw7viQlozxKkmty2KNfrw==" + "version": "1.3.717", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.717.tgz", + "integrity": "sha512-OfzVPIqD1MkJ7fX+yTl2nKyOE4FReeVfMCzzxQS+Kp43hZYwHwThlGP+EGIZRXJsxCM7dqo8Y65NOX/HP12iXQ==" }, "elliptic": { "version": "6.5.4", @@ -8019,9 +7993,9 @@ "dev": true }, "get-stream": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.0.tgz", - "integrity": "sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg==" + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" }, "get-value": { "version": "2.0.6", @@ -9242,11 +9216,6 @@ } } }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" - }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", @@ -9613,9 +9582,9 @@ "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "node-html-parser": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-3.1.3.tgz", - "integrity": "sha512-pCE2I5UY5iOBnWdJQkbYZSk+fyq2zepw0nsELpHQjVFyCzOeZhkMhnvKqGceKgzWsWx7EG4KtMqsy9Eklf5Thw==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-3.1.5.tgz", + "integrity": "sha512-/XKKdWbSUymlXTjtNBcDlmM7Jp8S/BqGMzLx7r2bd2NMjTXz+ofuLcz0Bl3VT0vTvVzF+N511FNLrZt4HVitXA==", "requires": { "css-select": "^3.1.2", "he": "1.2.0" @@ -9654,21 +9623,21 @@ "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" }, "domhandler": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.1.0.tgz", - "integrity": "sha512-/6/kmsGlMY4Tup/nGVutdrK9yQi4YjWVcVeoQmixpzjOUK1U7pQkvAPHBJeUxOgxF0J8f8lwCJSlCfD0V4CMGQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.0.tgz", + "integrity": "sha512-zk7sgt970kzPks2Bf+dwT/PLzghLnsivb9CcxkvR8Mzr66Olr0Ofd8neSbglHJHaHa2MadfoSdNlKYAaafmWfA==", "requires": { "domelementtype": "^2.2.0" } }, "domutils": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.5.2.tgz", - "integrity": "sha512-MHTthCb1zj8f1GVfRpeZUbohQf/HdBos0oX5gZcQFepOZPLLRyj6Wn7XS7EMnY7CVpwv8863u2vyE83Hfu28HQ==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.6.0.tgz", + "integrity": "sha512-y0BezHuy4MDYxh6OvolXYsH+1EMGmFbwv5FKW7ovwMG6zTPWqNPq3WF9ayZssFq+UlKdffGLbOEaghNdaOm1WA==", "requires": { "dom-serializer": "^1.0.1", "domelementtype": "^2.2.0", - "domhandler": "^4.1.0" + "domhandler": "^4.2.0" } }, "nth-check": { @@ -9989,9 +9958,9 @@ } }, "object-inspect": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", - "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==" + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.1.tgz", + "integrity": "sha512-WQUIkCSDPWm5ing/PTUkLr2KaOXX2uV/vz1hLGW2XbZ/RDUmtgcsOyEqA1ox0rkyNx9mJX4kxX+YWceje3pmag==" }, "string.prototype.trimend": { "version": "1.0.4", @@ -10721,11 +10690,10 @@ } }, "postcss-initial": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/postcss-initial/-/postcss-initial-3.0.2.tgz", - "integrity": "sha512-ugA2wKonC0xeNHgirR4D3VWHs2JcU08WAi1KFLVcnb7IN89phID6Qtg2RIctWbnvp1TM2BOmDtX8GGLCKdR8YA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/postcss-initial/-/postcss-initial-3.0.4.tgz", + "integrity": "sha512-3RLn6DIpMsK1l5UUy9jxQvoDeUN4gP939tDcKUHD/kM8SGSKbFAnvkpFpj3Bhtz3HGk1jWY5ZNWX6mPta5M9fg==", "requires": { - "lodash.template": "^4.5.0", "postcss": "^7.0.2" } }, @@ -12162,9 +12130,9 @@ } }, "object-inspect": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", - "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==" + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.1.tgz", + "integrity": "sha512-WQUIkCSDPWm5ing/PTUkLr2KaOXX2uV/vz1hLGW2XbZ/RDUmtgcsOyEqA1ox0rkyNx9mJX4kxX+YWceje3pmag==" } } }, @@ -12927,13 +12895,15 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" }, "thread-loader": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/thread-loader/-/thread-loader-3.0.1.tgz", - "integrity": "sha512-c8Mr7jooXEAochk72XoQ1vPauwFToz9GVwqevqQShAypCUW0nRzYIbkzZo3KErNhhYf/+ga5cUQWxVXQteJj/g==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/thread-loader/-/thread-loader-3.0.3.tgz", + "integrity": "sha512-/s8dGDkKLF89qAsn2b0PNdXS68pKhj+/Rqd7YDht/OvTlBoMm0FAsndceowSX1GEKVLo8yKRil9e+W0PpI/q1g==", "requires": { + "json-parse-better-errors": "^1.0.2", "loader-runner": "^4.1.0", "loader-utils": "^2.0.0", - "neo-async": "^2.6.2" + "neo-async": "^2.6.2", + "schema-utils": "^3.0.0" }, "dependencies": { "loader-utils": { @@ -12945,6 +12915,16 @@ "emojis-list": "^3.0.0", "json5": "^2.1.2" } + }, + "schema-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", + "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "requires": { + "@types/json-schema": "^7.0.6", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } } } }, @@ -13150,18 +13130,6 @@ } } }, - "ts-node": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", - "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", - "requires": { - "arg": "^4.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "source-map-support": "^0.5.17", - "yn": "3.1.1" - } - }, "ts-pnp": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", @@ -13250,9 +13218,9 @@ "integrity": "sha512-Yu7TJThwlr23peOkX/+hm6LfkyBs+eDWV880468PTrjKBKjjsNWFFwIuOqDfmXngRo9TZ4+twFYueRH0OLl0Gw==" }, "uglify-js": { - "version": "3.13.3", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.3.tgz", - "integrity": "sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig==" + "version": "3.13.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.4.tgz", + "integrity": "sha512-kv7fCkIXyQIilD5/yQy8O+uagsYIOt5cZvs890W40/e/rvjMSzJw81o9Bg0tkURxzZBROtDQhW2LFjOGoK3RZw==" }, "unbox-primitive": { "version": "1.0.1", @@ -14159,9 +14127,9 @@ } }, "webpack-bundle-analyzer": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.4.0.tgz", - "integrity": "sha512-9DhNa+aXpqdHk8LkLPTBU/dMfl84Y+WE2+KnfI6rSpNRNVKa0VGLjPd2pjFubDeqnWmulFggxmWBxhfJXZnR0g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.4.1.tgz", + "integrity": "sha512-j5m7WgytCkiVBoOGavzNokBOqxe6Mma13X1asfVYtKWM3wxBiRRu1u1iG0Iol5+qp9WgyhkMmBAcvjEfJ2bdDw==", "requires": { "acorn": "^8.0.4", "acorn-walk": "^8.0.0", @@ -14175,9 +14143,9 @@ }, "dependencies": { "acorn": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.1.0.tgz", - "integrity": "sha512-LWCF/Wn0nfHOmJ9rzQApGnxnvgfROzGilS8936rqN/lfcYkY9MYZzdMqN+2NJ4SlTc+m5HiSa+kNfDtI64dwUA==" + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.1.1.tgz", + "integrity": "sha512-xYiIVjNuqtKXMxlRMDc6mZUhXehod4a3gbZ1qRlM7icK4EbxUFNLhWoPblCvFtB2Y9CIqHP3CF/rdxLItaQv8g==" }, "ansi-styles": { "version": "4.3.0", @@ -14527,11 +14495,6 @@ "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", "dev": true }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" - }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 48971ad..78ea722 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,15 +3,14 @@ "version": "1.0.0", "private": true, "scripts": { - "dev": "set DEV=1 && nuxt-ts", - "build": "nuxt-ts build", - "start": "nuxt-ts start", - "generate": "nuxt-ts generate", + "dev": "set DEV=1 && nuxt", + "build": "nuxt build", + "start": "nuxt start", + "generate": "nuxt generate", "lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .", "lint": "npm run lint:js" }, "dependencies": { - "@nuxt/typescript-runtime": "^2.0.0", "axios": "^0.21.0", "convert-array-to-csv": "^2.0.0", "core-js": "^3.6.5", diff --git a/frontend/pages/my-pbs.vue b/frontend/pages/my-pbs.vue index 5ddbbd4..a1f5768 100644 --- a/frontend/pages/my-pbs.vue +++ b/frontend/pages/my-pbs.vue @@ -27,7 +27,7 @@ export default { }, title: 'My PBs', hiddenFilters: ['createdBy.id', 'isCurrent'], - hiddenHeaders: ['createdBy.name+createdBy.avatar'], + hiddenHeaders: ['createdBy.name+createdBy.avatar+createdBy.id'], } }, diff --git a/frontend/pages/public-pbs.vue b/frontend/pages/public-pbs.vue index ba2e88c..01aefdf 100644 --- a/frontend/pages/public-pbs.vue +++ b/frontend/pages/public-pbs.vue @@ -139,7 +139,7 @@ export default { }, watch: { '$route.query.pageOptions'() { - this.loadPresets() + this.syncFilters() }, }, @@ -160,7 +160,7 @@ export default { this.$router.push( generateRoute(this.$route.path, { ...originalPageOptions, - filters: (originalPageOptions.filters + filters: (originalPageOptions?.filters ? originalPageOptions.filters.filter( (filterObject) => !excludeFilterKeys.includes(filterObject.field) @@ -189,7 +189,7 @@ export default { this.$router.push( generateRoute(this.$route.path, { ...originalPageOptions, - filters: (originalPageOptions.filters + filters: (originalPageOptions?.filters ? originalPageOptions.filters.filter( (filterObject) => !excludeFilterKeys.includes(filterObject.field) @@ -220,7 +220,11 @@ export default { this.events = await getEvents(this) - // populate dropdown inputs + this.loading.presets = false + }, + + // syncs preset inputs with filters + syncFilters() { const originalPageOptions = this.$route.query.pageOptions ? JSON.parse(atob(decodeURIComponent(this.$route.query.pageOptions))) : null @@ -257,8 +261,6 @@ export default { this.inputs.pbType = null } } - - this.loading.presets = false }, }, }