Compare commits

...

52 Commits

Author SHA1 Message Date
wulkanat@gmail.com
821834cfa0 0.37.0 2020-09-23 06:09:13 +02:00
Wieland Schöbl
c369c8520a fix: remove keyword tag from steps 2020-09-09 18:12:32 +02:00
Rainer Killinger
66075ef99b fix: remove redundant property declaration 2020-09-02 06:38:14 +00:00
Rainer Killinger
7a6333aa8f test: bump branch coverage limit 2020-08-31 13:52:41 +02:00
Rainer Killinger
e242a21e99 refactor: update dependencies, remove extraneous 2020-08-31 13:52:39 +02:00
Rainer Killinger
6fecd1e89d refactor: update ts-optchain dependency 2020-08-26 12:51:10 +02:00
Sebastian Lange
f6a93e668b docs: update changelog 2020-07-16 11:37:58 +02:00
Sebastian Lange
2f96bc8569 0.36.0 2020-07-16 11:37:56 +02:00
Rainer Killinger
9ce4026b1a build: lower npm audit vulnerabilities 2020-07-01 08:00:26 +00:00
Rainer Killinger
e434b2d26e test: add tests for translatedThingType function 2020-07-01 08:00:26 +00:00
Rainer Killinger
fe7f1a53ae feat: add function to get translated SCThingType 2020-07-01 08:00:26 +00:00
Frank Nagel
907d61b5d2 ci: Change 'npm audit' failure behaviour
The audit fails only if the results include a vulnerability with a level of
at least 'high' in scheduled pipelines.
2020-06-19 13:12:14 +02:00
Rainer Killinger
5fb9755841 docs: update changelog 2020-05-13 11:59:43 +02:00
Rainer Killinger
e5dd02eeca 0.35.0 2020-05-13 11:59:33 +02:00
Rainer Killinger
e7b4a426a9 test: adapt tests for translatedPropertyNames 2020-05-04 13:09:03 +02:00
Rainer Killinger
7dd74af305 refactor: simplify use of translatedPropertyNames 2020-05-04 13:08:56 +02:00
Rainer Killinger
4409101647 docs: update changelog 2020-04-21 13:40:19 +02:00
Rainer Killinger
3a141e6cf4 0.34.0 2020-04-21 13:40:11 +02:00
Rainer Killinger
8a20e3e873 build: update indirect dependencies 2020-04-14 11:06:27 +02:00
Rainer Killinger
e196303e64 refactor: state explicit type in isThing function 2020-04-14 11:05:09 +02:00
Rainer Killinger
70c1a3eaa3 feat: annotate SCThing uid and url as filterable 2020-04-14 11:03:49 +02:00
Axel Nieder-Vahrenholz
6060113df5 feat: Update src/things/book.ts - made ISBN optional 2020-04-06 09:58:51 +00:00
Rainer Killinger
39d5becb56 test: add all files with functions in coverage 2020-03-09 09:34:34 +00:00
Wieland Schöbl
f5e88569eb feat: add @sortable tags to certain translatable properties 2020-02-21 12:55:59 +01:00
Rainer Killinger
67041aa39d docs: update changelog 2020-02-11 14:39:12 +01:00
Rainer Killinger
18943612a8 0.33.0 2020-02-11 14:39:07 +01:00
Rainer Killinger
d167947e04 refactor: update dependencies 2020-02-11 13:06:03 +01:00
Rainer Killinger
2a0dc812d8 ci: saperate aduit jobs from test stage 2020-02-06 13:23:25 +01:00
Rainer Killinger
cdb8a6507d docs: update changelog 2020-02-04 16:15:26 +01:00
Rainer Killinger
5bedb27cad 0.32.0 2020-02-04 16:15:08 +01:00
Rainer Killinger
0d89b14932 feat: make SCContactPoint extend SCThing
Refactor SCPerson and SCOrganization
2019-11-25 17:31:51 +01:00
Karl-Philipp Wulfert
5de523a4bf docs: update changelog 2019-11-14 12:06:08 +01:00
Sebastian Lange
f97e199bb9 0.31.0 2019-11-14 11:04:28 +01:00
Rainer Killinger
abda5cf0ca fix: translator can now handle enum translations 2019-11-11 14:46:49 +01:00
Rainer Killinger
9658f05d31 fix: remove categories from custom translations 2019-11-11 14:46:49 +01:00
Wieland Schöbl
e92bf6f7c7 docs: update changelog 2019-11-08 11:07:38 +01:00
Wieland Schöbl
ca8c4d1c05 0.30.0 2019-11-08 11:07:37 +01:00
Wieland Schöbl
443cb748fb feat: add aggregatable tag for type field 2019-11-05 13:39:06 +01:00
Sebastian Lange
5561b36a34 refactor: add @filterable tag to filterable properties 2019-09-26 14:26:31 +02:00
Wieland Schöbl
49b55db66f docs: add checklist for adding new SCThings 2019-09-25 12:30:25 +00:00
Roman Klopsch
01f92baa98 feat: add new field sequenceIndex to message 2019-09-23 10:57:32 +02:00
Wieland Schöbl
ce5856cd86 docs: update changelog 2019-09-17 13:26:16 +02:00
Wieland Schöbl
a821bcae83 0.29.0 2019-09-17 13:26:15 +02:00
Wieland Schöbl
149f3ffff1 feat: add mappingIgnoredTags property to SCBackend 2019-09-17 11:07:35 +00:00
Wieland Schöbl
9ca7870183 docs: add documentation for @filterable tag 2019-09-10 14:47:47 +02:00
Wieland Schöbl
87ee92b19b docs: update changelog 2019-09-10 14:10:21 +02:00
Wieland Schöbl
44e61bf336 0.28.0 2019-09-10 14:10:20 +02:00
Wieland Schöbl
fba63db137 feat: add onlyOnType field for SCFacet 2019-09-10 07:42:11 +00:00
Wieland Schöbl
8a5251c2e6 docs: update changelog 2019-09-03 12:57:42 +02:00
Wieland Schöbl
bde71c7e3a 0.27.0 2019-09-03 12:57:41 +02:00
Wieland Schöbl
fec33715ad feat: add @filterable tags 2019-08-21 10:34:04 +02:00
Karl-Philipp Wulfert
6dcca89257 docs: update changelog 2019-08-19 12:10:22 +02:00
50 changed files with 3270 additions and 1768 deletions

View File

@@ -11,6 +11,7 @@ before_script:
stages:
- build
- test
- audit
- deploy
- publish
@@ -26,7 +27,7 @@ build:
expire_in: 1 week
audit:
stage: test
stage: audit
script:
- npm audit
allow_failure: true
@@ -34,9 +35,9 @@ audit:
- schedules
scheduled-audit:
stage: test
stage: audit
script:
- npm audit
- npm audit --audit-level=high
only:
- schedules

View File

