mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a84d12f26 | ||
|
|
b621a12689 | ||
|
|
6ffa4efbaf | ||
|
|
e41169a9c7 | ||
|
|
46194b177b | ||
|
|
ff1f554e0b | ||
|
|
9c424b0f96 | ||
|
|
55b5248660 |
@@ -50,6 +50,21 @@ test:
|
|||||||
- report
|
- report
|
||||||
- coverage
|
- coverage
|
||||||
|
|
||||||
|
package:
|
||||||
|
dependencies:
|
||||||
|
- build
|
||||||
|
tags:
|
||||||
|
- secrecy
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
|
||||||
|
- npm publish
|
||||||
|
only:
|
||||||
|
- /^v[0-9]+.[0-9]+.[0-9]+$/
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- lib
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
|
|||||||
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,3 +1,13 @@
|
|||||||
|
# [0.20.0](https://gitlab.com/openstapps/core/compare/v0.19.0...v0.20.0) (2019-06-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add translations for every SCThing ([f847a2a](https://gitlab.com/openstapps/core/commit/f847a2a))
|
||||||
|
* rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64ba))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.19.0](https://gitlab.com/openstapps/core/compare/v0.18.0...v0.19.0) (2019-05-17)
|
# [0.19.0](https://gitlab.com/openstapps/core/compare/v0.18.0...v0.19.0) (2019-05-17)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -29,3 +29,21 @@ To generate a documentation for the routes use the following command.
|
|||||||
```shell
|
```shell
|
||||||
node --require ts-node/register src/cli.ts routes PATH/TO/ROUTES.md
|
node --require ts-node/register src/cli.ts routes PATH/TO/ROUTES.md
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Annotations
|
||||||
|
|
||||||
|
Annotations are used to add additional informations to fields, which are used to autogenerate mappings from the core objects.
|
||||||
|
External dependencies can not be covered by the annotations. Documentation about some of the annotations can be found in: [typedoc](https://typedoc.org/guides/doccomments/)
|
||||||
|
|
||||||
|
| annotation | description | parameters |
|
||||||
|
|-------------------|-------------------------------------------|---------------|
|
||||||
|
| `@aggregatable` | used for generating of aggregations of the field if the core schema is used to put data into a database/key-value store | |
|
||||||
|
| `@float` | number field is interpreted as float | |
|
||||||
|
| `@indexable` | marks the type as indexable if the core schema is used to put data into a database/key-value store| |
|
||||||
|
| `@integer` | number field is interpreted as integer | |
|
||||||
|
| `@keyword` | string field is interpreted as keyword | |
|
||||||
|
| `@sortable` | field is sortable if the core schema is used to put data into a database/key-value store | sort method to be used: ducet, price, distance |
|
||||||
|
| `@text` | string field is interpreted as text | |
|
||||||
|
| `@validatable` | marks the type as validatable if the core schema is used to put data into a database/key-value store | |
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
201
package-lock.json
generated
201
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@openstapps/core",
|
"name": "@openstapps/core",
|
||||||
"version": "0.20.0",
|
"version": "0.21.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -81,9 +81,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/runtime": {
|
"@babel/runtime": {
|
||||||
"version": "7.4.4",
|
"version": "7.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz",
|
||||||
"integrity": "sha512-w0+uT71b6Yi7i5SE0co4NioIpSYS6lLiXvCzWzGSKvpK5vdQtCbICHMj+gbAKAOtxiV6HsVh/MBdaF9EQ6faSg==",
|
"integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"regenerator-runtime": "^0.13.2"
|
"regenerator-runtime": "^0.13.2"
|
||||||
@@ -146,27 +146,62 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@openstapps/configuration": {
|
"@openstapps/configuration": {
|
||||||
"version": "0.14.0",
|
"version": "0.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.18.0.tgz",
|
||||||
"integrity": "sha512-0eiupryX/yOD76Q/aNgY//0uoJ0v2OEGRunqQjfAXW5humTRH2wUKv89IdqbhqV+w2At0Qlg0xd8SvfSNL43JQ==",
|
"integrity": "sha512-Ufi3jzCozVqCymNeaeRzuOHO2Yd5qXJ10uF4xNHk6Q4LFD9NAMMBkYbawkjmecZoNR+Llqs4AnwSxIkuEAxcxA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "10.14.4",
|
"@types/node": "10.14.7",
|
||||||
"@types/semver": "6.0.0",
|
"@types/semver": "6.0.0",
|
||||||
"@types/yaml": "1.0.2",
|
"@types/yaml": "1.0.2",
|
||||||
"chalk": "2.4.2",
|
"chalk": "2.4.2",
|
||||||
"commander": "2.20.0",
|
"commander": "2.20.0",
|
||||||
"semver": "6.0.0",
|
"semver": "6.1.0",
|
||||||
"tslint": "5.16.0",
|
"tslint": "5.16.0",
|
||||||
"tslint-eslint-rules": "5.4.0",
|
"tslint-eslint-rules": "5.4.0",
|
||||||
"yaml": "1.5.0"
|
"yaml": "1.6.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "10.14.4",
|
"version": "10.14.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.7.tgz",
|
||||||
"integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==",
|
"integrity": "sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"semver": {
|
||||||
|
"version": "6.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.1.0.tgz",
|
||||||
|
"integrity": "sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"tslint": {
|
||||||
|
"version": "5.16.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz",
|
||||||
|
"integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/code-frame": "^7.0.0",
|
||||||
|
"builtin-modules": "^1.1.1",
|
||||||
|
"chalk": "^2.3.0",
|
||||||
|
"commander": "^2.12.1",
|
||||||
|
"diff": "^3.2.0",
|
||||||
|
"glob": "^7.1.1",
|
||||||
|
"js-yaml": "^3.13.0",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"resolve": "^1.3.2",
|
||||||
|
"semver": "^5.3.0",
|
||||||
|
"tslib": "^1.8.0",
|
||||||
|
"tsutils": "^2.29.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"semver": {
|
||||||
|
"version": "5.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
||||||
|
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -241,26 +276,45 @@
|
|||||||
"once": "^1.3.0",
|
"once": "^1.3.0",
|
||||||
"path-is-absolute": "^1.0.0"
|
"path-is-absolute": "^1.0.0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"ts-node": {
|
||||||
|
"version": "8.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.1.0.tgz",
|
||||||
|
"integrity": "sha512-34jpuOrxDuf+O6iW1JpgTRDFynUZ1iEqtYruBqh35gICNjN8x+LpVcPAcwzLPi9VU6mdA3ym+x233nZmZp445A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"arg": "^4.1.0",
|
||||||
|
"diff": "^3.1.0",
|
||||||
|
"make-error": "^1.1.1",
|
||||||
|
"source-map-support": "^0.5.6",
|
||||||
|
"yn": "^3.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@openstapps/logger": {
|
"@openstapps/logger": {
|
||||||
"version": "0.1.0",
|
"version": "0.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-0.2.1.tgz",
|
||||||
"integrity": "sha512-5z7Yf3WrzayEVNPp1TBoGiCVgPlQtqzOFh0yQ06gac/vFedWLPLBmENGDdRoEKar8bXzghkxDLy6Rvj/8HEQaQ==",
|
"integrity": "sha512-6+F1nxEBuNTrd3hhBxKnvkH8B84HvB/dVmoMP9Pmv2g3mL3pYJ9l2BBGaACDRA7oUCyLpbNQw+4Kf+VdyzOttw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "10.14.6",
|
"@types/node": "10.14.7",
|
||||||
"@types/nodemailer": "4.6.8",
|
"@types/nodemailer": "6.1.0",
|
||||||
"chalk": "2.4.2",
|
"chalk": "2.4.2",
|
||||||
"flatted": "2.0.0",
|
"flatted": "2.0.0",
|
||||||
"nodemailer": "6.1.1"
|
"nodemailer": "6.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/node": {
|
||||||
|
"version": "10.14.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.7.tgz",
|
||||||
|
"integrity": "sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/nodemailer": {
|
"@types/nodemailer": {
|
||||||
"version": "4.6.8",
|
"version": "6.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-4.6.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.1.0.tgz",
|
||||||
"integrity": "sha512-IX1P3bxDP1VIdZf6/kIWYNmSejkYm9MOyMEtoDFi4DVzKjJ3kY4GhOcOAKs6lZRjqVVmF9UjPOZXuQczlpZThw==",
|
"integrity": "sha512-WysSJ4sGW2Aum1Cs6HFosZdlR3WUzX0XoSLsI53q77gLd4wDfE84OXffZu5/nLIjeKh4SwfTsdrKsgBL9WowMA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
@@ -368,9 +422,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "10.14.6",
|
"version": "10.14.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.8.tgz",
|
||||||
"integrity": "sha512-Fvm24+u85lGmV4hT5G++aht2C5I4Z4dYlWZIh62FAfFO/TfzXtPpoLI6I7AuBWkIFqZCnhFOoTT7RjjaIL5Fjg=="
|
"integrity": "sha512-I4+DbJEhLEg4/vIy/2gkWDvXBOOtPKV9EnLhYjMoqxcRW+TTZtUftkHktz/a8suoD5mUL7m6ReLrkPvSsCQQmw=="
|
||||||
},
|
},
|
||||||
"@types/nodemailer": {
|
"@types/nodemailer": {
|
||||||
"version": "4.6.5",
|
"version": "4.6.5",
|
||||||
@@ -692,6 +746,12 @@
|
|||||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"conditional-type-checks": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/conditional-type-checks/-/conditional-type-checks-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-+O/IE/QGjXzdk4ttJFLRQm8pofQE0KZZmgcamquUGhHfaZt0UTZMlklqW0J9tWO8HQvC70cPahEAVMwSfeqtuQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"conventional-changelog": {
|
"conventional-changelog": {
|
||||||
"version": "3.1.8",
|
"version": "3.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.8.tgz",
|
||||||
@@ -836,9 +896,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"conventional-changelog-writer": {
|
"conventional-changelog-writer": {
|
||||||
"version": "4.0.5",
|
"version": "4.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.6.tgz",
|
||||||
"integrity": "sha512-g/Myp4MaJ1A+f7Ai+SnVhkcWtaHk6flw0SYN7A+vQ+MTu0+gSovQWs4Pg4NtcNUcIztYQ9YHsoxHP+GGQplI7Q==",
|
"integrity": "sha512-ou/sbrplJMM6KQpR5rKFYNVQYesFjN7WpNGdudQSWNi6X+RgyFUcSv871YBYkrUYV9EX8ijMohYVzn9RUb+4ag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"compare-func": "^1.3.1",
|
"compare-func": "^1.3.1",
|
||||||
@@ -848,17 +908,9 @@
|
|||||||
"json-stringify-safe": "^5.0.1",
|
"json-stringify-safe": "^5.0.1",
|
||||||
"lodash": "^4.2.1",
|
"lodash": "^4.2.1",
|
||||||
"meow": "^4.0.0",
|
"meow": "^4.0.0",
|
||||||
"semver": "^5.5.0",
|
"semver": "^6.0.0",
|
||||||
"split": "^1.0.0",
|
"split": "^1.0.0",
|
||||||
"through2": "^3.0.0"
|
"through2": "^3.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"semver": {
|
|
||||||
"version": "5.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
|
||||||
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conventional-commits-filter": {
|
"conventional-commits-filter": {
|
||||||
@@ -872,13 +924,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conventional-commits-parser": {
|
"conventional-commits-parser": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.0.3.tgz",
|
||||||
"integrity": "sha512-y5eqgaKR0F6xsBNVSQ/5cI5qIF3MojddSUi1vKIggRkqUTbkqFKH9P5YX/AT1BVZp9DtSzBTIkvjyVLotLsVog==",
|
"integrity": "sha512-KaA/2EeUkO4bKjinNfGUyqPTX/6w9JGshuQRik4r/wJz7rUw3+D3fDG6sZSEqJvKILzKXFQuFkpPLclcsAuZcg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"JSONStream": "^1.0.4",
|
"JSONStream": "^1.0.4",
|
||||||
"is-text-path": "^1.0.0",
|
"is-text-path": "^2.0.0",
|
||||||
"lodash": "^4.2.1",
|
"lodash": "^4.2.1",
|
||||||
"meow": "^4.0.0",
|
"meow": "^4.0.0",
|
||||||
"split2": "^2.0.0",
|
"split2": "^2.0.0",
|
||||||
@@ -1729,6 +1781,11 @@
|
|||||||
"integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
|
"integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"http-status-codes": {
|
||||||
|
"version": "1.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-1.3.2.tgz",
|
||||||
|
"integrity": "sha512-nDUtj0ltIt08tGi2VWSpSzNNFye0v3YSe9lX3lIqLTuVvvRiYCvs4QQBSHo0eomFYw1wlUuofurUAlTm+vHnXg=="
|
||||||
|
},
|
||||||
"humanize-string": {
|
"humanize-string": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/humanize-string/-/humanize-string-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/humanize-string/-/humanize-string-2.1.0.tgz",
|
||||||
@@ -1884,12 +1941,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is-text-path": {
|
"is-text-path": {
|
||||||
"version": "1.0.1",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz",
|
||||||
"integrity": "sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=",
|
"integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"text-extensions": "^1.0.0"
|
"text-extensions": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is-utf8": {
|
"is-utf8": {
|
||||||
@@ -3490,9 +3547,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"text-extensions": {
|
"text-extensions": {
|
||||||
"version": "1.9.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.0.0.tgz",
|
||||||
"integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==",
|
"integrity": "sha512-F91ZqLgvi1E0PdvmxMgp+gcf6q8fMH7mhdwWfzXnl1k+GbpQDmi8l7DzLC5JTASKbwpY3TfxajAUzAXcv2NmsQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"through": {
|
"through": {
|
||||||
@@ -3561,16 +3618,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ts-node": {
|
"ts-node": {
|
||||||
"version": "8.1.0",
|
"version": "8.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.2.0.tgz",
|
||||||
"integrity": "sha512-34jpuOrxDuf+O6iW1JpgTRDFynUZ1iEqtYruBqh35gICNjN8x+LpVcPAcwzLPi9VU6mdA3ym+x233nZmZp445A==",
|
"integrity": "sha512-m8XQwUurkbYqXrKqr3WHCW310utRNvV5OnRVeISeea7LoCWVcdfeB/Ntl8JYWFh+WRoUAdBgESrzKochQt7sMw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"arg": "^4.1.0",
|
"arg": "^4.1.0",
|
||||||
"diff": "^3.1.0",
|
"diff": "^4.0.1",
|
||||||
"make-error": "^1.1.1",
|
"make-error": "^1.1.1",
|
||||||
"source-map-support": "^0.5.6",
|
"source-map-support": "^0.5.6",
|
||||||
"yn": "^3.0.0"
|
"yn": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"diff": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ts-optchain": {
|
"ts-optchain": {
|
||||||
@@ -3585,9 +3650,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tslint": {
|
"tslint": {
|
||||||
"version": "5.16.0",
|
"version": "5.17.0",
|
||||||
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.17.0.tgz",
|
||||||
"integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==",
|
"integrity": "sha512-pflx87WfVoYepTet3xLfDOLDm9Jqi61UXIKePOuca0qoAZyrGWonDG9VTbji58Fy+8gciUn8Bt7y69+KEVjc/w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
@@ -3596,7 +3661,7 @@
|
|||||||
"commander": "^2.12.1",
|
"commander": "^2.12.1",
|
||||||
"diff": "^3.2.0",
|
"diff": "^3.2.0",
|
||||||
"glob": "^7.1.1",
|
"glob": "^7.1.1",
|
||||||
"js-yaml": "^3.13.0",
|
"js-yaml": "^3.13.1",
|
||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.4",
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"resolve": "^1.3.2",
|
"resolve": "^1.3.2",
|
||||||
@@ -3631,9 +3696,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tsutils": {
|
"tsutils": {
|
||||||
"version": "3.10.0",
|
"version": "3.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.13.0.tgz",
|
||||||
"integrity": "sha512-q20XSMq7jutbGB8luhKKsQldRKWvyBO2BGqni3p4yq8Ys9bEP/xQw3KepKmMRt9gJ4lvQSScrihJrcKdKoSU7Q==",
|
"integrity": "sha512-wRtEjVU8Su72sDIDoqno5Scwt8x4eaF0teKO3m4hu8K1QFPnIZMM88CLafs2tapUeWnY9SwwO3bWeOt2uauBcg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.8.1"
|
"tslib": "^1.8.1"
|
||||||
@@ -3696,15 +3761,15 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.4.5",
|
"version": "3.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.1.tgz",
|
||||||
"integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==",
|
"integrity": "sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
"version": "3.5.12",
|
"version": "3.5.14",
|
||||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.12.tgz",
|
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.14.tgz",
|
||||||
"integrity": "sha512-KeQesOpPiZNgVwJj8Ge3P4JYbQHUdZzpx6Fahy6eKAYRSV4zhVmLXoC+JtOeYxcHCHTve8RG1ZGdTvpeOUM26Q==",
|
"integrity": "sha512-dgyjIw8KFK6AyVl5vm2tEqPewv5TKGEiiVFLI1LbF+oHua/Njd8tZk3lIbF1AWU1rNdEg7scaceADb4zqCcWXg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -3868,12 +3933,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yaml": {
|
"yaml": {
|
||||||
"version": "1.5.0",
|
"version": "1.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.6.0.tgz",
|
||||||
"integrity": "sha512-nKxSWOa7vxAP2pikrGxbkZsG/garQseRiLn9mIDjzwoQsyVy7ZWIpLoARejnINGGLA4fttuzRFFNxxbsztdJgw==",
|
"integrity": "sha512-iZfse3lwrJRoSlfs/9KQ9iIXxs9++RvBFVzAqbbBiFT+giYtyanevreF9r61ZTbGMgWQBxAua3FzJiniiJXWWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.4.3"
|
"@babel/runtime": "^7.4.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
|
|||||||
27
package.json
27
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@openstapps/core",
|
"name": "@openstapps/core",
|
||||||
"version": "0.20.0",
|
"version": "0.21.0",
|
||||||
"description": "StAppsCore - Generalized model of data",
|
"description": "StAppsCore - Generalized model of data",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Model",
|
"Model",
|
||||||
@@ -20,10 +20,13 @@
|
|||||||
"compile": "rimraf lib && tsc",
|
"compile": "rimraf lib && tsc",
|
||||||
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
|
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
|
||||||
"pack": "openstapps-core-tools pack",
|
"pack": "openstapps-core-tools pack",
|
||||||
|
"postversion": "npm run changelog",
|
||||||
"prepublishOnly": "npm ci && npm run build",
|
"prepublishOnly": "npm ci && npm run build",
|
||||||
|
"preversion": "npm run prepublishOnly",
|
||||||
|
"push": "git push && git push origin \"v$npm_package_version\"",
|
||||||
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src/core lib/schema",
|
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src/core lib/schema",
|
||||||
"test": "nyc mocha --require ts-node/register --require source-map-support/register --ui mocha-typescript test/*.spec.ts",
|
"test": "nyc mocha --require ts-node/register --require source-map-support/register --ui mocha-typescript test/*.spec.ts",
|
||||||
"tslint": "tslint 'src/**/*.ts'"
|
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
|
||||||
},
|
},
|
||||||
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@@ -39,31 +42,33 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/geojson": "1.0.6",
|
"@types/geojson": "1.0.6",
|
||||||
"@types/json-patch": "0.0.30",
|
"@types/json-patch": "0.0.30",
|
||||||
"@types/node": "10.14.6",
|
"@types/node": "10.14.8",
|
||||||
"fast-clone": "1.5.13",
|
"fast-clone": "1.5.13",
|
||||||
|
"http-status-codes": "1.3.2",
|
||||||
"json-patch": "0.7.0",
|
"json-patch": "0.7.0",
|
||||||
"jsonschema": "1.2.4",
|
"jsonschema": "1.2.4",
|
||||||
"ts-optchain": "0.1.3"
|
"ts-optchain": "0.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@krlwlfrt/async-pool": "0.1.0",
|
"@krlwlfrt/async-pool": "0.1.0",
|
||||||
"@openstapps/configuration": "0.14.0",
|
"@openstapps/configuration": "0.18.0",
|
||||||
"@openstapps/core-tools": "0.6.0",
|
"@openstapps/core-tools": "0.6.0",
|
||||||
"@openstapps/logger": "0.1.0",
|
"@openstapps/logger": "0.2.1",
|
||||||
"@types/chai": "4.1.7",
|
"@types/chai": "4.1.7",
|
||||||
"@types/rimraf": "2.0.2",
|
"@types/rimraf": "2.0.2",
|
||||||
"chai": "4.2.0",
|
"chai": "4.2.0",
|
||||||
"commander": "2.20.0",
|
"commander": "2.20.0",
|
||||||
|
"conditional-type-checks": "1.0.1",
|
||||||
"conventional-changelog-cli": "2.0.21",
|
"conventional-changelog-cli": "2.0.21",
|
||||||
"mocha": "6.1.4",
|
"mocha": "6.1.4",
|
||||||
"mocha-typescript": "1.1.17",
|
"mocha-typescript": "1.1.17",
|
||||||
"nyc": "14.1.1",
|
"nyc": "14.1.1",
|
||||||
"rimraf": "2.6.3",
|
"rimraf": "2.6.3",
|
||||||
"source-map-support": "0.5.12",
|
"source-map-support": "0.5.12",
|
||||||
"ts-node": "8.1.0",
|
"ts-node": "8.2.0",
|
||||||
"tslint": "5.16.0",
|
"tslint": "5.17.0",
|
||||||
"typedoc": "0.14.2",
|
"typedoc": "0.14.2",
|
||||||
"typescript": "3.4.5"
|
"typescript": "3.5.1"
|
||||||
},
|
},
|
||||||
"nyc": {
|
"nyc": {
|
||||||
"check-coverage": true,
|
"check-coverage": true,
|
||||||
@@ -75,7 +80,8 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"src/core/Route.ts",
|
"src/core/Route.ts",
|
||||||
"src/core/Thing.ts",
|
"src/core/Thing.ts",
|
||||||
"src/core/Translator.ts"
|
"src/core/Translator.ts",
|
||||||
|
"src/core/types/Guards.ts"
|
||||||
],
|
],
|
||||||
"exclude": [],
|
"exclude": [],
|
||||||
"extension": [
|
"extension": [
|
||||||
@@ -89,6 +95,9 @@
|
|||||||
},
|
},
|
||||||
"openstappsConfiguration": {
|
"openstappsConfiguration": {
|
||||||
"hasCli": false,
|
"hasCli": false,
|
||||||
|
"ignoreCiEntries": [
|
||||||
|
"build"
|
||||||
|
],
|
||||||
"standardBuild": false,
|
"standardBuild": false,
|
||||||
"standardDocumentation": false
|
"standardDocumentation": false
|
||||||
}
|
}
|
||||||
|
|||||||
100109
reflection.json
100109
reflection.json
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@ import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/Video';
|
|||||||
/**
|
/**
|
||||||
* A map of things, from type to meta data
|
* A map of things, from type to meta data
|
||||||
*/
|
*/
|
||||||
export const SCClasses: { [K in SCThingType]: any } = {
|
export const SCClasses: { [K in SCThingType]: object } = {
|
||||||
/* tslint:enable */
|
/* tslint:enable */
|
||||||
'academic event': SCAcademicEventMeta,
|
'academic event': SCAcademicEventMeta,
|
||||||
'article': SCArticleMeta,
|
'article': SCArticleMeta,
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ export enum SCRouteHttpVerbs {
|
|||||||
/**
|
/**
|
||||||
* The constructor of an error response
|
* The constructor of an error response
|
||||||
*/
|
*/
|
||||||
export type SCErrorResponseConstructor = new (...args: any) => SCErrorResponse;
|
// tslint:disable-next-line:no-any
|
||||||
|
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A description of a route
|
* A description of a route
|
||||||
@@ -94,19 +95,41 @@ export interface SCRoute {
|
|||||||
* An abstract route
|
* An abstract route
|
||||||
*/
|
*/
|
||||||
export abstract class SCAbstractRoute implements SCRoute {
|
export abstract class SCAbstractRoute implements SCRoute {
|
||||||
|
/**
|
||||||
|
* @see SCRoute.errorNames
|
||||||
|
*/
|
||||||
errorNames: SCErrorResponseConstructor[] = [];
|
errorNames: SCErrorResponseConstructor[] = [];
|
||||||
|
/**
|
||||||
|
* @see SCRoute.method
|
||||||
|
*/
|
||||||
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
|
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
|
||||||
|
/**
|
||||||
|
* @see SCRoute.obligatoryParameters
|
||||||
|
*/
|
||||||
obligatoryParameters?: SCMap<string>;
|
obligatoryParameters?: SCMap<string>;
|
||||||
|
/**
|
||||||
|
* @see SCRoute.requestBodyName
|
||||||
|
*/
|
||||||
requestBodyName = 'any';
|
requestBodyName = 'any';
|
||||||
|
/**
|
||||||
|
* @see SCRoute.responseBodyName
|
||||||
|
*/
|
||||||
responseBodyName = 'any';
|
responseBodyName = 'any';
|
||||||
|
/**
|
||||||
|
* @see SCRoute.statusCodeSuccess
|
||||||
|
*/
|
||||||
statusCodeSuccess = 200;
|
statusCodeSuccess = 200;
|
||||||
|
/**
|
||||||
|
* @see SCRoute.urlFragment
|
||||||
|
*/
|
||||||
urlFragment = '/';
|
urlFragment = '/';
|
||||||
|
|
||||||
public getUrlFragment(parameters?: SCMap<string>): string {
|
/**
|
||||||
if (typeof parameters === 'undefined') {
|
* Get "compiled" URL fragment
|
||||||
parameters = {};
|
*
|
||||||
}
|
* @param parameters Parameters to compile URL fragment with
|
||||||
|
*/
|
||||||
|
public getUrlFragment(parameters: SCMap<string> = {}): string {
|
||||||
let obligatoryParameters: string[] = [];
|
let obligatoryParameters: string[] = [];
|
||||||
|
|
||||||
if (typeof this.obligatoryParameters === 'object') {
|
if (typeof this.obligatoryParameters === 'object') {
|
||||||
@@ -126,14 +149,13 @@ export abstract class SCAbstractRoute implements SCRoute {
|
|||||||
|
|
||||||
const parameter = part.substr(1);
|
const parameter = part.substr(1);
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
if (typeof parameters[parameter] === 'undefined') {
|
if (typeof parameters[parameter] === 'undefined') {
|
||||||
throw new Error(`Parameter '${parameter}' not provided.`);
|
throw new Error(`Parameter '${parameter}' not provided.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
return parameters[parameter];
|
return parameters[parameter];
|
||||||
}).join('/');
|
})
|
||||||
|
.join('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,22 +54,29 @@ export enum SCThingType {
|
|||||||
export interface SCThingWithoutReferences {
|
export interface SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Alternate names of the thing
|
* Alternate names of the thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
alternateNames?: string[];
|
alternateNames?: string[];
|
||||||
/**
|
/**
|
||||||
* Description of the thing
|
* Description of the thing
|
||||||
*
|
*
|
||||||
* @minLength 1
|
* @minLength 1
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
description?: string;
|
description?: string;
|
||||||
/**
|
/**
|
||||||
* URL of an image of the thing
|
* URL of an image of the thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
image?: string;
|
image?: string;
|
||||||
/**
|
/**
|
||||||
* Name of the thing
|
* Name of the thing
|
||||||
*
|
*
|
||||||
* @minLength 1
|
* @minLength 1
|
||||||
|
* @sortable ducet
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
/**
|
/**
|
||||||
@@ -80,6 +87,9 @@ export interface SCThingWithoutReferences {
|
|||||||
translations?: SCTranslations<SCThingTranslatableProperties>;
|
translations?: SCTranslations<SCThingTranslatableProperties>;
|
||||||
/**
|
/**
|
||||||
* Type of the thing
|
* Type of the thing
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
|
* @aggregatable
|
||||||
*/
|
*/
|
||||||
type: SCThingType;
|
type: SCThingType;
|
||||||
/**
|
/**
|
||||||
@@ -143,6 +153,8 @@ export interface SCThingRemoteOrigin extends SCThingOrigin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the origin
|
* Name of the origin
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@@ -200,10 +212,14 @@ export interface SCThingUserOrigin extends SCThingOrigin {
|
|||||||
export interface SCThingTranslatableProperties {
|
export interface SCThingTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of the description of the thing
|
* Translation of the description of the thing
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
description?: string;
|
description?: string;
|
||||||
/**
|
/**
|
||||||
* Translation of the name of the thing
|
* Translation of the name of the thing
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name?: string;
|
name?: string;
|
||||||
/**
|
/**
|
||||||
@@ -218,6 +234,8 @@ export interface SCThingTranslatableProperties {
|
|||||||
export interface SCThingTranslatablePropertyOrigin {
|
export interface SCThingTranslatablePropertyOrigin {
|
||||||
/**
|
/**
|
||||||
* Translation of the name of the origin
|
* Translation of the name of the origin
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
@@ -271,14 +289,16 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// tslint:disable:static-this
|
||||||
/**
|
/**
|
||||||
* Function to retrieve typed singleton instance
|
* Function to retrieve typed singleton instance
|
||||||
*/
|
*/
|
||||||
public static getInstance<T extends SCThingMeta>(): T {
|
public static getInstance<T extends SCThingMeta>(): T {
|
||||||
if (!this._instance.has(this.name)) {
|
if (!SCThingMeta._instance.has(this.name)) {
|
||||||
this._instance.set(this.name, new this());
|
SCThingMeta._instance.set(this.name, new this());
|
||||||
}
|
}
|
||||||
return this._instance.get(this.name) as T;
|
|
||||||
|
return SCThingMeta._instance.get(this.name) as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected constructor() {
|
protected constructor() {
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ import {SCTranslations} from './types/i18n';
|
|||||||
import clone = require('fast-clone');
|
import clone = require('fast-clone');
|
||||||
import {Defined, OCType} from 'ts-optchain';
|
import {Defined, OCType} from 'ts-optchain';
|
||||||
|
|
||||||
|
// tslint:disable:no-any
|
||||||
|
const standardCacheSize = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SCThingTranslator class
|
* SCThingTranslator class
|
||||||
*/
|
*/
|
||||||
@@ -35,20 +38,19 @@ export class SCThingTranslator {
|
|||||||
* Property representing the translators base language
|
* Property representing the translators base language
|
||||||
* This means every translation is given for this language
|
* This means every translation is given for this language
|
||||||
*/
|
*/
|
||||||
private cache: LRUCache<SCThing>;
|
private readonly cache: LRUCache<SCThing>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property providing a mapping from a SCThingType to its known own meta class
|
* Property providing a mapping from a SCThingType to its known own meta class
|
||||||
*/
|
*/
|
||||||
private metaClasses: typeof SCClasses;
|
private readonly metaClasses: typeof SCClasses;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
|
||||||
* @example
|
* @example
|
||||||
* // returns translator instance for german
|
* // returns translator instance for german
|
||||||
* new SCThingTranslator('de');
|
* new SCThingTranslator('de');
|
||||||
*/
|
*/
|
||||||
constructor(language: keyof SCTranslations<SCThing>, cacheCapacity: number = 200) {
|
constructor(language: keyof SCTranslations<SCThing>, cacheCapacity: number = standardCacheSize) {
|
||||||
this.cache = new LRUCache(cacheCapacity);
|
this.cache = new LRUCache(cacheCapacity);
|
||||||
this._language = language;
|
this._language = language;
|
||||||
this.metaClasses = SCClasses;
|
this.metaClasses = SCClasses;
|
||||||
@@ -79,16 +81,19 @@ export class SCThingTranslator {
|
|||||||
* @param data The intermediate object / primitive returned by the Proxys get() method
|
* @param data The intermediate object / primitive returned by the Proxys get() method
|
||||||
* @returns an OCType<T> object allowing for access to translations or a translated value(s)
|
* @returns an OCType<T> object allowing for access to translations or a translated value(s)
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:prefer-function-over-method
|
||||||
private deeptranslate<T>(data?: T): OCType<T> {
|
private deeptranslate<T>(data?: T): OCType<T> {
|
||||||
const proxy = new Proxy(
|
const proxy = new Proxy(
|
||||||
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
|
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
|
||||||
{
|
{
|
||||||
get: (target, key) => {
|
get: (target, key) => {
|
||||||
const obj: any = target();
|
const obj: any = target();
|
||||||
|
|
||||||
return this.deeptranslate(obj[key]);
|
return this.deeptranslate(obj[key]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,30 +114,34 @@ export class SCThingTranslator {
|
|||||||
|
|
||||||
// Assigns every property in fieldTranslations to the known base language translation
|
// Assigns every property in fieldTranslations to the known base language translation
|
||||||
if (typeof metaClass.fieldTranslations.en !== 'undefined') {
|
if (typeof metaClass.fieldTranslations.en !== 'undefined') {
|
||||||
Object.keys(metaClass.fieldTranslations.en).forEach((key) => {
|
Object.keys(metaClass.fieldTranslations.en)
|
||||||
|
.forEach((key) => {
|
||||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
|
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assigns every property in fieldTranslations to the known translation in given language
|
// Assigns every property in fieldTranslations to the known translation in given language
|
||||||
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
|
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
|
||||||
Object.keys(metaClass.fieldTranslations[language]).forEach((key) => {
|
Object.keys(metaClass.fieldTranslations[language])
|
||||||
|
.forEach((key) => {
|
||||||
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
|
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return fieldTranslations;
|
return fieldTranslations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns meta class needed for translations given a SCThingType
|
* Returns meta class needed for translations given a SCThingType
|
||||||
*
|
*
|
||||||
* @param thingType
|
* @param thingType Type of the thing
|
||||||
* @returns An instance of the metaclass
|
* @returns An instance of the metaclass
|
||||||
*/
|
*/
|
||||||
private getMetaClassInstance(thingType: SCThingType): any {
|
private getMetaClassInstance(thingType: SCThingType): any {
|
||||||
if (thingType in this.metaClasses) {
|
if (thingType in this.metaClasses) {
|
||||||
return new (this.metaClasses as any)[thingType]();
|
return new (this.metaClasses as any)[thingType]();
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,10 +160,12 @@ export class SCThingTranslator {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
|
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
|
||||||
Object.keys(metaClass.fieldValueTranslations[language]).forEach((key) => {
|
Object.keys(metaClass.fieldValueTranslations[language])
|
||||||
|
.forEach((key) => {
|
||||||
if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
|
if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
|
||||||
// Assigns known translations of subproperties to property in given language (e.g. categories)
|
// Assigns known translations of subproperties to property in given language (e.g. categories)
|
||||||
Object.keys((instance as any)[key]).forEach((subKey) => {
|
Object.keys((instance as any)[key])
|
||||||
|
.forEach((subKey) => {
|
||||||
(instance as any)[key][subKey] =
|
(instance as any)[key][subKey] =
|
||||||
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
|
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
|
||||||
});
|
});
|
||||||
@@ -164,6 +175,7 @@ export class SCThingTranslator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,6 +204,7 @@ export class SCThingTranslator {
|
|||||||
}
|
}
|
||||||
const objTranslated = this.translateWholeThingDestructively(clone(obj));
|
const objTranslated = this.translateWholeThingDestructively(clone(obj));
|
||||||
this.cache.putObject(objTranslated);
|
this.cache.putObject(objTranslated);
|
||||||
|
|
||||||
return this.deeptranslate(objTranslated[key]);
|
return this.deeptranslate(objTranslated[key]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -204,13 +217,13 @@ export class SCThingTranslator {
|
|||||||
* @example
|
* @example
|
||||||
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
|
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
|
||||||
* @param language The language the object is translated to
|
* @param language The language the object is translated to
|
||||||
* @param thingType
|
* @param thingType Type of the thing
|
||||||
* @returns An object with the properties of the SCThingType where the values are the known property tranlations
|
* @returns An object with the properties of the SCThingType where the values are the known property tranlations
|
||||||
*/
|
*/
|
||||||
public translatedPropertyNames<T extends SCThing>(thing: T,
|
public translatedPropertyNames<T extends SCThing>(thing: T,
|
||||||
language?: keyof SCTranslations<T>): T | undefined {
|
language?: keyof SCTranslations<T>): T | undefined {
|
||||||
const targetLanguage = (language) ? language : this.language;
|
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
||||||
// return {...{}, ...this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T};
|
|
||||||
return this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T;
|
return this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,26 +237,29 @@ export class SCThingTranslator {
|
|||||||
*/
|
*/
|
||||||
public translateWholeThingDestructively(instance: any,
|
public translateWholeThingDestructively(instance: any,
|
||||||
language?: keyof SCTranslations<any>): any {
|
language?: keyof SCTranslations<any>): any {
|
||||||
const targetLanguage = (language) ? language : this.language;
|
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
||||||
|
let nextInstance = instance;
|
||||||
// Recursively call this function on all nested SCThings, arrays and objects
|
// Recursively call this function on all nested SCThings, arrays and objects
|
||||||
Object.keys(instance).forEach((key) => {
|
Object.keys(nextInstance)
|
||||||
|
.forEach((key) => {
|
||||||
if (
|
if (
|
||||||
isThing((instance as any)[key]) ||
|
isThing((nextInstance as any)[key]) ||
|
||||||
instance[key] instanceof Array ||
|
nextInstance[key] instanceof Array ||
|
||||||
instance[key] instanceof Object) {
|
nextInstance[key] instanceof Object) {
|
||||||
instance[key] = this.translateWholeThingDestructively(instance[key], targetLanguage);
|
nextInstance[key] = this.translateWholeThingDestructively(nextInstance[key], targetLanguage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spread variable translations given by the connector into thing
|
// Spread variable translations given by the connector into thing
|
||||||
if (typeof instance.translations !== 'undefined') {
|
if (typeof nextInstance.translations !== 'undefined') {
|
||||||
if (typeof instance.translations![targetLanguage] !== 'undefined') {
|
if (typeof nextInstance.translations![targetLanguage] !== 'undefined') {
|
||||||
instance = {...instance, ...instance.translations![targetLanguage]} as typeof instance;
|
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as typeof instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Spread known translations from meta classes into (partly) translated thing
|
// Spread known translations from meta classes into (partly) translated thing
|
||||||
this.replaceAvailableMetaFieldValueTranslations(instance, targetLanguage);
|
this.replaceAvailableMetaFieldValueTranslations(nextInstance, targetLanguage);
|
||||||
return instance;
|
|
||||||
|
return nextInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -256,15 +272,14 @@ class LRUCache<T> {
|
|||||||
/**
|
/**
|
||||||
* Map property that manages cached content
|
* Map property that manages cached content
|
||||||
*/
|
*/
|
||||||
private entries: Map<string, T> = new Map<string, T>();
|
private readonly entries: Map<string, T> = new Map<string, T>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property representing cache maximum capacity
|
* Property representing cache maximum capacity
|
||||||
*/
|
*/
|
||||||
private maxEntries: number;
|
private readonly maxEntries: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
|
||||||
* @example
|
* @example
|
||||||
* // returns LRUCache instance with a maximum capacity of 500
|
* // returns LRUCache instance with a maximum capacity of 500
|
||||||
* new LRUCache(500);
|
* new LRUCache(500);
|
||||||
@@ -307,11 +322,12 @@ class LRUCache<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const entry = this.entries.get(key);
|
const entry = this.entries.get(key);
|
||||||
if (entry) {
|
if (typeof entry !== 'undefined') {
|
||||||
// LRU behavior
|
// LRU behavior
|
||||||
this.entries.delete(key);
|
this.entries.delete(key);
|
||||||
this.entries.set(key, entry);
|
this.entries.set(key, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +340,8 @@ class LRUCache<T> {
|
|||||||
public put(key: string, content: T) {
|
public put(key: string, content: T) {
|
||||||
if (this.entries.size >= this.maxEntries) {
|
if (this.entries.size >= this.maxEntries) {
|
||||||
// LRU behavior
|
// LRU behavior
|
||||||
const keyToDelete = this.entries.keys().next().value;
|
const keyToDelete = this.entries.keys()
|
||||||
|
.next().value;
|
||||||
this.entries.delete(keyToDelete);
|
this.entries.delete(keyToDelete);
|
||||||
}
|
}
|
||||||
this.entries.set(key, content);
|
this.entries.set(key, content);
|
||||||
|
|||||||
@@ -28,12 +28,16 @@ export interface SCAcademicDegreeWithoutReferences
|
|||||||
/**
|
/**
|
||||||
* The achievable academic degree with academic field specification
|
* The achievable academic degree with academic field specification
|
||||||
* (eg. Master of Science)
|
* (eg. Master of Science)
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
academicDegreewithField: string;
|
academicDegreewithField: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The achievable academic degree with academic field specification
|
* The achievable academic degree with academic field specification
|
||||||
* shorted (eg. M.Sc.).
|
* shorted (eg. M.Sc.).
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
academicDegreewithFieldShort: string;
|
academicDegreewithFieldShort: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ export interface SCAcademicTermWithoutReferences
|
|||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Short name of the academic term, using the given pattern
|
* Short name of the academic term, using the given pattern
|
||||||
|
*
|
||||||
|
* @aggregatable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
acronym: string;
|
acronym: string;
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ export interface SCCreativeWorkWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Keywords of the creative work
|
* Keywords of the creative work
|
||||||
|
*
|
||||||
|
* @aggregatable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
keywords?: string[];
|
keywords?: string[];
|
||||||
|
|
||||||
@@ -79,6 +82,8 @@ export interface SCCreativeWorkTranslatableProperties
|
|||||||
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of the keywords of the creative work
|
* Translation of the keywords of the creative work
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
keywords?: string[];
|
keywords?: string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ export interface SCEventWithoutReferences
|
|||||||
* Maximum number of participants of the event
|
* Maximum number of participants of the event
|
||||||
*
|
*
|
||||||
* A maximum number of people that can participate in the event.
|
* A maximum number of people that can participate in the event.
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
maximumParticipants?: number;
|
maximumParticipants?: number;
|
||||||
|
|
||||||
@@ -35,6 +37,8 @@ export interface SCEventWithoutReferences
|
|||||||
* Remaining attendee capacity of the event
|
* Remaining attendee capacity of the event
|
||||||
*
|
*
|
||||||
* This number represents the remaining open spots.
|
* This number represents the remaining open spots.
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
remainingAttendeeCapacity?: number;
|
remainingAttendeeCapacity?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ export interface SCPlaceWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opening hours of the place
|
* Opening hours of the place
|
||||||
|
*
|
||||||
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
openingHours?: string;
|
openingHours?: string;
|
||||||
|
|
||||||
@@ -63,6 +65,9 @@ export interface SCPlace
|
|||||||
*/
|
*/
|
||||||
export interface SCPlaceWithoutReferencesTranslatableProperties
|
export interface SCPlaceWithoutReferencesTranslatableProperties
|
||||||
extends SCThingTranslatableProperties {
|
extends SCThingTranslatableProperties {
|
||||||
|
/**
|
||||||
|
* Address of a place
|
||||||
|
*/
|
||||||
address?: SCPostalAddress;
|
address?: SCPostalAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ import {SCISO8601Date} from '../types/Time';
|
|||||||
export interface SCPriceGroup {
|
export interface SCPriceGroup {
|
||||||
/**
|
/**
|
||||||
* Default price of the thing
|
* Default price of the thing
|
||||||
|
*
|
||||||
|
* @sortable price
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
default: number;
|
default: number;
|
||||||
}
|
}
|
||||||
@@ -36,16 +39,25 @@ export interface SCAcademicPriceGroup
|
|||||||
extends SCPriceGroup {
|
extends SCPriceGroup {
|
||||||
/**
|
/**
|
||||||
* Price for employees
|
* Price for employees
|
||||||
|
*
|
||||||
|
* @sortable price
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
employee?: number;
|
employee?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Price for guests
|
* Price for guests
|
||||||
|
*
|
||||||
|
* @sortable price
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
guest?: number;
|
guest?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Price for students
|
* Price for students
|
||||||
|
*
|
||||||
|
* @sortable price
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
student?: number;
|
student?: number;
|
||||||
}
|
}
|
||||||
@@ -115,6 +127,8 @@ export interface SCThingThatCanBeOfferedTranslatableProperties
|
|||||||
extends SCThingTranslatableProperties {
|
extends SCThingTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Availability of an offer
|
* Availability of an offer
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
'offers[].availability'?: string;
|
'offers[].availability'?: string;
|
||||||
}
|
}
|
||||||
@@ -141,7 +155,10 @@ export type SCThingThatCanBeOfferedAvailability =
|
|||||||
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
|
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
|
||||||
SCMetaTranslations<SCThingThatCanBeOffered<T>> {
|
SCMetaTranslations<SCThingThatCanBeOffered<T>> {
|
||||||
|
|
||||||
protected static _instance: any;
|
/**
|
||||||
|
* Instance
|
||||||
|
*/
|
||||||
|
protected static _instance = new Map<string, unknown>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translations of fields
|
* Translations of fields
|
||||||
@@ -169,12 +186,17 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// tslint:disable:static-this
|
||||||
/**
|
/**
|
||||||
* Function to retrieve typed singleton instance (including generics)
|
* Function to retrieve typed singleton instance (including generics)
|
||||||
*/
|
*/
|
||||||
public static getInstance<T extends SCPriceGroup>(): SCThingThatCanBeOfferedMeta<T> {
|
public static getInstance<T extends SCPriceGroup>(): SCThingThatCanBeOfferedMeta<T> {
|
||||||
return this._instance || (this._instance = new this<T>());
|
if (!SCThingThatCanBeOfferedMeta._instance.has(this.name)) {
|
||||||
}
|
SCThingThatCanBeOfferedMeta._instance.set(this.name, new SCThingThatCanBeOfferedMeta<T>());
|
||||||
|
}
|
||||||
|
|
||||||
|
return SCThingThatCanBeOfferedMeta._instance
|
||||||
|
.get(this.name) as SCThingThatCanBeOfferedMeta<T>;
|
||||||
|
}
|
||||||
protected constructor() {}
|
protected constructor() {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,15 @@ import {SCMap} from '../types/Map';
|
|||||||
* A thing without references with categories
|
* A thing without references with categories
|
||||||
*
|
*
|
||||||
* !!! BEWARE !!!
|
* !!! BEWARE !!!
|
||||||
* `T` should be a union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
|
* `T` should be a string literal union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
|
||||||
*/
|
*/
|
||||||
export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWithCategoriesSpecificValues>
|
export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWithCategoriesSpecificValues>
|
||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Categories of a thing with categories
|
* Categories of a thing with categories
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
|
* @aggregatable
|
||||||
*/
|
*/
|
||||||
categories: T[];
|
categories: T[];
|
||||||
|
|
||||||
@@ -72,26 +75,36 @@ export interface SCThingWithCategoriesTranslatableProperties
|
|||||||
export interface SCThingWithCategoriesSpecificValues {
|
export interface SCThingWithCategoriesSpecificValues {
|
||||||
/**
|
/**
|
||||||
* Category specific alternate names of a thing
|
* Category specific alternate names of a thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
alternateNames?: string[];
|
alternateNames?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category specific description of a thing
|
* Category specific description of a thing
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL of a category specific image of a thing
|
* URL of a category specific image of a thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
image?: string;
|
image?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category specific name of a thing
|
* Category specific name of a thing
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category specific URL of a thing
|
* Category specific URL of a thing
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
url?: string;
|
url?: string;
|
||||||
}
|
}
|
||||||
@@ -103,7 +116,10 @@ export interface SCThingWithCategoriesSpecificValues {
|
|||||||
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
||||||
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>> {
|
||||||
|
|
||||||
protected static _instance: any;
|
/**
|
||||||
|
* Instance
|
||||||
|
*/
|
||||||
|
protected static _instance = new Map<string, unknown>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translations of fields
|
* Translations of fields
|
||||||
@@ -133,11 +149,18 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// tslint:disable:static-this
|
||||||
/**
|
/**
|
||||||
* Function to retrieve typed singleton instance (including generics)
|
* Function to retrieve typed singleton instance (including generics)
|
||||||
*/
|
*/
|
||||||
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
|
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
|
||||||
return this._instance || (this._instance = new this<T, U>());
|
if (!SCThingWithCategoriesWithoutReferencesMeta._instance.has(this.name)) {
|
||||||
|
SCThingWithCategoriesWithoutReferencesMeta._instance
|
||||||
|
.set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>());
|
||||||
|
}
|
||||||
|
|
||||||
|
return SCThingWithCategoriesWithoutReferencesMeta._instance
|
||||||
|
.get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected constructor() {
|
protected constructor() {
|
||||||
|
|||||||
@@ -12,6 +12,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {
|
||||||
|
BAD_GATEWAY,
|
||||||
|
BAD_REQUEST, CONFLICT, INTERNAL_SERVER_ERROR,
|
||||||
|
METHOD_NOT_ALLOWED, NOT_ACCEPTABLE, NOT_FOUND,
|
||||||
|
REQUEST_TOO_LONG,
|
||||||
|
TOO_MANY_REQUESTS,
|
||||||
|
UNSUPPORTED_MEDIA_TYPE,
|
||||||
|
} from 'http-status-codes';
|
||||||
import {ValidationError} from 'jsonschema';
|
import {ValidationError} from 'jsonschema';
|
||||||
import {SCPluginMetaData} from '../routes/plugin/PluginRegisterRequest';
|
import {SCPluginMetaData} from '../routes/plugin/PluginRegisterRequest';
|
||||||
|
|
||||||
@@ -24,7 +32,7 @@ export interface SCErrorResponse extends Error {
|
|||||||
/**
|
/**
|
||||||
* Additional data that describes the error
|
* Additional data that describes the error
|
||||||
*/
|
*/
|
||||||
additionalData?: any;
|
additionalData?: unknown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP status code to return this error with
|
* HTTP status code to return this error with
|
||||||
@@ -49,7 +57,7 @@ export abstract class SCError implements SCErrorResponse {
|
|||||||
* @param statusCode HTTP status code to return this error with
|
* @param statusCode HTTP status code to return this error with
|
||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(public name: string, public message: string, public statusCode: number, stack?: boolean) {
|
constructor(public name: string, public message: string, public statusCode: number, stack = false) {
|
||||||
// generate stacktrace if needed
|
// generate stacktrace if needed
|
||||||
if (stack) {
|
if (stack) {
|
||||||
this.stack = (new Error()).stack;
|
this.stack = (new Error()).stack;
|
||||||
@@ -73,7 +81,7 @@ export class SCValidationErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(errors: ValidationError[], stack?: boolean) {
|
constructor(errors: ValidationError[], stack?: boolean) {
|
||||||
super('ValidationError', 'Validation of request failed', 400, stack);
|
super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
|
||||||
this.additionalData = errors;
|
this.additionalData = errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +96,7 @@ export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('UnsupportedMediaTypeError', 'Unsupported media type', 415, stack);
|
super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +110,7 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', 405, stack);
|
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', METHOD_NOT_ALLOWED, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,10 +120,11 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
|
|||||||
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
* Create a SCRequestBodyTooLargeErrorResponse
|
* Create a SCRequestBodyTooLargeErrorResponse
|
||||||
|
*
|
||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('RequestBodyTooLargeError', 'The request body is too large.', 413, stack);
|
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +138,12 @@ export class SCTooManyRequestsErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('TooManyRequestsError', 'Too many requests. You can not submit more than 5 queries an once', 429, stack);
|
super(
|
||||||
|
'TooManyRequestsError',
|
||||||
|
'Too many requests. You can not submit more than 5 queries an once',
|
||||||
|
TOO_MANY_REQUESTS,
|
||||||
|
stack,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +157,7 @@ export class SCNotFoundErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('NotFoundError', 'Resource not found', 404, stack);
|
super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +173,7 @@ export class SCParametersNotAcceptable extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(message: string, stack?: boolean) {
|
constructor(message: string, stack?: boolean) {
|
||||||
super('ParametersNotAcceptable', message, 406, stack);
|
super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,8 +196,8 @@ export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
|||||||
* @param plugin Provides meta data of a registered plugin, which is in a conflict with the plugin we want to register
|
* @param plugin Provides meta data of a registered plugin, which is in a conflict with the plugin we want to register
|
||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(message: string, plugin: SCPluginMetaData, stack?: boolean) {
|
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
|
||||||
super('SCPluginAlreadyRegisteredError', message, 409, stack);
|
super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
|
||||||
if (stack) {
|
if (stack) {
|
||||||
this.additionalData = plugin;
|
this.additionalData = plugin;
|
||||||
}
|
}
|
||||||
@@ -201,7 +215,7 @@ export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(message: string, stack?: boolean) {
|
constructor(message: string, stack?: boolean) {
|
||||||
super('PluginRegisteringFailedError', message, 500, stack);
|
super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +230,7 @@ export class SCSyntaxErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(message: string, stack?: boolean) {
|
constructor(message: string, stack?: boolean) {
|
||||||
super('SyntaxError', message, 400, stack);
|
super('SyntaxError', message, BAD_REQUEST, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,8 +250,8 @@ export class SCInternalServerErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
* and the internal server error should be displayed to the client
|
* and the internal server error should be displayed to the client
|
||||||
*/
|
*/
|
||||||
constructor(err?: Error, stack?: boolean) {
|
constructor(err?: Error, stack = false) {
|
||||||
super('InternalServerError', 'Internal server error', 502, stack);
|
super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
|
||||||
|
|
||||||
if (stack) {
|
if (stack) {
|
||||||
this.additionalData = err;
|
this.additionalData = err;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {OK} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||||
import {
|
import {
|
||||||
SCInternalServerErrorResponse,
|
SCInternalServerErrorResponse,
|
||||||
@@ -47,7 +48,7 @@ export class SCIndexRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCIndexRequest';
|
this.requestBodyName = 'SCIndexRequest';
|
||||||
this.responseBodyName = 'SCIndexResponse';
|
this.responseBodyName = 'SCIndexResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/';
|
this.urlFragment = '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,13 @@ import {SCBackendConfiguration} from '../../../types/config/Backend';
|
|||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export interface SCIndexResponse {
|
export interface SCIndexResponse {
|
||||||
|
/**
|
||||||
|
* @see SCAppConfiguration
|
||||||
|
*/
|
||||||
app: SCAppConfiguration;
|
app: SCAppConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SCBackendConfiguration
|
||||||
|
*/
|
||||||
backend: SCBackendConfiguration;
|
backend: SCBackendConfiguration;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {OK} from 'http-status-codes';
|
||||||
import {SCThings} from '../../../../Classes';
|
import {SCThings} from '../../../../Classes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
||||||
import {
|
import {
|
||||||
@@ -53,7 +54,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCThingUpdateRequest';
|
this.requestBodyName = 'SCThingUpdateRequest';
|
||||||
this.responseBodyName = 'SCThingUpdateResponse';
|
this.responseBodyName = 'SCThingUpdateResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/:TYPE/:UID';
|
this.urlFragment = '/:TYPE/:UID';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {OK} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||||
import {SCUuid} from '../../../types/UUID';
|
import {SCUuid} from '../../../types/UUID';
|
||||||
import {
|
import {
|
||||||
@@ -26,6 +27,7 @@ import {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to check the availability of books
|
* Request to check the availability of books
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
|
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
|
||||||
@@ -80,7 +82,7 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCBookAvailabilityRequest';
|
this.requestBodyName = 'SCBookAvailabilityRequest';
|
||||||
this.responseBodyName = 'SCBookAvailabilityResponse';
|
this.responseBodyName = 'SCBookAvailabilityResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/bookAvailability';
|
this.urlFragment = '/bookAvailability';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../../base/
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of availabilities of a book
|
* List of availabilities of a book
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
|
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {OK} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||||
import {SCThingType} from '../../../Thing';
|
import {SCThingType} from '../../../Thing';
|
||||||
import {SCISO8601Date} from '../../../types/Time';
|
import {SCISO8601Date} from '../../../types/Time';
|
||||||
@@ -78,7 +79,7 @@ export class SCBulkRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCBulkRequest';
|
this.requestBodyName = 'SCBulkRequest';
|
||||||
this.responseBodyName = 'SCBulkResponse';
|
this.responseBodyName = 'SCBulkResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/bulk';
|
this.urlFragment = '/bulk';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {CREATED} from 'http-status-codes';
|
||||||
import {SCThings} from '../../../../Classes';
|
import {SCThings} from '../../../../Classes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
||||||
import {
|
import {
|
||||||
@@ -26,6 +27,7 @@ import {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to add a thing to a bulk
|
* Request to add a thing to a bulk
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export type SCBulkAddRequest = SCThings;
|
export type SCBulkAddRequest = SCThings;
|
||||||
@@ -51,7 +53,7 @@ export class SCBulkAddRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCBulkAddRequest';
|
this.requestBodyName = 'SCBulkAddRequest';
|
||||||
this.responseBodyName = 'SCBulkAddResponse';
|
this.responseBodyName = 'SCBulkAddResponse';
|
||||||
this.statusCodeSuccess = 201;
|
this.statusCodeSuccess = CREATED;
|
||||||
this.urlFragment = '/bulk/:UID';
|
this.urlFragment = '/bulk/:UID';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Response to a request to add a thing to a bulk
|
* Response to a request to add a thing to a bulk
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export interface SCBulkAddResponse {
|
export interface SCBulkAddResponse {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {NO_CONTENT} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
|
||||||
import {
|
import {
|
||||||
SCInternalServerErrorResponse,
|
SCInternalServerErrorResponse,
|
||||||
@@ -25,6 +26,7 @@ import {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to change the bulk state to done (close the bulk process)
|
* Request to change the bulk state to done (close the bulk process)
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export interface SCBulkDoneRequest {
|
export interface SCBulkDoneRequest {
|
||||||
@@ -51,7 +53,7 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCBulkDoneRequest';
|
this.requestBodyName = 'SCBulkDoneRequest';
|
||||||
this.responseBodyName = 'SCBulkDoneResponse';
|
this.responseBodyName = 'SCBulkDoneResponse';
|
||||||
this.statusCodeSuccess = 204;
|
this.statusCodeSuccess = NO_CONTENT;
|
||||||
this.urlFragment = '/bulk/:UID/done';
|
this.urlFragment = '/bulk/:UID/done';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Response to a request to change the state of a bulk to done
|
* Response to a request to change the state of a bulk to done
|
||||||
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export interface SCBulkDoneResponse {
|
export interface SCBulkDoneResponse {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {NO_CONTENT} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||||
import {SCMessage} from '../../../things/Message';
|
import {SCMessage} from '../../../things/Message';
|
||||||
import {
|
import {
|
||||||
@@ -52,7 +53,7 @@ export class SCFeedbackRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCFeedbackRequest';
|
this.requestBodyName = 'SCFeedbackRequest';
|
||||||
this.responseBodyName = 'SCFeedbackResponse';
|
this.responseBodyName = 'SCFeedbackResponse';
|
||||||
this.statusCodeSuccess = 204;
|
this.statusCodeSuccess = NO_CONTENT;
|
||||||
this.urlFragment = '/feedback';
|
this.urlFragment = '/feedback';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +75,7 @@ export interface SCFeedbackRequestMetaData {
|
|||||||
/**
|
/**
|
||||||
* Scope/app state at feedback invocation
|
* Scope/app state at feedback invocation
|
||||||
*/
|
*/
|
||||||
scope: any;
|
scope: unknown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the feedback is sendable
|
* Whether or not the feedback is sendable
|
||||||
@@ -84,7 +85,7 @@ export interface SCFeedbackRequestMetaData {
|
|||||||
/**
|
/**
|
||||||
* App state that feedback was invoked from
|
* App state that feedback was invoked from
|
||||||
*/
|
*/
|
||||||
state: any;
|
state: unknown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User agent
|
* User agent
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {OK} from 'http-status-codes';
|
||||||
import {Schema} from 'jsonschema';
|
import {Schema} from 'jsonschema';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||||
import {
|
import {
|
||||||
@@ -108,7 +109,7 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCPluginRegisterRequest';
|
this.requestBodyName = 'SCPluginRegisterRequest';
|
||||||
this.responseBodyName = 'SCPluginRegisterResponse';
|
this.responseBodyName = 'SCPluginRegisterResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/plugin/register';
|
this.urlFragment = '/plugin/register';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {OK} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||||
import {SCMap} from '../../../types/Map';
|
import {SCMap} from '../../../types/Map';
|
||||||
import {
|
import {
|
||||||
@@ -54,7 +55,7 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCMultiSearchRequest';
|
this.requestBodyName = 'SCMultiSearchRequest';
|
||||||
this.responseBodyName = 'SCMultiSearchResponse';
|
this.responseBodyName = 'SCMultiSearchResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/search/multi';
|
this.urlFragment = '/search/multi';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {OK} from 'http-status-codes';
|
||||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
|
||||||
import {SCSearchContext} from '../../../types/config/Backend';
|
import {SCSearchContext} from '../../../types/config/Backend';
|
||||||
import {SCSearchFilter} from '../../../types/filters/Abstract';
|
import {SCSearchFilter} from '../../../types/filters/Abstract';
|
||||||
@@ -85,7 +86,7 @@ export class SCSearchRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCSearchRequest';
|
this.requestBodyName = 'SCSearchRequest';
|
||||||
this.responseBodyName = 'SCSearchResponse';
|
this.responseBodyName = 'SCSearchResponse';
|
||||||
this.statusCodeSuccess = 200;
|
this.statusCodeSuccess = OK;
|
||||||
this.urlFragment = '/search';
|
this.urlFragment = '/search';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,16 @@ export interface SCAcademicEventWithoutReferences
|
|||||||
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Majors of the academic event that this event belongs to
|
* Majors of the academic event that this event belongs to
|
||||||
|
*
|
||||||
|
* @aggregatable
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
majors?: string[];
|
majors?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Original unmapped category from the source of the academic event
|
* Original unmapped category from the source of the academic event
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
originalCategory?: string;
|
originalCategory?: string;
|
||||||
|
|
||||||
@@ -54,6 +59,7 @@ export interface SCAcademicEventWithoutReferences
|
|||||||
* An academic event
|
* An academic event
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCAcademicEvent
|
export interface SCAcademicEvent
|
||||||
extends SCEvent, SCAcademicEventWithoutReferences,
|
extends SCEvent, SCAcademicEventWithoutReferences,
|
||||||
@@ -95,11 +101,15 @@ export interface SCAcademicEventTranslatableProperties
|
|||||||
extends SCThingWithCategoriesTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translations of the majors of the academic event that this event belongs to
|
* Translations of the majors of the academic event that this event belongs to
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
majors?: string[];
|
majors?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translation of the original unmapped category from the source of the academic event
|
* Translation of the original unmapped category from the source of the academic event
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
originalCategory?: string;
|
originalCategory?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ export interface SCArticleWithoutReferences
|
|||||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Article itself as markdown
|
* Article itself as markdown
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
articleBody: string;
|
articleBody: string;
|
||||||
|
|
||||||
@@ -54,6 +56,7 @@ export interface SCArticleWithoutReferences
|
|||||||
* An article
|
* An article
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCArticle
|
export interface SCArticle
|
||||||
extends SCCreativeWork, SCArticleWithoutReferences,
|
extends SCCreativeWork, SCArticleWithoutReferences,
|
||||||
@@ -81,6 +84,8 @@ export interface SCArticleTranslatableProperties
|
|||||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of the article itself as markdown
|
* Translation of the article itself as markdown
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
articleBody?: string[];
|
articleBody?: string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,16 +30,22 @@ export interface SCBookWithoutReferences
|
|||||||
extends SCCreativeWorkWithoutReferences {
|
extends SCCreativeWorkWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Edition of a book
|
* Edition of a book
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
bookEdition?: string;
|
bookEdition?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ISBN of a book
|
* ISBN of a book
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
isbn: string;
|
isbn: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of pages of a book
|
* Number of pages of a book
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
numberOfPages?: number;
|
numberOfPages?: number;
|
||||||
|
|
||||||
@@ -58,6 +64,7 @@ export interface SCBookWithoutReferences
|
|||||||
* A book
|
* A book
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCBook
|
export interface SCBook
|
||||||
extends SCCreativeWork, SCBookWithoutReferences {
|
extends SCCreativeWork, SCBookWithoutReferences {
|
||||||
@@ -84,6 +91,8 @@ export interface SCBookTranslatableFields
|
|||||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of an edition of a book
|
* Translation of an edition of a book
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
bookEdition?: string;
|
bookEdition?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,11 +43,16 @@ export interface SCBuildingWithoutReferences
|
|||||||
SCPlaceWithoutReferences {
|
SCPlaceWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Categories of a building
|
* Categories of a building
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
|
* @aggregatable
|
||||||
*/
|
*/
|
||||||
categories: SCBuildingCategories[];
|
categories: SCBuildingCategories[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of floor names of the place
|
* List of floor names of the place
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
floors?: string[];
|
floors?: string[];
|
||||||
|
|
||||||
@@ -66,6 +71,7 @@ export interface SCBuildingWithoutReferences
|
|||||||
* A building
|
* A building
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCBuilding
|
export interface SCBuilding
|
||||||
extends SCBuildingWithoutReferences, SCPlace,
|
extends SCBuildingWithoutReferences, SCPlace,
|
||||||
@@ -83,6 +89,9 @@ export interface SCBuilding
|
|||||||
|
|
||||||
export interface SCBuildingTranslatableProperties
|
export interface SCBuildingTranslatableProperties
|
||||||
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
||||||
|
/**
|
||||||
|
* @see SCBuilding.floors
|
||||||
|
*/
|
||||||
floors?: string[];
|
floors?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ export interface SCCatalogWithoutReferences
|
|||||||
* Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.)
|
* Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.)
|
||||||
*
|
*
|
||||||
* Needed for keeping order in catalog inheritance array.
|
* Needed for keeping order in catalog inheritance array.
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
level: number;
|
level: number;
|
||||||
|
|
||||||
@@ -44,7 +46,8 @@ export interface SCCatalogWithoutReferences
|
|||||||
/**
|
/**
|
||||||
* A catalog
|
* A catalog
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCCatalog
|
export interface SCCatalog
|
||||||
extends SCCatalogWithoutReferences, SCThing,
|
extends SCCatalogWithoutReferences, SCThing,
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ export interface SCCourseOfStudiesWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Actual major of the course of studies (eg. physics)
|
* Actual major of the course of studies (eg. physics)
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
major: string;
|
major: string;
|
||||||
|
|
||||||
@@ -66,6 +68,7 @@ export interface SCCourseOfStudiesWithoutReferences
|
|||||||
* A course of studies
|
* A course of studies
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCCourseOfStudies
|
export interface SCCourseOfStudies
|
||||||
extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
|
extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ export interface SCSportCoursePriceGroup
|
|||||||
extends SCAcademicPriceGroup {
|
extends SCAcademicPriceGroup {
|
||||||
/**
|
/**
|
||||||
* Price for alumnis
|
* Price for alumnis
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
alumni?: number;
|
alumni?: number;
|
||||||
}
|
}
|
||||||
@@ -60,6 +62,8 @@ export interface SCDateSeriesWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Frequency of the date series
|
* Frequency of the date series
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
frequency: string;
|
frequency: string;
|
||||||
|
|
||||||
@@ -78,6 +82,7 @@ export interface SCDateSeriesWithoutReferences
|
|||||||
* A date series
|
* A date series
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCDateSeries
|
export interface SCDateSeries
|
||||||
extends SCDateSeriesWithoutReferences,
|
extends SCDateSeriesWithoutReferences,
|
||||||
@@ -167,5 +172,8 @@ export class SCDateSeriesMeta
|
|||||||
*/
|
*/
|
||||||
export interface SCDateSeriesTranslatableProperties
|
export interface SCDateSeriesTranslatableProperties
|
||||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
|
/**
|
||||||
|
* @see SCDateSeriesWithoutReferences.frequency
|
||||||
|
*/
|
||||||
frequency?: string;
|
frequency?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export interface SCDiffWithoutReferences
|
|||||||
* A diff
|
* A diff
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCDiff
|
export interface SCDiff
|
||||||
extends SCDiffWithoutReferences, SCThing {
|
extends SCDiffWithoutReferences, SCThing {
|
||||||
|
|||||||
@@ -37,11 +37,16 @@ export interface SCDishWithoutReferences
|
|||||||
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Additives of the dish
|
* Additives of the dish
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
additives?: string[];
|
additives?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category of the dish
|
* Category of the dish
|
||||||
|
*
|
||||||
|
* @sortable ducet
|
||||||
|
* @aggregatable
|
||||||
*/
|
*/
|
||||||
categories: SCDishCategories[];
|
categories: SCDishCategories[];
|
||||||
|
|
||||||
@@ -70,6 +75,7 @@ export interface SCDishWithoutReferences
|
|||||||
* A dish
|
* A dish
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCDish
|
export interface SCDish
|
||||||
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
extends SCDishWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>,
|
||||||
@@ -104,11 +110,15 @@ export interface SCDishTranslatableProperties
|
|||||||
export interface SCDishCharacteristic {
|
export interface SCDishCharacteristic {
|
||||||
/**
|
/**
|
||||||
* URL of an image of the characteristic
|
* URL of an image of the characteristic
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
image?: string;
|
image?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the characteristic
|
* Name of the characteristic
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
@@ -132,36 +142,50 @@ export type SCDishCategories =
|
|||||||
export interface SCNutritionInformation {
|
export interface SCNutritionInformation {
|
||||||
/**
|
/**
|
||||||
* Number of calories contained (in kcal)
|
* Number of calories contained (in kcal)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
calories?: number;
|
calories?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of carbohydrates (in grams)
|
* Content of carbohydrates (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
carbohydrateContent?: number;
|
carbohydrateContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of fat (in grams)
|
* Content of fat (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
fatContent?: number;
|
fatContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of proteins (in grams)
|
* Content of proteins (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
proteinContent?: number;
|
proteinContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of salt (in grams)
|
* Content of salt (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
saltContent?: number;
|
saltContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of saturated fat (in grams)
|
* Content of saturated fat (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
saturatedFatContent?: number;
|
saturatedFatContent?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of sugar (in grams)
|
* Content of sugar (in grams)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
sugarContent?: number;
|
sugarContent?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export interface SCFavoriteWithoutReferences
|
|||||||
* A favorite
|
* A favorite
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCFavorite
|
export interface SCFavorite
|
||||||
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
|
||||||
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
|
||||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
|
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
|
||||||
@@ -26,13 +27,15 @@ export interface SCFloorWithoutReferences
|
|||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
|
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
floorName: string;
|
floorName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Floor plan
|
* Floor plan
|
||||||
*/
|
*/
|
||||||
plan: SCFloorFeatureCollectionWithPlaces<LineString, any>;
|
plan: SCFloorFeatureCollectionWithPlaces<LineString>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated fields of a floor
|
* Translated fields of a floor
|
||||||
@@ -49,6 +52,7 @@ export interface SCFloorWithoutReferences
|
|||||||
* A floor
|
* A floor
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCFloor
|
export interface SCFloor
|
||||||
extends SCFloorWithoutReferences, SCThingInPlace {
|
extends SCFloorWithoutReferences, SCThingInPlace {
|
||||||
@@ -66,19 +70,19 @@ export interface SCFloor
|
|||||||
/**
|
/**
|
||||||
* A feature collection
|
* A feature collection
|
||||||
*/
|
*/
|
||||||
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject, P = any>
|
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
|
||||||
extends FeatureCollection<T, P> {
|
extends FeatureCollection<T> {
|
||||||
/**
|
/**
|
||||||
* Features of the collection
|
* Features of the collection
|
||||||
*/
|
*/
|
||||||
features: Array<SCFloorFeatureWithPlace<T, P>>;
|
features: Array<SCFloorFeatureWithPlace<T>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* A feature with a place
|
* A feature with a place
|
||||||
*/
|
*/
|
||||||
export interface SCFloorFeatureWithPlace<T extends GeometryObject, P = any>
|
export interface SCFloorFeatureWithPlace<T extends GeometryObject>
|
||||||
extends Feature<T, P> {
|
extends Feature<T> {
|
||||||
/**
|
/**
|
||||||
* The place of the feature
|
* The place of the feature
|
||||||
*/
|
*/
|
||||||
@@ -92,6 +96,8 @@ export interface SCFloorTranslatableProperties
|
|||||||
extends SCThingTranslatableProperties {
|
extends SCThingTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translation of the floor name
|
* Translation of the floor name
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
floorName?: string;
|
floorName?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ export interface SCMessageWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Message itself
|
* Message itself
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
messageBody: string;
|
messageBody: string;
|
||||||
|
|
||||||
@@ -58,6 +60,7 @@ export interface SCMessageWithoutReferences
|
|||||||
* A message
|
* A message
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCMessage
|
export interface SCMessage
|
||||||
extends SCCreativeWork, SCMessageWithoutReferences {
|
extends SCCreativeWork, SCMessageWithoutReferences {
|
||||||
@@ -87,6 +90,8 @@ export interface SCMessageTranslatableProperties
|
|||||||
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Message itself
|
* Message itself
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
messageBody?: string;
|
messageBody?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export interface SCOrganizationWithoutReferences
|
|||||||
* An organization
|
* An organization
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCOrganization
|
export interface SCOrganization
|
||||||
extends SCOrganizationWithoutReferences, SCThingInPlace {
|
extends SCOrganizationWithoutReferences, SCThingInPlace {
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export interface SCPersonWithoutReferences
|
|||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Additional first names of the person.
|
* Additional first names of the person.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
additionalName?: string;
|
additionalName?: string;
|
||||||
|
|
||||||
@@ -39,16 +41,22 @@ export interface SCPersonWithoutReferences
|
|||||||
* The private email address of the person.
|
* The private email address of the person.
|
||||||
*
|
*
|
||||||
* @TJS-format email
|
* @TJS-format email
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
email?: string;
|
email?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The family name of the person.
|
* The family name of the person.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
familyName: string;
|
familyName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The private fax number of the person.
|
* The private fax number of the person.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
faxNumber?: string;
|
faxNumber?: string;
|
||||||
|
|
||||||
@@ -59,26 +67,36 @@ export interface SCPersonWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The first name of the person.
|
* The first name of the person.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
givenName: string;
|
givenName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Honorific prefix of the person.
|
* Honorific prefix of the person.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
honorificPrefix?: string;
|
honorificPrefix?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Honorific suffix of the person.
|
* Honorific suffix of the person.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
honorificSuffix?: string;
|
honorificSuffix?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Titles of jobs that the person has.
|
* Titles of jobs that the person has.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
jobTitles?: string[];
|
jobTitles?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The complete name of the person combining all the parts of the name into one.
|
* The complete name of the person combining all the parts of the name into one.
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@@ -89,6 +107,8 @@ export interface SCPersonWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The private telephone number of the person.
|
* The private telephone number of the person.
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
telephone?: string;
|
telephone?: string;
|
||||||
|
|
||||||
@@ -102,6 +122,7 @@ export interface SCPersonWithoutReferences
|
|||||||
* A person
|
* A person
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCPerson
|
export interface SCPerson
|
||||||
extends SCPersonWithoutReferences, SCThing {
|
extends SCPersonWithoutReferences, SCThing {
|
||||||
@@ -210,26 +231,36 @@ export interface SCContactPoint {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* E-mail at the work location
|
* E-mail at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
email?: string;
|
email?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fax number at the work location
|
* Fax number at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
faxNumber?: string;
|
faxNumber?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Times available for contacting at the work location
|
* Times available for contacting at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
hoursAvailable?: string;
|
hoursAvailable?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contact number at the work location
|
* Contact number at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
telephone?: string;
|
telephone?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL at the work location
|
* URL at the work location
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
url?: string;
|
url?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export interface SCPointOfInterestWithoutReferences
|
|||||||
* A point of interest
|
* A point of interest
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCPointOfInterest
|
export interface SCPointOfInterest
|
||||||
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
|
extends SCPointOfInterestWithoutReferences, SCThingInPlace, SCPlace,
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ export interface SCRoomWithoutReferences
|
|||||||
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* The name of the floor in which the room is in.
|
* The name of the floor in which the room is in.
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
floorName?: string;
|
floorName?: string;
|
||||||
|
|
||||||
@@ -82,6 +84,7 @@ export interface SCRoomWithoutReferences
|
|||||||
* A room
|
* A room
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCRoom
|
export interface SCRoom
|
||||||
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace,
|
extends SCRoomWithoutReferences, SCThingInPlace, SCThingThatAcceptsPayments, SCPlace,
|
||||||
@@ -106,6 +109,8 @@ export interface SCRoomSpecificValues
|
|||||||
extends SCThingWithCategoriesSpecificValues {
|
extends SCThingWithCategoriesSpecificValues {
|
||||||
/**
|
/**
|
||||||
* Category specific opening hours of the room
|
* Category specific opening hours of the room
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
openingHours?: string;
|
openingHours?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export interface SCSemesterWithoutReferences
|
|||||||
* The short name of the semester, using the given pattern.
|
* The short name of the semester, using the given pattern.
|
||||||
*
|
*
|
||||||
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
|
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
acronym: string;
|
acronym: string;
|
||||||
|
|
||||||
@@ -42,6 +43,7 @@ export interface SCSemesterWithoutReferences
|
|||||||
* A semester
|
* A semester
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCSemester
|
export interface SCSemester
|
||||||
extends SCSemesterWithoutReferences, SCAcademicTerm {
|
extends SCSemesterWithoutReferences, SCAcademicTerm {
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ export interface SCSettingWithoutReferences
|
|||||||
inputType: SCSettingInputType;
|
inputType: SCSettingInputType;
|
||||||
/**
|
/**
|
||||||
* The order number this setting should show up in its category list
|
* The order number this setting should show up in its category list
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
order: number;
|
order: number;
|
||||||
/**
|
/**
|
||||||
@@ -85,6 +87,7 @@ export enum SCSettingInputType {
|
|||||||
* A setting with references
|
* A setting with references
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCSetting
|
export interface SCSetting
|
||||||
extends SCSettingWithoutReferences, SCThing,
|
extends SCSettingWithoutReferences, SCThing,
|
||||||
@@ -115,6 +118,8 @@ export type SCSettingValues = SCSettingValue[];
|
|||||||
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* The translations of the possible values of a setting
|
* The translations of the possible values of a setting
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
values?: string[];
|
values?: string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export interface SCSportCourseWithoutReferences
|
|||||||
* A sport course
|
* A sport course
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCSportCourse
|
export interface SCSportCourse
|
||||||
extends SCEvent, SCSportCourseWithoutReferences {
|
extends SCEvent, SCSportCourseWithoutReferences {
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ export interface SCStudyModuleWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ECTS points (European Credit Transfer System)
|
* ECTS points (European Credit Transfer System)
|
||||||
|
*
|
||||||
|
* @float
|
||||||
*/
|
*/
|
||||||
ects: number;
|
ects: number;
|
||||||
|
|
||||||
@@ -44,6 +46,8 @@ export interface SCStudyModuleWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Majors that this study module is meant for
|
* Majors that this study module is meant for
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
majors: string[];
|
majors: string[];
|
||||||
|
|
||||||
@@ -67,6 +71,7 @@ export interface SCStudyModuleWithoutReferences
|
|||||||
* A study module
|
* A study module
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCStudyModule
|
export interface SCStudyModule
|
||||||
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
extends SCStudyModuleWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||||
@@ -111,6 +116,8 @@ export interface SCStudyModuleTranslatableProperties
|
|||||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
/**
|
/**
|
||||||
* Translations of the majors that this study module is meant for
|
* Translations of the majors that this study module is meant for
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
majors?: string[];
|
majors?: string[];
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,15 @@ export interface SCTicketWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Waiting number of the ticket
|
* Waiting number of the ticket
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
currentTicketNumber: string;
|
currentTicketNumber: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service type of the ticket
|
* Service type of the ticket
|
||||||
*/
|
*/
|
||||||
serviceType: any;
|
serviceType: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of a ticket
|
* Type of a ticket
|
||||||
@@ -47,6 +49,7 @@ export interface SCTicketWithoutReferences
|
|||||||
* A ticket
|
* A ticket
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCTicket
|
export interface SCTicket
|
||||||
extends SCTicketWithoutReferences, SCThingInPlace {
|
extends SCTicketWithoutReferences, SCThingInPlace {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export interface SCToDoWithoutReferences
|
|||||||
* A "to do"
|
* A "to do"
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCToDo
|
export interface SCToDo
|
||||||
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
|
extends SCToDoWithoutReferences, SCThing, SCThingWithCategories<string, SCThingWithCategoriesSpecificValues> {
|
||||||
|
|||||||
@@ -22,16 +22,22 @@ export interface SCTourWithoutReferences
|
|||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
/**
|
/**
|
||||||
* Init script for the tour
|
* Init script for the tour
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
init?: string;
|
init?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steps of a tour
|
* Steps of a tour
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
steps: SCTourStep[];
|
steps: SCTourStep[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of a tour
|
* Type of a tour
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
type: SCThingType.Tour;
|
type: SCThingType.Tour;
|
||||||
}
|
}
|
||||||
@@ -40,6 +46,7 @@ export interface SCTourWithoutReferences
|
|||||||
* A tour
|
* A tour
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCTour
|
export interface SCTour
|
||||||
extends SCTourWithoutReferences, SCThing {
|
extends SCTourWithoutReferences, SCThing {
|
||||||
@@ -100,6 +107,8 @@ export type SCTourStep =
|
|||||||
export interface SCTourStepLocation {
|
export interface SCTourStepLocation {
|
||||||
/**
|
/**
|
||||||
* Location to go to
|
* Location to go to
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
location: string;
|
location: string;
|
||||||
|
|
||||||
@@ -120,6 +129,8 @@ export interface SCTourStepTooltip {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Element that the tooltip shall be pointing at or a list of elements to try in the specified order
|
* Element that the tooltip shall be pointing at or a list of elements to try in the specified order
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
element: string | string[];
|
element: string | string[];
|
||||||
|
|
||||||
@@ -135,11 +146,15 @@ export interface SCTourStepTooltip {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Text that the tooltip shall contain
|
* Text that the tooltip shall contain
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
text: string;
|
text: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How often it shall be retried
|
* How often it shall be retried
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
tries?: number;
|
tries?: number;
|
||||||
|
|
||||||
@@ -175,6 +190,8 @@ export interface SCTourStepMenu {
|
|||||||
export interface SCTourResolvedElement {
|
export interface SCTourResolvedElement {
|
||||||
/**
|
/**
|
||||||
* Element name
|
* Element name
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
element: string;
|
element: string;
|
||||||
}
|
}
|
||||||
@@ -185,6 +202,8 @@ export interface SCTourResolvedElement {
|
|||||||
export interface SCTourResolvedEvent {
|
export interface SCTourResolvedEvent {
|
||||||
/**
|
/**
|
||||||
* Event name
|
* Event name
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
event: string;
|
event: string;
|
||||||
}
|
}
|
||||||
@@ -205,6 +224,8 @@ export interface SCTourResolvedLocation {
|
|||||||
export interface SCTourResolvedLocationTypeIs {
|
export interface SCTourResolvedLocationTypeIs {
|
||||||
/**
|
/**
|
||||||
* Specific location name
|
* Specific location name
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
is: string;
|
is: string;
|
||||||
}
|
}
|
||||||
@@ -215,6 +236,8 @@ export interface SCTourResolvedLocationTypeIs {
|
|||||||
export interface SCTourResolvedLocationTypeMatch {
|
export interface SCTourResolvedLocationTypeMatch {
|
||||||
/**
|
/**
|
||||||
* Regex location name
|
* Regex location name
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
match: string;
|
match: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ export interface SCVideoWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* URLs to a thumbnails for the Video
|
* URLs to a thumbnails for the Video
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
thumbnails?: string[];
|
thumbnails?: string[];
|
||||||
|
|
||||||
@@ -45,6 +47,8 @@ export interface SCVideoWithoutReferences
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A Transcript of the Video
|
* A Transcript of the Video
|
||||||
|
*
|
||||||
|
* @text
|
||||||
*/
|
*/
|
||||||
transcript?: string;
|
transcript?: string;
|
||||||
|
|
||||||
@@ -57,6 +61,8 @@ export interface SCVideoWithoutReferences
|
|||||||
export interface SCVideoSource {
|
export interface SCVideoSource {
|
||||||
/**
|
/**
|
||||||
* Pixel Height of the Video
|
* Pixel Height of the Video
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
height?: number;
|
height?: number;
|
||||||
|
|
||||||
@@ -67,16 +73,22 @@ export interface SCVideoSource {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of the Video File in bytes
|
* Size of the Video File in bytes
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
size?: number;
|
size?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to the Video File
|
* URL to the Video File
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
url: string;
|
url: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pixel Width of the Video
|
* Pixel Width of the Video
|
||||||
|
*
|
||||||
|
* @integer
|
||||||
*/
|
*/
|
||||||
width?: number;
|
width?: number;
|
||||||
}
|
}
|
||||||
@@ -94,6 +106,8 @@ export interface SCVideoTrack {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to the Track File
|
* URL to the Track File
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
@@ -102,6 +116,7 @@ export interface SCVideoTrack {
|
|||||||
* A video
|
* A video
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCVideo
|
export interface SCVideo
|
||||||
extends SCCreativeWork, SCVideoWithoutReferences {
|
extends SCCreativeWork, SCVideoWithoutReferences {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Point, Polygon} from 'geojson';
|
import {Point, Polygon} from 'geojson';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* unknown WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
@@ -23,12 +23,25 @@ import {SCTranslations} from './i18n';
|
|||||||
*
|
*
|
||||||
* @param something Something to check
|
* @param something Something to check
|
||||||
*/
|
*/
|
||||||
export function isThing(something: any): something is SCThing {
|
export function isThing(something: unknown): something is SCThing {
|
||||||
return (
|
if (typeof something !== 'object' || something === null) {
|
||||||
typeof something === 'object'
|
return false;
|
||||||
&& typeof something.type === 'string'
|
}
|
||||||
&& Object.values(SCThingType).indexOf(something.type) >= 0
|
|
||||||
);
|
if (!('type' in something)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tslint:disable-next-line:completed-docs
|
||||||
|
const type = (something as { type: unknown; }).type;
|
||||||
|
|
||||||
|
if (typeof type !== 'string') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object
|
||||||
|
.values(SCThingType)
|
||||||
|
.indexOf(type) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +50,8 @@ export function isThing(something: any): something is SCThing {
|
|||||||
* @param thing Thing to check
|
* @param thing Thing to check
|
||||||
*/
|
*/
|
||||||
export function isThingWithTranslations(thing: SCThingWithoutReferences)
|
export function isThingWithTranslations(thing: SCThingWithoutReferences)
|
||||||
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties> } {
|
// tslint:disable-next-line:completed-docs
|
||||||
|
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties>; } {
|
||||||
return typeof thing.translations !== 'undefined';
|
return typeof thing.translations !== 'undefined';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,12 +60,34 @@ export function isThingWithTranslations(thing: SCThingWithoutReferences)
|
|||||||
*
|
*
|
||||||
* @param something Something to check
|
* @param something Something to check
|
||||||
*/
|
*/
|
||||||
export function isBulkResponse(something: any): something is SCBulkResponse {
|
export function isBulkResponse(something: unknown): something is SCBulkResponse {
|
||||||
return typeof something.expiration === 'string'
|
if (typeof something !== 'object' || something === null) {
|
||||||
&& typeof something.source === 'string'
|
return false;
|
||||||
&& typeof something.state === 'string'
|
}
|
||||||
&& typeof something.type === 'string'
|
|
||||||
&& typeof something.uid === 'string';
|
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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,15 +95,20 @@ export function isBulkResponse(something: any): something is SCBulkResponse {
|
|||||||
*
|
*
|
||||||
* @param something Something to check
|
* @param something Something to check
|
||||||
*/
|
*/
|
||||||
export function isSearchResponse(something: any): something is SCSearchResponse {
|
export function isSearchResponse(something: unknown): something is SCSearchResponse {
|
||||||
return Array.isArray(something.data)
|
if (!(typeof something === 'object') || something === null) {
|
||||||
&& Array.isArray(something.facets)
|
return false;
|
||||||
&& typeof something.pagination !== 'undefined'
|
}
|
||||||
&& typeof something.pagination.count === 'number'
|
const somethingObject = (something as { [key: string]: { [key: string]: string; }; });
|
||||||
&& typeof something.pagination.offset === 'number'
|
|
||||||
&& typeof something.pagination.total === 'number'
|
return Array.isArray(somethingObject.data)
|
||||||
&& typeof something.stats !== 'undefined'
|
&& Array.isArray(somethingObject.facets)
|
||||||
&& typeof something.stats.time === 'number';
|
&& 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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,8 +116,11 @@ export function isSearchResponse(something: any): something is SCSearchResponse
|
|||||||
*
|
*
|
||||||
* @param something Something to check
|
* @param something Something to check
|
||||||
*/
|
*/
|
||||||
export function isMultiSearchResponse(something: any): something is SCMultiSearchResponse {
|
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {
|
||||||
return Object.keys(something).reduce((previousOnesAreSearchResponses, key) => {
|
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false;
|
||||||
return previousOnesAreSearchResponses && isSearchResponse(something[key]);
|
|
||||||
}, true as boolean);
|
return Object.keys(something as { [key: string]: string; })
|
||||||
|
.reduce((previousOnesAreSearchResponses, key) => {
|
||||||
|
return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]);
|
||||||
|
}, initialValue as boolean);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Polygon} from 'geojson';
|
import {Polygon} from 'geojson';
|
||||||
import {SCSetting} from '../../things/Setting';
|
import {SCSetting} from '../../things/Setting';
|
||||||
import {SCTranslations} from '../i18n';
|
import {SCTranslations} from '../i18n';
|
||||||
@@ -126,11 +127,11 @@ export interface SCAppConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Map of features
|
||||||
*/
|
*/
|
||||||
export interface SCAppConfigurationFeature {
|
export interface SCAppConfigurationFeature {
|
||||||
/**
|
/**
|
||||||
*
|
* Whether or not widgets are enabled
|
||||||
*/
|
*/
|
||||||
widgets: boolean;
|
widgets: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,10 +176,9 @@ export interface SCBackendInternalConfiguration {
|
|||||||
/**
|
/**
|
||||||
* Configuration of the database
|
* Configuration of the database
|
||||||
*/
|
*/
|
||||||
export interface SCBackendConfigurationDatabaseConfiguration extends SCMap<any> {
|
export interface SCBackendConfigurationDatabaseConfiguration extends SCMap<unknown> {
|
||||||
/**
|
/**
|
||||||
* Name of the database used by the backend
|
* Name of the database used by the backend
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ export interface SCMonitoringWatcher {
|
|||||||
/**
|
/**
|
||||||
* Query to execute against the database
|
* Query to execute against the database
|
||||||
*/
|
*/
|
||||||
query: any;
|
query: unknown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of triggers
|
* A list of triggers
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export interface SCSearchAbstractFilter<T extends SCSearchAbstractFilterArgument
|
|||||||
/**
|
/**
|
||||||
* Arguments for the filter instruction
|
* Arguments for the filter instruction
|
||||||
*/
|
*/
|
||||||
export type SCSearchAbstractFilterArguments = SCMap<any>;
|
export type SCSearchAbstractFilterArguments = SCMap<unknown>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Available filter instructions
|
* Available filter instructions
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
|
|||||||
* Filter for documents where it cannot be safely determined that they are not available
|
* Filter for documents where it cannot be safely determined that they are not available
|
||||||
*/
|
*/
|
||||||
export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAvailabilityFilterArguments> {
|
export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAvailabilityFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
type: 'availability';
|
type: 'availability';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter}
|
|||||||
* This filter can be used to combine multiple filters with boolean operations.
|
* This filter can be used to combine multiple filters with boolean operations.
|
||||||
*/
|
*/
|
||||||
export interface SCSearchBooleanFilter extends SCSearchAbstractFilter<SCBooleanFilterArguments> {
|
export interface SCSearchBooleanFilter extends SCSearchAbstractFilter<SCBooleanFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
type: 'boolean';
|
type: 'boolean';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Position} from 'geojson';
|
import {Position} from 'geojson';
|
||||||
import {SCThingsField} from '../../Classes';
|
import {SCThingsField} from '../../Classes';
|
||||||
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
|
||||||
@@ -22,6 +23,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
|
|||||||
* Filter for documents that are in the given distance of the given location
|
* Filter for documents that are in the given distance of the given location
|
||||||
*/
|
*/
|
||||||
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCSearchAbstractFilterArguments> {
|
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCSearchAbstractFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
type: 'distance';
|
type: 'distance';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
|
|||||||
* Filters for documents that match the value on the given field
|
* Filters for documents that match the value on the given field
|
||||||
*/
|
*/
|
||||||
export interface SCSearchValueFilter extends SCSearchAbstractFilter<SCValueFilterArguments> {
|
export interface SCSearchValueFilter extends SCSearchAbstractFilter<SCValueFilterArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractFilter.type
|
||||||
|
*/
|
||||||
type: 'value';
|
type: 'value';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -714,6 +714,12 @@ type SCRequiredTranslation<T> = {
|
|||||||
* Interface to be implemented by all Meta classes
|
* Interface to be implemented by all Meta classes
|
||||||
*/
|
*/
|
||||||
export interface SCMetaTranslations<T> {
|
export interface SCMetaTranslations<T> {
|
||||||
|
/**
|
||||||
|
* Field translations
|
||||||
|
*/
|
||||||
fieldTranslations: SCRequiredTranslation<T>;
|
fieldTranslations: SCRequiredTranslation<T>;
|
||||||
fieldValueTranslations: any;
|
/**
|
||||||
|
* Field value translations
|
||||||
|
*/
|
||||||
|
fieldValueTranslations: unknown;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export interface SCSearchAbstractSort<T extends SCSearchAbstractSortArguments> {
|
|||||||
/**
|
/**
|
||||||
* Map of arguments for the sort instruction
|
* Map of arguments for the sort instruction
|
||||||
*/
|
*/
|
||||||
export interface SCSearchAbstractSortArguments extends SCMap<any> {
|
export interface SCSearchAbstractSortArguments extends SCMap<unknown> {
|
||||||
/**
|
/**
|
||||||
* Field to sort by
|
* Field to sort by
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Position} from 'geojson';
|
import {Position} from 'geojson';
|
||||||
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
||||||
|
|
||||||
@@ -19,6 +20,9 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
|||||||
* Sort instruction to sort by distance
|
* Sort instruction to sort by distance
|
||||||
*/
|
*/
|
||||||
export interface SCDistanceSort extends SCSearchAbstractSort<SCDistanceSortArguments> {
|
export interface SCDistanceSort extends SCSearchAbstractSort<SCDistanceSortArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractSort.type
|
||||||
|
*/
|
||||||
type: 'distance';
|
type: 'distance';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,5 +18,8 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
|||||||
* Sort instruction for ducet sort
|
* Sort instruction for ducet sort
|
||||||
*/
|
*/
|
||||||
export interface SCDucetSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
|
export interface SCDucetSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractSort.type
|
||||||
|
*/
|
||||||
type: 'ducet';
|
type: 'ducet';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
|
|||||||
* Sort instruction to sort by price
|
* Sort instruction to sort by price
|
||||||
*/
|
*/
|
||||||
export interface SCPriceSort extends SCSearchAbstractSort<SCPriceSortArguments> {
|
export interface SCPriceSort extends SCSearchAbstractSort<SCPriceSortArguments> {
|
||||||
|
/**
|
||||||
|
* @see SCSearchAbstractSort.type
|
||||||
|
*/
|
||||||
type: 'price';
|
type: 'price';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,44 +14,129 @@
|
|||||||
*/
|
*/
|
||||||
import {expect} from 'chai';
|
import {expect} from 'chai';
|
||||||
import {slow, suite, test, timeout} from 'mocha-typescript';
|
import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||||
|
import {SCBulkResponse} from '../src/core/protocol/routes/bulk/BulkResponse';
|
||||||
|
import {SCMultiSearchResponse} from '../src/core/protocol/routes/search/MultiSearchResponse';
|
||||||
|
import {SCSearchResponse} from '../src/core/protocol/routes/search/SearchResponse';
|
||||||
import {SCThingOriginType, SCThingType} from '../src/core/Thing';
|
import {SCThingOriginType, SCThingType} from '../src/core/Thing';
|
||||||
import {SCDish} from '../src/core/things/Dish';
|
import {SCDish} from '../src/core/things/Dish';
|
||||||
import {isThing} from '../src/core/types/Guards';
|
import {
|
||||||
|
isBulkResponse,
|
||||||
|
isMultiSearchResponse,
|
||||||
|
isSearchResponse,
|
||||||
|
isThing,
|
||||||
|
isThingWithTranslations,
|
||||||
|
} from '../src/core/types/Guards';
|
||||||
|
|
||||||
@suite(timeout(10000), slow(5000))
|
@suite(timeout(10000), slow(5000))
|
||||||
export class GuardsSpec {
|
export class GuardsSpec {
|
||||||
|
|
||||||
|
static bulkResponse: SCBulkResponse = {
|
||||||
|
expiration: '2009-06-30T18:30:00+02:00 ',
|
||||||
|
source: 'bar',
|
||||||
|
state: 'done',
|
||||||
|
type: SCThingType.Dish,
|
||||||
|
uid: 'foo',
|
||||||
|
};
|
||||||
|
|
||||||
|
static dishWithTranslation: SCDish = {
|
||||||
|
categories: [
|
||||||
|
'appetizer',
|
||||||
|
],
|
||||||
|
name: 'foo',
|
||||||
|
origin: {
|
||||||
|
created: '',
|
||||||
|
type: SCThingOriginType.User,
|
||||||
|
},
|
||||||
|
translations: {
|
||||||
|
de: {
|
||||||
|
name: 'Foo',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
type: SCThingType.Dish,
|
||||||
|
uid: 'bar',
|
||||||
|
};
|
||||||
|
|
||||||
|
static notADish = {
|
||||||
|
categories: [
|
||||||
|
'appetizer',
|
||||||
|
],
|
||||||
|
name: 'foo',
|
||||||
|
origin: {
|
||||||
|
created: '',
|
||||||
|
type: SCThingOriginType.User,
|
||||||
|
},
|
||||||
|
type: 'foobar',
|
||||||
|
uid: 'bar',
|
||||||
|
};
|
||||||
|
|
||||||
|
static searchResponse: SCSearchResponse = {
|
||||||
|
data: [
|
||||||
|
GuardsSpec.dishWithTranslation,
|
||||||
|
],
|
||||||
|
facets: [
|
||||||
|
{
|
||||||
|
buckets: [
|
||||||
|
{
|
||||||
|
count: 1,
|
||||||
|
key: 'key',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
field: 'field',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
pagination: {
|
||||||
|
count: 1,
|
||||||
|
offset: 0,
|
||||||
|
total: 1,
|
||||||
|
},
|
||||||
|
stats: {
|
||||||
|
time: 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
@test
|
||||||
|
public isBulkResponse() {
|
||||||
|
expect(isBulkResponse(null)).to.be.equal(false);
|
||||||
|
expect(isBulkResponse(GuardsSpec.dishWithTranslation)).to.be.equal(false);
|
||||||
|
expect(isBulkResponse(GuardsSpec.bulkResponse)).to.be.equal(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@test
|
||||||
|
public isMultiSearchResponse() {
|
||||||
|
const multiSearchResponse: SCMultiSearchResponse = {
|
||||||
|
foo: GuardsSpec.searchResponse,
|
||||||
|
};
|
||||||
|
expect(isMultiSearchResponse(multiSearchResponse)).to.be.equal(true);
|
||||||
|
const notAMultiSearchResponse = {...multiSearchResponse, ...{bar: 'baz'}};
|
||||||
|
expect(isMultiSearchResponse(notAMultiSearchResponse)).to.be.equal(false);
|
||||||
|
delete multiSearchResponse.foo;
|
||||||
|
expect(isMultiSearchResponse(multiSearchResponse)).to.be.equal(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@test
|
||||||
|
public isSearchResponse() {
|
||||||
|
const notASearchResponse = {...GuardsSpec.searchResponse};
|
||||||
|
delete notASearchResponse.pagination;
|
||||||
|
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
|
||||||
|
delete notASearchResponse.data;
|
||||||
|
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
|
||||||
|
expect(isSearchResponse(null)).to.be.equal(false);
|
||||||
|
expect(isSearchResponse(GuardsSpec.searchResponse)).to.be.equal(true);
|
||||||
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public isThing() {
|
public isThing() {
|
||||||
const notADish = {
|
|
||||||
categories: [
|
|
||||||
'appetizer',
|
|
||||||
],
|
|
||||||
name: 'foo',
|
|
||||||
origin: {
|
|
||||||
created: '',
|
|
||||||
type: SCThingOriginType.User,
|
|
||||||
},
|
|
||||||
type: 'foobar',
|
|
||||||
uid: 'bar',
|
|
||||||
};
|
|
||||||
|
|
||||||
const dish: SCDish = {
|
|
||||||
categories: [
|
|
||||||
'appetizer',
|
|
||||||
],
|
|
||||||
name: 'foo',
|
|
||||||
origin: {
|
|
||||||
created: '',
|
|
||||||
type: SCThingOriginType.User,
|
|
||||||
},
|
|
||||||
type: SCThingType.Dish,
|
|
||||||
uid: 'bar',
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(isThing('foo')).to.be.equal(false);
|
expect(isThing('foo')).to.be.equal(false);
|
||||||
|
expect(isThing({type: 'foo'})).to.be.equal(false);
|
||||||
|
expect(isThing(GuardsSpec.notADish)).to.be.equal(false);
|
||||||
|
expect(isThing(GuardsSpec.dishWithTranslation)).to.be.equal(true);
|
||||||
|
}
|
||||||
|
|
||||||
expect(isThing(notADish)).to.be.equal(false);
|
@test
|
||||||
|
public isThingWithTranslations() {
|
||||||
expect(isThing(dish)).to.be.equal(true);
|
const dishWithoutTranslation = {...GuardsSpec.dishWithTranslation};
|
||||||
|
delete dishWithoutTranslation.translations;
|
||||||
|
expect(isThingWithTranslations(dishWithoutTranslation)).to.be.equal(false);
|
||||||
|
expect(isThingWithTranslations(GuardsSpec.dishWithTranslation)).to.be.equal(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ export class SchemaSpec {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = property.type!;
|
let type = property.type!;
|
||||||
|
|
||||||
if (isIntrinsicType(type)) {
|
if (isIntrinsicType(type)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -212,10 +212,24 @@ export class SchemaSpec {
|
|||||||
fail(`'${thingName}'#'${property.name}' element type '${elementType.type}' is not handled by this test!`);
|
fail(`'${thingName}'#'${property.name}' element type '${elementType.type}' is not handled by this test!`);
|
||||||
}
|
}
|
||||||
} else if (isReferenceType(type)) {
|
} else if (isReferenceType(type)) {
|
||||||
expect(SchemaSpec.thingNames).not.to.contain(
|
do {
|
||||||
type.name,
|
expect(SchemaSpec.thingNames).not.to.contain(
|
||||||
`Property '${property.name}' on type '${thingName}' has element type '${type.name}'.`,
|
type.name,
|
||||||
);
|
`Property '${property.name}' on type '${thingName}' has element type '${type.name}'.`,
|
||||||
|
);
|
||||||
|
|
||||||
|
const referencedObject = SchemaSpec.objects[type.name];
|
||||||
|
if (typeof referencedObject !== 'undefined') {
|
||||||
|
const referencedType = referencedObject.type;
|
||||||
|
if (typeof referencedType !== 'undefined') {
|
||||||
|
type = referencedType;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (isReferenceType(type));
|
||||||
} else if (isUnionType(type)) {
|
} else if (isUnionType(type)) {
|
||||||
for (const nestedType of type.types) {
|
for (const nestedType of type.types) {
|
||||||
if (isIntrinsicType(nestedType) || isStringLiteralType(nestedType)) {
|
if (isIntrinsicType(nestedType) || isStringLiteralType(nestedType)) {
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ export class MetaTranslationSpec {
|
|||||||
public consistencyWithMetaClass() {
|
public consistencyWithMetaClass() {
|
||||||
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish);
|
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish);
|
||||||
const dishMetaTranslationsEN = translator.translatedPropertyNames(dish, 'en');
|
const dishMetaTranslationsEN = translator.translatedPropertyNames(dish, 'en');
|
||||||
|
expect(dishMetaTranslationsEN).to.not.deep.equal(dishMetaTranslationsDE);
|
||||||
expect(dishMetaTranslationsDE).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.de);
|
expect(dishMetaTranslationsDE).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.de);
|
||||||
expect(dishMetaTranslationsEN).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.en);
|
expect(dishMetaTranslationsEN).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.en);
|
||||||
}
|
}
|
||||||
|
|||||||
344
test/Type.spec.ts
Normal file
344
test/Type.spec.ts
Normal file
@@ -0,0 +1,344 @@
|
|||||||
|
import {assert, Has, IsAny, IsNever, NotHas} from 'conditional-type-checks';
|
||||||
|
import {SCThing, SCThingWithoutReferences} from '../src/core/Thing';
|
||||||
|
import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/core/things/AcademicEvent';
|
||||||
|
import {SCArticle, SCArticleWithoutReferences} from '../src/core/things/Article';
|
||||||
|
import {SCBook, SCBookWithoutReferences} from '../src/core/things/Book';
|
||||||
|
import {SCBuilding, SCBuildingWithoutReferences} from '../src/core/things/Building';
|
||||||
|
import {SCCatalog, SCCatalogWithoutReferences} from '../src/core/things/Catalog';
|
||||||
|
import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/core/things/CourseOfStudies';
|
||||||
|
import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/core/things/DateSeries';
|
||||||
|
import {SCDiff, SCDiffWithoutReferences} from '../src/core/things/Diff';
|
||||||
|
import {SCDish, SCDishWithoutReferences} from '../src/core/things/Dish';
|
||||||
|
import {SCFavorite, SCFavoriteWithoutReferences} from '../src/core/things/Favorite';
|
||||||
|
import {SCFloor, SCFloorWithoutReferences} from '../src/core/things/Floor';
|
||||||
|
import {SCMessage, SCMessageWithoutReferences} from '../src/core/things/Message';
|
||||||
|
import {SCOrganization, SCOrganizationWithoutReferences} from '../src/core/things/Organization';
|
||||||
|
import {SCPerson, SCPersonWithoutReferences} from '../src/core/things/Person';
|
||||||
|
import {SCPointOfInterest, SCPointOfInterestWithoutReferences} from '../src/core/things/PointOfInterest';
|
||||||
|
import {SCRoom, SCRoomWithoutReferences} from '../src/core/things/Room';
|
||||||
|
import {SCSemester, SCSemesterWithoutReferences} from '../src/core/things/Semester';
|
||||||
|
import {SCSetting, SCSettingWithoutReferences} from '../src/core/things/Setting';
|
||||||
|
import {SCSportCourse, SCSportCourseWithoutReferences} from '../src/core/things/SportCourse';
|
||||||
|
import {SCStudyModule, SCStudyModuleWithoutReferences} from '../src/core/things/StudyModule';
|
||||||
|
import {SCTicket, SCTicketWithoutReferences} from '../src/core/things/Ticket';
|
||||||
|
import {SCToDo, SCToDoWithoutReferences} from '../src/core/things/ToDo';
|
||||||
|
import {SCTour, SCTourWithoutReferences} from '../src/core/things/Tour';
|
||||||
|
import {SCVideo, SCVideoWithoutReferences} from '../src/core/things/Video';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if E extends T
|
||||||
|
*/
|
||||||
|
type Extends<E, T> = E extends T ? true : false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get type of array elements up to nesting level 3
|
||||||
|
*/
|
||||||
|
type ElementType<T> = T extends any[] ?
|
||||||
|
(T[0] extends any[] ?
|
||||||
|
(T[0][0] extends any[] ?
|
||||||
|
T[0][0][0] : T[0][0]) : T[0]) : T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get types of properties
|
||||||
|
*
|
||||||
|
* - Extracts only the properties which extend object and are not any.
|
||||||
|
* - If type is an array it returns the type of the elements.
|
||||||
|
*/
|
||||||
|
type PropertyTypes<T> = Extract<ElementType<T extends object ?
|
||||||
|
(IsAny<T[keyof T]> extends true ?
|
||||||
|
never : T[keyof T]) : never>
|
||||||
|
, object>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get nested property types
|
||||||
|
*/
|
||||||
|
type PropertyTypesNested<T> = PropertyTypes<T> extends object ? PropertyTypes<PropertyTypes<T>> : PropertyTypes<T>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCDiff
|
||||||
|
*/
|
||||||
|
type SCDiffPropertyTypes = PropertyTypesNested<SCDiff>;
|
||||||
|
assert<NotHas<SCDiffPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCDiffPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCDiffPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCDiffPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCDiffWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCDiff, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCAcademicEvent
|
||||||
|
*/
|
||||||
|
type SCAcademicEventPropertyTypes = PropertyTypesNested<SCAcademicEvent>;
|
||||||
|
assert<NotHas<SCAcademicEventPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCAcademicEventPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCAcademicEventPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCAcademicEventPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCAcademicEventWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCAcademicEvent, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCArticle
|
||||||
|
*/
|
||||||
|
type SCArticlePropertyTypes = PropertyTypesNested<SCArticle>;
|
||||||
|
assert<NotHas<SCArticlePropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCArticlePropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCArticlePropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCArticlePropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCArticleWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCArticle, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCBook
|
||||||
|
*/
|
||||||
|
type SCBookPropertyTypes = PropertyTypesNested<SCBook>;
|
||||||
|
assert<NotHas<SCBookPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCBookPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCBookPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCBookPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCBookWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCBook, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCBuilding
|
||||||
|
*/
|
||||||
|
type SCBuildingPropertyTypes = PropertyTypesNested<SCBuilding>;
|
||||||
|
assert<NotHas<SCBuildingPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCBuildingPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCBuildingPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCBuildingPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCBuildingWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCBuilding, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCCatalog
|
||||||
|
*/
|
||||||
|
type SCCatalogPropertyTypes = PropertyTypesNested<SCCatalog>;
|
||||||
|
assert<NotHas<SCCatalogPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCCatalogPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCCatalogPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCCatalogPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCCatalogWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCCatalog, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCCourseOfStudies
|
||||||
|
*/
|
||||||
|
type SCCourseOfStudiesPropertyTypes = PropertyTypesNested<SCCourseOfStudies>;
|
||||||
|
assert<NotHas<SCCourseOfStudiesPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCCourseOfStudiesPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCCourseOfStudiesPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCCourseOfStudiesPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCCourseOfStudiesWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCCourseOfStudies, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCDateSeries
|
||||||
|
*/
|
||||||
|
type SCDateSeriesPropertyTypes = PropertyTypesNested<SCDateSeries>;
|
||||||
|
assert<NotHas<SCDateSeriesPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCDateSeriesPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCDateSeriesPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCDateSeriesPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCDateSeriesWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCDateSeries, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCDish
|
||||||
|
*/
|
||||||
|
type SCDishPropertyTypes = PropertyTypesNested<SCDish>;
|
||||||
|
assert<NotHas<SCDishPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCDishPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCDishPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCDishPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCDishWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCDish, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCFavorite
|
||||||
|
*/
|
||||||
|
type SCFavoritePropertyTypes = PropertyTypesNested<SCFavorite>;
|
||||||
|
assert<NotHas<SCFavoritePropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCFavoritePropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCFavoritePropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCFavoritePropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCFavoriteWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCFavorite, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCFloor
|
||||||
|
*/
|
||||||
|
type SCFloorPropertyTypes = PropertyTypesNested<SCFloor>;
|
||||||
|
assert<NotHas<SCFloorPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCFloorPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCFloorPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCFloorPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCFloorWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCFloor, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCMessage
|
||||||
|
*/
|
||||||
|
type SCMessagePropertyTypes = PropertyTypesNested<SCMessage>;
|
||||||
|
assert<NotHas<SCMessagePropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCMessagePropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCMessagePropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCMessagePropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCMessageWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCMessage, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCOrganization
|
||||||
|
*/
|
||||||
|
type SCOrganizationPropertyTypes = PropertyTypesNested<SCOrganization>;
|
||||||
|
assert<NotHas<SCOrganizationPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCOrganizationPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCOrganizationPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCOrganizationPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCOrganizationWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCOrganization, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCPerson
|
||||||
|
*/
|
||||||
|
type SCPersonPropertyTypes = PropertyTypesNested<SCPerson>;
|
||||||
|
assert<NotHas<SCPersonPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCPersonPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCPersonPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCPersonPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCPersonWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCPerson, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCPointOfInterest
|
||||||
|
*/
|
||||||
|
type SCPointOfInterestPropertyTypes = PropertyTypesNested<SCPointOfInterest>;
|
||||||
|
assert<NotHas<SCPointOfInterestPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCPointOfInterestPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCPointOfInterestPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCPointOfInterestPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCPointOfInterestWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCPointOfInterest, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCRoom
|
||||||
|
*/
|
||||||
|
type SCRoomPropertyTypes = PropertyTypesNested<SCRoom>;
|
||||||
|
assert<NotHas<SCRoomPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCRoomPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCRoomPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCRoomPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCRoomWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCRoom, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCSemester
|
||||||
|
*/
|
||||||
|
type SCSemesterPropertyTypes = PropertyTypesNested<SCSemester>;
|
||||||
|
assert<NotHas<SCSemesterPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCSemesterPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCSemesterPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCSemesterPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCSemesterWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCSemester, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCSetting
|
||||||
|
*/
|
||||||
|
type SCSettingPropertyTypes = PropertyTypesNested<SCSetting>;
|
||||||
|
assert<NotHas<SCSettingPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCSettingPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCSettingPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCSettingPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCSettingWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCSetting, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCSportCourse
|
||||||
|
*/
|
||||||
|
type SCSportCoursePropertyTypes = PropertyTypesNested<SCSportCourse>;
|
||||||
|
assert<NotHas<SCSportCoursePropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCSportCoursePropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCSportCoursePropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCSportCoursePropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCSportCourseWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCSportCourse, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCStudyModule
|
||||||
|
*/
|
||||||
|
type SCStudyModulePropertyTypes = PropertyTypesNested<SCStudyModule>;
|
||||||
|
assert<NotHas<SCStudyModulePropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCStudyModulePropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCStudyModulePropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCStudyModulePropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCStudyModuleWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCStudyModule, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCTicket
|
||||||
|
*/
|
||||||
|
type SCTicketPropertyTypes = PropertyTypesNested<SCTicket>;
|
||||||
|
assert<NotHas<SCTicketPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCTicketPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCTicketPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCTicketPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCTicketWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCTicket, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCToDo
|
||||||
|
*/
|
||||||
|
type SCToDoPropertyTypes = PropertyTypesNested<SCToDo>;
|
||||||
|
assert<NotHas<SCToDoPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCToDoPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCToDoPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCToDoPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCToDoWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCToDo, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCToDo
|
||||||
|
*/
|
||||||
|
type SCTourPropertyTypes = PropertyTypesNested<SCTour>;
|
||||||
|
assert<NotHas<SCTourPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCTourPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCTourPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCTourPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCTourWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCTour, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCVideo
|
||||||
|
*/
|
||||||
|
type SCVideoPropertyTypes = PropertyTypesNested<SCVideo>;
|
||||||
|
assert<NotHas<SCVideoPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCVideoPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCVideoPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCVideoPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCVideoWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCVideo, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy interface, to check if union types still resolve to any if one of the members is any
|
||||||
|
*/
|
||||||
|
interface Foo {
|
||||||
|
bar: SCPerson;
|
||||||
|
foo: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type that is unfortunately never - blame TypeScript
|
||||||
|
*/
|
||||||
|
type UnfortunatelyNever = PropertyTypesNested<Foo>;
|
||||||
|
assert<IsNever<UnfortunatelyNever>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flat property types
|
||||||
|
*/
|
||||||
|
type FlatPropertyTypes<T> = T[keyof T];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type that is unfortunately any - blame TypeScript
|
||||||
|
*/
|
||||||
|
type UnfortunatelyAny = FlatPropertyTypes<Foo>;
|
||||||
|
assert<IsAny<UnfortunatelyAny>>(true);
|
||||||
@@ -28,9 +28,7 @@
|
|||||||
"name": "Prüfungsamt - Team 2",
|
"name": "Prüfungsamt - Team 2",
|
||||||
"floorName": "0"
|
"floorName": "0"
|
||||||
},
|
},
|
||||||
"serviceType": {
|
"serviceType": "Prüfungsamt",
|
||||||
"name": "Prüfungsamt"
|
|
||||||
},
|
|
||||||
"origin": {
|
"origin": {
|
||||||
"indexed": "2018-09-11T12:30:00Z",
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
"name": "Dummy",
|
"name": "Dummy",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "./node_modules/@openstapps/configuration/tslint.json",
|
"extends": "./node_modules/@openstapps/configuration/tslint.json",
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-empty-interface": false
|
"no-empty-interface": false,
|
||||||
|
"file-name-casing": [false, "camel-case"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user