diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..3d0a9346 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +resources +openapi diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..a8d40002 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,29 @@ +{ + "extends": "@openstapps", + "rules": { + "@typescript-eslint/no-empty-interface": "off", + "jsdoc/check-tag-names": [ + "error", + { + "definedTags": [ + "internal", + "aggregatable", + "float", + "indexable", + "integer", + "keyword", + "sortable", + "text", + "date", + "validatable", + "filterable", + "inheritTags", + "minLength", + "pattern", + "typeparam", + "TJS-format" + ] + } + ] + } +} diff --git a/package-lock.json b/package-lock.json index 6d3ab22e..4cb70fb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -317,6 +317,17 @@ "@jridgewell/trace-mapping": "0.3.9" } }, + "@es-joy/jsdoccomment": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.31.0.tgz", + "integrity": "sha512-tc1/iuQcnaiSIUVad72PBierDFpsxdUHtEF/OrfqvM1CBAsIoMP51j52jTMb3dXriwhieTo289InzZj72jL3EQ==", + "dev": true, + "requires": { + "comment-parser": "1.3.1", + "esquery": "^1.4.0", + "jsdoc-type-pratt-parser": "~3.1.0" + } + }, "@eslint/eslintrc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", @@ -547,34 +558,18 @@ } }, "@openstapps/configuration": { - "version": "0.29.1", - "resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.29.1.tgz", - "integrity": "sha512-H6DNB1HrujC5LwOF17rYkXQPFaEWTaA5T3IPsfccSuKHSUhB0ry6V5OkMwmvls2nOSrbpuRpyQoM7ulwZ9X9Bw==", + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.33.0.tgz", + "integrity": "sha512-sum9DB8+2r5eXnJhie1UPcQQTPupd0m3Xgsft+D6LVvbjbmt/XCpCMvlZSoM+LE1ZkUdgUmbFJ81mqjWKgCsJA==", "dev": true, "requires": { - "@types/node": "14.18.18", - "@types/semver": "7.3.9", + "@types/node": "14.18.24", + "@types/semver": "7.3.12", "@types/yaml": "1.9.7", "chalk": "4.1.2", - "commander": "9.2.0", + "commander": "9.4.0", "semver": "7.3.7", - "tslint": "6.1.3", - "tslint-eslint-rules": "5.4.0", "yaml": "1.10.2" - }, - "dependencies": { - "@types/node": { - "version": "14.18.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.18.tgz", - "integrity": "sha512-B9EoJFjhqcQ9OmQrNorItO+OwEOORNn3S31WuiHvZY/dm9ajkB7AKD/8toessEtHHNL+58jofbq7hMMY9v4yig==", - "dev": true - }, - "commander": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.2.0.tgz", - "integrity": "sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==", - "dev": true - } } }, "@openstapps/core-tools": { @@ -659,6 +654,12 @@ } } }, + "@openstapps/eslint-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@openstapps/eslint-config/-/eslint-config-1.1.0.tgz", + "integrity": "sha512-yhSWgzKB5cU3kTtWdAOEO6y4PjLDBnyJc+Dpmz9Rxg97WSViOiz3Bv9BWTSl0TR56GAnFi0NI8K56RfCqjpk5w==", + "dev": true + }, "@openstapps/logger": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-1.0.0.tgz", @@ -847,9 +848,9 @@ } }, "@types/semver": { - "version": "7.3.9", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz", - "integrity": "sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==", + "version": "7.3.12", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==", "dev": true }, "@types/yaml": { @@ -861,6 +862,134 @@ "yaml": "*" } }, + "@typescript-eslint/eslint-plugin": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.33.1.tgz", + "integrity": "sha512-S1iZIxrTvKkU3+m63YUOxYPKaP+yWDQrdhxTglVDVEVBf+aCSw85+BmJnyUaQQsk5TXFG/LpBu9fa+LrAQ91fQ==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/type-utils": "5.33.1", + "@typescript-eslint/utils": "5.33.1", + "debug": "^4.3.4", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.2.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "dependencies": { + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/parser": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.33.1.tgz", + "integrity": "sha512-IgLLtW7FOzoDlmaMoXdxG8HOCByTBXrB1V2ZQYSEV1ggMmJfAkMWTwUjjzagS6OkfpySyhKFkBw7A9jYmcHpZA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/typescript-estree": "5.33.1", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.33.1.tgz", + "integrity": "sha512-8ibcZSqy4c5m69QpzJn8XQq9NnqAToC8OdH/W6IXPXv83vRyEDPYLdjAlUx8h/rbusq6MkW4YdQzURGOqsn3CA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/visitor-keys": "5.33.1" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.33.1.tgz", + "integrity": "sha512-X3pGsJsD8OiqhNa5fim41YtlnyiWMF/eKsEZGsHID2HcDqeSC5yr/uLOeph8rNF2/utwuI0IQoAK3fpoxcLl2g==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "5.33.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "dependencies": { + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/types": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.33.1.tgz", + "integrity": "sha512-7K6MoQPQh6WVEkMrMW5QOA5FO+BOwzHSNd0j3+BlBwd6vtzfZceJ8xJ7Um2XDi/O3umS8/qDX6jdy2i7CijkwQ==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.33.1.tgz", + "integrity": "sha512-JOAzJ4pJ+tHzA2pgsWQi4804XisPHOtbvwUyqsuuq8+y5B5GMZs7lI1xDWs6V2d7gE/Ez5bTGojSK12+IIPtXA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/visitor-keys": "5.33.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "dependencies": { + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/utils": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.33.1.tgz", + "integrity": "sha512-uphZjkMaZ4fE8CR4dU7BquOV6u0doeQAr8n6cQenl/poMaIyJtBu8eys5uk6u5HiDH01Mj5lzbJ5SfeDz7oqMQ==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/typescript-estree": "5.33.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.33.1.tgz", + "integrity": "sha512-nwIxOK8Z2MPWltLKMLOEZwmfBZReqUdbEoHQXeCpa+sRVARe5twpJGHCB4dk9903Yaf0nMAlGbQfaAH92F60eg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.33.1", + "eslint-visitor-keys": "^3.3.0" + } + }, "@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", @@ -1317,6 +1446,21 @@ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" }, + "ci-info": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.2.tgz", + "integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==", + "dev": true + }, + "clean-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clean-regexp/-/clean-regexp-1.0.0.tgz", + "integrity": "sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -1438,6 +1582,12 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.0.tgz", "integrity": "sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==" }, + "comment-parser": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", + "integrity": "sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==", + "dev": true + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -2021,6 +2171,20 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + }, "glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -2036,13 +2200,176 @@ } } }, + "eslint-config-prettier": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", + "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "dev": true + }, + "eslint-plugin-jsdoc": { + "version": "39.3.6", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.6.tgz", + "integrity": "sha512-R6dZ4t83qPdMhIOGr7g2QII2pwCjYyKP+z0tPOfO1bbAbQyKC20Y2Rd6z1te86Lq3T7uM8bNo+VD9YFpE8HU/g==", + "dev": true, + "requires": { + "@es-joy/jsdoccomment": "~0.31.0", + "comment-parser": "1.3.1", + "debug": "^4.3.4", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.4.0", + "semver": "^7.3.7", + "spdx-expression-parse": "^3.0.1" + }, + "dependencies": { + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + } + } + }, + "eslint-plugin-prettier": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", + "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0" + } + }, + "eslint-plugin-unicorn": { + "version": "43.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-43.0.2.tgz", + "integrity": "sha512-DtqZ5mf/GMlfWoz1abIjq5jZfaFuHzGBZYIeuJfEoKKGWRHr2JiJR+ea+BF7Wx2N1PPRoT/2fwgiK1NnmNE3Hg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "ci-info": "^3.3.2", + "clean-regexp": "^1.0.0", + "eslint-utils": "^3.0.0", + "esquery": "^1.4.0", + "indent-string": "^4.0.0", + "is-builtin-module": "^3.1.0", + "lodash": "^4.17.21", + "pluralize": "^8.0.0", + "read-pkg-up": "^7.0.1", + "regexp-tree": "^0.1.24", + "safe-regex": "^2.1.1", + "semver": "^7.3.7", + "strip-indent": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "dependencies": { + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + } + } + }, + "read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, "eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, "requires": { "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" + "estraverse": "^4.1.1" } }, "eslint-utils": { @@ -2087,6 +2414,13 @@ "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", "requires": { "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + } } }, "esrecurse": { @@ -2095,12 +2429,20 @@ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "requires": { "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + } } }, "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true }, "esutils": { "version": "2.0.3", @@ -2146,6 +2488,12 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, "fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -3020,6 +3368,23 @@ "binary-extensions": "^2.0.0" } }, + "is-builtin-module": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.0.tgz", + "integrity": "sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw==", + "dev": true, + "requires": { + "builtin-modules": "^3.3.0" + }, + "dependencies": { + "builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true + } + } + }, "is-core-module": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", @@ -3118,12 +3483,6 @@ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3252,6 +3611,12 @@ "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", "dev": true }, + "jsdoc-type-pratt-parser": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-3.1.0.tgz", + "integrity": "sha512-MgtD0ZiCDk9B+eI73BextfRrVQl0oyzRG8B2BjORts6jbunj4ScKPcyXGTbB6eXL4y9TzxCm6hyeLq/2ASzNdw==", + "dev": true + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -4456,11 +4821,32 @@ "resolved": "https://registry.npmjs.org/plantuml-encoder/-/plantuml-encoder-1.4.0.tgz", "integrity": "sha512-sxMwpDw/ySY1WB2CE3+IdMuEcWibJ72DDOsXLkSmEaSzwEUaYBT6DWgOfBiHGCux4q433X6+OEFWjlVqp7gL6g==" }, + "pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" }, + "prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true + }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -4717,6 +5103,12 @@ "strip-indent": "^3.0.0" } }, + "regexp-tree": { + "version": "0.1.24", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.24.tgz", + "integrity": "sha512-s2aEVuLhvnVJW6s/iPgEGK6R+/xngd2jNQ+xy4bXNDKxZKJH6jpPHY6kVeVv1IeLCHgswRj+Kl3ELaDjG6V1iw==", + "dev": true + }, "regexpp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", @@ -4881,6 +5273,15 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "safe-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-2.1.1.tgz", + "integrity": "sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==", + "dev": true, + "requires": { + "regexp-tree": "~0.1.1" + } + }, "safe-stable-stringify": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz", @@ -5570,50 +5971,6 @@ } } }, - "tslint-eslint-rules": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz", - "integrity": "sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==", - "dev": true, - "requires": { - "doctrine": "0.7.2", - "tslib": "1.9.0", - "tsutils": "^3.0.0" - }, - "dependencies": { - "doctrine": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", - "integrity": "sha512-qiB/Rir6Un6Ad/TIgTRzsremsTGWzs8j7woXvp14jgq00676uBiBT5eUOi+FgRywZFVy5Us/c04ISRpZhRbS6w==", - "dev": true, - "requires": { - "esutils": "^1.1.6", - "isarray": "0.0.1" - } - }, - "esutils": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", - "integrity": "sha512-RG1ZkUT7iFJG9LSHr7KDuuMSlujfeTtMNIcInURxKAxhMtwQhI3NrQhz26gZQYlsYZQKzsnwtpKrFKj9K9Qu1A==", - "dev": true - }, - "tslib": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", - "dev": true - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } - } - }, "tsutils": { "version": "2.29.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", diff --git a/package.json b/package.json index e244a82f..5731140f 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "main": "./lib/index.js", "types": "./lib/index.d.ts", "scripts": { - "build": "npm run tslint && npm run compile && npm run pack && npm run schema && npm run mappings", + "build": "npm run lint && npm run compile && npm run pack && npm run schema && npm run mappings", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'", "check-configuration": "openstapps-configuration", "compile": "rimraf lib && tsc", @@ -28,7 +28,7 @@ "mappings": "mkdir lib/mappings && openstapps-es-mapping-generator mapping ../core/src -i minlength,pattern,see,tjs-format -m lib/mappings/mappings.json -a lib/mappings/aggregations.json", "mappings-integration": "openstapps-es-mapping-generator put-es-templates lib/mappings/mappings.json http://elasticsearch:9200/", "test": "nyc mocha --recursive 'test/*.spec.ts'", - "tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'" + "lint": "eslint --ext .ts src/" }, "author": "Karl-Philipp Wulfert ", "contributors": [ @@ -58,25 +58,33 @@ "ts-optchain": "0.1.8" }, "devDependencies": { - "@openstapps/configuration": "0.29.1", + "@openstapps/configuration": "0.33.0", "@openstapps/es-mapping-generator": "0.3.0", + "@openstapps/eslint-config": "1.1.0", "@openstapps/logger": "1.0.0", "@testdeck/mocha": "0.2.0", "@types/chai": "4.3.3", "@types/lodash": "4.14.182", "@types/mocha": "9.1.1", "@types/rimraf": "3.0.2", + "@typescript-eslint/eslint-plugin": "5.33.1", + "@typescript-eslint/parser": "5.33.1", "chai": "4.3.6", "conditional-type-checks": "1.0.6", "conventional-changelog-cli": "2.2.2", + "eslint": "8.22.0", + "eslint-config-prettier": "8.5.0", + "eslint-plugin-jsdoc": "39.3.6", + "eslint-plugin-prettier": "4.2.1", + "eslint-plugin-unicorn": "43.0.2", "lodash": "4.17.21", "mocha": "10.0.0", "nyc": "15.1.0", + "prettier": "2.7.1", "rimraf": "3.0.2", "source-map-support": "0.5.21", "surge": "0.23.1", "ts-node": "10.9.1", - "tslint": "6.1.3", "typedoc": "0.22.18", "typescript": "4.4.4" }, diff --git a/src/config/app.ts b/src/config/app.ts index 9844963a..d412ceb4 100644 --- a/src/config/app.ts +++ b/src/config/app.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -12,7 +12,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -// tslint:disable-next-line:no-implicit-dependencies import {Polygon} from 'geojson'; import {SCTranslations} from '../general/i18n'; import {SCMap} from '../general/map'; @@ -56,11 +55,7 @@ export interface SCAppConfigurationMenuCategory { /** * ID of the menu category */ - id: - 'main' - | 'meta' - | 'personal' - | 'external'; + id: 'main' | 'meta' | 'personal' | 'external'; /** * A list of items that belong to the category diff --git a/src/config/authorization.ts b/src/config/authorization.ts index 6acc44b1..5f9558e3 100644 --- a/src/config/authorization.ts +++ b/src/config/authorization.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -21,7 +21,7 @@ import {SCUserConfigurationMap} from './user'; * @see https://datatracker.ietf.org/doc/html/rfc6749#section-1.3.1 * @see https://github.com/gbv/paia */ -export type SCAuthorizationProviderType = 'default' | 'paia' ; +export type SCAuthorizationProviderType = 'default' | 'paia'; /** * An authorization provider complete configuration diff --git a/src/config/backend.ts b/src/config/backend.ts index f725aee9..0f48e2e2 100644 --- a/src/config/backend.ts +++ b/src/config/backend.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -95,29 +95,25 @@ export interface SCBackendConfigurationSortableField { * A list of supported sorts on this field */ sortTypes: SCSearchSortType[]; - } /** * Possible context names to be used by the search request */ -export type SCSearchContext = - | 'default' - | 'dining' - | 'place'; +export type SCSearchContext = 'default' | 'dining' | 'place'; /** * A boosting configuration for one context */ -export type SCBackendConfigurationSearchBoostingContext = - SCRestrictedMap; +export type SCBackendConfigurationSearchBoostingContext = SCRestrictedMap< + SCSearchContext, + SCBackendConfigurationSearchBoostingType[] +>; /** * A boosting configuration for one SCType */ export interface SCBackendConfigurationSearchBoostingType { - /** * The factor of which the scores matching this type should be multiplied by */ diff --git a/src/config/feature.ts b/src/config/feature.ts index d4f074f3..78ef2506 100644 --- a/src/config/feature.ts +++ b/src/config/feature.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 StApps + * Copyright (C) 2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -28,7 +28,6 @@ export interface SCFeatureConfiguration { plugins?: SCMap; } - export interface SCFeatureConfigurationPlugin { /** * URL path registered with the backend diff --git a/src/config/file.ts b/src/config/file.ts index 4281c770..316bc63c 100644 --- a/src/config/file.ts +++ b/src/config/file.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -19,10 +19,10 @@ import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend' /** * A configuration file that configures app and backend + * * @validatable */ export interface SCConfigFile { - /** * Configuration for the app that is visible to clients */ @@ -31,7 +31,7 @@ export interface SCConfigFile { /** * Configuration for the supported authorization providers */ - auth: { [key in SCAuthorizationProviderType]?: SCAuthorizationProvider; }; + auth: {[key in SCAuthorizationProviderType]?: SCAuthorizationProvider}; /** * Configuration for the backend that is visible to clients diff --git a/src/config/user.ts b/src/config/user.ts index aef45b40..1c602ca6 100644 --- a/src/config/user.ts +++ b/src/config/user.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -16,7 +16,9 @@ /** * User configuration keys mapped to string type while including their requiredness */ -export type SCUserConfigurationMap = { [K in keyof SCUserConfigurationOptional]?: string } & { [K in keyof SCUserConfigurationRequired]: string }; +export type SCUserConfigurationMap = {[K in keyof SCUserConfigurationOptional]?: string} & { + [K in keyof SCUserConfigurationRequired]: string; +}; /** * A user configuration @@ -40,7 +42,7 @@ interface SCUserConfigurationRequired { /** * A user configurations optional properties */ - interface SCUserConfigurationOptional { +interface SCUserConfigurationOptional { /** * User's e-mail */ diff --git a/src/general/i18n.ts b/src/general/i18n.ts index 1a2b0a29..dc784029 100644 --- a/src/general/i18n.ts +++ b/src/general/i18n.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -37,7 +37,7 @@ export interface SCLanguage { * @see https://en.wikipedia.org/wiki/ISO_639-1 */ export type SCLanguageName = - 'afar' + | 'afar' | 'abkhazian' | 'avestan' | 'afrikaans' @@ -229,7 +229,7 @@ export type SCLanguageName = * @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes */ export type SCLanguageCode = - 'aa' + | 'aa' | 'ab' | 'ae' | 'af' @@ -421,7 +421,7 @@ export type SCLanguageCode = * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 */ export type SCNationality = - 'Afghanistan' + | 'Afghanistan' | 'Åland Islands' | 'Albania' | 'Algeria' @@ -475,7 +475,7 @@ export type SCNationality = | 'Congo (Democratic Republic of the)' | 'Cook Islands' | 'Costa Rica' - | 'Côte d\'Ivoire' + | "Côte d'Ivoire" | 'Croatia' | 'Cuba' | 'Curaçao' @@ -538,11 +538,11 @@ export type SCNationality = | 'Kazakhstan' | 'Kenya' | 'Kiribati' - | 'Korea (Democratic People\'s Republic of)' + | "Korea (Democratic People's Republic of)" | 'Korea (Republic of)' | 'Kuwait' | 'Kyrgyzstan' - | 'Lao People\'s Democratic Republic' + | "Lao People's Democratic Republic" | 'Latvia' | 'Lebanon' | 'Lesotho' @@ -694,10 +694,11 @@ export interface SCTranslations { * (Source: https://stackoverflow.com/a/51365037) */ type RecursivePartial = { - [P in keyof T]-?: - T[P] extends Array ? Array> : - T[P] extends object ? RecursivePartial : - T[P]; + [P in keyof T]-?: T[P] extends Array + ? Array> + : T[P] extends object + ? RecursivePartial + : T[P]; }; /** diff --git a/src/general/map.ts b/src/general/map.ts index f036cec2..c9634686 100644 --- a/src/general/map.ts +++ b/src/general/map.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -42,5 +42,5 @@ export type SCRestrictedMap = { /** * One value for each key */ - [key in U]: T + [key in U]: T; }; diff --git a/src/general/namespaces.ts b/src/general/namespaces.ts index 701e8082..3d7e300a 100644 --- a/src/general/namespaces.ts +++ b/src/general/namespaces.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -15,775 +15,774 @@ /** * The license plate of a university e.g. the UID of the university */ -export type SCLicensePlate = 'ac-kf' | - 'ac-fk' | - 'ac-fh' | - 'ac-hm' | - 'ac-th' | - 'dn-fh' | - 'aa-fh' | - 'sig-f2' | - 'su-ah' | - 'rd-vf' | - 'am-f2' | - 'am-fh' | - 'an-fh' | - 'ik-fh' | - 'ab-fh' | - 'asl-vf' | - 'a-hm' | - 'a-u' | - 'a-fh' | - 'hef-fh' | - 'hg-hs' | - 'su-if' | - 'cw-ih' | - 'tbb-dh' | - 'eu-vf' | - 'los-pf' | - 'esw-pf' | - 'ba-u' | - 'bt-kh' | - 'bt-u' | - 'gap-kh' | - 'wr-vf' | - 'pb-f2' | - 'b-ah' | - 'b-am' | - 'b-fs' | - 'b-ab' | - 'b-pf' | - 'b-tf' | - 'b-mu' | - 'b-dk' | - 'b-p2' | - 'b-bs' | - 'b-eh' | - 'b-hw' | - 'b-es' | - 'b-em' | - 'b-ec' | - 'b-ef' | - 'b-vf' | - 'b-gb' | - 'b-hs' | - 'b-pk' | - 'b-mh' | - 'b-ft' | - 'b-p3' | - 'b-fb' | - 'b-wt' | - 'b-u2' | - 'b-u' | - 'b-v2' | - 'b-fw' | - 'b-p4' | - 'b-ih' | - 'b-kf' | - 'b-mf' | - 'b-dh' | - 'b-pu' | - 'b-ph' | - 'b-qh' | - 'b-ot' | - 'b-fh' | - 'b-su' | - 'b-tk' | - 'b-tc' | - 'b-hk' | - 'b-wb' | - 'b-fp' | - 'b-v3' | - 'b-fu' | - 'b-h3' | - 'b-hm' | - 'b-kh' | - 'b-h4' | - 'b-f3' | - 'b-f5' | - 'b-f2' | - 'b-tu' | - 'ber-vf' | - 'bbg-fh' | - 'bbg-hs' | - 'w-k2' | - 'bi-kh' | - 'bc-fh' | - 'bi-du' | - 'bi-fm' | - 'pb-f4' | - 'bi-u' | - 'bi-fh' | - 'bi-vf' | - 'wm-hs' | - 'mz-fh' | - 'tr-f2' | - 'bo-eb' | - 'bo-fh' | - 'bo-f1' | - 'bo-fg' | - 'bo-hm' | - 'bo-f3' | - 'bo-kf' | - 'bo-u' | - 'bn-sg' | - 'bn-pf' | - 'bn-vf' | - 'bn-fh' | - 'bn-u' | - 'bot-fh' | - 'brb-vf' | - 'brb-fh' | - 'bs-fh' | - 'bs-hk' | - 'bs-tu' | - 'hb-ah' | - 'hb-hi' | - 'hb-fh' | - 'hb-iu' | - 'hb-hk' | - 'hb-u' | - 'hb-vf' | - 'hb-h' | - 'ka-pu' | - 'bm-eu' | - 'bm-fb' | - 'std-hs' | - 'std-fh' | - 'cw-fh' | - 'cw-hs' | - 'ce-pf' | - 'c-tu' | - 'c-th' | - 'gs-tu' | - 'co-fh' | - 'co-hs' | - 'co-f2' | - 'cb-fh' | - 'cb-tu' | - 'da-kf' | - 'da-vf' | - 'da-fh' | - 'da-pf' | - 'da-tu' | - 'da-v2' | - 'deg-fh' | - 'de-fh' | - 'dt-fl' | - 'lip-h2' | - 'lip-hm' | - 'dt-hm' | - 'da-v3' | - 'dh-fh' | - 'do-fh' | - 'do-mh' | - 'do-is' | - 'do-pf' | - 'do-u' | - 'do-hm' | - 'do-vf' | - 'dd-ec' | - 'dd-fh' | - 'dd-hs' | - 'dd-ak' | - 'dd-ph' | - 'dd-pf' | - 'dd-pu' | - 'dd-hl' | - 'dd-ht' | - 'dd-hk' | - 'dd-ma' | - 'dd-hm' | - 'dd-p2' | - 'dd-p3' | - 'dd-tu' | - 'dd-hv' | - 'd-iu' | - 'du-hm' | - 'du-pf' | - 'du-ug' | - 'du-vf' | - 'du-u' | - 'd-am' | - 'd-eb' | - 'd-ff' | - 'd-pf' | - 'd-fh' | - 'd-vf' | - 'd-hk' | - 'd-hm' | - 'd-u' | - 'bar-fh' | - 'ew-fh' | - 'eck-fh' | - 'ld-vf' | - 'ei-u' | - 'pi-f2' | - 'ol-f2' | - 'hvl-hs' | - 'hvl-fh' | - 'emd-fh' | - 'ed-pf' | - 'ef-fh' | - 'ef-mh' | - 'ef-pf' | - 'ef-kh' | - 'ef-u' | - 'ef-ph' | - 'er-u' | - 'e-fh' | - 'e-p2' | - 'e-pf' | - 'e-uk' | - 'e-u' | - 'e-ug' | - 'e-hm' | - 'es-ft' | - 'es-fs' | - 'fl-fh' | - 'fl-ph' | - 'fl-u' | - 'f-hb' | - 'f-ms' | - 'f-u' | - 'f-v2' | - 'f-fh' | - 'f-hk' | - 'f-hm' | - 'f-kh' | - 'f-pf' | - 'f-vf' | - 'ff-eu' | - 'fg-u' | - 'fr-fh' | - 'fr-kf' | - 'fr-u' | - 'fr-hm' | - 'fr-ph' | - 'fb-fh' | - 'hal-kh' | - 'fn-dh' | - 'fn-u' | - 'fd-fh' | - 'fd-kh' | - 'ffb-vf' | - 'vs-fh' | - 'wi-f2' | - 'ul-f2' | - 'ge-f3' | - 'ge-fh' | - 'ge-f2' | - 'ge-vf' | - 'g-pf' | - 'ger-u' | - 'gi-ft' | - 'gi-fh' | - 'gi-vf' | - 'gi-u' | - 'gp-fh' | - 'zi-hw' | - 'gth-vf' | - 'g-hs' | - 'goe-fh' | - 'goe-u' | - 'goe-pf' | - 'gw-u' | - 'nb-u' | - 'gw-u2' | - 'gw-u1' | - 'hgw-u' | - 'gue-fh' | - 'gue-vf' | - 'pb-f3' | - 'gt-pf' | - 'ww-vf' | - 'ha-ug' | - 'ha-fh' | - 'ha-f2' | - 'ha-vf' | - 'hbs-fh' | - 'hbs-vf' | - 'hal-eh' | - 'hal-hk' | - 'hal-ph' | - 'hal-u' | - 'hal-u2' | - 'koet-ph' | - 'hal-uw' | - 'hh-am' | - 'hh-bs' | - 'hh-pf' | - 'hh-bc' | - 'hh-ef' | - 'hh-fh' | - 'hh-hu' | - 'hh-ub' | - 'hh-ff' | - 'hh-vf' | - 'hh-fi' | - 'hh-ba' | - 'hh-ib' | - 'hh-mf' | - 'hh-ms' | - 'hh-hf' | - 'hh-u' | - 'hh-hs' | - 'hh-uk' | - 'hh-fs' | - 'hh-hk' | - 'hh-hm' | - 'hh-tu' | - 'hm-hs' | - 'ham-f2' | - 'ham-fh' | - 'h-fg' | - 'h-fh' | - 'h-hm' | - 'h-vf' | - 'h-la' | - 'h-u' | - 'h-fb' | - 'h-kf' | - 'h-mh' | - 'h-f3' | - 'h-pf' | - 'h-ti' | - 'hei-fh' | - 'hd-hm' | - 'hd-ph' | - 'hd-kh' | - 'hd-u' | - 'hd-fh' | - 'hdh-dh' | - 'hn-dh' | - 'hn-bs' | - 'hn-fh' | - 'hn-f2' | - 'su-f3' | - 'su-k2' | - 'he-hk' | - 'sta-v2' | - 'hi-fg' | - 'hi-fs' | - 'hi-fh' | - 'hi-v2' | - 'hi-vf' | - 'hi-u' | - 'hi-v3' | - 'ho-fh' | - 'ho-f2' | - 'ho-vf' | - 's-u2' | - 'ww-fh' | - 'hol-fh' | - 'fds-dh' | - 'hx-fh' | - 'lip-h3' | - 'hx-ug' | - 'tr-f3' | - 'mz-f5' | - 'wi-f5' | - 'wi-f4' | - 'rued-pf' | - 'ik-tu' | - 'il-th' | - 'in-fh' | - 'in-u' | - 'mk-ts' | - 'mk-fh' | - 'rv-pf' | - 'j-fh' | - 'j-u' | - 'kl-fh' | - 'kl-u' | - 'wes-fh' | - 'ka-dh' | - 'ka-fh' | - 'ka-pf' | - 'ka-u' | - 'ka-hk' | - 'ka-hg' | - 'ka-hm' | - 'ka-ph' | - 'ks-cv' | - 'ks-pf' | - 'ks-fh' | - 'ks-ms' | - 'ks-u3' | - 'ks-ug' | - 'ks-vf' | - 'ks-u2' | - 'og-vf' | - 'ke-fh' | - 'ki-u' | - 'ki-fh' | - 'ki-f2' | - 'ki-f6' | - 'ki-hk' | - 'ki-f3' | - 'ki-f4' | - 'ki-f5' | - 'ki-ph' | - 'kle-fh' | - 'ko-fh' | - 'ko-u3' | - 'ko-u' | - 'ko-vf' | - 'k-iu' | - 'k-cb' | - 'k-fm' | - 'k-fp' | - 'k-kf' | - 'k-mf' | - 'k-p2' | - 'k-u' | - 'k-fb' | - 'k-u2' | - 'k-fh' | - 'k-vf' | - 'k-hk' | - 'k-hm' | - 'k-pf' | - 'k-v2' | - 'k-f2' | - 'kw-fh' | - 'kn-fh' | - 'kn-f2' | - 'kn-u' | - 'koet-fh' | - 'koet-th' | - 'koet-u' | - 'kr-fh' | - 'og-fw' | - 'ld-u' | - 'la-fh' | - 'da-v4' | - 'ler-fh' | - 'l-fb' | - 'l-f2' | - 'l-kh' | - 'l-h3' | - 'l-hh' | - 'l-hm' | - 'l-h2' | - 'l-ph' | - 'l-hs' | - 'l-ht' | - 'l-th' | - 'l-u' | - 'mer-th' | - 'lev-pf' | - 'lev-fh' | - 'fg-fh' | - 'lip-f2' | - 'lip-h1' | - 'lip-fh' | - 'so-f2' | - 'loe-dh' | - 'hl-fh' | - 'hl-vf' | - 'hl-f3' | - 'hl-uk' | - 'hl-u' | - 'hl-f2' | - 'hl-hm' | - 'lb-v2' | - 'lb-fh' | - 'lb-ph' | - 'lb-p2' | - 'lb-vf' | - 'lu-fh' | - 'lu-kf' | - 'lg-u' | - 'lg-fh' | - 'md-f2' | - 'md-fh' | - 'md-tu' | - 'md-f3' | - 'md-mh' | - 'md-ph' | - 'md-u' | - 'mz-f4' | - 'mz-u2' | - 'mz-vf' | - 'mz-f3' | - 'mz-f2' | - 'mz-u' | - 'mz-kf' | - 'ma-dh' | - 'ma-fg' | - 'ma-ft' | - 'ma-ba' | - 'ma-v3' | - 'ma-v2' | - 'ma-hm' | - 'ma-fs' | - 'ma-u' | - 'mr-eh' | - 'mr-fh' | - 'mr-u' | - 're-pf' | - 'myk-vf' | - 'mgn-vf' | - 'mei-fh' | - 'mei-fv' | - 'mei-f2' | - 'sk-hs' | - 'hal-fh' | - 'hsk-fh' | - 'me-fh' | - 'rt-hs' | - 'mi-fh' | - 'c-fh' | - 'mw-ht' | - 'hc-ih' | - 'mtw-ht' | - 'mg-fh' | - 'z-fh' | - 'mos-dh' | - 'mh-fh' | - 'm-am' | - 'm-b2' | - 'm-bw' | - 'm-ea' | - 'm-vf' | - 'm-as' | - 'm-mf' | - 'm-hk' | - 'm-hs' | - 'm-fh' | - 'm-kf' | - 'm-hm' | - 'm-kh' | - 'm-hp' | - 'm-fp' | - 'm-tu' | - 'm-u' | - 'gap-ks' | - 'm-u2' | - 'm-t2' | - 'ms-ph' | - 'ms-kf' | - 'ms-u' | - 'ms-fh' | - 'ms-vf' | - 'ms-hk' | - 'ms-hm' | - 'ms-kh' | - 'ms-v2' | - 'nmb-kh' | - 'nb-fh' | - 'm-ah' | - 'm-k3' | - 'ne-eu' | - 'ne-hs' | - 'ne-pf' | - 'nu-fh' | - 'h-f2' | - 'ndh-fh' | - 'coe-vf' | - 'n-kf' | - 'n-hm' | - 'n-hk' | - 'n-k1' | - 'n-k2' | - 'n-k3' | - 'n-fh' | - 'n-u' | - 'nt-fh' | - 'nt-f3' | - 'gp-f2' | - 'gr-kh' | - 'hg-kh' | - 'wi-eb' | - 'of-hk' | - 'fr-f2' | - 'ol-fh' | - 'ol-pf' | - 'ol-u' | - 'os-f2' | - 'os-fh' | - 'os-f3' | - 'os-u' | - 'os-kf' | - 'ver-fh' | - 'pb-fh' | - 'pb-kf' | - 'pb-kh' | - 'pb-ug' | - 'pb-f1' | - 'pb-u2' | - 'pa-u' | - 'pf-fg' | - 'pf-fh' | - 'ps-fh' | - 'pl-fh' | - 'p-bs' | - 'p-f2' | - 'p-sh' | - 'p-pf' | - 'p-u' | - 'p-fh' | - 'p-hf' | - 'brb-f2' | - 'dd-f2' | - 'rv-fh' | - 'rv-dh' | - 'r-kh' | - 'r-u' | - 'r-fh' | - 'rd-v2' | - 'ko-f2' | - 'rd-bf' | - 'rd-fh' | - 'rt-fh' | - 'rt-ts' | - 'rt-ft' | - 'su-f2' | - 'st-mh' | - 'bc-f2' | - 'rie-fh' | - 'shg-vf' | - 'ro-fh' | - 'ros-hm' | - 'ros-im' | - 'hro-hu' | - 'hro-u' | - 'hro-hm' | - 'rof-vf' | - 'nol-fh' | - 'tue-fh' | - 'wi-f3' | - 'sb-f2' | - 'sb-hm' | - 'sb-hs' | - 'sb-vf' | - 'sb-hk' | - 'sb-fh' | - 'sb-kf' | - 'sb-u' | - 'sz-fh' | - 'sm-fh' | - 'aa-fg' | - 'aa-ph' | - 'sha-ht' | - 'sha-kh' | - 'sad-pf' | - 'ru-fh' | - 'wue-f2' | - 'lds-bc' | - 'sn-hm' | - 'hd-vf' | - 'sfb-fh' | - 'si-pf' | - 'si-ug' | - 'sig-fh' | - 'so-fh' | - 'so-vf' | - 'so-ug' | - 'sp-u' | - 'su-fh' | - 'su-kh' | - 'sta-vf' | - 'st-fh' | - 'sdl-fh' | - 'hst-fh' | - 'hst-f2' | - 'sr-fh' | - 'og-fh' | - 's-dp' | - 's-dh' | - 's-f2' | - 's-im' | - 's-kf' | - 's-u' | - 's-va' | - 's-wh' | - 's-hk' | - 's-fh' | - 's-fb' | - 's-hm' | - 's-mf' | - 's-f3' | - 's-th' | - 'ue-fh' | - 'k-v3' | - 'k-f3' | - 'tr-fh' | - 'tr-kh' | - 'tr-u' | - 'an-f2' | - 'tut-hm' | - 'tue-u' | - 'tut-f3' | - 'ul-fh' | - 'ul-f4' | - 'ul-u' | - 'myk-kh' | - 'vec-fh' | - 'vec-u' | - 'vec-kf' | - 'bo-f2' | - 'vs-vf' | - 'vs-dh' | - 'vs-f2' | - 'ros-hs' | - 'ro-vf' | - 'pi-fh' | - 'fs-fh' | - 'we-hm' | - 'we-u' | - 'we-vf' | - 'we-th' | - 'kn-ph' | - 'rv-ph' | - 'wsf-pf' | - 'wr-fh' | - 'wr-v2' | - 'qlb-vf' | - 'ldk-fh' | - 'wi-bs' | - 'wi-v1' | - 'wi-fh' | - 'wi-vf' | - 'kw-th' | - 'whv-fh' | - 'hwi-fh' | - 'wis-th' | - 'wis-fh' | - 'en-u' | - 'wf-fh' | - 'wob-fh' | - 'wo-fh' | - 'w-hm' | - 'w-kh' | - 'w-ug' | - 'w-vf' | - 'wue-hm' | - 'wue-u' | - 'wue-fh' | - 'wue-f3' | - 'zi-ht' | - 'zi-ih' | - 'zi-th' | - 'zw-fh' | - 'z-t3' | - 'z-t2' | - 'z-pf' | - 'z-hs' | - 'z-ph' | - 'z-th' | - 'z-tu' | - 'z-ht' | - 'rc-hs' | - 'z-p2'; +export type SCLicensePlate = + | 'ac-kf' + | 'ac-fk' + | 'ac-fh' + | 'ac-hm' + | 'ac-th' + | 'dn-fh' + | 'aa-fh' + | 'sig-f2' + | 'su-ah' + | 'rd-vf' + | 'am-f2' + | 'am-fh' + | 'an-fh' + | 'ik-fh' + | 'ab-fh' + | 'asl-vf' + | 'a-hm' + | 'a-u' + | 'a-fh' + | 'hef-fh' + | 'hg-hs' + | 'su-if' + | 'cw-ih' + | 'tbb-dh' + | 'eu-vf' + | 'los-pf' + | 'esw-pf' + | 'ba-u' + | 'bt-kh' + | 'bt-u' + | 'gap-kh' + | 'wr-vf' + | 'pb-f2' + | 'b-ah' + | 'b-am' + | 'b-fs' + | 'b-ab' + | 'b-pf' + | 'b-tf' + | 'b-mu' + | 'b-dk' + | 'b-p2' + | 'b-bs' + | 'b-eh' + | 'b-hw' + | 'b-es' + | 'b-em' + | 'b-ec' + | 'b-ef' + | 'b-vf' + | 'b-gb' + | 'b-hs' + | 'b-pk' + | 'b-mh' + | 'b-ft' + | 'b-p3' + | 'b-fb' + | 'b-wt' + | 'b-u2' + | 'b-u' + | 'b-v2' + | 'b-fw' + | 'b-p4' + | 'b-ih' + | 'b-kf' + | 'b-mf' + | 'b-dh' + | 'b-pu' + | 'b-ph' + | 'b-qh' + | 'b-ot' + | 'b-fh' + | 'b-su' + | 'b-tk' + | 'b-tc' + | 'b-hk' + | 'b-wb' + | 'b-fp' + | 'b-v3' + | 'b-fu' + | 'b-h3' + | 'b-hm' + | 'b-kh' + | 'b-h4' + | 'b-f3' + | 'b-f5' + | 'b-f2' + | 'b-tu' + | 'ber-vf' + | 'bbg-fh' + | 'bbg-hs' + | 'w-k2' + | 'bi-kh' + | 'bc-fh' + | 'bi-du' + | 'bi-fm' + | 'pb-f4' + | 'bi-u' + | 'bi-fh' + | 'bi-vf' + | 'wm-hs' + | 'mz-fh' + | 'tr-f2' + | 'bo-eb' + | 'bo-fh' + | 'bo-f1' + | 'bo-fg' + | 'bo-hm' + | 'bo-f3' + | 'bo-kf' + | 'bo-u' + | 'bn-sg' + | 'bn-pf' + | 'bn-vf' + | 'bn-fh' + | 'bn-u' + | 'bot-fh' + | 'brb-vf' + | 'brb-fh' + | 'bs-fh' + | 'bs-hk' + | 'bs-tu' + | 'hb-ah' + | 'hb-hi' + | 'hb-fh' + | 'hb-iu' + | 'hb-hk' + | 'hb-u' + | 'hb-vf' + | 'hb-h' + | 'ka-pu' + | 'bm-eu' + | 'bm-fb' + | 'std-hs' + | 'std-fh' + | 'cw-fh' + | 'cw-hs' + | 'ce-pf' + | 'c-tu' + | 'c-th' + | 'gs-tu' + | 'co-fh' + | 'co-hs' + | 'co-f2' + | 'cb-fh' + | 'cb-tu' + | 'da-kf' + | 'da-vf' + | 'da-fh' + | 'da-pf' + | 'da-tu' + | 'da-v2' + | 'deg-fh' + | 'de-fh' + | 'dt-fl' + | 'lip-h2' + | 'lip-hm' + | 'dt-hm' + | 'da-v3' + | 'dh-fh' + | 'do-fh' + | 'do-mh' + | 'do-is' + | 'do-pf' + | 'do-u' + | 'do-hm' + | 'do-vf' + | 'dd-ec' + | 'dd-fh' + | 'dd-hs' + | 'dd-ak' + | 'dd-ph' + | 'dd-pf' + | 'dd-pu' + | 'dd-hl' + | 'dd-ht' + | 'dd-hk' + | 'dd-ma' + | 'dd-hm' + | 'dd-p2' + | 'dd-p3' + | 'dd-tu' + | 'dd-hv' + | 'd-iu' + | 'du-hm' + | 'du-pf' + | 'du-ug' + | 'du-vf' + | 'du-u' + | 'd-am' + | 'd-eb' + | 'd-ff' + | 'd-pf' + | 'd-fh' + | 'd-vf' + | 'd-hk' + | 'd-hm' + | 'd-u' + | 'bar-fh' + | 'ew-fh' + | 'eck-fh' + | 'ld-vf' + | 'ei-u' + | 'pi-f2' + | 'ol-f2' + | 'hvl-hs' + | 'hvl-fh' + | 'emd-fh' + | 'ed-pf' + | 'ef-fh' + | 'ef-mh' + | 'ef-pf' + | 'ef-kh' + | 'ef-u' + | 'ef-ph' + | 'er-u' + | 'e-fh' + | 'e-p2' + | 'e-pf' + | 'e-uk' + | 'e-u' + | 'e-ug' + | 'e-hm' + | 'es-ft' + | 'es-fs' + | 'fl-fh' + | 'fl-ph' + | 'fl-u' + | 'f-hb' + | 'f-ms' + | 'f-u' + | 'f-v2' + | 'f-fh' + | 'f-hk' + | 'f-hm' + | 'f-kh' + | 'f-pf' + | 'f-vf' + | 'ff-eu' + | 'fg-u' + | 'fr-fh' + | 'fr-kf' + | 'fr-u' + | 'fr-hm' + | 'fr-ph' + | 'fb-fh' + | 'hal-kh' + | 'fn-dh' + | 'fn-u' + | 'fd-fh' + | 'fd-kh' + | 'ffb-vf' + | 'vs-fh' + | 'wi-f2' + | 'ul-f2' + | 'ge-f3' + | 'ge-fh' + | 'ge-f2' + | 'ge-vf' + | 'g-pf' + | 'ger-u' + | 'gi-ft' + | 'gi-fh' + | 'gi-vf' + | 'gi-u' + | 'gp-fh' + | 'zi-hw' + | 'gth-vf' + | 'g-hs' + | 'goe-fh' + | 'goe-u' + | 'goe-pf' + | 'gw-u' + | 'nb-u' + | 'gw-u2' + | 'gw-u1' + | 'hgw-u' + | 'gue-fh' + | 'gue-vf' + | 'pb-f3' + | 'gt-pf' + | 'ww-vf' + | 'ha-ug' + | 'ha-fh' + | 'ha-f2' + | 'ha-vf' + | 'hbs-fh' + | 'hbs-vf' + | 'hal-eh' + | 'hal-hk' + | 'hal-ph' + | 'hal-u' + | 'hal-u2' + | 'koet-ph' + | 'hal-uw' + | 'hh-am' + | 'hh-bs' + | 'hh-pf' + | 'hh-bc' + | 'hh-ef' + | 'hh-fh' + | 'hh-hu' + | 'hh-ub' + | 'hh-ff' + | 'hh-vf' + | 'hh-fi' + | 'hh-ba' + | 'hh-ib' + | 'hh-mf' + | 'hh-ms' + | 'hh-hf' + | 'hh-u' + | 'hh-hs' + | 'hh-uk' + | 'hh-fs' + | 'hh-hk' + | 'hh-hm' + | 'hh-tu' + | 'hm-hs' + | 'ham-f2' + | 'ham-fh' + | 'h-fg' + | 'h-fh' + | 'h-hm' + | 'h-vf' + | 'h-la' + | 'h-u' + | 'h-fb' + | 'h-kf' + | 'h-mh' + | 'h-f3' + | 'h-pf' + | 'h-ti' + | 'hei-fh' + | 'hd-hm' + | 'hd-ph' + | 'hd-kh' + | 'hd-u' + | 'hd-fh' + | 'hdh-dh' + | 'hn-dh' + | 'hn-bs' + | 'hn-fh' + | 'hn-f2' + | 'su-f3' + | 'su-k2' + | 'he-hk' + | 'sta-v2' + | 'hi-fg' + | 'hi-fs' + | 'hi-fh' + | 'hi-v2' + | 'hi-vf' + | 'hi-u' + | 'hi-v3' + | 'ho-fh' + | 'ho-f2' + | 'ho-vf' + | 's-u2' + | 'ww-fh' + | 'hol-fh' + | 'fds-dh' + | 'hx-fh' + | 'lip-h3' + | 'hx-ug' + | 'tr-f3' + | 'mz-f5' + | 'wi-f5' + | 'wi-f4' + | 'rued-pf' + | 'ik-tu' + | 'il-th' + | 'in-fh' + | 'in-u' + | 'mk-ts' + | 'mk-fh' + | 'rv-pf' + | 'j-fh' + | 'j-u' + | 'kl-fh' + | 'kl-u' + | 'wes-fh' + | 'ka-dh' + | 'ka-fh' + | 'ka-pf' + | 'ka-u' + | 'ka-hk' + | 'ka-hg' + | 'ka-hm' + | 'ka-ph' + | 'ks-cv' + | 'ks-pf' + | 'ks-fh' + | 'ks-ms' + | 'ks-u3' + | 'ks-ug' + | 'ks-vf' + | 'ks-u2' + | 'og-vf' + | 'ke-fh' + | 'ki-u' + | 'ki-fh' + | 'ki-f2' + | 'ki-f6' + | 'ki-hk' + | 'ki-f3' + | 'ki-f4' + | 'ki-f5' + | 'ki-ph' + | 'kle-fh' + | 'ko-fh' + | 'ko-u3' + | 'ko-u' + | 'ko-vf' + | 'k-iu' + | 'k-cb' + | 'k-fm' + | 'k-fp' + | 'k-kf' + | 'k-mf' + | 'k-p2' + | 'k-u' + | 'k-fb' + | 'k-u2' + | 'k-fh' + | 'k-vf' + | 'k-hk' + | 'k-hm' + | 'k-pf' + | 'k-v2' + | 'k-f2' + | 'kw-fh' + | 'kn-fh' + | 'kn-f2' + | 'kn-u' + | 'koet-fh' + | 'koet-th' + | 'koet-u' + | 'kr-fh' + | 'og-fw' + | 'ld-u' + | 'la-fh' + | 'da-v4' + | 'ler-fh' + | 'l-fb' + | 'l-f2' + | 'l-kh' + | 'l-h3' + | 'l-hh' + | 'l-hm' + | 'l-h2' + | 'l-ph' + | 'l-hs' + | 'l-ht' + | 'l-th' + | 'l-u' + | 'mer-th' + | 'lev-pf' + | 'lev-fh' + | 'fg-fh' + | 'lip-f2' + | 'lip-h1' + | 'lip-fh' + | 'so-f2' + | 'loe-dh' + | 'hl-fh' + | 'hl-vf' + | 'hl-f3' + | 'hl-uk' + | 'hl-u' + | 'hl-f2' + | 'hl-hm' + | 'lb-v2' + | 'lb-fh' + | 'lb-ph' + | 'lb-p2' + | 'lb-vf' + | 'lu-fh' + | 'lu-kf' + | 'lg-u' + | 'lg-fh' + | 'md-f2' + | 'md-fh' + | 'md-tu' + | 'md-f3' + | 'md-mh' + | 'md-ph' + | 'md-u' + | 'mz-f4' + | 'mz-u2' + | 'mz-vf' + | 'mz-f3' + | 'mz-f2' + | 'mz-u' + | 'mz-kf' + | 'ma-dh' + | 'ma-fg' + | 'ma-ft' + | 'ma-ba' + | 'ma-v3' + | 'ma-v2' + | 'ma-hm' + | 'ma-fs' + | 'ma-u' + | 'mr-eh' + | 'mr-fh' + | 'mr-u' + | 're-pf' + | 'myk-vf' + | 'mgn-vf' + | 'mei-fh' + | 'mei-fv' + | 'mei-f2' + | 'sk-hs' + | 'hal-fh' + | 'hsk-fh' + | 'me-fh' + | 'rt-hs' + | 'mi-fh' + | 'c-fh' + | 'mw-ht' + | 'hc-ih' + | 'mtw-ht' + | 'mg-fh' + | 'z-fh' + | 'mos-dh' + | 'mh-fh' + | 'm-am' + | 'm-b2' + | 'm-bw' + | 'm-ea' + | 'm-vf' + | 'm-as' + | 'm-mf' + | 'm-hk' + | 'm-hs' + | 'm-fh' + | 'm-kf' + | 'm-hm' + | 'm-kh' + | 'm-hp' + | 'm-fp' + | 'm-tu' + | 'm-u' + | 'gap-ks' + | 'm-u2' + | 'm-t2' + | 'ms-ph' + | 'ms-kf' + | 'ms-u' + | 'ms-fh' + | 'ms-vf' + | 'ms-hk' + | 'ms-hm' + | 'ms-kh' + | 'ms-v2' + | 'nmb-kh' + | 'nb-fh' + | 'm-ah' + | 'm-k3' + | 'ne-eu' + | 'ne-hs' + | 'ne-pf' + | 'nu-fh' + | 'h-f2' + | 'ndh-fh' + | 'coe-vf' + | 'n-kf' + | 'n-hm' + | 'n-hk' + | 'n-k1' + | 'n-k2' + | 'n-k3' + | 'n-fh' + | 'n-u' + | 'nt-fh' + | 'nt-f3' + | 'gp-f2' + | 'gr-kh' + | 'hg-kh' + | 'wi-eb' + | 'of-hk' + | 'fr-f2' + | 'ol-fh' + | 'ol-pf' + | 'ol-u' + | 'os-f2' + | 'os-fh' + | 'os-f3' + | 'os-u' + | 'os-kf' + | 'ver-fh' + | 'pb-fh' + | 'pb-kf' + | 'pb-kh' + | 'pb-ug' + | 'pb-f1' + | 'pb-u2' + | 'pa-u' + | 'pf-fg' + | 'pf-fh' + | 'ps-fh' + | 'pl-fh' + | 'p-bs' + | 'p-f2' + | 'p-sh' + | 'p-pf' + | 'p-u' + | 'p-fh' + | 'p-hf' + | 'brb-f2' + | 'dd-f2' + | 'rv-fh' + | 'rv-dh' + | 'r-kh' + | 'r-u' + | 'r-fh' + | 'rd-v2' + | 'ko-f2' + | 'rd-bf' + | 'rd-fh' + | 'rt-fh' + | 'rt-ts' + | 'rt-ft' + | 'su-f2' + | 'st-mh' + | 'bc-f2' + | 'rie-fh' + | 'shg-vf' + | 'ro-fh' + | 'ros-hm' + | 'ros-im' + | 'hro-hu' + | 'hro-u' + | 'hro-hm' + | 'rof-vf' + | 'nol-fh' + | 'tue-fh' + | 'wi-f3' + | 'sb-f2' + | 'sb-hm' + | 'sb-hs' + | 'sb-vf' + | 'sb-hk' + | 'sb-fh' + | 'sb-kf' + | 'sb-u' + | 'sz-fh' + | 'sm-fh' + | 'aa-fg' + | 'aa-ph' + | 'sha-ht' + | 'sha-kh' + | 'sad-pf' + | 'ru-fh' + | 'wue-f2' + | 'lds-bc' + | 'sn-hm' + | 'hd-vf' + | 'sfb-fh' + | 'si-pf' + | 'si-ug' + | 'sig-fh' + | 'so-fh' + | 'so-vf' + | 'so-ug' + | 'sp-u' + | 'su-fh' + | 'su-kh' + | 'sta-vf' + | 'st-fh' + | 'sdl-fh' + | 'hst-fh' + | 'hst-f2' + | 'sr-fh' + | 'og-fh' + | 's-dp' + | 's-dh' + | 's-f2' + | 's-im' + | 's-kf' + | 's-u' + | 's-va' + | 's-wh' + | 's-hk' + | 's-fh' + | 's-fb' + | 's-hm' + | 's-mf' + | 's-f3' + | 's-th' + | 'ue-fh' + | 'k-v3' + | 'k-f3' + | 'tr-fh' + | 'tr-kh' + | 'tr-u' + | 'an-f2' + | 'tut-hm' + | 'tue-u' + | 'tut-f3' + | 'ul-fh' + | 'ul-f4' + | 'ul-u' + | 'myk-kh' + | 'vec-fh' + | 'vec-u' + | 'vec-kf' + | 'bo-f2' + | 'vs-vf' + | 'vs-dh' + | 'vs-f2' + | 'ros-hs' + | 'ro-vf' + | 'pi-fh' + | 'fs-fh' + | 'we-hm' + | 'we-u' + | 'we-vf' + | 'we-th' + | 'kn-ph' + | 'rv-ph' + | 'wsf-pf' + | 'wr-fh' + | 'wr-v2' + | 'qlb-vf' + | 'ldk-fh' + | 'wi-bs' + | 'wi-v1' + | 'wi-fh' + | 'wi-vf' + | 'kw-th' + | 'whv-fh' + | 'hwi-fh' + | 'wis-th' + | 'wis-fh' + | 'en-u' + | 'wf-fh' + | 'wob-fh' + | 'wo-fh' + | 'w-hm' + | 'w-kh' + | 'w-ug' + | 'w-vf' + | 'wue-hm' + | 'wue-u' + | 'wue-fh' + | 'wue-f3' + | 'zi-ht' + | 'zi-ih' + | 'zi-th' + | 'zw-fh' + | 'z-t3' + | 'z-t2' + | 'z-pf' + | 'z-hs' + | 'z-ph' + | 'z-th' + | 'z-tu' + | 'z-ht' + | 'rc-hs' + | 'z-p2'; -/* tslint:disable:variable-name */ /** * Namespaces for universities for UUID generation */ -export const SCNamespaces: { [id in SCLicensePlate]?: string } = { - /* tslint:enable:variable-name */ +export const SCNamespaces: {[id in SCLicensePlate]?: string} = { /** * Namespace for Hochschule Aschaffenburg */ diff --git a/src/general/time.ts b/src/general/time.ts index 41da0455..4fadd6a5 100644 --- a/src/general/time.ts +++ b/src/general/time.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -12,19 +12,15 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -/* tslint:disable:max-line-length */ /** * An ISO8601 date * * @pattern ^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])(T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])([\.,][0-9]{0,7})?(Z|[+-](?:2[0-3]|[01][0-9])(:?[0-5][0-9])?)?)?$ * @see https://gist.github.com/philipashlock/8830168 - * * @date */ export type SCISO8601Date = string; -/* tslint:enable */ -/* tslint:disable:max-line-length */ /** * An ISO8601 duration * @@ -32,7 +28,6 @@ export type SCISO8601Date = string; * @see https://gist.github.com/philipashlock/8830168 */ export type SCISO8601Duration = string; -/* tslint:enable */ /** * An ISO8601 time diff --git a/src/general/uuid.ts b/src/general/uuid.ts index 37d9a6b7..5b5bbcc1 100644 --- a/src/general/uuid.ts +++ b/src/general/uuid.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/guards.ts b/src/guards.ts index ae8eeeb3..c11abde7 100644 --- a/src/guards.ts +++ b/src/guards.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -16,7 +16,12 @@ import {SCTranslations} from './general/i18n'; import {SCBulkResponse} from './protocol/routes/bulk-request'; import {SCSearchResponse} from './protocol/routes/search'; import {SCMultiSearchResponse} from './protocol/routes/search-multi'; -import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './things/abstract/thing'; +import { + SCThing, + SCThingTranslatableProperties, + SCThingType, + SCThingWithoutReferences, +} from './things/abstract/thing'; /** * Type guard to check if something is a SCThing @@ -32,16 +37,13 @@ export function isThing(something: unknown): something is SCThing { return false; } - // tslint:disable-next-line:completed-docs - const type = (something as { type: unknown; }).type; + const type = (something as {type: unknown}).type; if (typeof type !== 'string') { return false; } - return Object - .values(SCThingType) - .indexOf(type as SCThingType) >= 0; + return Object.values(SCThingType).includes(type as SCThingType); } /** @@ -49,9 +51,9 @@ export function isThing(something: unknown): something is SCThing { * * @param thing Thing to check */ -export function isThingWithTranslations(thing: SCThingWithoutReferences) -// tslint:disable-next-line:completed-docs - : thing is SCThingWithoutReferences & { translations: SCTranslations; } { +export function isThingWithTranslations( + thing: SCThingWithoutReferences, +): thing is SCThingWithoutReferences & {translations: SCTranslations} { return typeof thing.translations !== 'undefined'; } @@ -65,29 +67,31 @@ export function isBulkResponse(something: unknown): something is SCBulkResponse return false; } - if (!('expiration' in something) - || !('source' in something) - || !('state' in something) - || !('type' in something) - || !('uid' in something)) { + if ( + !('expiration' in something) || + !('source' in something) || + !('state' in something) || + !('type' in something) || + !('uid' in something) + ) { return false; } const {expiration, source, state, type, uid} = something as { - // tslint:disable:completed-docs expiration: unknown; source: unknown; state: unknown; type: unknown; uid: unknown; - // tslint:enable }; - return typeof expiration === 'string' - && typeof source === 'string' - && typeof state === 'string' - && typeof type === 'string' - && typeof uid === 'string'; + return ( + typeof expiration === 'string' && + typeof source === 'string' && + typeof state === 'string' && + typeof type === 'string' && + typeof uid === 'string' + ); } /** @@ -99,16 +103,18 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo if (!(typeof something === 'object') || something === null) { return false; } - const somethingObject = (something as { [key: string]: { [key: string]: string; }; }); + const somethingObject = something as {[key: string]: {[key: string]: string}}; - return Array.isArray(somethingObject.data) - && Array.isArray(somethingObject.facets) - && typeof somethingObject.pagination !== 'undefined' - && typeof somethingObject.pagination.count === 'number' - && typeof somethingObject.pagination.offset === 'number' - && typeof somethingObject.pagination.total === 'number' - && typeof somethingObject.stats !== 'undefined' - && typeof somethingObject.stats.time === 'number'; + return ( + Array.isArray(somethingObject.data) && + Array.isArray(somethingObject.facets) && + typeof somethingObject.pagination !== 'undefined' && + typeof somethingObject.pagination.count === 'number' && + typeof somethingObject.pagination.offset === 'number' && + typeof somethingObject.pagination.total === 'number' && + typeof somethingObject.stats !== 'undefined' && + typeof somethingObject.stats.time === 'number' + ); } /** @@ -117,10 +123,10 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo * @param something Something to check */ export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse { - const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false; + const initialValue = Object.keys(something as {[key: string]: string}).length > 0 ? true : false; - return Object.keys(something as { [key: string]: string; }) - .reduce((previousOnesAreSearchResponses, key) => { - return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]); - }, initialValue as boolean); + // eslint-disable-next-line unicorn/no-array-reduce + return Object.keys(something as {[key: string]: string}).reduce((previousOnesAreSearchResponses, key) => { + return previousOnesAreSearchResponses && isSearchResponse((something as {[key: string]: string})[key]); + }, initialValue as boolean); } diff --git a/src/meta.ts b/src/meta.ts index 498fe7ad..682929f0 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -13,14 +13,22 @@ * this program. If not, see . */ import {SCThingType} from './things/abstract/thing'; -import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/academic-event'; +import { + SCAcademicEvent, + SCAcademicEventMeta, + SCAcademicEventWithoutReferences, +} from './things/academic-event'; import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article'; import {SCAssessment, SCAssessmentMeta, SCAssessmentWithoutReferences} from './things/assessment'; import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book'; import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building'; import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog'; import {SCContactPoint, SCContactPointMeta, SCContactPointWithoutReferences} from './things/contact-point'; -import {SCCourseOfStudy, SCCourseOfStudyMeta, SCCourseOfStudyWithoutReferences} from './things/course-of-study'; +import { + SCCourseOfStudy, + SCCourseOfStudyMeta, + SCCourseOfStudyWithoutReferences, +} from './things/course-of-study'; import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series'; import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff'; import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish'; @@ -30,7 +38,11 @@ import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/mes import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization'; import {SCPeriodical, SCPeriodicalMeta, SCPeriodicalWithoutReferences} from './things/periodical'; import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person'; -import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest'; +import { + SCPointOfInterest, + SCPointOfInterestMeta, + SCPointOfInterestWithoutReferences, +} from './things/point-of-interest'; import { SCPublicationEvent, SCPublicationEventMeta, @@ -46,12 +58,10 @@ import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/todo'; import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour'; import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video'; -/* tslint:disable:variable-name */ /** * A map of things, from type to meta data */ -export const SCClasses: { [K in SCThingType]: object } = { - /* tslint:enable */ +export const SCClasses: {[K in SCThingType]: object} = { 'assessment': SCAssessmentMeta, 'academic event': SCAcademicEventMeta, 'article': SCArticleMeta, @@ -83,7 +93,7 @@ export const SCClasses: { [K in SCThingType]: object } = { }; export type SCIndexableThings = - SCAssessment + | SCAssessment | SCAcademicEvent | SCArticle | SCBook @@ -112,9 +122,7 @@ export type SCIndexableThings = /** * An object that exists in the StAppsCore */ -export type SCThings = - SCIndexableThings - | SCDiff | SCFavorite | SCSetting; +export type SCThings = SCIndexableThings | SCDiff | SCFavorite | SCSetting; /** * A field of a thing @@ -124,67 +132,121 @@ export type SCThingsField = keyof SCThings | string; /** * Thing without references for a thing */ -export type SCAssociatedThingWithoutReferences = - THING extends SCAssessment ? SCAssessmentWithoutReferences : - THING extends SCAcademicEvent ? SCAcademicEventWithoutReferences : - THING extends SCArticle ? SCArticleWithoutReferences : - THING extends SCBook ? SCBookWithoutReferences : - THING extends SCBuilding ? SCBuildingWithoutReferences : - THING extends SCCatalog ? SCCatalogWithoutReferences : - THING extends SCContactPoint ? SCContactPointWithoutReferences : - THING extends SCCourseOfStudy ? SCCourseOfStudyWithoutReferences : - THING extends SCDateSeries ? SCDateSeriesWithoutReferences : - THING extends SCDiff ? SCDiffWithoutReferences : - THING extends SCDish ? SCDishWithoutReferences : - THING extends SCFavorite ? SCFavoriteWithoutReferences : - THING extends SCFloor ? SCFloorWithoutReferences : - THING extends SCMessage ? SCMessageWithoutReferences : - THING extends SCOrganization ? SCOrganizationWithoutReferences : - THING extends SCPeriodical ? SCPeriodicalWithoutReferences : - THING extends SCPerson ? SCPersonWithoutReferences : - THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences : - THING extends SCPublicationEvent ? SCPublicationEventWithoutReferences : - THING extends SCRoom ? SCRoomWithoutReferences : - THING extends SCSemester ? SCSemesterWithoutReferences : - THING extends SCSetting ? SCSettingWithoutReferences : - THING extends SCSportCourse ? SCSportCourseWithoutReferences : - THING extends SCStudyModule ? SCStudyModuleWithoutReferences : - THING extends SCTicket ? SCTicketWithoutReferences : - THING extends SCToDo ? SCToDoWithoutReferences : - THING extends SCTour ? SCTourWithoutReferences : - THING extends SCVideo ? SCVideoWithoutReferences : - never; +export type SCAssociatedThingWithoutReferences = THING extends SCAssessment + ? SCAssessmentWithoutReferences + : THING extends SCAcademicEvent + ? SCAcademicEventWithoutReferences + : THING extends SCArticle + ? SCArticleWithoutReferences + : THING extends SCBook + ? SCBookWithoutReferences + : THING extends SCBuilding + ? SCBuildingWithoutReferences + : THING extends SCCatalog + ? SCCatalogWithoutReferences + : THING extends SCContactPoint + ? SCContactPointWithoutReferences + : THING extends SCCourseOfStudy + ? SCCourseOfStudyWithoutReferences + : THING extends SCDateSeries + ? SCDateSeriesWithoutReferences + : THING extends SCDiff + ? SCDiffWithoutReferences + : THING extends SCDish + ? SCDishWithoutReferences + : THING extends SCFavorite + ? SCFavoriteWithoutReferences + : THING extends SCFloor + ? SCFloorWithoutReferences + : THING extends SCMessage + ? SCMessageWithoutReferences + : THING extends SCOrganization + ? SCOrganizationWithoutReferences + : THING extends SCPeriodical + ? SCPeriodicalWithoutReferences + : THING extends SCPerson + ? SCPersonWithoutReferences + : THING extends SCPointOfInterest + ? SCPointOfInterestWithoutReferences + : THING extends SCPublicationEvent + ? SCPublicationEventWithoutReferences + : THING extends SCRoom + ? SCRoomWithoutReferences + : THING extends SCSemester + ? SCSemesterWithoutReferences + : THING extends SCSetting + ? SCSettingWithoutReferences + : THING extends SCSportCourse + ? SCSportCourseWithoutReferences + : THING extends SCStudyModule + ? SCStudyModuleWithoutReferences + : THING extends SCTicket + ? SCTicketWithoutReferences + : THING extends SCToDo + ? SCToDoWithoutReferences + : THING extends SCTour + ? SCTourWithoutReferences + : THING extends SCVideo + ? SCVideoWithoutReferences + : never; /** * Thing for a thing without references */ -export type SCAssociatedThing = - THING extends SCAssessmentWithoutReferences ? SCAssessment : - THING extends SCAcademicEventWithoutReferences ? SCAcademicEvent : - THING extends SCArticleWithoutReferences ? SCArticle : - THING extends SCBookWithoutReferences ? SCBook : - THING extends SCBuildingWithoutReferences ? SCBuilding : - THING extends SCCatalogWithoutReferences ? SCCatalog : - THING extends SCContactPointWithoutReferences ? SCContactPoint : - THING extends SCCourseOfStudyWithoutReferences ? SCCourseOfStudy : - THING extends SCDateSeriesWithoutReferences ? SCDateSeries : - THING extends SCDiffWithoutReferences ? SCDiff : - THING extends SCDishWithoutReferences ? SCDish : - THING extends SCFavoriteWithoutReferences ? SCFavorite : - THING extends SCFloorWithoutReferences ? SCFloor : - THING extends SCMessageWithoutReferences ? SCMessage : - THING extends SCOrganizationWithoutReferences ? SCOrganization : - THING extends SCPeriodicalWithoutReferences ? SCPeriodical : - THING extends SCPersonWithoutReferences ? SCPerson : - THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest : - THING extends SCPublicationEventWithoutReferences ? SCPublicationEvent : - THING extends SCRoomWithoutReferences ? SCRoom : - THING extends SCSemesterWithoutReferences ? SCSemester : - THING extends SCSettingWithoutReferences ? SCSetting : - THING extends SCSportCourseWithoutReferences ? SCSportCourse : - THING extends SCStudyModuleWithoutReferences ? SCStudyModule : - THING extends SCTicketWithoutReferences ? SCTicket : - THING extends SCToDoWithoutReferences ? SCToDo : - THING extends SCTourWithoutReferences ? SCTour : - THING extends SCVideoWithoutReferences ? SCVideo : - never; +export type SCAssociatedThing = THING extends SCAssessmentWithoutReferences + ? SCAssessment + : THING extends SCAcademicEventWithoutReferences + ? SCAcademicEvent + : THING extends SCArticleWithoutReferences + ? SCArticle + : THING extends SCBookWithoutReferences + ? SCBook + : THING extends SCBuildingWithoutReferences + ? SCBuilding + : THING extends SCCatalogWithoutReferences + ? SCCatalog + : THING extends SCContactPointWithoutReferences + ? SCContactPoint + : THING extends SCCourseOfStudyWithoutReferences + ? SCCourseOfStudy + : THING extends SCDateSeriesWithoutReferences + ? SCDateSeries + : THING extends SCDiffWithoutReferences + ? SCDiff + : THING extends SCDishWithoutReferences + ? SCDish + : THING extends SCFavoriteWithoutReferences + ? SCFavorite + : THING extends SCFloorWithoutReferences + ? SCFloor + : THING extends SCMessageWithoutReferences + ? SCMessage + : THING extends SCOrganizationWithoutReferences + ? SCOrganization + : THING extends SCPeriodicalWithoutReferences + ? SCPeriodical + : THING extends SCPersonWithoutReferences + ? SCPerson + : THING extends SCPointOfInterestWithoutReferences + ? SCPointOfInterest + : THING extends SCPublicationEventWithoutReferences + ? SCPublicationEvent + : THING extends SCRoomWithoutReferences + ? SCRoom + : THING extends SCSemesterWithoutReferences + ? SCSemester + : THING extends SCSettingWithoutReferences + ? SCSetting + : THING extends SCSportCourseWithoutReferences + ? SCSportCourse + : THING extends SCStudyModuleWithoutReferences + ? SCStudyModule + : THING extends SCTicketWithoutReferences + ? SCTicket + : THING extends SCToDoWithoutReferences + ? SCToDo + : THING extends SCTourWithoutReferences + ? SCTour + : THING extends SCVideoWithoutReferences + ? SCVideo + : never; diff --git a/src/protocol/error.ts b/src/protocol/error.ts index bd2e20f6..cfee8b95 100644 --- a/src/protocol/error.ts +++ b/src/protocol/error.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -50,7 +50,8 @@ export abstract class SCError implements SCErrorResponse { constructor(public name: string, public message: string, public statusCode: number, stack = false) { // generate stacktrace if needed if (stack) { - this.stack = (new Error()).stack; + // eslint-disable-next-line unicorn/error-message + this.stack = new Error().stack; } } } diff --git a/src/protocol/errors/internal-server-error.ts b/src/protocol/errors/internal-server-error.ts index 3bef060b..94e882ca 100644 --- a/src/protocol/errors/internal-server-error.ts +++ b/src/protocol/errors/internal-server-error.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -29,15 +29,15 @@ export class SCInternalServerErrorResponse extends SCError { /** * Create a SCInternalServerErrorResponse * - * @param err Internal server error + * @param error Internal server error * @param stack Set to true if a stack trace should be created * and the internal server error should be displayed to the client */ - constructor(err?: Error, stack = false) { + constructor(error?: Error, stack = false) { super('InternalServerError', 'Internal server error', StatusCodes.BAD_GATEWAY, stack); if (stack) { - this.additionalData = err; + this.additionalData = error; } } } diff --git a/src/protocol/errors/method-not-allowed.ts b/src/protocol/errors/method-not-allowed.ts index 7c5e90ce..474d7a8b 100644 --- a/src/protocol/errors/method-not-allowed.ts +++ b/src/protocol/errors/method-not-allowed.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -27,6 +27,11 @@ export class SCMethodNotAllowedErrorResponse extends SCError { * @param stack Set to true if a stack trace should be created */ constructor(stack?: boolean) { - super('MethodNotAllowedError', 'HTTP method is not allowed on this route', StatusCodes.METHOD_NOT_ALLOWED, stack); + super( + 'MethodNotAllowedError', + 'HTTP method is not allowed on this route', + StatusCodes.METHOD_NOT_ALLOWED, + stack, + ); } } diff --git a/src/protocol/errors/not-found.ts b/src/protocol/errors/not-found.ts index 1cf3f422..d5ac0a9b 100644 --- a/src/protocol/errors/not-found.ts +++ b/src/protocol/errors/not-found.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/errors/parameters-not-acceptable.ts b/src/protocol/errors/parameters-not-acceptable.ts index cff4dfb2..ad5dcec1 100644 --- a/src/protocol/errors/parameters-not-acceptable.ts +++ b/src/protocol/errors/parameters-not-acceptable.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/errors/plugin-already-registered.ts b/src/protocol/errors/plugin-already-registered.ts index c0397798..c2ebede0 100644 --- a/src/protocol/errors/plugin-already-registered.ts +++ b/src/protocol/errors/plugin-already-registered.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/errors/plugin-registering-failed.ts b/src/protocol/errors/plugin-registering-failed.ts index bd75201e..76d78d94 100644 --- a/src/protocol/errors/plugin-registering-failed.ts +++ b/src/protocol/errors/plugin-registering-failed.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/errors/request-body-too-large.ts b/src/protocol/errors/request-body-too-large.ts index ff572f80..65473b35 100644 --- a/src/protocol/errors/request-body-too-large.ts +++ b/src/protocol/errors/request-body-too-large.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/errors/syntax-error.ts b/src/protocol/errors/syntax-error.ts index 9bea0f17..a0332cdf 100644 --- a/src/protocol/errors/syntax-error.ts +++ b/src/protocol/errors/syntax-error.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/errors/too-many-requests.ts b/src/protocol/errors/too-many-requests.ts index 0865cd29..c0c574ac 100644 --- a/src/protocol/errors/too-many-requests.ts +++ b/src/protocol/errors/too-many-requests.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/errors/unsupported-media-type.ts b/src/protocol/errors/unsupported-media-type.ts index 878f9708..1eef9a6c 100644 --- a/src/protocol/errors/unsupported-media-type.ts +++ b/src/protocol/errors/unsupported-media-type.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/errors/validation.ts b/src/protocol/errors/validation.ts index f32e5bf3..f7d0c582 100644 --- a/src/protocol/errors/validation.ts +++ b/src/protocol/errors/validation.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/route.ts b/src/protocol/route.ts index b7eb5e7d..b82cbb57 100644 --- a/src/protocol/route.ts +++ b/src/protocol/route.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -40,8 +40,8 @@ export enum SCRouteHttpVerbs { /** * The constructor of an error response */ -// tslint:disable-next-line:no-any -export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type SCErrorResponseConstructor = new (...arguments_: any[]) => SCErrorResponse; /** * A description of a route @@ -91,26 +91,32 @@ export abstract class SCAbstractRoute implements SCRoute { * @see SCRoute.errorNames */ errorNames: SCErrorResponseConstructor[] = []; + /** * @see SCRoute.method */ method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET; + /** * @see SCRoute.obligatoryParameters */ obligatoryParameters?: SCMap; + /** * @see SCRoute.requestBodyName */ requestBodyName = 'any'; + /** * @see SCRoute.responseBodyName */ responseBodyName = 'any'; + /** * @see SCRoute.statusCodeSuccess */ statusCodeSuccess = 200; + /** * @see SCRoute.urlPath */ @@ -134,15 +140,15 @@ export abstract class SCAbstractRoute implements SCRoute { return this.urlPath .split('/') - .map((part) => { + .map(part => { if (part.indexOf(':') !== 0) { return part; } - const parameter = part.substr(1); + const parameter = part.slice(1); if (typeof parameters[parameter] === 'undefined') { - throw new Error(`Parameter '${parameter}' not provided.`); + throw new TypeError(`Parameter '${parameter}' not provided.`); } return parameters[parameter]; @@ -155,7 +161,7 @@ export abstract class SCAbstractRoute implements SCRoute { * Possible requests */ export type SCRequests = - SCBookAvailabilityRequest + | SCBookAvailabilityRequest | SCBulkRequest | SCBulkAddRequest | SCBulkDoneRequest @@ -169,7 +175,7 @@ export type SCRequests = * Possible responses */ export type SCResponses = - SCBookAvailabilityResponse + | SCBookAvailabilityResponse | SCBulkResponse | SCBulkAddResponse | SCBulkDoneResponse @@ -182,59 +188,91 @@ export type SCResponses = /** * Associated response for a request */ -export type SCAssociatedResponse = - REQUEST extends SCBookAvailabilityRequest ? SCBookAvailabilityResponse : - REQUEST extends SCBulkRequest ? SCBulkResponse : - REQUEST extends SCBulkAddRequest ? SCBulkAddResponse : - REQUEST extends SCBulkDoneRequest ? SCBulkDoneResponse : - REQUEST extends SCFeedbackRequest ? SCFeedbackResponse : - REQUEST extends SCIndexRequest ? SCIndexResponse : - REQUEST extends SCMultiSearchRequest ? SCMultiSearchResponse : - REQUEST extends SCSearchRequest ? SCSearchResponse : - REQUEST extends SCThingUpdateRequest ? SCThingUpdateResponse : - never; +export type SCAssociatedResponse = REQUEST extends SCBookAvailabilityRequest + ? SCBookAvailabilityResponse + : REQUEST extends SCBulkRequest + ? SCBulkResponse + : REQUEST extends SCBulkAddRequest + ? SCBulkAddResponse + : REQUEST extends SCBulkDoneRequest + ? SCBulkDoneResponse + : REQUEST extends SCFeedbackRequest + ? SCFeedbackResponse + : REQUEST extends SCIndexRequest + ? SCIndexResponse + : REQUEST extends SCMultiSearchRequest + ? SCMultiSearchResponse + : REQUEST extends SCSearchRequest + ? SCSearchResponse + : REQUEST extends SCThingUpdateRequest + ? SCThingUpdateResponse + : never; /** * Associated request for a response */ -export type SCAssociatedRequest = - RESPONSE extends SCBookAvailabilityResponse ? SCBookAvailabilityRequest : - RESPONSE extends SCBulkResponse ? SCBulkRequest : - RESPONSE extends SCBulkAddResponse ? SCBulkAddRequest : - RESPONSE extends SCBulkDoneResponse ? SCBulkDoneRequest : - RESPONSE extends SCFeedbackResponse ? SCFeedbackRequest : - RESPONSE extends SCIndexResponse ? SCIndexRequest : - RESPONSE extends SCMultiSearchResponse ? SCMultiSearchRequest : - RESPONSE extends SCSearchResponse ? SCSearchRequest : - RESPONSE extends SCThingUpdateResponse ? SCThingUpdateRequest : - never; +export type SCAssociatedRequest = RESPONSE extends SCBookAvailabilityResponse + ? SCBookAvailabilityRequest + : RESPONSE extends SCBulkResponse + ? SCBulkRequest + : RESPONSE extends SCBulkAddResponse + ? SCBulkAddRequest + : RESPONSE extends SCBulkDoneResponse + ? SCBulkDoneRequest + : RESPONSE extends SCFeedbackResponse + ? SCFeedbackRequest + : RESPONSE extends SCIndexResponse + ? SCIndexRequest + : RESPONSE extends SCMultiSearchResponse + ? SCMultiSearchRequest + : RESPONSE extends SCSearchResponse + ? SCSearchRequest + : RESPONSE extends SCThingUpdateResponse + ? SCThingUpdateRequest + : never; /** * Associated request for a route */ -export type SCAssignedRequest = - ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityRequest : - ROUTE extends SCBulkRoute ? SCBulkRequest : - ROUTE extends SCBulkAddRoute ? SCBulkAddRequest : - ROUTE extends SCBulkDoneRoute ? SCBulkDoneRequest : - ROUTE extends SCFeedbackRoute ? SCFeedbackRequest : - ROUTE extends SCIndexRoute ? SCIndexRequest : - ROUTE extends SCMultiSearchRoute ? SCMultiSearchRequest : - ROUTE extends SCSearchRoute ? SCSearchRequest : - ROUTE extends SCThingUpdateRoute ? SCThingUpdateRequest : - never; +export type SCAssignedRequest = ROUTE extends SCBookAvailabilityRoute + ? SCBookAvailabilityRequest + : ROUTE extends SCBulkRoute + ? SCBulkRequest + : ROUTE extends SCBulkAddRoute + ? SCBulkAddRequest + : ROUTE extends SCBulkDoneRoute + ? SCBulkDoneRequest + : ROUTE extends SCFeedbackRoute + ? SCFeedbackRequest + : ROUTE extends SCIndexRoute + ? SCIndexRequest + : ROUTE extends SCMultiSearchRoute + ? SCMultiSearchRequest + : ROUTE extends SCSearchRoute + ? SCSearchRequest + : ROUTE extends SCThingUpdateRoute + ? SCThingUpdateRequest + : never; /** * Associated response for a route */ -export type SCAssignedResponse = - ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityResponse : - ROUTE extends SCBulkRoute ? SCBulkResponse : - ROUTE extends SCBulkAddRoute ? SCBulkAddResponse : - ROUTE extends SCBulkDoneRoute ? SCBulkDoneResponse : - ROUTE extends SCFeedbackRoute ? SCFeedbackResponse : - ROUTE extends SCIndexRoute ? SCIndexResponse : - ROUTE extends SCMultiSearchRoute ? SCMultiSearchResponse : - ROUTE extends SCSearchRoute ? SCSearchResponse : - ROUTE extends SCThingUpdateRoute ? SCThingUpdateResponse : - never; +export type SCAssignedResponse = ROUTE extends SCBookAvailabilityRoute + ? SCBookAvailabilityResponse + : ROUTE extends SCBulkRoute + ? SCBulkResponse + : ROUTE extends SCBulkAddRoute + ? SCBulkAddResponse + : ROUTE extends SCBulkDoneRoute + ? SCBulkDoneResponse + : ROUTE extends SCFeedbackRoute + ? SCFeedbackResponse + : ROUTE extends SCIndexRoute + ? SCIndexResponse + : ROUTE extends SCMultiSearchRoute + ? SCMultiSearchResponse + : ROUTE extends SCSearchRoute + ? SCSearchResponse + : ROUTE extends SCThingUpdateRoute + ? SCThingUpdateResponse + : never; diff --git a/src/protocol/routes/book-availability.ts b/src/protocol/routes/book-availability.ts index 687344fc..ec20e917 100644 --- a/src/protocol/routes/book-availability.ts +++ b/src/protocol/routes/book-availability.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -14,7 +14,10 @@ */ import {StatusCodes} from 'http-status-codes'; import {SCUuid} from '../../general/uuid'; -import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered'; +import { + SCAcademicPriceGroup, + SCThingThatCanBeOfferedOffer, +} from '../../things/abstract/thing-that-can-be-offered'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error'; import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed'; import {SCNotFoundErrorResponse} from '../errors/not-found'; diff --git a/src/protocol/routes/bulk-add.ts b/src/protocol/routes/bulk-add.ts index bb046e24..6edb98f8 100644 --- a/src/protocol/routes/bulk-add.ts +++ b/src/protocol/routes/bulk-add.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -35,8 +35,7 @@ export type SCBulkAddRequest = SCThings; * * @validatable */ -export interface SCBulkAddResponse { -} +export interface SCBulkAddResponse {} /** * Route for indexing SC things in a bulk diff --git a/src/protocol/routes/bulk-done.ts b/src/protocol/routes/bulk-done.ts index b42a2185..68514ba1 100644 --- a/src/protocol/routes/bulk-done.ts +++ b/src/protocol/routes/bulk-done.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -27,16 +27,14 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route'; * * @validatable */ -export interface SCBulkDoneRequest { -} +export interface SCBulkDoneRequest {} /** * Response to a request to change the state of a bulk to done * * @validatable */ -export interface SCBulkDoneResponse { -} +export interface SCBulkDoneResponse {} /** * Route for closing bulks diff --git a/src/protocol/routes/bulk-request.ts b/src/protocol/routes/bulk-request.ts index 58962f4c..d92e6aa7 100644 --- a/src/protocol/routes/bulk-request.ts +++ b/src/protocol/routes/bulk-request.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -31,8 +31,7 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route'; * * @validatable */ -export interface SCBulkRequest extends SCBulkParameters { -} +export type SCBulkRequest = SCBulkParameters; /** * Parameters for a bulk diff --git a/src/protocol/routes/feedback.ts b/src/protocol/routes/feedback.ts index 3f935052..b7e941c8 100644 --- a/src/protocol/routes/feedback.ts +++ b/src/protocol/routes/feedback.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -39,8 +39,7 @@ export interface SCFeedbackRequest extends SCMessage { * * @validatable */ -export interface SCFeedbackResponse { -} +export interface SCFeedbackResponse {} /** * Route for feedback submission diff --git a/src/protocol/routes/index.ts b/src/protocol/routes/index.ts index 8fe23cd6..901c7cdf 100644 --- a/src/protocol/routes/index.ts +++ b/src/protocol/routes/index.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -29,8 +29,7 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route'; * * @validatable */ -export interface SCIndexRequest { -} +export interface SCIndexRequest {} /** * A response to an index request @@ -46,7 +45,7 @@ export interface SCIndexResponse { /** * @see SCAuthorizationProvider */ - auth: { [key in SCAuthorizationProviderType]?: SCAuthorizationProvider; }; + auth: {[key in SCAuthorizationProviderType]?: SCAuthorizationProvider}; /** * @see SCBackendConfiguration diff --git a/src/protocol/routes/plugin-register.ts b/src/protocol/routes/plugin-register.ts index 1aff7f77..4a25a636 100644 --- a/src/protocol/routes/plugin-register.ts +++ b/src/protocol/routes/plugin-register.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/routes/search-multi.ts b/src/protocol/routes/search-multi.ts index 14ffd446..8a5e7495 100644 --- a/src/protocol/routes/search-multi.ts +++ b/src/protocol/routes/search-multi.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/routes/search.ts b/src/protocol/routes/search.ts index f4c27803..bfe64ab6 100644 --- a/src/protocol/routes/search.ts +++ b/src/protocol/routes/search.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -28,16 +28,14 @@ import {SCSearchResult} from '../search/result'; * * @validatable */ -export interface SCSearchRequest extends SCSearchQuery { -} +export type SCSearchRequest = SCSearchQuery; /** * A search response * * @validatable */ -export interface SCSearchResponse extends SCSearchResult { -} +export type SCSearchResponse = SCSearchResult; /** * Route for searching things diff --git a/src/protocol/routes/thing-update.ts b/src/protocol/routes/thing-update.ts index a3d74820..f087b8ec 100644 --- a/src/protocol/routes/thing-update.ts +++ b/src/protocol/routes/thing-update.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -35,8 +35,7 @@ export type SCThingUpdateRequest = SCThings; * * @validatable */ -export interface SCThingUpdateResponse { -} +export interface SCThingUpdateResponse {} /** * Route for updating existing things diff --git a/src/protocol/search/filter.ts b/src/protocol/search/filter.ts index 6b8be777..a52aaaad 100644 --- a/src/protocol/search/filter.ts +++ b/src/protocol/search/filter.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -27,7 +27,7 @@ import {SCSearchValueFilter} from './filters/value'; * Filter instruction types */ export type SCSearchFilterType = - 'availability' + | 'availability' | 'boolean' | 'distance' | 'value' @@ -59,7 +59,7 @@ export type SCSearchAbstractFilterArguments = SCMap; * Available filter instructions */ export type SCSearchFilter = - SCSearchAvailabilityFilter + | SCSearchAvailabilityFilter | SCSearchBooleanFilter | SCSearchDistanceFilter | SCSearchValueFilter diff --git a/src/protocol/search/filters/distance.ts b/src/protocol/search/filters/distance.ts index a52b2c67..1316faaf 100644 --- a/src/protocol/search/filters/distance.ts +++ b/src/protocol/search/filters/distance.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -12,7 +12,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -// tslint:disable-next-line:no-implicit-dependencies import {Position} from 'geojson'; import {SCThingsField} from '../../../meta'; import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter'; diff --git a/src/protocol/search/filters/geo.ts b/src/protocol/search/filters/geo.ts index 28f40c22..bc5bddca 100644 --- a/src/protocol/search/filters/geo.ts +++ b/src/protocol/search/filters/geo.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -12,7 +12,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -// tslint:disable-next-line:no-implicit-dependencies import {Polygon, Position} from 'geojson'; import {SCThingsField} from '../../../meta'; import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter'; diff --git a/src/protocol/search/filters/range.ts b/src/protocol/search/filters/range.ts index 4d982d61..b4716b86 100644 --- a/src/protocol/search/filters/range.ts +++ b/src/protocol/search/filters/range.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 StApps + * Copyright (C) 2020-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -47,6 +47,7 @@ export interface SCSearchNumericRangeFilter extends SCSearchAbstractFilter { diff --git a/src/protocol/search/sort.ts b/src/protocol/search/sort.ts index 2fecdd02..a3d1eb1c 100644 --- a/src/protocol/search/sort.ts +++ b/src/protocol/search/sort.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019, 2020 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/protocol/search/sorts/distance.ts b/src/protocol/search/sorts/distance.ts index d082e6b8..37ddfdfd 100644 --- a/src/protocol/search/sorts/distance.ts +++ b/src/protocol/search/sorts/distance.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -12,7 +12,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -// tslint:disable-next-line:no-implicit-dependencies import {Position} from 'geojson'; import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort'; diff --git a/src/things/abstract/academic-degree.ts b/src/things/abstract/academic-degree.ts index 90258e3c..fe0d370b 100644 --- a/src/things/abstract/academic-degree.ts +++ b/src/things/abstract/academic-degree.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -18,8 +18,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing'; /** * An academic degree without references */ -export interface SCAcademicDegreeWithoutReferences - extends SCThingWithoutReferences { +export interface SCAcademicDegreeWithoutReferences extends SCThingWithoutReferences { /** * The achievable academic degree * @@ -46,16 +45,14 @@ export interface SCAcademicDegreeWithoutReferences /** * An academic degree */ -export interface SCAcademicDegree - extends SCAcademicDegreeWithoutReferences, SCThing { +export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences, SCThing { // noop } /** * Meta information about academic degrees */ -export class SCAcademicDegreeMeta - extends SCThingMeta implements SCMetaTranslations { +export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/abstract/academic-term.ts b/src/things/abstract/academic-term.ts index 86122b94..1d2ce53e 100644 --- a/src/things/abstract/academic-term.ts +++ b/src/things/abstract/academic-term.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -19,8 +19,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing'; /** * An academic term without references */ -export interface SCAcademicTermWithoutReferences - extends SCThingWithoutReferences { +export interface SCAcademicTermWithoutReferences extends SCThingWithoutReferences { /** * Short name of the academic term, using the given pattern * @@ -62,16 +61,14 @@ export interface SCAcademicTermWithoutReferences /** * An academic term */ -export interface SCAcademicTerm - extends SCAcademicTermWithoutReferences, SCThing { +export interface SCAcademicTerm extends SCAcademicTermWithoutReferences, SCThing { // noop } /** * Meta information about academic terms */ -export class SCAcademicTermWithoutReferencesMeta - extends SCThingMeta implements SCMetaTranslations { +export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/abstract/creative-work.ts b/src/things/abstract/creative-work.ts index a0eaba02..6c0b28dc 100644 --- a/src/things/abstract/creative-work.ts +++ b/src/things/abstract/creative-work.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -22,9 +22,7 @@ import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutRefer /** * A creative work without references */ -export interface SCCreativeWorkWithoutReferences - extends SCThingWithoutReferences { - +export interface SCCreativeWorkWithoutReferences extends SCThingWithoutReferences { /** * Languages this creative work is available in */ @@ -81,8 +79,7 @@ export interface SCCreativeWorkWithoutReferences /** * A creative work */ -export interface SCCreativeWork - extends SCCreativeWorkWithoutReferences, SCThing { +export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThing { /** * Authors of the creative work */ @@ -117,8 +114,7 @@ export interface SCCreativeWork /** * Translatable properties of creative works */ -export interface SCCreativeWorkTranslatableProperties - extends SCThingTranslatableProperties { +export interface SCCreativeWorkTranslatableProperties extends SCThingTranslatableProperties { /** * Translation of the keywords of the creative work * @@ -130,8 +126,7 @@ export interface SCCreativeWorkTranslatableProperties /** * Meta information about creative works */ -export class SCCreativeWorkMeta - extends SCThingMeta implements SCMetaTranslations { +export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/abstract/event.ts b/src/things/abstract/event.ts index efce2ba4..86f0c671 100644 --- a/src/things/abstract/event.ts +++ b/src/things/abstract/event.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -22,8 +22,7 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing'; /** * An event without references */ -export interface SCEventWithoutReferences - extends SCThingWithoutReferences { +export interface SCEventWithoutReferences extends SCThingWithoutReferences { /** * Maximum number of participants of the event * @@ -46,8 +45,7 @@ export interface SCEventWithoutReferences /** * An event */ -export interface SCEvent - extends SCEventWithoutReferences, SCThing { +export interface SCEvent extends SCEventWithoutReferences, SCThing { /** * Academic terms that an event belongs to, e.g. semester(s). */ @@ -79,8 +77,7 @@ export interface SCEvent /** * Meta information about events */ -export class SCEventMeta - extends SCThingMeta implements SCMetaTranslations { +export class SCEventMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/abstract/place.ts b/src/things/abstract/place.ts index ce4850e7..a8259011 100644 --- a/src/things/abstract/place.ts +++ b/src/things/abstract/place.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -12,7 +12,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -// tslint:disable-next-line:no-implicit-dependencies import {Point, Polygon} from 'geojson'; import {SCMetaTranslations, SCTranslations} from '../../general/i18n'; import {SCBuildingWithoutReferences} from '../building'; @@ -84,8 +83,7 @@ export interface SCPostalAddress { /** * A place without references */ -export interface SCPlaceWithoutReferences - extends SCThingWithoutReferences { +export interface SCPlaceWithoutReferences extends SCThingWithoutReferences { /** * Address of the place */ @@ -116,8 +114,7 @@ export interface SCPlaceWithoutReferences /** * A place */ -export interface SCPlace - extends SCPlaceWithoutReferences, SCThing { +export interface SCPlace extends SCPlaceWithoutReferences, SCThing { /** * Translated fields of a place */ @@ -127,8 +124,7 @@ export interface SCPlace /** * Translatable properties of a place without references */ -export interface SCPlaceWithoutReferencesTranslatableProperties - extends SCThingTranslatableProperties { +export interface SCPlaceWithoutReferencesTranslatableProperties extends SCThingTranslatableProperties { /** * Address of a place */ @@ -139,7 +135,9 @@ export interface SCPlaceWithoutReferencesTranslatableProperties * Meta information about creative works */ export class SCPlaceWithoutReferencesMeta - extends SCThingMeta implements SCMetaTranslations { + extends SCThingMeta + implements SCMetaTranslations +{ /** * Translations of fields */ @@ -181,8 +179,5 @@ export interface SCInPlace { /** * Place the thing is or happens in */ - inPlace?: - SCBuildingWithoutReferences - | SCPointOfInterestWithoutReferences - | SCRoomWithoutReferences; + inPlace?: SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences; } diff --git a/src/things/abstract/range.ts b/src/things/abstract/range.ts index a1eb5b90..251fb337 100644 --- a/src/things/abstract/range.ts +++ b/src/things/abstract/range.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -24,41 +24,43 @@ export type SCISO8601DateRange = SCRange; /** * Generic range type */ -export type SCRange = { - /** - * Greater than value - */ - gt?: never; +export type SCRange = + | { + /** + * Greater than value + */ + gt?: never; - /** - * Greater or equal to value - */ - gte?: T; + /** + * Greater or equal to value + */ + gte?: T; - /** - * Greater than value - */ - lt?: never; + /** + * Greater than value + */ + lt?: never; - /** - * Greater or equal to value - */ - lte?: T; -} | { - // tslint:disable:completed-docs - gt?: T; - gte?: never; - lt?: T; - lte?: never; -} | { - gt?: T; - gte?: never; - lt?: never; - lte?: T; -} | { - gt?: never; - gte?: T; - lt?: T; - lte?: never; - // tslint:enable:completed-docs -}; + /** + * Greater or equal to value + */ + lte?: T; + } + | { + gt?: T; + gte?: never; + lt?: T; + lte?: never; + } + | { + gt?: T; + gte?: never; + lt?: never; + lte?: T; + } + | { + gt?: never; + gte?: T; + lt?: T; + lte?: never; + }; diff --git a/src/things/abstract/saveable-thing.ts b/src/things/abstract/saveable-thing.ts index 67c90bb4..8f3c9aa8 100644 --- a/src/things/abstract/saveable-thing.ts +++ b/src/things/abstract/saveable-thing.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -18,15 +18,12 @@ import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing'; /** * An encapsulation of the data (e.g. a thing) that is saved, which provides additional information. */ -export interface SCSaveableThingWithoutReferences - extends SCThingWithoutReferences { -} +export type SCSaveableThingWithoutReferences = SCThingWithoutReferences; /** * An encapsulation of the data (e.g. a thing) that is saved, which provides additional information. */ -export interface SCSaveableThing - extends SCSaveableThingWithoutReferences, SCThing { +export interface SCSaveableThing extends SCSaveableThingWithoutReferences, SCThing { /** * The contained data */ diff --git a/src/things/abstract/thing-in-place.ts b/src/things/abstract/thing-in-place.ts index 8fb214bf..a4e9878e 100644 --- a/src/things/abstract/thing-in-place.ts +++ b/src/things/abstract/thing-in-place.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -19,16 +19,14 @@ import {SCThing, SCThingMeta} from './thing'; /** * A thing that is or happens in a place */ -export interface SCThingInPlace - extends SCThing, SCInPlace { +export interface SCThingInPlace extends SCThing, SCInPlace { // noop } /** * Meta information about thing in a place */ -export class SCThingInPlaceMeta - extends SCThingMeta implements SCMetaTranslations { +export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/abstract/thing-that-accepts-payments.ts b/src/things/abstract/thing-that-accepts-payments.ts index 4414e939..9e385805 100644 --- a/src/things/abstract/thing-that-accepts-payments.ts +++ b/src/things/abstract/thing-that-accepts-payments.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -18,16 +18,12 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing'; /** * Types of payment that are accepted at a place. */ -export type SCThingThatAcceptsPaymentsAcceptedPayments = - 'cash' - | 'credit' - | 'cafeteria card'; +export type SCThingThatAcceptsPaymentsAcceptedPayments = 'cash' | 'credit' | 'cafeteria card'; /** * A thing without references that accepts payments */ -export interface SCThingThatAcceptsPaymentsWithoutReferences - extends SCThingWithoutReferences { +export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThingWithoutReferences { /** * Accepted payments of the place * @@ -39,8 +35,7 @@ export interface SCThingThatAcceptsPaymentsWithoutReferences /** * A thing that accepts payments */ -export interface SCThingThatAcceptsPayments - extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing { +export interface SCThingThatAcceptsPayments extends SCThingThatAcceptsPaymentsWithoutReferences, SCThing { // noop } @@ -48,7 +43,9 @@ export interface SCThingThatAcceptsPayments * Meta information about a thing without references that accepts payments */ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta - extends SCThingMeta implements SCMetaTranslations { + extends SCThingMeta + implements SCMetaTranslations +{ /** * Translations of fields */ diff --git a/src/things/abstract/thing-that-can-be-offered.ts b/src/things/abstract/thing-that-can-be-offered.ts index 29437eff..f7a71081 100644 --- a/src/things/abstract/thing-that-can-be-offered.ts +++ b/src/things/abstract/thing-that-can-be-offered.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -35,8 +35,7 @@ export interface SCPriceGroup { /** * Price distinctions for academic context */ -export interface SCAcademicPriceGroup - extends SCPriceGroup { +export interface SCAcademicPriceGroup extends SCPriceGroup { /** * Price for employees * @@ -65,8 +64,7 @@ export interface SCAcademicPriceGroup /** * A thing without references that can be offered */ -export interface SCThingThatCanBeOfferedWithoutReferences - extends SCThingWithoutReferences { +export interface SCThingThatCanBeOfferedWithoutReferences extends SCThingWithoutReferences { /** * Translations of a thing that can be offered */ @@ -77,7 +75,8 @@ export interface SCThingThatCanBeOfferedWithoutReferences * A thing that can be offered */ export interface SCThingThatCanBeOffered - extends SCThing, SCThingThatCanBeOfferedWithoutReferences { + extends SCThing, + SCThingThatCanBeOfferedWithoutReferences { /** * List of offers for that thing */ @@ -92,8 +91,7 @@ export interface SCThingThatCanBeOffered /** * Offer of a thing */ -export interface SCThingThatCanBeOfferedOffer - extends SCInPlace { +export interface SCThingThatCanBeOfferedOffer extends SCInPlace { /** * Availability of an offer */ @@ -118,8 +116,7 @@ export interface SCThingThatCanBeOfferedOffer /** * Translatable properties of a thing that can be offered */ -export interface SCThingThatCanBeOfferedTranslatableProperties - extends SCThingTranslatableProperties { +export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTranslatableProperties { /** * Availability of an offer * @@ -131,9 +128,7 @@ export interface SCThingThatCanBeOfferedTranslatableProperties /** * Entity responsible for the offer */ -export type SCThingThatCanBeOfferedProvider = - | SCOrganizationWithoutReferences - | SCPersonWithoutReferences; +export type SCThingThatCanBeOfferedProvider = SCOrganizationWithoutReferences | SCPersonWithoutReferences; /** * Availability of an Offer @@ -148,8 +143,8 @@ export type SCThingThatCanBeOfferedAvailability = * Meta information about a thing without references that accepts payments */ export class SCThingThatCanBeOfferedMeta - implements SCMetaTranslations> { - + implements SCMetaTranslations> +{ /** * Translations of fields */ diff --git a/src/things/abstract/thing-with-categories.ts b/src/things/abstract/thing-with-categories.ts index c4cd7e9c..2fd59fce 100644 --- a/src/things/abstract/thing-with-categories.ts +++ b/src/things/abstract/thing-with-categories.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -50,7 +50,8 @@ export interface SCThingWithCategoriesWithoutReferences - extends SCThing, SCThingWithCategoriesWithoutReferences { + extends SCThing, + SCThingWithCategoriesWithoutReferences { /** * Translated fields of a thing with categories */ @@ -60,8 +61,7 @@ export interface SCThingWithCategories - implements SCMetaTranslations> { - + implements SCMetaTranslations> +{ /** * Translations of fields */ diff --git a/src/things/abstract/thing.ts b/src/things/abstract/thing.ts index d27c21f6..5e560db2 100644 --- a/src/things/abstract/thing.ts +++ b/src/things/abstract/thing.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. diff --git a/src/things/abstract/user-groups.ts b/src/things/abstract/user-groups.ts index 1750cb8c..95e4a18a 100644 --- a/src/things/abstract/user-groups.ts +++ b/src/things/abstract/user-groups.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -15,7 +15,4 @@ /** * Types of data consumers */ -export type SCUserGroup = - 'students' - | 'employees' - | 'guests'; +export type SCUserGroup = 'students' | 'employees' | 'guests'; diff --git a/src/things/academic-event.ts b/src/things/academic-event.ts index affc6049..308c34e3 100644 --- a/src/things/academic-event.ts +++ b/src/things/academic-event.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -64,7 +64,8 @@ export interface SCAcademicEventWithoutReferences * @indexable */ export interface SCAcademicEvent - extends SCEvent, SCAcademicEventWithoutReferences, + extends SCEvent, + SCAcademicEventWithoutReferences, SCThingWithCategories { /** * Translated fields of an academic event @@ -81,7 +82,7 @@ export interface SCAcademicEvent * Categories of academic events */ export type SCAcademicEventCategories = - 'lecture' + | 'lecture' | 'seminar' | 'integrated course' | 'written exam' @@ -100,8 +101,7 @@ export type SCAcademicEventCategories = /** * Translatable properties of an academic event */ -export interface SCAcademicEventTranslatableProperties - extends SCThingWithCategoriesTranslatableProperties { +export interface SCAcademicEventTranslatableProperties extends SCThingWithCategoriesTranslatableProperties { /** * Translations of the majors of the academic event that this event belongs to * @@ -120,24 +120,26 @@ export interface SCAcademicEventTranslatableProperties /** * Meta information about academic events */ -export class SCAcademicEventMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { ...new SCEventMeta().fieldTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCAcademicEventCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, majors: 'Hauptfächer', originalCategory: 'ursprüngliche Kategorie', }, en: { ...new SCEventMeta().fieldTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCAcademicEventCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, majors: 'majors', originalCategory: 'original category', }, @@ -149,8 +151,10 @@ export class SCAcademicEventMeta fieldValueTranslations = { de: { ...new SCEventMeta().fieldValueTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCAcademicEventCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, categories: { 'colloquium': 'Kolloquium', 'course': 'Kurs', @@ -172,8 +176,10 @@ export class SCAcademicEventMeta }, en: { ...new SCEventMeta().fieldValueTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCAcademicEventCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, type: SCThingType.AcademicEvent, }, }; diff --git a/src/things/article.ts b/src/things/article.ts index 71a4209e..dcb3a490 100644 --- a/src/things/article.ts +++ b/src/things/article.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -20,7 +20,13 @@ import { SCCreativeWorkWithoutReferences, } from './abstract/creative-work'; import {SCThingMeta, SCThingType} from './abstract/thing'; -import {SCAcademicPriceGroup, SCThingThatCanBeOffered, SCThingThatCanBeOfferedMeta, SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedWithoutReferences} from './abstract/thing-that-can-be-offered'; +import { + SCAcademicPriceGroup, + SCThingThatCanBeOffered, + SCThingThatCanBeOfferedMeta, + SCThingThatCanBeOfferedTranslatableProperties, + SCThingThatCanBeOfferedWithoutReferences, +} from './abstract/thing-that-can-be-offered'; import { SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, @@ -32,17 +38,15 @@ import {SCPeriodicalWithoutReferences} from './periodical'; /** * Categories of an article */ -export type SCArticleCategories = 'unipedia' - | 'article' - | 'eArticle'; +export type SCArticleCategories = 'unipedia' | 'article' | 'eArticle'; /** * An article without references */ export interface SCArticleWithoutReferences extends SCCreativeWorkWithoutReferences, - SCThingThatCanBeOfferedWithoutReferences, - SCThingWithCategoriesWithoutReferences { + SCThingThatCanBeOfferedWithoutReferences, + SCThingWithCategoriesWithoutReferences { /** * Article itself as markdown * @@ -74,8 +78,8 @@ export interface SCArticleWithoutReferences */ export interface SCArticle extends SCCreativeWork, - SCThingThatCanBeOffered, - SCArticleWithoutReferences { + SCThingThatCanBeOffered, + SCArticleWithoutReferences { /** * A periodical to which this article belongs */ @@ -101,8 +105,8 @@ export interface SCArticle */ export interface SCArticleTranslatableProperties extends SCThingWithCategoriesTranslatableProperties, - SCThingThatCanBeOfferedTranslatableProperties, - SCCreativeWorkTranslatableProperties { + SCThingThatCanBeOfferedTranslatableProperties, + SCCreativeWorkTranslatableProperties { /** * Translation of the article itself as markdown * @@ -114,27 +118,28 @@ export interface SCArticleTranslatableProperties /** * Meta information about an article */ -export class SCArticleMeta - extends SCThingMeta implements SCMetaTranslations { +export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCCreativeWorkMeta().fieldTranslations - .de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, + ...new SCCreativeWorkMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCArticleCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, categories: 'Format', reference: 'Referenz', articleBody: 'Artikelinhalt', }, en: { - ...new SCCreativeWorkMeta().fieldTranslations - .en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCCreativeWorkMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCArticleCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, ...new SCThingThatCanBeOfferedMeta().fieldTranslations.en, categories: 'format', reference: 'reference', @@ -148,10 +153,11 @@ export class SCArticleMeta fieldValueTranslations = { de: { ...new SCCreativeWorkMeta().fieldValueTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCArticleCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, categories: { article: 'Artikel', eArticle: 'E-Aufsatz', @@ -161,10 +167,11 @@ export class SCArticleMeta }, en: { ...new SCCreativeWorkMeta().fieldValueTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCArticleCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, type: SCThingType.Article, categories: { article: 'article', diff --git a/src/things/assessment.ts b/src/things/assessment.ts index 79fde0ad..3fdc525e 100644 --- a/src/things/assessment.ts +++ b/src/things/assessment.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -16,59 +16,67 @@ import {SCMetaTranslations, SCTranslations} from '../general/i18n'; import {SCISO8601Date} from '../general/time'; import {SCThing, SCThingMeta, SCThingType} from './abstract/thing'; -import {SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta} from './abstract/thing-with-categories'; +import { + SCThingWithCategories, + SCThingWithCategoriesSpecificValues, + SCThingWithCategoriesTranslatableProperties, + SCThingWithCategoriesWithoutReferences, + SCThingWithCategoriesWithoutReferencesMeta, +} from './abstract/thing-with-categories'; import {SCCourseOfStudyWithoutReferences} from './course-of-study'; - /** * Categories of assessments */ - export type SCAssessmentCategories = 'university assessment'; +export type SCAssessmentCategories = 'university assessment'; /** * An assessment without references * */ export interface SCAssessmentWithoutReferences - extends SCThingWithCategoriesWithoutReferences { - /** - * Number of attempts - * - * @integer - */ - attempt?: number; + extends SCThingWithCategoriesWithoutReferences< + SCAssessmentCategories, + SCThingWithCategoriesSpecificValues + > { + /** + * Number of attempts + * + * @integer + */ + attempt?: number; - /** - * Date assessment was taken or graded - */ - date?: SCISO8601Date; + /** + * Date assessment was taken or graded + */ + date?: SCISO8601Date; - /** - * ECTS (credit-points) - * - * @float - */ - ects?: number; + /** + * ECTS (credit-points) + * + * @float + */ + ects?: number; - /** - * Grade - */ - grade: string; + /** + * Grade + */ + grade: string; - /** - * Current status - */ - status?: string; + /** + * Current status + */ + status?: string; - /** - * Translated fields of an assessment - */ - translations?: SCTranslations; + /** + * Translated fields of an assessment + */ + translations?: SCTranslations; - /** - * Type of an assessment - */ - type: SCThingType.Assessment; + /** + * Type of an assessment + */ + type: SCThingType.Assessment; } /** @@ -77,9 +85,9 @@ export interface SCAssessmentWithoutReferences * @validatable */ export interface SCAssessment - extends SCAssessmentWithoutReferences, SCThing, + extends SCAssessmentWithoutReferences, + SCThing, SCThingWithCategories { - /** * Course of study the assessment was taken for */ @@ -99,30 +107,28 @@ export interface SCAssessment * Type of an assessment */ type: SCThingType.Assessment; - } -export interface SCAssessmentTranslatableProperties - extends SCThingWithCategoriesTranslatableProperties { +export interface SCAssessmentTranslatableProperties extends SCThingWithCategoriesTranslatableProperties { /** * @see SCAssessmentWithoutReferences.status */ - status?: string; + status?: string; } /** * Study module meta data */ - export class SCAssessmentMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCAssessmentMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCAssessmentCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, attempt: 'Versuch', courseOfStudy: 'Studiengang', date: 'Datum', @@ -132,8 +138,10 @@ export interface SCAssessmentTranslatableProperties superAssessments: 'übergeordnete Prüfungen', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCAssessmentCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, attempt: 'attempt', courseOfStudy: 'course of study', date: 'date', @@ -149,13 +157,17 @@ export interface SCAssessmentTranslatableProperties */ fieldValueTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCAssessmentCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, type: 'Prüfung', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCAssessmentCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, type: SCThingType.Assessment, }, }; diff --git a/src/things/book.ts b/src/things/book.ts index 32f0aa6b..e1194359 100644 --- a/src/things/book.ts +++ b/src/things/book.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -20,7 +20,13 @@ import { SCCreativeWorkWithoutReferences, } from './abstract/creative-work'; import {SCThingMeta, SCThingType} from './abstract/thing'; -import {SCAcademicPriceGroup, SCThingThatCanBeOffered, SCThingThatCanBeOfferedMeta, SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedWithoutReferences} from './abstract/thing-that-can-be-offered'; +import { + SCAcademicPriceGroup, + SCThingThatCanBeOffered, + SCThingThatCanBeOfferedMeta, + SCThingThatCanBeOfferedTranslatableProperties, + SCThingThatCanBeOfferedWithoutReferences, +} from './abstract/thing-that-can-be-offered'; import { SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, @@ -31,7 +37,8 @@ import { /** * Categories of a book */ -export type SCBookCategories = 'audio' +export type SCBookCategories = + | 'audio' | 'book' | 'cd' | 'dvd' @@ -55,8 +62,8 @@ export type SCBookCategories = 'audio' */ export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences, - SCThingThatCanBeOfferedWithoutReferences, - SCThingWithCategoriesWithoutReferences { + SCThingThatCanBeOfferedWithoutReferences, + SCThingWithCategoriesWithoutReferences { /** * Categories of a book */ @@ -96,8 +103,8 @@ export interface SCBookWithoutReferences */ export interface SCBook extends SCCreativeWork, - SCThingThatCanBeOffered, - SCBookWithoutReferences { + SCThingThatCanBeOffered, + SCBookWithoutReferences { /** * Translated properties of a book */ @@ -114,9 +121,8 @@ export interface SCBook */ export interface SCBookTranslatableFields extends SCThingWithCategoriesTranslatableProperties, - SCThingThatCanBeOfferedTranslatableProperties, - SCCreativeWorkTranslatableProperties { -} + SCThingThatCanBeOfferedTranslatableProperties, + SCCreativeWorkTranslatableProperties {} /** * Meta information about a book @@ -128,8 +134,10 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCBookCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, categories: 'Format', ISBNs: 'ISBN', @@ -137,8 +145,10 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCBookCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, ...new SCThingThatCanBeOfferedMeta().fieldTranslations.en, categories: 'format', ISBNs: 'ISBN', @@ -151,12 +161,12 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations().fieldValueTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.de, + ...new SCCreativeWorkMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCBookCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.de, categories: { audio: 'Tonträger', book: 'Buch', @@ -180,12 +190,12 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations().fieldValueTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.en, + ...new SCCreativeWorkMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCBookCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.en, type: SCThingType.Book, categories: { audio: 'audio material', diff --git a/src/things/building.ts b/src/things/building.ts index 1680e815..120133a2 100644 --- a/src/things/building.ts +++ b/src/things/building.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -29,7 +29,7 @@ import { } from './abstract/thing-with-categories'; export type SCBuildingCategories = - 'cafe' + | 'cafe' | 'education' | 'library' | 'office' @@ -67,7 +67,8 @@ export interface SCBuildingWithoutReferences * @indexable */ export interface SCBuilding - extends SCBuildingWithoutReferences, SCPlace, + extends SCBuildingWithoutReferences, + SCPlace, SCThingWithCategories { /** * Translated fields of a building @@ -81,7 +82,8 @@ export interface SCBuilding } export interface SCBuildingTranslatableProperties - extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties { + extends SCPlaceWithoutReferencesTranslatableProperties, + SCThingWithCategoriesTranslatableProperties { /** * @see SCBuilding.floors */ @@ -91,22 +93,24 @@ export interface SCBuildingTranslatableProperties /** * Meta information about a place */ -export class SCBuildingMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCBuildingCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.de, floors: 'Etagen', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCBuildingCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.en, floors: 'floors', }, @@ -117,8 +121,10 @@ export class SCBuildingMeta */ fieldValueTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCBuildingCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, ...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de, categories: { 'cafe': 'Café', @@ -133,8 +139,10 @@ export class SCBuildingMeta type: 'Gebäude', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCBuildingCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, ...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en, type: SCThingType.Building, }, diff --git a/src/things/catalog.ts b/src/things/catalog.ts index 8a4a1046..ceb148ab 100644 --- a/src/things/catalog.ts +++ b/src/things/catalog.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -51,7 +51,8 @@ export interface SCCatalogWithoutReferences * @indexable */ export interface SCCatalog - extends SCCatalogWithoutReferences, SCThing, + extends SCCatalogWithoutReferences, + SCThing, SCThingWithCategories { /** * Academic term that a catalog belongs to (e.g. semester) @@ -82,23 +83,26 @@ export interface SCCatalog /** * Catalog meta data */ -export class SCCatalogMeta - extends SCThingMeta implements SCMetaTranslations { +export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCCatalogCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, academicTerm: 'Semester', level: 'Ebene', superCatalog: 'übergeordnetes Verzeichniss', superCatalogs: 'übergeordnete Verzeichnisse', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCCatalogCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, academicTerm: 'academic term', level: 'level', superCatalog: 'parent catalog', @@ -111,16 +115,20 @@ export class SCCatalogMeta */ fieldValueTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCCatalogCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, categories: { 'university events': 'Universitätsveranstaltung', }, type: 'Verzeichnis', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCCatalogCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, type: SCThingType.Catalog, }, }; diff --git a/src/things/contact-point.ts b/src/things/contact-point.ts index 8b014569..85f0a3b0 100644 --- a/src/things/contact-point.ts +++ b/src/things/contact-point.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -14,19 +14,13 @@ */ import {SCMetaTranslations} from '../general/i18n'; -import { - SCThing, - SCThingMeta, - SCThingType, - SCThingWithoutReferences, - } from './abstract/thing'; +import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing'; import {SCRoomWithoutReferences} from './room'; /** * A contact point without references */ -export interface SCContactPointWithoutReferences - extends SCThingWithoutReferences { +export interface SCContactPointWithoutReferences extends SCThingWithoutReferences { /** * E-mail at the work location * @@ -73,12 +67,10 @@ export interface SCContactPointWithoutReferences * A contact point * * @see http://schema.org/ContactPoint - * * @validatable * @indexable */ -export interface SCContactPoint - extends SCContactPointWithoutReferences, SCThing { +export interface SCContactPoint extends SCContactPointWithoutReferences, SCThing { /** * Exact place where work is performed */ @@ -93,9 +85,7 @@ export interface SCContactPoint /** * Meta information about a contact point */ -export class SCContactPointMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCContactPointMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/course-of-study.ts b/src/things/course-of-study.ts index f08a3396..489c38b7 100644 --- a/src/things/course-of-study.ts +++ b/src/things/course-of-study.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -13,7 +13,11 @@ * this program. If not, see . */ import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n'; -import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from './abstract/academic-degree'; +import { + SCAcademicDegree, + SCAcademicDegreeMeta, + SCAcademicDegreeWithoutReferences, +} from './abstract/academic-degree'; import {SCThingMeta, SCThingType} from './abstract/thing'; import { SCAcademicPriceGroup, @@ -29,7 +33,8 @@ import {SCOrganizationWithoutReferences} from './organization'; * A course of study without references */ export interface SCCourseOfStudyWithoutReferences - extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences { + extends SCAcademicDegreeWithoutReferences, + SCThingThatCanBeOfferedWithoutReferences { /** * The main language in which the course of study * is beeing offered @@ -68,7 +73,9 @@ export interface SCCourseOfStudyWithoutReferences * @indexable */ export interface SCCourseOfStudy - extends SCCourseOfStudyWithoutReferences, SCThingThatCanBeOffered, SCAcademicDegree { + extends SCCourseOfStudyWithoutReferences, + SCThingThatCanBeOffered, + SCAcademicDegree { /** * The department that manages the course of study */ @@ -99,26 +106,19 @@ export interface SCCourseOfStudy /** * Translatable properties of a course of study */ -export interface SCCourseOfStudyTranslatableProperties - extends SCThingThatCanBeOfferedTranslatableProperties { - // noop -} +export type SCCourseOfStudyTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties; /** * Meta information about a course of study */ -export class SCCourseOfStudyMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCCourseOfStudyMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCAcademicDegreeMeta() - .fieldTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldTranslations.de, + ...new SCAcademicDegreeMeta().fieldTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, department: 'Fachbereich', mainLanguage: 'Unterrichtssprache', mode: 'Studiengangsart', @@ -127,10 +127,8 @@ export class SCCourseOfStudyMeta timeMode: 'Zeitmodell', }, en: { - ...new SCAcademicDegreeMeta() - .fieldTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldTranslations.de, + ...new SCAcademicDegreeMeta().fieldTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, department: 'department', mainLanguage: 'main language', mode: 'mode', @@ -147,10 +145,10 @@ export class SCCourseOfStudyMeta de: { ...new SCAcademicDegreeMeta().fieldValueTranslations.de, modes: { - combination: 'Kombinationsstudiengang', + 'combination': 'Kombinationsstudiengang', 'double-degree': 'Doppelstudium', - dual: 'duales Studium', - standard: 'Studium', + 'dual': 'duales Studium', + 'standard': 'Studium', }, timeMode: { fulltime: 'Vollzeitstudiengang', @@ -161,10 +159,10 @@ export class SCCourseOfStudyMeta en: { ...new SCAcademicDegreeMeta().fieldValueTranslations.en, modes: { - combination: 'combination course of study', + 'combination': 'combination course of study', 'double-degree': 'double degree course of study', - dual: 'dual course of study', - standard: 'course of study', + 'dual': 'dual course of study', + 'standard': 'course of study', }, timeMode: { fulltime: 'full-time', @@ -178,13 +176,9 @@ export class SCCourseOfStudyMeta /** * Types of (german) course of study modes */ -export type SCCourseOfStudyMode = 'combination' - | 'dual' - | 'double-degree' - | 'standard' ; +export type SCCourseOfStudyMode = 'combination' | 'dual' | 'double-degree' | 'standard'; /** * Types of (german) course of study time modes */ -export type SCCourseOfStudyTimeMode = 'fulltime' - | 'parttime' ; +export type SCCourseOfStudyTimeMode = 'fulltime' | 'parttime'; diff --git a/src/things/date-series.ts b/src/things/date-series.ts index c2cbd637..dbd8f128 100644 --- a/src/things/date-series.ts +++ b/src/things/date-series.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -30,8 +30,7 @@ import {SCSportCourseWithoutReferences} from './sport-course'; /** * Price groups for sport courses */ -export interface SCSportCoursePriceGroup - extends SCAcademicPriceGroup { +export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup { /** * Price for alumnis * @@ -43,8 +42,7 @@ export interface SCSportCoursePriceGroup /** * A date without references */ -export interface SCDateSeriesWithoutReferences - extends SCThingThatCanBeOfferedWithoutReferences { +export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences { /** * Dates of the date series that are initially planned to be held * @@ -93,8 +91,7 @@ export interface SCDateSeries /** * Event to which the date series belongs */ - event: SCAcademicEventWithoutReferences - | SCSportCourseWithoutReferences; + event: SCAcademicEventWithoutReferences | SCSportCourseWithoutReferences; /** * Performers of the date series @@ -115,18 +112,14 @@ export interface SCDateSeries /** * Meta information about a date series */ -export class SCDateSeriesMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCThingInPlaceMeta().fieldTranslations - .de, - ...new SCThingThatCanBeOfferedMeta() - .fieldTranslations.de, + ...new SCThingInPlaceMeta().fieldTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, dates: 'Einzeltermine', duration: 'Dauer', event: 'Event', @@ -135,10 +128,8 @@ export class SCDateSeriesMeta performers: 'Vortragende', }, en: { - ...new SCThingInPlaceMeta().fieldTranslations - .en, - ...new SCThingThatCanBeOfferedMeta() - .fieldTranslations.en, + ...new SCThingInPlaceMeta().fieldTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldTranslations.en, dates: 'dates', duration: 'duration', event: 'event', @@ -153,17 +144,13 @@ export class SCDateSeriesMeta */ fieldValueTranslations = { de: { - ...new SCThingInPlaceMeta() - .fieldValueTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.de, + ...new SCThingInPlaceMeta().fieldValueTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.de, type: 'Terminserie', }, en: { - ...new SCThingInPlaceMeta() - .fieldValueTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.en, + ...new SCThingInPlaceMeta().fieldValueTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.en, type: SCThingType.DateSeries, }, }; @@ -172,6 +159,4 @@ export class SCDateSeriesMeta /** * Translatable properties of date series' */ -export interface SCDateSeriesTranslatableProperties - extends SCThingThatCanBeOfferedTranslatableProperties { -} +export type SCDateSeriesTranslatableProperties = SCThingThatCanBeOfferedTranslatableProperties; diff --git a/src/things/diff.ts b/src/things/diff.ts index 968f070b..6e147b9c 100644 --- a/src/things/diff.ts +++ b/src/things/diff.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -21,8 +21,7 @@ import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abs /** * A diff without references */ -export interface SCDiffWithoutReferences - extends SCThingWithoutReferences { +export interface SCDiffWithoutReferences extends SCThingWithoutReferences { /** * Action of the diff */ @@ -49,8 +48,7 @@ export interface SCDiffWithoutReferences * * @validatable */ -export interface SCDiff - extends SCDiffWithoutReferences, SCThing { +export interface SCDiff extends SCDiffWithoutReferences, SCThing { /** * Original object the diff was generated on */ @@ -65,9 +63,7 @@ export interface SCDiff /** * Meta information about a diff */ -export class SCDiffMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ @@ -95,8 +91,8 @@ export class SCDiffMeta de: { ...new SCThingMeta().fieldValueTranslations.de, action: { - 'changed': 'geändert', - 'removed': 'gelöscht', + changed: 'geändert', + removed: 'gelöscht', }, type: 'Unterschied', }, diff --git a/src/things/dish.ts b/src/things/dish.ts index b5a19a2d..c43b787f 100644 --- a/src/things/dish.ts +++ b/src/things/dish.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -71,7 +71,8 @@ export interface SCDishWithoutReferences * @indexable */ export interface SCDish - extends SCDishWithoutReferences, SCThingThatCanBeOffered, + extends SCDishWithoutReferences, + SCThingThatCanBeOffered, SCThingWithCategories { /** * Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish) @@ -90,7 +91,8 @@ export interface SCDish } export interface SCDishTranslatableProperties - extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties { + extends SCThingWithCategoriesTranslatableProperties, + SCThingThatCanBeOfferedTranslatableProperties { /** * Additives of the dish * @@ -127,13 +129,7 @@ export interface SCDishCharacteristic { /** * A list of categories for dishes */ -export type SCDishCategories = - | 'appetizer' - | 'salad' - | 'main dish' - | 'dessert' - | 'soup' - | 'side dish'; +export type SCDishCategories = 'appetizer' | 'salad' | 'main dish' | 'dessert' | 'soup' | 'side dish'; /** * Type definition for SCNutritionInformation @@ -194,28 +190,28 @@ export interface SCNutritionInformation { /** * Meta information about a dish */ -export class SCDishMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCDishMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCDishCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, additives: 'Zusatzstoffe', characteristics: 'Merkmale', dishAddOns: 'Beilagen', nutrition: 'Nährwertangaben', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCDishCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldTranslations.en, additives: 'additives', characteristics: 'characteristics', dishAddOns: 'side dishes', @@ -228,25 +224,27 @@ export class SCDishMeta */ fieldValueTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCDishCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.de, categories: { - appetizer: 'Vorspeise', - dessert: 'Nachtisch', + 'appetizer': 'Vorspeise', + 'dessert': 'Nachtisch', 'main dish': 'Hauptgericht', - salad: 'Salat', + 'salad': 'Salat', 'side dish': 'Beilage', - soup: 'Suppe', + 'soup': 'Suppe', }, type: 'Essen', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCDishCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.en, type: SCThingType.Dish, }, }; diff --git a/src/things/favorite.ts b/src/things/favorite.ts index ae38f5aa..df166378 100644 --- a/src/things/favorite.ts +++ b/src/things/favorite.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -18,8 +18,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing'; /** * A favorite without references */ -export interface SCFavoriteWithoutReferences - extends SCSaveableThingWithoutReferences { +export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutReferences { /** * Type of a favorite */ @@ -41,6 +40,4 @@ export interface SCFavorite extends SCSaveableThing { /** * Meta information about a favorite */ -export class SCFavoriteMeta - extends SCThingMeta { -} +export class SCFavoriteMeta extends SCThingMeta {} diff --git a/src/things/floor.ts b/src/things/floor.ts index 81d1a2c3..f3a34be6 100644 --- a/src/things/floor.ts +++ b/src/things/floor.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -12,10 +12,14 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -// tslint:disable-next-line:no-implicit-dependencies import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson'; import {SCMetaTranslations, SCTranslations} from '../general/i18n'; -import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './abstract/thing'; +import { + SCThingMeta, + SCThingTranslatableProperties, + SCThingType, + SCThingWithoutReferences, +} from './abstract/thing'; import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place'; import {SCPointOfInterestWithoutReferences} from './point-of-interest'; import {SCRoomWithoutReferences} from './room'; @@ -23,8 +27,7 @@ import {SCRoomWithoutReferences} from './room'; /** * A floor without references */ -export interface SCFloorWithoutReferences - extends SCThingWithoutReferences { +export interface SCFloorWithoutReferences extends SCThingWithoutReferences { /** * Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name. * @@ -54,8 +57,7 @@ export interface SCFloorWithoutReferences * @validatable * @indexable */ -export interface SCFloor - extends SCFloorWithoutReferences, SCThingInPlace { +export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace { /** * Translated fields of a floor */ @@ -70,8 +72,7 @@ export interface SCFloor /** * A feature collection */ -export interface SCFloorFeatureCollectionWithPlaces - extends FeatureCollection { +export interface SCFloorFeatureCollectionWithPlaces extends FeatureCollection { /** * Features of the collection */ @@ -82,7 +83,7 @@ export interface SCFloorFeatureCollectionWithPlaces * A feature with a place */ export interface SCFloorFeatureWithPlace - // tslint:disable-next-line:no-any TODO + // eslint-disable-next-line @typescript-eslint/no-explicit-any extends Feature { /** * The place of the feature @@ -93,8 +94,7 @@ export interface SCFloorFeatureWithPlace /** * Translatable properties of a floor */ -export interface SCFloorTranslatableProperties - extends SCThingTranslatableProperties { +export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties { /** * Translation of the floor name * @@ -106,22 +106,18 @@ export interface SCFloorTranslatableProperties /** * Meta information about floors */ -export class SCFloorMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCThingInPlaceMeta().fieldTranslations - .de, + ...new SCThingInPlaceMeta().fieldTranslations.de, floorName: 'Etagenbezeichnung', plan: 'Grundriss', }, en: { - ...new SCThingInPlaceMeta().fieldTranslations - .en, + ...new SCThingInPlaceMeta().fieldTranslations.en, floorName: 'floor name', plan: 'plan', }, @@ -132,13 +128,11 @@ export class SCFloorMeta */ fieldValueTranslations = { de: { - ...new SCThingInPlaceMeta() - .fieldValueTranslations.de, + ...new SCThingInPlaceMeta().fieldValueTranslations.de, type: 'Etage', }, en: { - ...new SCThingInPlaceMeta() - .fieldValueTranslations.en, + ...new SCThingInPlaceMeta().fieldValueTranslations.en, type: SCThingType.Floor, }, }; diff --git a/src/things/message.ts b/src/things/message.ts index 14f2bde7..345818ab 100644 --- a/src/things/message.ts +++ b/src/things/message.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -24,7 +24,8 @@ import {SCThingMeta, SCThingType} from './abstract/thing'; import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered'; import { SCThingWithCategoriesSpecificValues, - SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta, + SCThingWithCategoriesWithoutReferences, + SCThingWithCategoriesWithoutReferencesMeta, } from './abstract/thing-with-categories'; import {SCUserGroup} from './abstract/user-groups'; import {SCOrganizationWithoutReferences} from './organization'; @@ -39,7 +40,7 @@ export type SCMessageCategories = 'news'; */ export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferences, - SCThingWithCategoriesWithoutReferences { + SCThingWithCategoriesWithoutReferences { /** * Organizational unit for which the message is intended */ @@ -93,8 +94,7 @@ export interface SCMessageWithoutReferences * @validatable * @indexable */ -export interface SCMessage - extends SCCreativeWork, SCMessageWithoutReferences { +export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences { /** * Translated fields of a message */ @@ -110,7 +110,8 @@ export interface SCMessage * Translatable properties of a message */ export interface SCMessageTranslatableProperties - extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties { + extends SCCreativeWorkTranslatableProperties, + SCThingThatCanBeOfferedTranslatableProperties { /** * Message itself * @@ -122,17 +123,17 @@ export interface SCMessageTranslatableProperties /** * Meta information about messages */ -export class SCMessageMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { ...new SCCreativeWorkMeta().fieldTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCMessageCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, audienceOrganizations: 'Zielgruppenorganisationen', audiences: 'Zielgruppen', dateCreated: 'Erstellungsdatum', @@ -141,8 +142,10 @@ export class SCMessageMeta }, en: { ...new SCCreativeWorkMeta().fieldTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCMessageCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, audienceOrganizations: 'audience organizations', audiences: 'audiences', dateCreated: 'date created', @@ -157,8 +160,10 @@ export class SCMessageMeta fieldValueTranslations = { de: { ...new SCCreativeWorkMeta().fieldValueTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCMessageCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, audiences: { employees: 'Angestellte', guests: 'Gäste', @@ -171,8 +176,10 @@ export class SCMessageMeta }, en: { ...new SCCreativeWorkMeta().fieldValueTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCMessageCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, type: SCThingType.Message, }, }; diff --git a/src/things/organization.ts b/src/things/organization.ts index ce3c9a3e..6534d300 100644 --- a/src/things/organization.ts +++ b/src/things/organization.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -20,8 +20,7 @@ import {SCContactPointWithoutReferences} from './contact-point'; /** * An organization without references */ -export interface SCOrganizationWithoutReferences - extends SCThingWithoutReferences { +export interface SCOrganizationWithoutReferences extends SCThingWithoutReferences { /** * Type of an organization */ @@ -34,8 +33,7 @@ export interface SCOrganizationWithoutReferences * @validatable * @indexable */ -export interface SCOrganization - extends SCOrganizationWithoutReferences, SCThingInPlace { +export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace { /** * A list of contact points concerning the organization */ @@ -50,8 +48,7 @@ export interface SCOrganization /** * Meta information about an organization */ -export class SCOrganizationMeta - extends SCThingMeta implements SCMetaTranslations { +export class SCOrganizationMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/periodical.ts b/src/things/periodical.ts index 988a8afb..e96c3b89 100644 --- a/src/things/periodical.ts +++ b/src/things/periodical.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -20,7 +20,13 @@ import { SCCreativeWorkWithoutReferences, } from './abstract/creative-work'; import {SCThingMeta, SCThingType} from './abstract/thing'; -import {SCAcademicPriceGroup, SCThingThatCanBeOffered, SCThingThatCanBeOfferedMeta, SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedWithoutReferences} from './abstract/thing-that-can-be-offered'; +import { + SCAcademicPriceGroup, + SCThingThatCanBeOffered, + SCThingThatCanBeOfferedMeta, + SCThingThatCanBeOfferedTranslatableProperties, + SCThingThatCanBeOfferedWithoutReferences, +} from './abstract/thing-that-can-be-offered'; import { SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, @@ -38,8 +44,8 @@ export type SCPeriodicalCategories = 'journal' | 'electronic'; */ export interface SCPeriodicalWithoutReferences extends SCCreativeWorkWithoutReferences, - SCThingThatCanBeOfferedWithoutReferences, - SCThingWithCategoriesWithoutReferences { + SCThingThatCanBeOfferedWithoutReferences, + SCThingWithCategoriesWithoutReferences { /** * Categories of a periodical */ @@ -71,8 +77,8 @@ export interface SCPeriodicalWithoutReferences */ export interface SCPeriodical extends SCCreativeWork, - SCThingThatCanBeOffered, - SCPeriodicalWithoutReferences { + SCThingThatCanBeOffered, + SCPeriodicalWithoutReferences { /** * Translated properties of a periodical */ @@ -89,9 +95,8 @@ export interface SCPeriodical */ export interface SCPeriodicalTranslatableFields extends SCThingWithCategoriesTranslatableProperties, - SCThingThatCanBeOfferedTranslatableProperties, - SCCreativeWorkTranslatableProperties { -} + SCThingThatCanBeOfferedTranslatableProperties, + SCCreativeWorkTranslatableProperties {} /** * Meta information about a periodical @@ -103,16 +108,20 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations< fieldTranslations = { de: { ...new SCCreativeWorkMeta().fieldTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCPeriodicalCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, categories: 'Format', ISSNs: 'ISSN', }, en: { ...new SCCreativeWorkMeta().fieldTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCPeriodicalCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, ...new SCThingThatCanBeOfferedMeta().fieldTranslations.en, categories: 'format', ISSNs: 'ISSN', @@ -125,8 +134,10 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations< fieldValueTranslations = { de: { ...new SCCreativeWorkMeta().fieldValueTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCPeriodicalCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.de, type: 'Periodikum', categories: { @@ -136,8 +147,10 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations< }, en: { ...new SCCreativeWorkMeta().fieldValueTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCPeriodicalCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.en, type: 'periodical', categories: { diff --git a/src/things/person.ts b/src/things/person.ts index 1b1e60b6..ecd4fc94 100644 --- a/src/things/person.ts +++ b/src/things/person.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -24,8 +24,7 @@ import {SCRoomWithoutReferences} from './room'; /** * A person without references */ -export interface SCPersonWithoutReferences - extends SCThingWithoutReferences { +export interface SCPersonWithoutReferences extends SCThingWithoutReferences { /** * Additional first names of the person. * @@ -45,7 +44,6 @@ export interface SCPersonWithoutReferences * The private email address of the person. * * @TJS-format email - * * @filterable * @keyword */ @@ -138,8 +136,7 @@ export interface SCPersonWithoutReferences * @validatable * @indexable */ -export interface SCPerson - extends SCPersonWithoutReferences, SCThing { +export interface SCPerson extends SCPersonWithoutReferences, SCThing { /** * Organization the person works for */ @@ -148,9 +145,9 @@ export interface SCPerson /** * A list of homes of the person */ - homeLocations?: Array; + homeLocations?: Array< + SCBuildingWithoutReferences | SCPointOfInterestWithoutReferences | SCRoomWithoutReferences + >; /** * Type of a person @@ -166,9 +163,7 @@ export interface SCPerson /** * Meta information about a person */ -export class SCPersonMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ @@ -219,10 +214,10 @@ export class SCPersonMeta de: { ...new SCThingMeta().fieldValueTranslations.de, gender: { - 'female': 'weiblich', - 'inter': 'divers', - 'male': 'männlich', - 'undefined': 'undefiniert', + female: 'weiblich', + inter: 'divers', + male: 'männlich', + undefined: 'undefiniert', }, type: 'Person', }, @@ -236,8 +231,4 @@ export class SCPersonMeta /** * Gender of a person */ -export type SCPersonGender = - 'male' - | 'female' - | 'inter' - | 'undefined'; +export type SCPersonGender = 'male' | 'female' | 'inter' | 'undefined'; diff --git a/src/things/point-of-interest.ts b/src/things/point-of-interest.ts index c479de53..64cd504e 100644 --- a/src/things/point-of-interest.ts +++ b/src/things/point-of-interest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -28,7 +28,10 @@ import { * A point of interest without references */ export interface SCPointOfInterestWithoutReferences - extends SCThingWithCategoriesWithoutReferences, + extends SCThingWithCategoriesWithoutReferences< + SCPointOfInterestCategories, + SCThingWithCategoriesSpecificValues + >, SCPlaceWithoutReferences { /** * Translated properties of a point of interest @@ -48,7 +51,9 @@ export interface SCPointOfInterestWithoutReferences * @indexable */ export interface SCPointOfInterest - extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace, + extends SCPointOfInterestWithoutReferences, + SCThingInPlace, + SCPlace, SCThingWithCategories { /** * Translated properties of a point of interest @@ -65,7 +70,7 @@ export interface SCPointOfInterest * Categories of a point of interest */ export type SCPointOfInterestCategories = - 'computer' + | 'computer' | 'validator' | 'card charger' | 'printer' @@ -74,26 +79,26 @@ export type SCPointOfInterestCategories = /** * Meta information about points of interest */ -export class SCPointOfInterestMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCPointOfInterestCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.de, - ...new SCThingInPlaceMeta().fieldTranslations - .de, + ...new SCThingInPlaceMeta().fieldTranslations.de, }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCPointOfInterestCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.en, - ...new SCThingInPlaceMeta().fieldTranslations - .en, + ...new SCThingInPlaceMeta().fieldTranslations.en, }, }; @@ -102,8 +107,10 @@ export class SCPointOfInterestMeta */ fieldValueTranslations = { de: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCPointOfInterestCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, ...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de, categories: { 'card charger': 'Kartenaufwerter', @@ -115,8 +122,10 @@ export class SCPointOfInterestMeta type: 'Sonderziel', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCPointOfInterestCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, ...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en, type: SCThingType.PointOfInterest, }, diff --git a/src/things/publication-event.ts b/src/things/publication-event.ts index b793b5a6..347fc8a9 100644 --- a/src/things/publication-event.ts +++ b/src/things/publication-event.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 StApps + * Copyright (C) 2021-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -19,8 +19,7 @@ import {SCThingMeta, SCThingTranslatableProperties, SCThingType} from './abstrac /** * An publication event without references */ -export interface SCPublicationEventWithoutReferences - extends SCEventWithoutReferences { +export interface SCPublicationEventWithoutReferences extends SCEventWithoutReferences { /** * All the locations related to the event (e.g. where a creative work was published) */ @@ -48,8 +47,7 @@ export interface SCPublicationEventWithoutReferences * @validatable * @indexable */ -export interface SCPublicationEvent - extends SCEvent, SCPublicationEventWithoutReferences { +export interface SCPublicationEvent extends SCEvent, SCPublicationEventWithoutReferences { /** * Translated fields of an publication event */ @@ -64,15 +62,12 @@ export interface SCPublicationEvent /** * Translatable properties of an publication event */ -export interface SCPublicationEventTranslatableProperties extends SCThingTranslatableProperties { -} +export type SCPublicationEventTranslatableProperties = SCThingTranslatableProperties; /** * Meta information about publication events */ -export class SCPublicationEventMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCPublicationEventMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/room.ts b/src/things/room.ts index a73774a3..18fba5ae 100644 --- a/src/things/room.ts +++ b/src/things/room.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -35,7 +35,7 @@ import { * Categories of a room */ export type SCRoomCategories = - 'cafe' + | 'cafe' | 'canteen' | 'computer' | 'education' @@ -53,7 +53,8 @@ export type SCRoomCategories = * A room without references */ export interface SCRoomWithoutReferences - extends SCPlaceWithoutReferences, SCThingThatAcceptsPaymentsWithoutReferences, + extends SCPlaceWithoutReferences, + SCThingThatAcceptsPaymentsWithoutReferences, SCThingWithCategoriesWithoutReferences { /** * The name of the floor in which the room is in. @@ -88,7 +89,10 @@ export interface SCRoomWithoutReferences * @indexable */ export interface SCRoom - extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace, + extends SCRoomWithoutReferences, + SCThingInPlace, + SCThingThatAcceptsPayments, + SCPlace, SCThingWithCategories { /** * Translations of specific values of the object @@ -106,8 +110,7 @@ export interface SCRoom /** * Category specific values of a room */ -export interface SCRoomSpecificValues - extends SCThingWithCategoriesSpecificValues { +export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues { /** * Category specific opening hours of the room * @@ -119,32 +122,26 @@ export interface SCRoomSpecificValues /** * Meta information about a place */ -export class SCRoomMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { ...new SCPlaceWithoutReferencesMeta().fieldTranslations.de, - ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta() + ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta() .fieldTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de, - ...new SCThingInPlaceMeta().fieldTranslations - .de, + ...new SCThingInPlaceMeta().fieldTranslations.de, floorName: 'Etagenbezeichnung', inventory: 'Bestand', }, en: { ...new SCPlaceWithoutReferencesMeta().fieldTranslations.en, - ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta() + ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta() .fieldTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, - ...new SCThingInPlaceMeta().fieldTranslations - .en, + ...new SCThingInPlaceMeta().fieldTranslations.en, floorName: 'floor name', inventory: 'inventory', }, @@ -156,12 +153,10 @@ export class SCRoomMeta fieldValueTranslations = { de: { ...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de, - ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta() - .fieldValueTranslations.de, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de, - ...new SCThingInPlaceMeta() + ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta() .fieldValueTranslations.de, + ...new SCThingInPlaceMeta().fieldValueTranslations.de, categories: { 'cafe': 'Café', 'canteen': 'Kantine', @@ -181,12 +176,10 @@ export class SCRoomMeta }, en: { ...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.en, - ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta() - .fieldValueTranslations.en, - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, - ...new SCThingInPlaceMeta() + ...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta() .fieldValueTranslations.en, + ...new SCThingInPlaceMeta().fieldValueTranslations.en, type: SCThingType.Room, }, }; diff --git a/src/things/semester.ts b/src/things/semester.ts index 03ce97ff..64a4cc8f 100644 --- a/src/things/semester.ts +++ b/src/things/semester.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -23,8 +23,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing'; /** * A semester without references */ -export interface SCSemesterWithoutReferences - extends SCAcademicTermWithoutReferences { +export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences { /** * The short name of the semester, using the given pattern. * @@ -46,8 +45,7 @@ export interface SCSemesterWithoutReferences * @validatable * @indexable */ -export interface SCSemester - extends SCSemesterWithoutReferences, SCAcademicTerm { +export interface SCSemester extends SCSemesterWithoutReferences, SCAcademicTerm { /** * Type of the semester */ @@ -57,9 +55,7 @@ export interface SCSemester /** * Meta information about a semester */ -export class SCSemesterMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ @@ -87,13 +83,11 @@ export class SCSemesterMeta */ fieldValueTranslations = { de: { - ...new SCAcademicTermWithoutReferencesMeta() - .fieldValueTranslations.de, + ...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.de, type: 'Semester', }, en: { - ...new SCAcademicTermWithoutReferencesMeta() - .fieldValueTranslations.en, + ...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.en, type: SCThingType.Semester, }, }; diff --git a/src/things/setting.ts b/src/things/setting.ts index 462e9705..837de9b8 100644 --- a/src/things/setting.ts +++ b/src/things/setting.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -63,11 +63,7 @@ export interface SCSettingWithoutReferences /** * A list of categories for settings */ -export type SCSettingCategories = - 'profile' - | 'privacy' - | 'credentials' - | 'others'; +export type SCSettingCategories = 'profile' | 'privacy' | 'credentials' | 'others'; /** * The types of input/value a setting object can carry @@ -86,7 +82,8 @@ export enum SCSettingInputType { * @validatable */ export interface SCSetting - extends SCSettingWithoutReferences, SCThing, + extends SCSettingWithoutReferences, + SCThing, SCThingWithCategories { /** * Translated fields of a setting @@ -129,8 +126,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCSettingCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.de, defaultValue: 'Standard Wert', inputType: 'Eingabetyp', order: 'Position', @@ -138,8 +137,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCSettingCategories, + SCThingWithCategoriesSpecificValues + >().fieldTranslations.en, defaultValue: 'default value', inputType: 'input type', order: 'position', @@ -153,8 +154,10 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCSettingCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.de, categories: { credentials: 'Anmeldedaten', others: 'Andere', @@ -163,16 +166,18 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta< + SCSettingCategories, + SCThingWithCategoriesSpecificValues + >().fieldValueTranslations.en, type: SCThingType.Setting, }, }; diff --git a/src/things/sport-course.ts b/src/things/sport-course.ts index 714f1759..644aebc0 100644 --- a/src/things/sport-course.ts +++ b/src/things/sport-course.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -19,8 +19,7 @@ import {SCThingMeta, SCThingType} from './abstract/thing'; /** * A sport course without references */ -export interface SCSportCourseWithoutReferences - extends SCEventWithoutReferences { +export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences { /** * Type of a sport course */ @@ -33,8 +32,7 @@ export interface SCSportCourseWithoutReferences * @validatable * @indexable */ -export interface SCSportCourse - extends SCEvent, SCSportCourseWithoutReferences { +export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences { /** * Type of a sport course */ @@ -44,9 +42,7 @@ export interface SCSportCourse /** * Meta information about a sport course */ -export class SCSportCourseMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ diff --git a/src/things/study-module.ts b/src/things/study-module.ts index 170d8229..4576f098 100644 --- a/src/things/study-module.ts +++ b/src/things/study-module.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -29,9 +29,7 @@ import {SCPersonWithoutReferences} from './person'; /** * A study module without references */ -export interface SCStudyModuleWithoutReferences - extends SCThingThatCanBeOfferedWithoutReferences { - +export interface SCStudyModuleWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences { /** * ECTS points (European Credit Transfer System) * @@ -75,7 +73,8 @@ export interface SCStudyModuleWithoutReferences * @indexable */ export interface SCStudyModule - extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered { + extends SCStudyModuleWithoutReferences, + SCThingThatCanBeOffered { /** * Academic events that make up a study module */ @@ -113,8 +112,7 @@ export interface SCStudyModule type: SCThingType.StudyModule; } -export interface SCStudyModuleTranslatableProperties - extends SCThingThatCanBeOfferedTranslatableProperties { +export interface SCStudyModuleTranslatableProperties extends SCThingThatCanBeOfferedTranslatableProperties { /** * Translations of the majors that this study module is meant for * @@ -142,17 +140,14 @@ export enum SCStudyModuleNecessity { /** * Study module meta data */ -export class SCStudyModuleMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { ...new SCThingMeta().fieldTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, academicEvents: 'Veranstaltungen', ects: 'ECTS-Punkte', faculty: 'Fachbereich', @@ -165,8 +160,7 @@ export class SCStudyModuleMeta }, en: { ...new SCThingMeta().fieldTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldTranslations.en, academicEvents: 'academic events', ects: 'ECTS points', faculty: 'faculty', @@ -185,19 +179,17 @@ export class SCStudyModuleMeta fieldValueTranslations = { de: { ...new SCThingMeta().fieldValueTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.de, necessity: { - 'elective': 'Wahlfach', - 'optional': 'optional', - 'required': 'benötigt', + elective: 'Wahlfach', + optional: 'optional', + required: 'benötigt', }, type: 'Studiengangmodul', }, en: { ...new SCThingMeta().fieldValueTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.en, type: SCThingType.StudyModule, }, }; diff --git a/src/things/ticket.ts b/src/things/ticket.ts index 469419cb..7d17a733 100644 --- a/src/things/ticket.ts +++ b/src/things/ticket.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -20,8 +20,7 @@ import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place'; /** * A ticket without references */ -export interface SCTicketWithoutReferences - extends SCThingWithoutReferences { +export interface SCTicketWithoutReferences extends SCThingWithoutReferences { /** * Approximate wait time */ @@ -51,8 +50,7 @@ export interface SCTicketWithoutReferences * @validatable * @indexable */ -export interface SCTicket - extends SCTicketWithoutReferences, SCThingInPlace { +export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace { /** * Type of a ticket */ @@ -62,23 +60,19 @@ export interface SCTicket /** * Meta information about a ticket */ -export class SCTicketMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCThingInPlaceMeta().fieldTranslations - .de, + ...new SCThingInPlaceMeta().fieldTranslations.de, approxWaitingTime: 'ungefähre Wartezeit', currentTicketNumber: 'aktuelle Ticketnummer', serviceType: 'Service Kategorie', }, en: { - ...new SCThingInPlaceMeta().fieldTranslations - .en, + ...new SCThingInPlaceMeta().fieldTranslations.en, approxWaitingTime: 'approximate waiting time', currentTicketNumber: 'current ticket number', serviceType: 'type of service', @@ -90,13 +84,11 @@ export class SCTicketMeta */ fieldValueTranslations = { de: { - ...new SCThingInPlaceMeta() - .fieldValueTranslations.de, + ...new SCThingInPlaceMeta().fieldValueTranslations.de, type: 'Ticket', }, en: { - ...new SCThingInPlaceMeta() - .fieldValueTranslations.en, + ...new SCThingInPlaceMeta().fieldValueTranslations.en, type: SCThingType.Ticket, }, }; diff --git a/src/things/todo.ts b/src/things/todo.ts index e5701eb6..bc01354e 100644 --- a/src/things/todo.ts +++ b/src/things/todo.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -58,7 +58,9 @@ export interface SCToDoWithoutReferences * @indexable */ export interface SCToDo - extends SCToDoWithoutReferences, SCThing, SCThingWithCategories { + extends SCToDoWithoutReferences, + SCThing, + SCThingWithCategories { /** * Translated fields of a thing with categories */ @@ -88,15 +90,15 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations().fieldTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta() + .fieldTranslations.de, done: 'Erledigt', dueDate: 'Fälligkeitsdatum', priority: 'Priorität', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta() + .fieldTranslations.en, done: 'done', dueDate: 'due date', priority: 'priority', @@ -108,13 +110,13 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations().fieldValueTranslations.de, + ...new SCThingWithCategoriesWithoutReferencesMeta() + .fieldValueTranslations.de, type: 'ToDo', }, en: { - ...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.en, + ...new SCThingWithCategoriesWithoutReferencesMeta() + .fieldValueTranslations.en, type: SCThingType.ToDo, }, }; diff --git a/src/things/tour.ts b/src/things/tour.ts index ade8929a..85348c43 100644 --- a/src/things/tour.ts +++ b/src/things/tour.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -18,8 +18,7 @@ import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abs /** * A tour without references */ -export interface SCTourWithoutReferences - extends SCThingWithoutReferences { +export interface SCTourWithoutReferences extends SCThingWithoutReferences { /** * Init script for the tour * @@ -46,8 +45,7 @@ export interface SCTourWithoutReferences * @validatable * @indexable */ -export interface SCTour - extends SCTourWithoutReferences, SCThing { +export interface SCTour extends SCTourWithoutReferences, SCThing { /** * Type of a tour */ @@ -57,9 +55,7 @@ export interface SCTour /** * Meta information about a tour */ -export class SCTourMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCTourMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ @@ -94,10 +90,7 @@ export class SCTourMeta /** * A step in a tour */ -export type SCTourStep = - SCTourStepMenu - | SCTourStepLocation - | SCTourStepTooltip; +export type SCTourStep = SCTourStepMenu | SCTourStepLocation | SCTourStepTooltip; /** * A location of a tour step diff --git a/src/things/video.ts b/src/things/video.ts index 082865c3..560e0f67 100644 --- a/src/things/video.ts +++ b/src/things/video.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -14,9 +14,20 @@ */ import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n'; import {SCISO8601Duration} from '../general/time'; -import {SCCreativeWork, SCCreativeWorkMeta, SCCreativeWorkTranslatableProperties, SCCreativeWorkWithoutReferences} from './abstract/creative-work'; +import { + SCCreativeWork, + SCCreativeWorkMeta, + SCCreativeWorkTranslatableProperties, + SCCreativeWorkWithoutReferences, +} from './abstract/creative-work'; import {SCThingMeta, SCThingType} from './abstract/thing'; -import {SCAcademicPriceGroup, SCThingThatCanBeOffered, SCThingThatCanBeOfferedMeta, SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedWithoutReferences} from './abstract/thing-that-can-be-offered'; +import { + SCAcademicPriceGroup, + SCThingThatCanBeOffered, + SCThingThatCanBeOfferedMeta, + SCThingThatCanBeOfferedTranslatableProperties, + SCThingThatCanBeOfferedWithoutReferences, +} from './abstract/thing-that-can-be-offered'; import {SCPersonWithoutReferences} from './person'; /** @@ -24,7 +35,7 @@ import {SCPersonWithoutReferences} from './person'; */ export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReferences, - SCThingThatCanBeOfferedWithoutReferences { + SCThingThatCanBeOfferedWithoutReferences { /** * The Duration of the Video */ @@ -131,8 +142,8 @@ export interface SCVideoTrack { */ export interface SCVideo extends SCCreativeWork, - SCThingThatCanBeOffered, - SCVideoWithoutReferences { + SCThingThatCanBeOffered, + SCVideoWithoutReferences { /** * Persons acting in the Video */ @@ -153,24 +164,19 @@ export interface SCVideo * Translatable properties of a video */ export interface SCVideoTranslatableFields -extends SCCreativeWorkTranslatableProperties, - SCThingThatCanBeOfferedTranslatableProperties { -} - + extends SCCreativeWorkTranslatableProperties, + SCThingThatCanBeOfferedTranslatableProperties {} /** * Meta information about a video */ -export class SCVideoMeta - extends SCThingMeta - implements SCMetaTranslations { +export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations { /** * Translations of fields */ fieldTranslations = { de: { - ...new SCCreativeWorkMeta().fieldTranslations - .de, + ...new SCCreativeWorkMeta().fieldTranslations.de, ...new SCThingThatCanBeOfferedMeta().fieldTranslations.de, actors: 'Darsteller', duration: 'Dauer', @@ -180,8 +186,7 @@ export class SCVideoMeta transcript: 'Transkript', }, en: { - ...new SCCreativeWorkMeta().fieldTranslations - .en, + ...new SCCreativeWorkMeta().fieldTranslations.en, ...new SCThingThatCanBeOfferedMeta().fieldTranslations.en, actors: 'actors', duration: 'duration', @@ -197,17 +202,13 @@ export class SCVideoMeta */ fieldValueTranslations = { de: { - ...new SCCreativeWorkMeta() - .fieldValueTranslations.de, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.de, + ...new SCCreativeWorkMeta().fieldValueTranslations.de, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.de, type: 'Video', }, en: { - ...new SCCreativeWorkMeta() - .fieldValueTranslations.en, - ...new SCThingThatCanBeOfferedMeta() - .fieldValueTranslations.en, + ...new SCCreativeWorkMeta().fieldValueTranslations.en, + ...new SCThingThatCanBeOfferedMeta().fieldValueTranslations.en, type: SCThingType.Video, }, }; @@ -217,7 +218,7 @@ export class SCVideoMeta * Video Encoding Formats */ export type SCVideoMimeType = - 'video/mp4' + | 'video/mp4' | 'video/ogg' | 'video/webm' | 'application/vnd.apple.mpegurl' @@ -226,9 +227,4 @@ export type SCVideoMimeType = /** * Video Track Types */ -export type SCVideoTrackTypes = - 'closed captions' - | 'chapters' - | 'description' - | 'metadata' - | 'subtitles'; +export type SCVideoTrackTypes = 'closed captions' | 'chapters' | 'description' | 'metadata' | 'subtitles'; diff --git a/src/translator.ts b/src/translator.ts index 727f7920..8e708b18 100644 --- a/src/translator.ts +++ b/src/translator.ts @@ -1,5 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ /* - * Copyright (C) 2019 StApps + * Copyright (C) 2019-2022 Open StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -20,14 +21,13 @@ import {isThing} from './guards'; import {SCClasses} from './meta'; import {SCThing, SCThingType} from './things/abstract/thing'; -// tslint:disable:no-any +// eslint disable @typescript-eslint/no-explicit-any const standardCacheSize = 200; /** * SCThingTranslator class */ export class SCThingTranslator { - /** * Getter for language property */ @@ -92,15 +92,14 @@ export class SCThingTranslator { * @param data The intermediate object / primitive returned by the Proxys get() method * @returns an TSOCType object allowing for access to translations or a translated value(s) */ - // tslint:disable-next-line:prefer-function-over-method private deeptranslate(data?: T): TSOCType { const proxy = new Proxy( - ((defaultValue?: Defined) => (data == null ? defaultValue : data)) as TSOCType, + ((defaultValue?: Defined) => (data == undefined ? defaultValue : data)) as TSOCType, { get: (target, key) => { - const obj: any = target(); + const object: any = target(); - return this.deeptranslate(obj[key]); + return this.deeptranslate(object[key]); }, }, ); @@ -115,8 +114,7 @@ export class SCThingTranslator { * @param language The language the thing property values are translated to * @returns The thing with all known meta values translated */ - private getAllMetaFieldTranslations(thingType: SCThingType, - language: SCLanguageCode): object | undefined { + private getAllMetaFieldTranslations(thingType: SCThingType, language: SCLanguageCode): object | undefined { const fieldTranslations = {}; const metaClass = this.getMetaClassInstance(thingType); if (typeof metaClass === 'undefined') { @@ -125,18 +123,16 @@ export class SCThingTranslator { // Assigns every property in fieldTranslations to the known base language translation if (typeof metaClass.fieldTranslations.en !== 'undefined') { - Object.keys(metaClass.fieldTranslations.en) - .forEach((key) => { - (fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key]; - }); + for (const key of Object.keys(metaClass.fieldTranslations.en)) { + (fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key]; + } } // Assigns every property in fieldTranslations to the known translation in given language if (typeof metaClass.fieldTranslations[language] !== 'undefined') { - Object.keys(metaClass.fieldTranslations[language]) - .forEach((key) => { - (fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key]; - }); + for (const key of Object.keys(metaClass.fieldTranslations[language])) { + (fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key]; + } } return fieldTranslations; @@ -164,32 +160,33 @@ export class SCThingTranslator { * @param language The language the thing / object is translated to * @returns The thing with translated meta field values */ - private replaceAvailableMetaFieldValueTranslations(instance: any, - language: SCLanguageCode): any { + private replaceAvailableMetaFieldValueTranslations(instance: any, language: SCLanguageCode): any { const metaClass = this.getMetaClassInstance(instance.type); if (typeof metaClass === 'undefined') { return instance; } if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') { - Object.keys(metaClass.fieldValueTranslations[language]) - .forEach((key) => { - if (metaClass.fieldValueTranslations[language][key] instanceof Object - && (instance as any)[key] instanceof Object) { - // Assigns known translations of subproperties to property in given language (e.g. categories) - Object.keys((instance as any)[key]) - .forEach((subKey) => { - (instance as any)[key][subKey] = - metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]]; - }); - } else if (metaClass.fieldValueTranslations[language][key] instanceof Object - && typeof (instance as any)[key] === 'string') { - // Assigns known translations of enum to property in given language (e.g. SCSettingInputType) - (instance as any)[key] = metaClass.fieldValueTranslations[language][key][(instance as any)[key]]; - } else { - // Assigns property to known translation of fieldValueTranslations in given language - (instance as any)[key] = metaClass.fieldValueTranslations[language][key]; + for (const key of Object.keys(metaClass.fieldValueTranslations[language])) { + if ( + metaClass.fieldValueTranslations[language][key] instanceof Object && + (instance as any)[key] instanceof Object + ) { + // Assigns known translations of subproperties to property in given language (e.g. categories) + for (const subKey of Object.keys((instance as any)[key])) { + (instance as any)[key][subKey] = + metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]]; } - }); + } else if ( + metaClass.fieldValueTranslations[language][key] instanceof Object && + typeof (instance as any)[key] === 'string' + ) { + // Assigns known translations of enum to property in given language (e.g. SCSettingInputType) + (instance as any)[key] = metaClass.fieldValueTranslations[language][key][(instance as any)[key]]; + } else { + // Assigns property to known translation of fieldValueTranslations in given language + (instance as any)[key] = metaClass.fieldValueTranslations[language][key]; + } + } } return instance; @@ -207,15 +204,15 @@ export class SCThingTranslator { let nextInstance = instance as any; // Recursively call this function on all nested SCThings, arrays and objects - Object.keys(nextInstance) - .forEach((key) => { - if ( - isThing(nextInstance[key]) || - nextInstance[key] instanceof Array || - nextInstance[key] instanceof Object) { - nextInstance[key] = this.translateThingInPlaceDestructively(nextInstance[key]); - } - }); + for (const key of Object.keys(nextInstance)) { + if ( + isThing(nextInstance[key]) || + Array.isArray(nextInstance[key]) || + nextInstance[key] instanceof Object + ) { + nextInstance[key] = this.translateThingInPlaceDestructively(nextInstance[key]); + } + } // Spread variable translations given by the connector into thing if (typeof nextInstance.translations?.[targetLanguage] !== 'undefined') { @@ -231,7 +228,7 @@ export class SCThingTranslator { * Recursively translates the given object in-place * Translated values overwrite current values (destructive) * - * @param instance The thing / object that will be translated + * @param thing The thing / object that will be translated * @returns The thing translated */ public translate(thing: T): T { @@ -251,6 +248,7 @@ export class SCThingTranslator { /** * Get field value translation recursively + * * @example * const dish: SCDish = {...}; * translator.translate(dish).offers[0].inPlace.categories[1]()); @@ -264,21 +262,21 @@ export class SCThingTranslator { */ public translatedAccess(thing: T): TSOCType { return new Proxy( - ((defaultValue?: Defined) => (thing == null ? defaultValue : thing)) as TSOCType, + ((defaultValue?: Defined) => (thing == undefined ? defaultValue : thing)) as TSOCType, { get: (target, key) => { - const obj: any = target(); + const object: any = target(); if (equal(this.sourceCache.get(thing), thing)) { - const objTranslatedFromCache = this.cache.get(thing); - if (typeof objTranslatedFromCache !== 'undefined') { - return this.deeptranslate((objTranslatedFromCache as any)[key]); + const objectTranslatedFromCache = this.cache.get(thing); + if (typeof objectTranslatedFromCache !== 'undefined') { + return this.deeptranslate((objectTranslatedFromCache as any)[key]); } } - const objTranslated = this.translateThingInPlaceDestructively(clone()(obj)); - this.cache.putObject(objTranslated); + const objectTranslated = this.translateThingInPlaceDestructively(clone()(object)); + this.cache.putObject(objectTranslated); this.sourceCache.putObject(thing); - return this.deeptranslate(objTranslated[key]); + return this.deeptranslate(objectTranslated[key]); }, }, ); @@ -287,6 +285,7 @@ export class SCThingTranslator { /** * Given a SCThingType this function returns an object with the same basic structure as the corresponding SCThing * All the values will be set to the known translations of the property/key name + * * @example * const translatedMetaDish = translator.translatedPropertyNames(SCThingType.CourseOfStudy); * @param type The type whose property names will be translated @@ -299,6 +298,7 @@ export class SCThingTranslator { /** * Given a SCThingType and a corresponding property name it returns the known property value translation * Access pattern to the meta object containing the translation can be thought of as type.field[key] with key being optional + * * @example * const singleValueTranslation = translator.translatedPropertyValue(SCThingType.Dish, 'categories', 'main dish'); * @param type The type for whose property values a translation is required @@ -306,11 +306,10 @@ export class SCThingTranslator { * @param key If specified tries to access the field with this key * @returns Known translation for the property */ - public translatedPropertyValue(type: SCThingType, - field: string, - key?: string): string | undefined { - const fieldValueTranslations = this.getMetaClassInstance(type).fieldValueTranslations[this.language] ?? - this.getMetaClassInstance(type).fieldValueTranslations.en; + public translatedPropertyValue(type: SCThingType, field: string, key?: string): string | undefined { + const fieldValueTranslations = + this.getMetaClassInstance(type).fieldValueTranslations[this.language] ?? + this.getMetaClassInstance(type).fieldValueTranslations.en; const fieldTranslation = fieldValueTranslations?.[field]; return fieldTranslation?.[key ?? ''] ?? key ?? fieldTranslation; @@ -393,8 +392,7 @@ class LRUCache { public put(key: string, content: T) { if (this.entries.size >= this.maxEntries) { // LRU behavior - const keyToDelete = this.entries.keys() - .next().value; + const keyToDelete = this.entries.keys().next().value; this.entries.delete(keyToDelete); } this.entries.set(key, content); @@ -406,6 +404,6 @@ class LRUCache { * @param something The object that should be cached under something.uid */ public putObject(something: U) { - this.put(something.uid, (something as any) as T); + this.put(something.uid, something as any as T); } } diff --git a/test/features.spec.ts b/test/features.spec.ts index d7ffcd33..30a6748b 100644 --- a/test/features.spec.ts +++ b/test/features.spec.ts @@ -47,7 +47,6 @@ describe('Features', () => { referenceName: 'SCDiff', }); - // tslint:disable-next-line:no-unused-expression expect(thingsReflection.type?.specificationTypes?.every(it => typeof it.referenceName !== 'undefined')).to.be.true; thingNames = thingsReflection.type?.specificationTypes?.map(type => type.referenceName!) ?? []; things = thingNames diff --git a/test/translator.spec.ts b/test/translator.spec.ts index df2c2d45..ad9c6ca2 100644 --- a/test/translator.spec.ts +++ b/test/translator.spec.ts @@ -112,7 +112,6 @@ const translatorWithFallback = new SCThingTranslator('tt'); const translatedThingDE = translator.translate(dish); const translatedThingFallback = translatorWithFallback.translate(dish); -// tslint:disable:max-line-length member-ordering newline-per-chained-call prefer-function-over-method completed-docs TranslationSpecInplace @suite(timeout(10000), slow(5000)) export class TranslationSpecInplace { @test @@ -244,7 +243,6 @@ export class TranslationSpecInplace { @test public directStringLiteralTypeUndefined() { - // tslint:disable-next-line:no-eval const undefinedThing = eval('(x) => undefined;'); expect(translator.translatedAccess(undefinedThing())('defaultValue')).to.equal('defaultValue'); expect(translator.translatedAccess(dish).name('defaultValue')).to.not.equal('defaultValue'); @@ -252,9 +250,7 @@ export class TranslationSpecInplace { @test public nestedMetaArrayOfStringSubscriptUndefined() { - // tslint:disable-next-line: no-eval const workingTranslation = eval('translator.translatedAccess(dish).offers[0].inPlace.categories[1](\'printer\');'); - // tslint:disable-next-line: no-eval const defaultValueTranslation = eval('translator.translatedAccess(dish).offers[0].inPlace.categories[1234](\'printer\');'); expect(defaultValueTranslation).to.equal('printer'); @@ -295,7 +291,6 @@ export class TranslationSpecInplace { } } -// tslint:disable:member-ordering no-eval no-unused-expression TranslationSpec @suite(timeout(10000), slow(5000)) export class MetaTranslationSpec { diff --git a/test/type.spec.ts b/test/type.spec.ts index 459f2647..deaa31a8 100644 --- a/test/type.spec.ts +++ b/test/type.spec.ts @@ -43,9 +43,6 @@ import {SCVideo, SCVideoWithoutReferences} from '../src/things/video'; import {SCPeriodical, SCPeriodicalWithoutReferences} from '../src/things/periodical'; import {SCPublicationEvent, SCPublicationEventWithoutReferences} from '../src/things/publication-event'; -// tslint:disable:no-any -// tslint:disable:completed-docs - /** * Check if E extends T */ diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 6af73026..00000000 --- a/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./node_modules/@openstapps/configuration/tslint.json", - "rules": { - "no-empty-interface": false, - "no-redundant-jsdoc": false - } -}