@@ -1,9 +1,107 @@
# [0.36.0](https://gitlab.com/openstapps/core/compare/v0.35.0...v0.36.0) (2020-07-16)
### Features
* add function to get translated SCThingType ([fe7f1a5](https://gitlab.com/openstapps/core/commit/fe7f1a53ae46e052e23f1b39851f1547b5a8dded))
# [0.35.0](https://gitlab.com/openstapps/core/compare/v0.34.0...v0.35.0) (2020-05-13)
# [0.34.0](https://gitlab.com/openstapps/core/compare/v0.33.0...v0.34.0) (2020-04-21)
### Features
* add [@sortable](https://gitlab.com/sortable) tags to certain translatable properties ([f5e8856](https://gitlab.com/openstapps/core/commit/f5e88569eb75578febbcde67259c0c14563e53fe))
* annotate SCThing uid and url as filterable ([70c1a3e](https://gitlab.com/openstapps/core/commit/70c1a3eaa3d1c88f4b86f0df86d0d362ad1f930c))
* Update src/things/book.ts - made ISBN optional ([6060113](https://gitlab.com/openstapps/core/commit/6060113df56b871bb5014a8a961974895e52158f))
# [0.33.0](https://gitlab.com/openstapps/core/compare/v0.32.0...v0.33.0) (2020-02-11)
# [0.32.0](https://gitlab.com/openstapps/core/compare/v0.31.0...v0.32.0) (2020-02-04)
### Features
* make SCContactPoint extend SCThing ([0d89b14](https://gitlab.com/openstapps/core/commit/0d89b1493293f83e9096615f653a6094519d59f2))
# [0.31.0](https://gitlab.com/openstapps/core/compare/v0.30.0...v0.31.0) (2019-11-14)
### Bug Fixes
* remove categories from custom translations ([9658f05](https://gitlab.com/openstapps/core/commit/9658f05d31366b3735da3aa548ef5ed0255d8054))
* translator can now handle enum translations ([abda5cf](https://gitlab.com/openstapps/core/commit/abda5cf0caead37f085431e1e5a9771b79272ec6))
# [0.30.0](https://gitlab.com/openstapps/core/compare/v0.29.0...v0.30.0) (2019-11-08)
### Features
* add aggregatable tag for type field ([443cb74](https://gitlab.com/openstapps/core/commit/443cb748fba1575f5f1e16c550fd33eb7fa7901c))
* add new field sequenceIndex to message ([01f92ba](https://gitlab.com/openstapps/core/commit/01f92baa985013bfe1c79fad60351fdaf44bd676))
# [0.29.0](https://gitlab.com/openstapps/core/compare/v0.28.0...v0.29.0) (2019-09-17)
### Features
* add mappingIgnoredTags property to SCBackend ([149f3ff](https://gitlab.com/openstapps/core/commit/149f3ffff15dce27337665abba520d11bc3014dd))
# [0.28.0](https://gitlab.com/openstapps/core/compare/v0.27.0...v0.28.0) (2019-09-10)
### Features
* add onlyOnType field for SCFacet ([fba63db](https://gitlab.com/openstapps/core/commit/fba63db137c52212113545be1062d760f0c4213f))
# [0.27.0](https://gitlab.com/openstapps/core/compare/v0.26.0...v0.27.0) (2019-09-03)
### Features
* add [@filterable](https://gitlab.com/filterable) tags ([fec3371](https://gitlab.com/openstapps/core/commit/fec33715add996ae0a7125ad00ee043d288c6671))
# [0.26.0](https://gitlab.com/openstapps/core/compare/v0.25.0...v0.26.0) (2019-08-19)
### Bug Fixes
* complete german translations ([bad15dc](https://gitlab.com/openstapps/core/commit/bad15dc8728954ee6ee23fa68c471647328830b9))
### Features
* add pluginRequestTimeout field to backend config ([88f579e](https://gitlab.com/openstapps/core/commit/88f579e09bc5e7726dbc4fc788737ba49a0801cd))
# [0.25.0](https://gitlab.com/openstapps/core/compare/v0.24.0...v0.25.0) (2019-07-25)
### Bug Fixes
* correct package job ([d4a8ef6](https://gitlab.com/openstapps/core/commit/d4a8ef6))
* correct package job ([d4a8ef6](https://gitlab.com/openstapps/core/commit/d4a8ef6a9ca69849f8b981804da45e4ba907f37b))
@@ -12,7 +110,7 @@
### Features
* add new field receivingOrganisations to message ([d781dd6](https://gitlab.com/openstapps/core/commit/d781dd6))
* add new field receivingOrganisations to message ([d781dd6](https://gitlab.com/openstapps/core/commit/d781dd6de5cc7572b9218df959247b93cb2db305))
@@ -21,12 +119,12 @@
### Bug Fixes
* use correct generic for the distance filter ([f262a6b](https://gitlab.com/openstapps/core/commit/f262a6b))
* use correct generic for the distance filter ([f262a6b](https://gitlab.com/openstapps/core/commit/f262a6b8fa7a9d40234569ec490d5ef8e9437a75))
### Features
* add type maps from routes to requests and responses ([e1d4b2b](https://gitlab.com/openstapps/core/commit/e1d4b2b)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
* add type maps from routes to requests and responses ([e1d4b2b](https://gitlab.com/openstapps/core/commit/e1d4b2bc9de60a2332788c9a2264760d151c8813)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
@@ -35,8 +133,8 @@
### Features
* add mapping type from response to request and vice versa ([c18e3c1](https://gitlab.com/openstapps/core/commit/c18e3c1)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
* support 404 (resource not found) error on plugin register route ([43851d2](https://gitlab.com/openstapps/core/commit/43851d2))
* add mapping type from response to request and vice versa ([c18e3c1](https://gitlab.com/openstapps/core/commit/c18e3c15f1940338b6872343f6b20dba6346f84b)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
* support 404 (resource not found) error on plugin register route ([43851d2](https://gitlab.com/openstapps/core/commit/43851d2d358c4c342a80a863b059a6447c819c04))
@@ -49,8 +147,8 @@
### Features
* add ES annotations ([9c424b0](https://gitlab.com/openstapps/core/commit/9c424b0))
* add static typed test for consistency ([ff1f554](https://gitlab.com/openstapps/core/commit/ff1f554)), closes [#71](https://gitlab.com/openstapps/core/issues/71)
* add ES annotations ([9c424b0](https://gitlab.com/openstapps/core/commit/9c424b0f96da26d3aae9ffaadb2c640e7369ca7e))
* add static typed test for consistency ([ff1f554](https://gitlab.com/openstapps/core/commit/ff1f554e0beacb5ce2f3308c8212e2b8e4d8cbb0)), closes [#71](https://gitlab.com/openstapps/core/issues/71)
@@ -59,8 +157,8 @@
### 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))
* add translations for every SCThing ([f847a2a](https://gitlab.com/openstapps/core/commit/f847a2aa0cf576e2fd79197cdc7795638d929136))
* rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64bae08d9ca12badaedf921a24fa5ffe90552))
@@ -69,9 +167,9 @@
### Bug Fixes
* add thing without references, split thing ([da0507e](https://gitlab.com/openstapps/core/commit/da0507e)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
* adjust model to remove references from things without references ([ca72c20](https://gitlab.com/openstapps/core/commit/ca72c20)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
* remove references from origins ([1d6a2b7](https://gitlab.com/openstapps/core/commit/1d6a2b7)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
* add thing without references, split thing ([da0507e](https://gitlab.com/openstapps/core/commit/da0507ee341af75cd15dddeeb3f4cbe08899434c)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
* adjust model to remove references from things without references ([ca72c20](https://gitlab.com/openstapps/core/commit/ca72c20bd098032745ed0eb6978902b6ff6feac5)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
* remove references from origins ([1d6a2b7](https://gitlab.com/openstapps/core/commit/1d6a2b7841e9c38e68c9e5c718377a9c04fe50d6)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
@@ -80,7 +178,7 @@
### Features
* add study module interface ([d3790ad](https://gitlab.com/openstapps/core/commit/d3790ad))
* add study module interface ([d3790ad](https://gitlab.com/openstapps/core/commit/d3790adbd82417923d79b4a5a35c74fcaab3e050))
@@ -97,13 +195,13 @@
### Bug Fixes
* change SCThingMeta getInstance() return value ([4986042](https://gitlab.com/openstapps/core/commit/4986042))
* resolve issues with things that can be offered ([623ed61](https://gitlab.com/openstapps/core/commit/623ed61)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
* change SCThingMeta getInstance() return value ([4986042](https://gitlab.com/openstapps/core/commit/4986042428e24a04b73fb03d71c01353588419a7))
* resolve issues with things that can be offered ([623ed61](https://gitlab.com/openstapps/core/commit/623ed613a9405b53a86a33c13d48bc49d48de1ce)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
### Features
* provide context based search ([3242411](https://gitlab.com/openstapps/core/commit/3242411))
* provide context based search ([3242411](https://gitlab.com/openstapps/core/commit/324241176849b338bee9f5d1dcaf1109f47a8bb9))
@@ -112,7 +210,7 @@
### Features
* add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/8188731))
* add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/81887315f8c3038ec37c2197db8e193da835f6fc))
@@ -121,14 +219,14 @@
### Bug Fixes
* correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9))
* update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fca))
* correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9eb810de94ca0bb6e1298799ee3f550145))
* update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fcac42c21c68b5c6aa6bcf9bbdecfdf84de7))
### Features
* add conditional "maps" for associated types ([c8bda2e](https://gitlab.com/openstapps/core/commit/c8bda2e)), closes [#50](https://gitlab.com/openstapps/core/issues/50)
* provide sample JSON files with the package ([5d1e79d](https://gitlab.com/openstapps/core/commit/5d1e79d)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
* add conditional "maps" for associated types ([c8bda2e](https://gitlab.com/openstapps/core/commit/c8bda2eae7f44ec4a284cc26fc85051a9a45e192)), closes [#50](https://gitlab.com/openstapps/core/issues/50)
* provide sample JSON files with the package ([5d1e79d](https://gitlab.com/openstapps/core/commit/5d1e79d4879e6ce8f43d4cebb9d8c8500d5d16b7)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
@@ -137,12 +235,12 @@
### Bug Fixes
* add todo to SCThingsWithoutDiff and SCClasses ([9a49442](https://gitlab.com/openstapps/core/commit/9a49442)), closes [#39](https://gitlab.com/openstapps/core/issues/39)
* add todo to SCThingsWithoutDiff and SCClasses ([9a49442](https://gitlab.com/openstapps/core/commit/9a49442902a9f49439083a9197bd9f0a231d007d)), closes [#39](https://gitlab.com/openstapps/core/issues/39)
### Features
* add SCThingTranslator class. move functionality accordingly ([90e3d22](https://gitlab.com/openstapps/core/commit/90e3d22))
* add SCThingTranslator class. move functionality accordingly ([90e3d22](https://gitlab.com/openstapps/core/commit/90e3d2239921bbfcea27b64aef9344ffee270b6d))
@@ -151,8 +249,8 @@
### Features
* add laboratory and computer as room categories ([a0ab72e](https://gitlab.com/openstapps/core/commit/a0ab72e)), closes [#33](https://gitlab.com/openstapps/core/issues/33)
* add maxRequestBodySize in backend configuration ([b5bd09e](https://gitlab.com/openstapps/core/commit/b5bd09e))
* add laboratory and computer as room categories ([a0ab72e](https://gitlab.com/openstapps/core/commit/a0ab72e597f6a14cfc0bd8935e1ef765b86b90f7)), closes [#33](https://gitlab.com/openstapps/core/issues/33)
* add maxRequestBodySize in backend configuration ([b5bd09e](https://gitlab.com/openstapps/core/commit/b5bd09e40bfb49463815538ebaa44ff53b5d7b92))
@@ -161,7 +259,7 @@
### Features
* add model for requestBodyTooLargeError ([bc3a0f6](https://gitlab.com/openstapps/core/commit/bc3a0f6))
* add model for requestBodyTooLargeError ([bc3a0f6](https://gitlab.com/openstapps/core/commit/bc3a0f6d11cba836a55cbd5787d68cfe655b68a6))
@@ -174,7 +272,7 @@
### Features
* add config for maximum queries ([c7ab473](https://gitlab.com/openstapps/core/commit/c7ab473))
* add config for maximum queries ([c7ab473](https://gitlab.com/openstapps/core/commit/c7ab47397e2a33b1c460b9038cbf53fec148316d))
@@ -191,7 +289,7 @@
### Features
* add model for syntax error ([a3f9fcb](https://gitlab.com/openstapps/core/commit/a3f9fcb))
* add model for syntax error ([a3f9fcb](https://gitlab.com/openstapps/core/commit/a3f9fcbfb0c35206adabc95792de076518f604f7))
@@ -200,7 +298,7 @@
### Features
* add draft of todo ([2860a11](https://gitlab.com/openstapps/core/commit/2860a11))
* add draft of todo ([2860a11](https://gitlab.com/openstapps/core/commit/2860a11b618081ab88ecb1780a280cab37217a0e))
@@ -209,13 +307,13 @@
### Bug Fixes
* set larger v8 stack size ([d3d08e7](https://gitlab.com/openstapps/core/commit/d3d08e7))
* set larger v8 stack size ([d3d08e7](https://gitlab.com/openstapps/core/commit/d3d08e7735808d4eae5aab4b263e36047c608679))
### Features
* add different origin types: remote and user ([13a4965](https://gitlab.com/openstapps/core/commit/13a4965)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
* add saveable thing for saving user/client data ([a4f3fab](https://gitlab.com/openstapps/core/commit/a4f3fab)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
* add different origin types: remote and user ([13a4965](https://gitlab.com/openstapps/core/commit/13a49650c4498f6edbe17c9de3598e0180b866da)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
* add saveable thing for saving user/client data ([a4f3fab](https://gitlab.com/openstapps/core/commit/a4f3fab033ca18352c0119061f2d0e64252d4bbb)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
@@ -224,7 +322,7 @@
### Features
* use tag [@validatable](https://gitlab.com/validatable) to mark schema types ([7f248ee](https://gitlab.com/openstapps/core/commit/7f248ee))
* use tag [@validatable](https://gitlab.com/validatable) to mark schema types ([7f248ee](https://gitlab.com/openstapps/core/commit/7f248eea13c732a95c4ee8e1bc91afeee52e8c2d))
@@ -233,9 +331,9 @@
### Features
* add base scheme for academic degrees ([85c8fc4](https://gitlab.com/openstapps/core/commit/85c8fc4))
* add schema for course of studies ([2d4a76a](https://gitlab.com/openstapps/core/commit/2d4a76a))
* add tool to generate documentation for routes ([1a07df2](https://gitlab.com/openstapps/core/commit/1a07df2))
* add base scheme for academic degrees ([85c8fc4](https://gitlab.com/openstapps/core/commit/85c8fc49c14b0ce45cf0cfdaf46c1ebe43b23ec7))
* add schema for course of studies ([2d4a76a](https://gitlab.com/openstapps/core/commit/2d4a76a555603a395c81a7a92ce5d95ed04de9de))
* add tool to generate documentation for routes ([1a07df2](https://gitlab.com/openstapps/core/commit/1a07df2d676895264f43b0138645d7c13f60c9db))
@@ -243,12 +341,12 @@
## [0.0.1](https://gitlab.com/openstapps/core/compare/2d770dd...v0.0.1) (2018-11-29)
## [0.0.1](https://gitlab.com/openstapps/core/compare/2d770dde4464dc4cf4cdc29927aa4e4382914148...v0.0.1) (2018-11-29)
### Features
* add core ([2d770dd](https://gitlab.com/openstapps/core/commit/2d770dd))
* add core ([2d770dd](https://gitlab.com/openstapps/core/commit/2d770dde4464dc4cf4cdc29927aa4e4382914148))

View File

@@ -28,6 +28,33 @@ The [core tools](https://openstapps.gitlab.io/core-tools) are more or less not d
App and connectors should be updated regularly to new releases of the core but not as important like API and backend. Since the app is just a view for the data stored in the backend it is not necessary to be up to date with the newest core immediately and the connectors are developed independently by every school and up to their responsibility.
## Adding new Types
Adding new types requires changes at multiple locations for it to work correctly
### Required changes
* Add your SCThing and SCThingWithoutReferences to `src/things/your-thing-name.ts` and make them extend `SCThingWithoutReferences` and `SCThing` respectively
* Add your SCThingMeta to `src/things/your-thing-name.ts` and make it extend `SCThingMeta`
* Add your SCThingMeta to `SCClasses` in `src/meta.ts`
* Add your SCThing to `SCThingsWithoutDiff` in `src/meta.ts`
* Add your SCThingWithoutReferences to `SCAssociatedThingWithoutReferences` in `src/meta.ts`
* Add your SCThing to `SCAssociatedThing` in `src/meta.ts`
* Add your SCThing to the `SCThingType` enum in `src/things/abstract/thing.ts`
* Add an example file for your SCThing in `test/resources/YourThingName.json`
* Add the following lines for your SCThing in `test/type.spec.ts`:
```typescript
/**
* Types of properties of SCYourThingName
*/
type SCYourThingNamePropertyTypes = PropertyTypesNested<SCYourThingName>;
assert<NotHas<SCYourThingNamePropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCYourThingNamePropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCYourThingNamePropertyTypes, SCThing>>(true);
assert<Has<SCYourThingNamePropertyTypes, SCThing>>(false);
assert<Extends<SCYourThingNameWithoutReferences, SCThing>>(false);
assert<Extends<SCYourThingName, SCThing>>(true);
```
## Additional coding style
### Extract inline type definitions

View File

@@ -37,13 +37,14 @@ External dependencies can not be covered by the annotations. Documentation about
| 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 | |
| `@aggregatable` | used for generating of aggregations of the field if the core schema is used to put data into a database/key-value store | whether the property is being used on the top type or across all types: `global` |
| `@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 |
| `@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 | |
| `@filterable` | non-object/nested field is filterable if the core schema is used to put data into a database/key-value store | |

4112
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@openstapps/core",
"version": "0.26.0",
"version": "0.37.0",
"description": "StAppsCore - Generalized model of data",
"keywords": [
"Model",
@@ -36,7 +36,7 @@
"Imran Hossain",
"Jovan Krunić <jovan.krunic@gmail.com>",
"Michel Jonathan Schmitz",
"Rainer Killinger",
"Rainer Killinger <mail-openstapps@killinger.co>",
"Sebastian Lange",
"Wieland Schöbl",
"Roman Klopsch"
@@ -44,37 +44,35 @@
"dependencies": {
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/node": "10.14.14",
"@types/node": "10.17.14",
"fast-clone": "1.5.13",
"http-status-codes": "1.3.2",
"http-status-codes": "2.1.2",
"json-patch": "0.7.0",
"jsonschema": "1.2.4",
"ts-optchain": "0.1.3"
"jsonschema": "1.2.5",
"ts-optchain": "0.1.8"
},
"devDependencies": {
"@krlwlfrt/async-pool": "0.1.0",
"@openstapps/configuration": "0.21.1",
"@openstapps/core-tools": "0.8.0",
"@openstapps/logger": "0.4.0",
"@types/chai": "4.1.7",
"@types/rimraf": "2.0.2",
"@openstapps/configuration": "0.24.0",
"@openstapps/core-tools": "0.14.0",
"@openstapps/logger": "0.5.0",
"@types/chai": "4.2.12",
"@types/rimraf": "3.0.0",
"chai": "4.2.0",
"commander": "2.20.0",
"conditional-type-checks": "1.0.1",
"conventional-changelog-cli": "2.0.23",
"mocha": "6.2.0",
"conditional-type-checks": "1.0.5",
"conventional-changelog-cli": "2.1.0",
"mocha": "8.1.1",
"mocha-typescript": "1.1.17",
"nyc": "14.1.1",
"rimraf": "2.6.3",
"source-map-support": "0.5.13",
"ts-node": "8.3.0",
"tslint": "5.18.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"source-map-support": "0.5.19",
"ts-node": "9.0.0",
"tslint": "6.1.3",
"typedoc": "0.14.2",
"typescript": "3.5.3"
},
"nyc": {
"all": true,
"branches": 85,
"branches": 90,
"check-coverage": true,
"exclude": [],
"extension": [
@@ -84,6 +82,8 @@
"include": [
"src/protocol/route.ts",
"src/things/abstract/thing.ts",
"src/things/abstract/thing-that-can-be-offered.ts",
"src/things/abstract/thing-with-categories.ts",
"src/translator.ts",
"src/guards.ts"
],

View File

@@ -37,6 +37,13 @@ export interface SCBackendConfiguration {
*/
hiddenTypes: SCThingType[];
/**
* A list of tags that will be ignored by the mapping generator
*
* The ignored tags should mainly be tags that are irrelevant to the mapping. The tags should include the '@'.
*/
mappingIgnoredTags: string[];
/**
* Maximum number of queries, that can be used in MultiSearchRoute
*/

View File

@@ -18,11 +18,15 @@
export interface SCLanguage {
/**
* The two letter ISO 639-1 Code of the Language
*
* @filterable
*/
code: SCLanguageCode;
/**
* The Fulltext name of the Language
*
* @filterable
*/
name: SCLanguageName;
}

View File

@@ -15,6 +15,7 @@
/**
* Universally unique identifier of the thing
*
* @filterable
* @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
* @see http://stackoverflow.com/questions/7905929/how-to-test-valid-uuid-guid
*/

View File

@@ -41,7 +41,7 @@ export function isThing(something: unknown): something is SCThing {
return Object
.values(SCThingType)
.indexOf(type) >= 0;
.indexOf(type as SCThingType) >= 0;
}
/**

View File

@@ -18,6 +18,7 @@ import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/art
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book';
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building';
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog';
import {SCContactPoint, SCContactPointMeta, SCContactPointWithoutReferences} from './things/contact-point';
import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/course-of-studies';
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series';
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff';
@@ -49,6 +50,7 @@ export const SCClasses: { [K in SCThingType]: object } = {
'book': SCBookMeta,
'building': SCBuildingMeta,
'catalog': SCCatalogMeta,
'contact point': SCContactPointMeta,
'course of studies': SCCourseOfStudiesMeta,
'date series': SCDateSeriesMeta,
'diff': SCDiffMeta,
@@ -76,6 +78,7 @@ export type SCThingsWithoutDiff =
| SCBook
| SCBuilding
| SCCatalog
| SCContactPoint
| SCCourseOfStudies
| SCDateSeries
| SCDish
@@ -116,26 +119,27 @@ export type SCAssociatedThingWithoutReferences<THING extends SCThings> =
THING extends SCBook ? SCBookWithoutReferences :
THING extends SCBuilding ? SCBuildingWithoutReferences :
THING extends SCCatalog ? SCCatalogWithoutReferences :
THING extends SCCourseOfStudies ? SCCourseOfStudiesWithoutReferences :
THING extends SCDateSeries ? SCDateSeriesWithoutReferences :
THING extends SCDiff ? SCDiffWithoutReferences :
THING extends SCDish ? SCDishWithoutReferences :
THING extends SCFavorite ? SCFavoriteWithoutReferences :
THING extends SCFloor ? SCFloorWithoutReferences :
THING extends SCMessage ? SCMessageWithoutReferences :
THING extends SCOrganization ? SCOrganizationWithoutReferences :
THING extends SCPerson ? SCPersonWithoutReferences :
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences :
THING extends SCRoom ? SCRoomWithoutReferences :
THING extends SCSemester ? SCSemesterWithoutReferences :
THING extends SCSetting ? SCSettingWithoutReferences :
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
THING extends SCTicket ? SCTicketWithoutReferences :
THING extends SCToDo ? SCToDoWithoutReferences :
THING extends SCTour ? SCTourWithoutReferences :
THING extends SCVideo ? SCVideoWithoutReferences :
never;
THING extends SCContactPoint ? SCContactPointWithoutReferences :
THING extends SCCourseOfStudies ? SCCourseOfStudiesWithoutReferences :
THING extends SCDateSeries ? SCDateSeriesWithoutReferences :
THING extends SCDiff ? SCDiffWithoutReferences :
THING extends SCDish ? SCDishWithoutReferences :
THING extends SCFavorite ? SCFavoriteWithoutReferences :
THING extends SCFloor ? SCFloorWithoutReferences :
THING extends SCMessage ? SCMessageWithoutReferences :
THING extends SCOrganization ? SCOrganizationWithoutReferences :
THING extends SCPerson ? SCPersonWithoutReferences :
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences :
THING extends SCRoom ? SCRoomWithoutReferences :
THING extends SCSemester ? SCSemesterWithoutReferences :
THING extends SCSetting ? SCSettingWithoutReferences :
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
THING extends SCTicket ? SCTicketWithoutReferences :
THING extends SCToDo ? SCToDoWithoutReferences :
THING extends SCTour ? SCTourWithoutReferences :
THING extends SCVideo ? SCVideoWithoutReferences :
never;
/**
* Thing for a thing without references
@@ -146,23 +150,24 @@ export type SCAssociatedThing<THING extends SCThings> =
THING extends SCBookWithoutReferences ? SCBook :
THING extends SCBuildingWithoutReferences ? SCBuilding :
THING extends SCCatalogWithoutReferences ? SCCatalog :
THING extends SCCourseOfStudiesWithoutReferences ? SCCourseOfStudies :
THING extends SCDateSeriesWithoutReferences ? SCDateSeries :
THING extends SCDiffWithoutReferences ? SCDiff :
THING extends SCDishWithoutReferences ? SCDish :
THING extends SCFavoriteWithoutReferences ? SCFavorite :
THING extends SCFloorWithoutReferences ? SCFloor :
THING extends SCMessageWithoutReferences ? SCMessage :
THING extends SCOrganizationWithoutReferences ? SCOrganization :
THING extends SCPersonWithoutReferences ? SCPerson :
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest :
THING extends SCRoomWithoutReferences ? SCRoom :
THING extends SCSemesterWithoutReferences ? SCSemester :
THING extends SCSettingWithoutReferences ? SCSetting :
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
THING extends SCTicketWithoutReferences ? SCTicket :
THING extends SCToDoWithoutReferences ? SCToDo :
THING extends SCTourWithoutReferences ? SCTour :
THING extends SCVideoWithoutReferences ? SCVideo :
never;
THING extends SCContactPointWithoutReferences ? SCContactPoint :
THING extends SCCourseOfStudiesWithoutReferences ? SCCourseOfStudies :
THING extends SCDateSeriesWithoutReferences ? SCDateSeries :
THING extends SCDiffWithoutReferences ? SCDiff :
THING extends SCDishWithoutReferences ? SCDish :
THING extends SCFavoriteWithoutReferences ? SCFavorite :
THING extends SCFloorWithoutReferences ? SCFloor :
THING extends SCMessageWithoutReferences ? SCMessage :
THING extends SCOrganizationWithoutReferences ? SCOrganization :
THING extends SCPersonWithoutReferences ? SCPerson :
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest :
THING extends SCRoomWithoutReferences ? SCRoom :
THING extends SCSemesterWithoutReferences ? SCSemester :
THING extends SCSettingWithoutReferences ? SCSetting :
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
THING extends SCTicketWithoutReferences ? SCTicket :
THING extends SCToDoWithoutReferences ? SCToDo :
THING extends SCTourWithoutReferences ? SCTour :
THING extends SCVideoWithoutReferences ? SCVideo :
never;

View File

@@ -13,6 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingsField} from '../../meta';
import {SCThingType} from '../../things/abstract/thing';
/**
* A search facet
@@ -27,6 +28,11 @@ export interface SCFacet {
* Field of the aggregation
*/
field: SCThingsField;
/**
* Type of the aggregation
*/
onlyOnType?: SCThingType;
}
/**

View File

@@ -29,6 +29,7 @@ export interface SCAcademicDegreeWithoutReferences
* The achievable academic degree with academic field specification
* (eg. Master of Science)
*
* @filterable
* @keyword
*/
academicDegreewithField: string;
@@ -37,6 +38,7 @@ export interface SCAcademicDegreeWithoutReferences
* The achievable academic degree with academic field specification
* shorted (eg. M.Sc.).
*
* @filterable
* @keyword
*/
academicDegreewithFieldShort: string;

View File

@@ -25,27 +25,36 @@ export interface SCAcademicTermWithoutReferences
* Short name of the academic term, using the given pattern
*
* @aggregatable
* @filterable
* @keyword
*/
acronym: string;
/**
* End date of the academic term
*
* @filterable
*/
endDate: SCISO8601Date;
/**
* End date of lectures in the academic term
*
* @filterable
*/
eventsEndDate?: SCISO8601Date;
/**
* Start date of lectures in the academic term
*
* @filterable
*/
eventsStartDate?: SCISO8601Date;
/**
* Start date of the academic term
*
* @filterable
*/
startDate: SCISO8601Date;
}

View File

@@ -32,6 +32,8 @@ export interface SCCreativeWorkWithoutReferences
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
/**
* Date the creative work was published
*
* @filterable
*/
datePublished?: SCISO8601Date;
@@ -44,6 +46,7 @@ export interface SCCreativeWorkWithoutReferences
* Keywords of the creative work
*
* @aggregatable
* @filterable
* @keyword
*/
keywords?: string[];

View File

@@ -40,31 +40,43 @@ export interface SCGeoInformation {
export interface SCPostalAddress {
/**
* Country of the address
*
* @filterable
*/
addressCountry: string;
/**
* City of the address
*
* @filterable
*/
addressLocality: string;
/**
* State of the address
*
* @filterable
*/
addressRegion?: string;
/**
* Zip code of the address
*
* @filterable
*/
postalCode: string;
/**
* Optional post box number
*
* @filterable
*/
postOfficeBoxNumber?: string;
/**
* Street of the address - with house number!
*
* @filterable
*/
streetAddress: string;
}

View File

@@ -30,6 +30,8 @@ export interface SCThingThatAcceptsPaymentsWithoutReferences
extends SCThingWithoutReferences {
/**
* Accepted payments of the place
*
* @filterable
*/
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];
}

View File

@@ -29,6 +29,7 @@ export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWith
*
* @sortable ducet
* @aggregatable
* @filterable
*/
categories: T[];
@@ -63,6 +64,8 @@ export interface SCThingWithCategoriesTranslatableProperties
extends SCThingTranslatableProperties {
/**
* translations of the categories of a thing with categories
*
* @sortable ducet
*/
categories?: string[];
}
@@ -97,6 +100,7 @@ export interface SCThingWithCategoriesSpecificValues {
/**
* Category specific name of a thing
*
* @sortable ducet
* @text
*/
name?: string;

View File

@@ -27,6 +27,7 @@ export enum SCThingType {
Book = 'book',
Building = 'building',
Catalog = 'catalog',
ContactPoint = 'contact point',
CourseOfStudies = 'course of studies',
DateSeries = 'date series',
Diff = 'diff',
@@ -55,6 +56,7 @@ export interface SCThingWithoutReferences {
/**
* Alternate names of the thing
*
* @filterable
* @keyword
*/
alternateNames?: string[];
@@ -74,6 +76,7 @@ export interface SCThingWithoutReferences {
/**
* Name of the thing
*
* @filterable
* @minLength 1
* @sortable ducet
* @text
@@ -89,7 +92,8 @@ export interface SCThingWithoutReferences {
* Type of the thing
*
* @sortable ducet
* @aggregatable
* @filterable
* @aggregatable global
*/
type: SCThingType;
/**
@@ -98,6 +102,8 @@ export interface SCThingWithoutReferences {
uid: SCUuid;
/**
* URL of the thing
*
* @filterable
*/
url?: string;
}
@@ -219,6 +225,7 @@ export interface SCThingTranslatableProperties {
/**
* Translation of the name of the thing
*
* @sortable ducet
* @text
*/
name?: string;

View File

@@ -33,6 +33,7 @@ export interface SCAcademicEventWithoutReferences
* Majors of the academic event that this event belongs to
*
* @aggregatable
* @filterable
* @keyword
*/
majors?: string[];
@@ -40,6 +41,7 @@ export interface SCAcademicEventWithoutReferences
/**
* Original unmapped category from the source of the academic event
*
* @filterable
* @keyword
*/
originalCategory?: string;

View File

@@ -31,6 +31,7 @@ export interface SCBookWithoutReferences
/**
* Edition of a book
*
* @filterable
* @keyword
*/
bookEdition?: string;
@@ -38,9 +39,10 @@ export interface SCBookWithoutReferences
/**
* ISBN of a book
*
* @filterable
* @keyword
*/
isbn: string;
isbn?: string;
/**
* Number of pages of a book

View File

@@ -41,17 +41,10 @@ export type SCBuildingCategories =
export interface SCBuildingWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories, SCThingWithCategoriesSpecificValues>,
SCPlaceWithoutReferences {
/**
* Categories of a building
*
* @sortable ducet
* @aggregatable
*/
categories: SCBuildingCategories[];
/**
* List of floor names of the place
*
* @filterable
* @keyword
*/
floors?: string[];

136
src/things/contact-point.ts Normal file
View File

@@ -0,0 +1,136 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations} from '../general/i18n';
import {
SCThing,
SCThingMeta,
SCThingType,
SCThingWithoutReferences,
} from './abstract/thing';
import {SCRoomWithoutReferences} from './room';
/**
* A contact point without references
*/
export interface SCContactPointWithoutReferences
extends SCThingWithoutReferences {
/**
* E-mail at the work location
*
* @keyword
*/
email?: string;
/**
* Fax number at the work location
*
* @keyword
*/
faxNumber?: string;
/**
* Office hours for contacting someone at the work location
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
* @keyword
*/
officeHours?: string;
/**
* Contact number at the work location
*
* @keyword
*/
telephone?: string;
/**
* Type of a contact point
*/
type: SCThingType.ContactPoint;
/**
* URL at the work location
*
* @keyword
*/
url?: string;
}
/**
* A contact point
*
* @see http://schema.org/ContactPoint
*
* @validatable
* @indexable
*/
export interface SCContactPoint
extends SCContactPointWithoutReferences, SCThing {
/**
* Exact place where work is performed
*/
areaServed?: SCRoomWithoutReferences;
/**
* Type of a contact point
*/
type: SCThingType.ContactPoint;
}
/**
* Meta information about a contact point
*/
export class SCContactPointMeta
extends SCThingMeta
implements SCMetaTranslations<SCContactPoint> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
areaServed: 'Arbeitsraum',
email: 'E-Mail-Addresse',
faxNumber: 'Faxnummer',
officeHours: 'Sprechzeiten',
telephone: 'Telefonnummer',
url: 'Link',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
areaServed: 'location',
email: 'email address',
faxNumber: 'fax number',
officeHours: 'office hours',
telephone: 'telephone number',
url: 'link',
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
type: 'Kontaktinformation',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
type: SCThingType.ContactPoint,
},
};
}

View File

@@ -39,6 +39,7 @@ export interface SCCourseOfStudiesWithoutReferences
/**
* Actual major of the course of studies (eg. physics)
*
* @filterable
* @keyword
*/
major: string;

View File

@@ -47,6 +47,8 @@ export interface SCDateSeriesWithoutReferences
extends SCThingThatCanBeOfferedWithoutReferences {
/**
* Dates of the date series that are initially planned to be held
*
* @filterable
*/
dates: SCISO8601Date[];

View File

@@ -38,18 +38,11 @@ export interface SCDishWithoutReferences
/**
* Additives of the dish
*
* @filterable
* @keyword
*/
additives?: string[];
/**
* Category of the dish
*
* @sortable ducet
* @aggregatable
*/
categories: SCDishCategories[];
/**
* Characteristics of the dish
*/
@@ -118,6 +111,7 @@ export interface SCDishCharacteristic {
/**
* Name of the characteristic
*
* @filterable
* @text
*/
name: string;

View File

@@ -36,11 +36,15 @@ export interface SCMessageWithoutReferences
/**
* Roles for which the message is intended
*
* @filterable
*/
audiences: SCMessageAudience[];
/**
* When the message was created
*
* @filterable
*/
dateCreated?: SCISO8601Date;
@@ -51,6 +55,11 @@ export interface SCMessageWithoutReferences
*/
messageBody: string;
/**
* An index for applying a custom sorting of multiple messages
*/
sequenceIndex?: number;
/**
* Translated fields of a message
*/
@@ -119,6 +128,7 @@ export class SCMessageMeta
audiences: 'Zielgruppen',
dateCreated: 'Erstellungsdatum',
messageBody: 'Nachrichteninhalt',
sequenceIndex: 'Sequenzindex',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
@@ -127,6 +137,7 @@ export class SCMessageMeta
audiences: 'audiences',
dateCreated: 'date created',
messageBody: 'message body',
sequenceIndex: 'sequence index',
},
};

View File

@@ -15,6 +15,7 @@
import {SCMetaTranslations} from '../general/i18n';
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
import {SCContactPointWithoutReferences} from './contact-point';
/**
* An organization without references
@@ -35,6 +36,11 @@ export interface SCOrganizationWithoutReferences
*/
export interface SCOrganization
extends SCOrganizationWithoutReferences, SCThingInPlace {
/**
* A list of contact points concerning the organization
*/
contactPoints?: SCContactPointWithoutReferences[];
/**
* Type of an organization
*/
@@ -52,9 +58,11 @@ export class SCOrganizationMeta
fieldTranslations = {
de: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.de,
contactPoints: 'Kontaktinformationen',
},
en: {
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations.en,
contactPoints: 'contact details',
},
};

View File

@@ -16,6 +16,7 @@ import {SCMetaTranslations, SCNationality} from '../general/i18n';
import {SCISO8601Date} from '../general/time';
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCBuildingWithoutReferences} from './building';
import {SCContactPointWithoutReferences} from './contact-point';
import {SCOrganizationWithoutReferences} from './organization';
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
import {SCRoomWithoutReferences} from './room';
@@ -28,12 +29,15 @@ export interface SCPersonWithoutReferences
/**
* Additional first names of the person.
*
* @filterable
* @keyword
*/
additionalName?: string;
/**
* The birth date of the person.
*
* @filterable
*/
birthDate?: SCISO8601Date;
@@ -42,6 +46,7 @@ export interface SCPersonWithoutReferences
*
* @TJS-format email
*
* @filterable
* @keyword
*/
email?: string;
@@ -49,6 +54,7 @@ export interface SCPersonWithoutReferences
/**
* The family name of the person.
*
* @filterable
* @keyword
*/
familyName: string;
@@ -56,18 +62,22 @@ export interface SCPersonWithoutReferences
/**
* The private fax number of the person.
*
* @filterable
* @keyword
*/
faxNumber?: string;
/**
* The gender of the person.
*
* @filterable
*/
gender?: SCPersonGender;
/**
* The first name of the person.
*
* @filterable
* @keyword
*/
givenName: string;
@@ -75,6 +85,7 @@ export interface SCPersonWithoutReferences
/**
* Honorific prefix of the person.
*
* @filterable
* @keyword
*/
honorificPrefix?: string;
@@ -82,6 +93,7 @@ export interface SCPersonWithoutReferences
/**
* Honorific suffix of the person.
*
* @filterable
* @keyword
*/
honorificSuffix?: string;
@@ -89,6 +101,7 @@ export interface SCPersonWithoutReferences
/**
* Titles of jobs that the person has.
*
* @filterable
* @keyword
*/
jobTitles?: string[];
@@ -96,6 +109,7 @@ export interface SCPersonWithoutReferences
/**
* The complete name of the person combining all the parts of the name into one.
*
* @filterable
* @text
*/
name: string;
@@ -146,7 +160,7 @@ export interface SCPerson
/**
* Locations where the person performs her/his work
*/
workLocations?: SCContactPoint[];
workLocations?: SCContactPointWithoutReferences[];
}
/**
@@ -175,13 +189,14 @@ export class SCPersonMeta
jobTitles: 'Berufsbezeichnungen',
nationality: 'Staatsangehörigkeit',
telephone: 'Telefonnummer',
workLocations: 'Arbeitsorte',
workLocations: 'Arbeitsstandorte',
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
additionalName: 'additional name',
affiliations: 'affiliations',
birthDate: 'birth date',
contactDetails: 'contact details',
email: 'email',
familyName: 'family name',
faxNumber: 'fax',
@@ -218,53 +233,6 @@ export class SCPersonMeta
};
}
/**
* A contact point
*
* @see http://schema.org/ContactPoint
*/
export interface SCContactPoint {
/**
* Exact place where work is performed
*/
areaServed?: SCRoomWithoutReferences;
/**
* E-mail at the work location
*
* @keyword
*/
email?: string;
/**
* Fax number at the work location
*
* @keyword
*/
faxNumber?: string;
/**
* Times available for contacting at the work location
*
* @keyword
*/
hoursAvailable?: string;
/**
* Contact number at the work location
*
* @keyword
*/
telephone?: string;
/**
* URL at the work location
*
* @keyword
*/
url?: string;
}
/**
* Gender of a person
*/

View File

@@ -58,6 +58,7 @@ export interface SCRoomWithoutReferences
/**
* The name of the floor in which the room is in.
*
* @filterable
* @text
*/
floorName?: string;

View File

@@ -28,6 +28,7 @@ export interface SCSemesterWithoutReferences
/**
* The short name of the semester, using the given pattern.
*
* @filterable
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
* @keyword
*/

View File

@@ -27,10 +27,6 @@ import {
*/
export interface SCSettingWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
/**
* Categories of a setting
*/
categories: SCSettingCategories[];
/**
* The default value of a setting
*/

View File

@@ -47,6 +47,7 @@ export interface SCStudyModuleWithoutReferences
/**
* Majors that this study module is meant for
*
* @filterable
* @keyword
*/
majors: string[];

View File

@@ -35,6 +35,8 @@ export interface SCToDoWithoutReferences
/**
* A date when the "to do" is due
*
* @filterable
*/
dueDate?: SCISO8601Date;

View File

@@ -29,8 +29,6 @@ export interface SCTourWithoutReferences
/**
* Steps of a tour
*
* @keyword
*/
steps: SCTourStep[];

View File

@@ -68,6 +68,8 @@ export interface SCVideoSource {
/**
* MIME-Type of the source File
*
* @filterable
*/
mimeType: SCVideoMimeType;
@@ -101,6 +103,8 @@ export interface SCVideoTrack {
/**
* Content Type of the Track File
*
* @filterable
*/
type: SCVideoTrackTypes;

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import clone = require('fast-clone');
import {Defined, OCType} from 'ts-optchain';
import {Defined, TSOCType} from 'ts-optchain';
import {SCTranslations} from './general/i18n';
import {isThing} from './guards';
import {SCClasses} from './meta';
@@ -76,12 +76,12 @@ export class SCThingTranslator {
* Get field value translation recursively
*
* @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 TSOCType<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): TSOCType<T> {
const proxy = new Proxy(
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as TSOCType<T>,
{
get: (target, key) => {
const obj: any = target();
@@ -146,8 +146,8 @@ export class SCThingTranslator {
* Applies known field value translations of the given SCThings meta class to an instance
* Translated values overwrite current values inplace (destructive)
*
* @param language The language the thing is translated to
* @param thing The thing that will be translated
* @param instance The thing / object that will be translated
* @param language The language the thing / object is translated to
* @returns The thing with translated meta field values
*/
private replaceAvailableMetaFieldValueTranslations(instance: any,
@@ -159,13 +159,18 @@ export class SCThingTranslator {
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldValueTranslations[language])
.forEach((key) => {
if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
if (metaClass.fieldValueTranslations[language][key] instanceof Object
&& (instance as any)[key] instanceof Object) {
// Assigns known translations of subproperties to property in given language (e.g. categories)
Object.keys((instance as any)[key])
.forEach((subKey) => {
(instance as any)[key][subKey] =
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
});
} else if (metaClass.fieldValueTranslations[language][key] instanceof Object
&& typeof (instance as any)[key] === 'string') {
// Assigns known translations of enum to property in given language (e.g. SCSettingInputType)
(instance as any)[key] = metaClass.fieldValueTranslations[language][key][(instance as any)[key]];
} else {
// Assigns property to known translation of fieldValueTranslations in given language
(instance as any)[key] = metaClass.fieldValueTranslations[language][key];
@@ -184,14 +189,14 @@ export class SCThingTranslator {
* // or
* const dishTranslatedAccess = translator.translate(dish);
* dishTranslatedAccess.offers[0].inPlace.categories[1]();
* // undoing the OCType<T>
* // undoing the TSTSOCType<T>
* const dishAsBefore: SCDish = dishTranslatedAccess()!;
* @param data Top level object that gets passed through the recursion
* @returns an OCType<T> object allowing for access to translations or a translated value(s)
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
*/
public translate<T extends SCThing>(data: T): OCType<T> {
public translate<T extends SCThing>(data: T): TSOCType<T> {
return new Proxy(
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as OCType<T>,
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as TSOCType<T>,
{
get: (target, key) => {
const obj: any = target();
@@ -213,23 +218,43 @@ export class SCThingTranslator {
* All the values will be set to the known translations of the property/key name
* @example
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
* @param language The language the object is translated to
* @param thingType Type of the thing
* @param type The type whose property names will be translated
* @param language The language all property names will be translated to
* @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>(type: SCThingType,
language?: keyof SCTranslations<T>): T | undefined {
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
return this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T;
return this.getAllMetaFieldTranslations(type, targetLanguage) as T;
}
/**
* Given a SCThingType this function will translate it
*
* @param type The type that will be translated
* @param language The language the type will be translated to
* @returns Known translation of type parameter
*/
public translatedThingType<T extends unknown>(type: SCThingType,
language?: keyof SCTranslations<T>): string {
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
const metaClass = this.getMetaClassInstance(type);
if (typeof metaClass.fieldValueTranslations[targetLanguage] !== 'undefined' &&
typeof metaClass.fieldValueTranslations[targetLanguage].type !== 'undefined') {
return metaClass.fieldValueTranslations[targetLanguage].type as string ;
}
return type;
}
/**
* Recursively translates the given object in-place
* Translated values overwrite current values (destructive)
*
* @param language The language the thing is translated to
* @param thing The thing that will be translated
* @param instance The thing / object that will be translated
* @param language The language the thing / object is translated to
* @returns The thing translated
*/
public translateWholeThingDestructively(instance: any,

View File

@@ -0,0 +1,39 @@
{
"errorNames": [],
"instance": {
"type": "contact point",
"name": "Dienstadresse",
"areaServed": {
"type": "room",
"categories": [
"education"
],
"uid": "39c1a574-04ef-5157-9c6f-e271d93eb273",
"name": "3.G 121",
"alternateNames": [
"Dienstzimmer"
],
"geo": {
"point": {
"coordinates": [
8.66919,
50.12834
],
"type": "Point"
}
}
},
"email": "info@example.com",
"faxNumber": "069 / 123450",
"officeHours": "Mo, Mi 8:00-13:00",
"telephone": "069 / 12345",
"url": "https://example.com",
"uid": "be34a419-e9e8-5de0-b998-dd1b19e7beef",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",
"type": "remote"
}
},
"schema": "SCContactPoint"
}

View File

@@ -21,6 +21,7 @@
"audiences": [
"students"
],
"sequenceIndex": 1010,
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",

View File

@@ -21,6 +21,7 @@
"audiences": [
"students"
],
"sequenceIndex": 1020,
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",

View File

@@ -9,6 +9,7 @@
"audiences": [
"students"
],
"sequenceIndex": 1001,
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",

View File

@@ -11,6 +11,7 @@
"audiences": [
"students"
],
"sequenceIndex": 1004,
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "foo",

View File

@@ -17,6 +17,7 @@
"type": "organization",
"uid": "4806ef14-b631-5c20-91d1-3c627decca5a"
}],
"sequenceIndex": 1005,
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",

View File

@@ -0,0 +1,26 @@
{
"errorNames": [],
"instance": {
"type": "organization",
"uid": "20e48393-0d2b-5bdc-9d92-5e0dc1e2860f",
"contactPoints": [
{
"type": "contact point",
"name": "Dienstadresse",
"email": "info@example.com",
"faxNumber": "069 / 123450",
"officeHours": "Mo, Mi 8:00-13:00",
"telephone": "069 / 12345",
"url": "https://example.com",
"uid": "be34a419-e9e8-5de0-b998-dd1b19e7beef"
}
],
"name": "Technische Universität Berlin",
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",
"type": "remote"
}
},
"schema": "SCOrganization"
}

View File

@@ -17,58 +17,14 @@
"uid": "be34a419-e9e8-5de0-b998-dd1b19e7f451",
"workLocations": [
{
"url": "http://www.fb03.uni-frankfurt.de/1234567",
"email": "mustermann@soz.uni-frankfurt.de",
"faxNumber": "",
"telephone": "069/123-36232; -1324325",
"hoursAvailable": "siehe Homepage",
"areaServed": {
"type": "room",
"categories": [
"education"
],
"uid": "39c1a574-04ef-5157-9c6f-e271d93eb273",
"name": "3.G 121",
"alternateNames": [
"Dienstzimmer"
],
"geo": {
"point": {
"coordinates": [
8.66919,
50.12834
],
"type": "Point"
}
}
}
},
{
"url": "http://www2.uni-frankfurt.de/12345/vizepraesidenten",
"email": "",
"faxNumber": "",
"telephone": "069/123-1235",
"hoursAvailable": "siehe Homepage",
"areaServed": {
"type": "room",
"categories": [
"education"
],
"uid": "5e54aefd-078b-5007-bca1-53dc60f79d37",
"name": "4.P 22",
"alternateNames": [
"Dienstzimmer"
],
"geo": {
"point": {
"coordinates": [
8.66898,
50.12772
],
"type": "Point"
}
}
}
"type": "contact point",
"name": "Dienstadresse",
"email": "info@example.com",
"faxNumber": "069 / 123450",
"officeHours": "Mo, Mi 8:00-13:00",
"telephone": "069 / 12345",
"url": "https://example.com",
"uid": "be34a419-e9e8-5de0-b998-dd1b19e7beef"
}
],
"origin": {

View File

@@ -16,7 +16,6 @@
},
"translations": {
"de": {
"categories": ["Benutzer"],
"description": "Die Sprache in der die App angezeigt wird.",
"name": "Sprache",
"values": [
@@ -25,9 +24,6 @@
]
},
"en": {
"categories": [
"User"
],
"description": "The language this app is going to use.",
"name": "Language",
"values": [

View File

@@ -24,8 +24,7 @@ import {DeclarationReflection, ProjectReflection} from 'typedoc';
import {ArrayType, IntrinsicType, ReferenceType, StringLiteralType, Type, UnionType} from 'typedoc/dist/lib/models';
process.on('unhandledRejection', (err) => {
Logger.error('UNHANDLED REJECTION', err.stack);
process.exit(1);
throw err;
});
/**

View File

@@ -18,6 +18,7 @@ import {slow, suite, test, timeout} from 'mocha-typescript';
import {SCThingOriginType, SCThingType} from '../src/things/abstract/thing';
import {SCBuildingWithoutReferences} from '../src/things/building';
import {SCDish, SCDishMeta} from '../src/things/dish';
import {SCSetting, SCSettingInputType} from '../src/things/setting';
import {SCThingTranslator} from '../src/translator';
const building: SCBuildingWithoutReferences = {
@@ -86,15 +87,36 @@ const dish: SCDish = {
uid: '540862f3-ea30-5b8f-8678-56b4dc217140',
};
const setting: SCSetting = {
categories: ['profile'],
defaultValue: 'student',
description: 'base-description',
inputType: SCSettingInputType.SingleChoice,
name: 'group',
order: 1,
origin: {
indexed: '2018-11-11T14:30:00Z',
name: 'Dummy',
type: SCThingOriginType.Remote,
},
type: SCThingType.Setting,
uid: '2c97aa36-4aa2-43de-bc5d-a2b2cb3a530e',
values: ['student', 'employee', true, 42],
};
const translator = new SCThingTranslator('de');
// tslint:disable-next-line:no-eval
const languageNonExistant = eval("'jp'");
// this will simulate a translator always utilizing the base language translations
const translatorWithFallback = new SCThingTranslator(languageNonExistant);
// tslint:disable:member-ordering TranslationSpecInplace
// tslint:disable:max-line-length member-ordering newline-per-chained-call prefer-function-over-method completed-docs TranslationSpecInplace
@suite(timeout(10000), slow(5000))
export class TranslationSpecInplace {
@test
public directEnumSingleValue () {
expect(translator.translate(setting).inputType()).to.equal('einfache Auswahl');
}
@test
public directStringLiteralType() {
@@ -204,8 +226,13 @@ export class TranslationSpecInplace {
@test
public nestedMetaArrayOfStringSubscriptUndefined() {
expect(translator.translate(dish).offers[0].inPlace.categories[1234]('printer')).to.equal('printer');
expect(translator.translate(dish).offers[0].inPlace.categories[1]('printer')).to.not.equal('printer');
// tslint:disable-next-line: no-eval
const workingTranslation = eval('translator.translate(dish).offers[0].inPlace.categories[1](\'printer\');');
// tslint:disable-next-line: no-eval
const defaultValueTranslation = eval('translator.translate(dish).offers[0].inPlace.categories[1234](\'printer\');');
expect(defaultValueTranslation).to.equal('printer');
expect(workingTranslation).to.not.equal('printer');
}
@test
@@ -234,20 +261,30 @@ export class MetaTranslationSpec {
@test
public consistencyWithMetaClass() {
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish);
const dishMetaTranslationsEN = translator.translatedPropertyNames(dish, 'en');
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish.type);
const dishMetaTranslationsEN = translator.translatedPropertyNames(dish.type, 'en');
expect(dishMetaTranslationsEN).to.not.deep.equal(dishMetaTranslationsDE);
expect(dishMetaTranslationsDE).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.de);
expect(dishMetaTranslationsEN).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.en);
}
@test
public retrieveTranslatedThingType() {
const dishTypeDE = translator.translatedThingType(dish.type);
const dishTypeEN = translator.translatedThingType(dish.type, 'en');
const dishTypeBASE = translatorWithFallback.translatedThingType(dish.type);
expect(dishTypeDE).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.de.type);
expect(dishTypeEN).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.en.type);
expect(dishTypeBASE).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.en.type);
}
@test
public thingWithoutMetaClass() {
const dishCopy = clone(dish);
const typeNonExistant = eval("(x) => x + 'typeNonExistant';");
// this will assign a non existant SCThingType to dishCopy
dishCopy.type = typeNonExistant();
const dishMetaTranslationsDE = translator.translatedPropertyNames(dishCopy);
const dishMetaTranslationsDE = translator.translatedPropertyNames(dishCopy.type);
expect(dishMetaTranslationsDE).to.be.undefined;
}
}

View File

@@ -19,6 +19,7 @@ import {SCArticle, SCArticleWithoutReferences} from '../src/things/article';
import {SCBook, SCBookWithoutReferences} from '../src/things/book';
import {SCBuilding, SCBuildingWithoutReferences} from '../src/things/building';
import {SCCatalog, SCCatalogWithoutReferences} from '../src/things/catalog';
import {SCContactPoint, SCContactPointWithoutReferences} from '../src/things/contact-point';
import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/things/course-of-studies';
import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/things/date-series';
import {SCDiff, SCDiffWithoutReferences} from '../src/things/diff';
@@ -126,6 +127,17 @@ assert<Has<SCBuildingPropertyTypes, SCThing>>(false);
assert<Extends<SCBuildingWithoutReferences, SCThing>>(false);
assert<Extends<SCBuilding, SCThing>>(true);
/**
* Types of properties of SCContactPoint
*/
type SCContactPointPropertyTypes = PropertyTypesNested<SCContactPoint>;
assert<NotHas<SCContactPointPropertyTypes, SCThingWithoutReferences>>(false);
assert<Has<SCContactPointPropertyTypes, SCThingWithoutReferences>>(true);
assert<NotHas<SCContactPointPropertyTypes, SCThing>>(true);
assert<Has<SCContactPointPropertyTypes, SCThing>>(false);
assert<Extends<SCContactPointWithoutReferences, SCThing>>(false);
assert<Extends<SCContactPoint, SCThing>>(true);
/**
* Types of properties of SCCatalog
*/