Compare commits

...

282 Commits

Author SHA1 Message Date
Rainer Killinger
830e249ac4 0.56.0 2021-12-17 10:35:50 +01:00
Rainer Killinger
8c9df3ea9a test: adjust testing resources 2021-12-17 10:34:03 +01:00
Rainer Killinger
f85768d32e refactor: update dependencies 2021-12-17 10:33:20 +01:00
Rainer Killinger
580ace368f docs: update changelog 2021-12-15 13:15:12 +01:00
Rainer Killinger
522be6643a 0.55.0 2021-12-15 13:15:10 +01:00
Rainer Killinger
8784309ddb refactor: update dependencies 2021-12-15 13:03:57 +01:00
Rainer Killinger
3d8f996690 refactor: make offer price property optional 2021-11-30 12:27:40 +01:00
Rainer Killinger
36a4bfcbbc docs: update changelog 2021-11-17 11:38:00 +01:00
Rainer Killinger
db347bf324 0.54.0 2021-11-17 11:37:56 +01:00
Rainer Killinger
7a2e0f20d1 feat: add SCAssessment 2021-11-16 10:56:28 +01:00
Jovan Krunić
b2d18da82a docs: update changelog 2021-10-19 16:09:46 +02:00
Jovan Krunić
fae7395cf0 0.53.0 2021-10-19 16:09:45 +02:00
Jovan Krunić
0745b1af72 refactor: adjust http status of feedback route 2021-10-12 16:50:19 +02:00
Jovan Krunić
a2b2cefe8e refactor: adjust depricated use of http-status-codes 2021-10-12 16:48:42 +02:00
wulkanat@gmail.com
04b21a7c5d docs: update changelog 2021-09-28 16:02:23 +02:00
wulkanat@gmail.com
ca7626db17 0.52.0 2021-09-28 16:02:14 +02:00
Wieland Schöbl
e8d492a18a test: add test to make sure there are no duplicate names 2021-09-27 09:06:40 +00:00
Wieland Schöbl
aa294c4e29 feat: add about config 2021-09-23 12:40:50 +00:00
Jovan Krunić
369bb906c1 docs: update changelog 2021-09-10 14:15:06 +02:00
Jovan Krunić
aa38fef293 0.51.0 2021-09-10 14:15:05 +02:00
Jovan Krunić
ded8e7dfd5 fix: add physicalobject to book categories 2021-09-10 14:13:28 +02:00
Jovan Krunić
d47897c7e8 docs: update changelog 2021-09-01 13:56:46 +02:00
Jovan Krunić
9ab5280b2e 0.50.0 2021-09-01 13:56:44 +02:00
Wieland Schöbl
596788f3a1 test: migrate schema.spec.ts from TypeDoc to Easy AST 2021-09-01 11:40:32 +00:00
Rainer Killinger
70271a4849 docs: update changelog 2021-08-27 17:27:23 +02:00
Rainer Killinger
98ab64403f 0.49.5 2021-08-27 17:27:21 +02:00
Rainer Killinger
3d1bb6ef13 docs: update changelog 2021-08-27 17:25:06 +02:00
Rainer Killinger
d5f39517e8 0.49.4 2021-08-27 17:20:40 +02:00
Rainer Killinger
dfe35d71a3 fix: test resources from hds2 2021-08-27 17:19:25 +02:00
wulkanat@gmail.com
cdaa83122f docs: update changelog 2021-08-18 09:57:29 +02:00
wulkanat@gmail.com
937919f1a7 0.49.3 2021-08-18 09:57:22 +02:00
Wieland Schöbl
3249300dac refactor: move indexable test files to separate folder 2021-08-17 18:55:27 +02:00
wulkanat@gmail.com
5acf49fd52 docs: update changelog 2021-08-17 18:15:19 +02:00
wulkanat@gmail.com
07b5ad1618 0.49.2 2021-08-17 18:15:11 +02:00
Wieland Schöbl
d56c3d11a8 refactor: move indexable test files to separate folder 2021-08-17 17:51:53 +02:00
wulkanat@gmail.com
83f00f40bf docs: update changelog 2021-08-13 11:04:27 +02:00
wulkanat@gmail.com
782ee3758a 0.49.1 2021-08-13 11:04:20 +02:00
Wieland Schöbl
8a28d6fa86 fix: documentation generation 2021-08-13 08:41:54 +00:00
wulkanat@gmail.com
ed53c6595e docs: update changelog 2021-08-12 15:45:19 +02:00
wulkanat@gmail.com
49ea2c59ab 0.49.0 2021-08-12 15:45:12 +02:00
openstappsbot
869fa831ea refactor: update all 2021-08-12 13:10:08 +00:00
Wieland Schöbl
21eeecd5ee feat: add elasticsearch mappings to build
Add backwards compatibility check with typescript v3.8.3
2021-08-12 13:09:45 +00:00
Rainer Killinger
2dfb64bafd refactor: remodel entities for library search and results 2021-08-12 12:41:03 +00:00
Jovan Krunić
4ab8770fbc refactor: every indexable thing can be a favorite 2021-08-04 13:57:06 +00:00
Jovan Krunić
2cf1027796 ci: manual web docs for feature branches 2021-08-04 11:43:22 +02:00
openstappsbot
3aed37ecb4 refactor: update all 2021-08-02 13:06:03 +00:00
Jovan Krunić
ddb26b8207 ci: fix elasticsearch service (change runner)
Closes #135
2021-07-29 17:28:44 +02:00
Jovan Krunić
805c1f0937 refactor: specific settings for user group and language 2021-07-27 14:02:56 +02:00
Jovan Krunić
5377d026f3 refactor: define user groups in an extra file 2021-07-21 14:53:08 +02:00
Rainer Killinger
148fd77f4d docs: update changelog 2021-07-14 12:41:31 +02:00
Rainer Killinger
4036bfd193 0.48.0 2021-07-14 12:41:26 +02:00
Rainer Killinger
f4f372b9ad docs: adjust @validatable documentation 2021-07-14 11:16:56 +02:00
Rainer Killinger
872c1f5fc3 fix: correct parameter name of thing update route 2021-07-14 11:16:55 +02:00
Rainer Killinger
4f2ca30dab refactor: make resonse error types validatable 2021-07-14 11:16:55 +02:00
Wieland Schöbl
882483ee24 feat: support geo shape queries 2021-07-09 13:32:28 +00:00
openstappsbot
c998166938 refactor: update all 2021-06-23 13:11:10 +00:00
Rainer Killinger
d61e33de39 docs: update changelog 2021-06-15 10:48:03 +02:00
Rainer Killinger
07d6c4770a 0.47.0 2021-06-15 10:48:01 +02:00
openstappsbot
aab3e9fa6c refactor: update all 2021-06-15 10:46:58 +02:00
Rainer Killinger
4a4cd4e6d4 fix: set date-series frequency non translatable 2021-06-15 09:41:27 +02:00
Wieland Schöbl
942cd11469 feat: make SCDateSeries.frequency compliant with schema.org 2021-06-07 12:23:48 +02:00
Wieland Schöbl
fe090c7387 test: increase schema timeout 2021-05-12 18:03:09 +02:00
Wieland Schöbl
f0782d8820 test: add mapping test 2021-05-12 17:52:22 +02:00
Jovan Krunić
a2461d5904 docs: update changelog 2021-05-04 16:51:52 +02:00
Jovan Krunić
d2e0069dc2 0.46.0 2021-05-04 16:51:50 +02:00
Wieland Schöbl
9c6972af78 feat: change range offer to use date range
add date range type
change availability filter
2021-05-04 16:48:10 +02:00
Rainer Killinger
56b03aa0b9 docs: update changelog 2021-04-26 10:29:36 +02:00
Rainer Killinger
b517837671 0.45.0 2021-04-26 10:29:34 +02:00
Rainer Killinger
6f03ede8bf refactor: make SCCatalog level filterable 2021-04-13 16:11:44 +02:00
wulkanat@gmail.com
952207ace1 docs: update changelog 2021-04-12 15:06:12 +02:00
wulkanat@gmail.com
3d9d28c60c 0.44.0 2021-04-12 15:06:04 +02:00
Wieland Schöbl
913c5691da feat: add support for multiple values in the value filter 2021-04-08 08:06:38 +00:00
Rainer Killinger
03cdbc6f9b docs: update changelog 2021-04-07 13:34:33 +02:00
Rainer Killinger
9f886a8968 0.43.0 2021-04-07 13:34:29 +02:00
openstappsbot
e80afe2c93 refactor: update all 2021-04-06 16:12:49 +00:00
Rainer Killinger
6b10cc86d8 refactor: update @types/node for node version 14 2021-04-06 14:08:42 +02:00
openstappsbot
1aedd6332f refactor: update all 2021-03-29 04:15:38 +00:00
Rainer Killinger
790c8bbc3f docs: update changelog 2021-02-16 14:04:46 +01:00
Rainer Killinger
e934017a65 0.42.0 2021-02-16 14:04:40 +01:00
Rainer Killinger
88dbedd932 refactor: update dependenices 2021-02-15 10:57:25 +01:00
Rainer Killinger
8b1b3444fd refactor: align SCCreativeWork to schema.org spec 2021-02-15 10:37:43 +01:00
Rainer Killinger
d5f3d71a41 refactor: overhaul translator as mentioned in #118 2021-02-15 10:37:38 +01:00
wulkanat@gmail.com
cbcf9c9adb docs: update changelog 2021-02-08 14:59:21 +01:00
wulkanat@gmail.com
321e4f6f24 0.41.0 2021-02-08 14:59:14 +01:00
Wieland Schöbl
8510f11d7b fix: add date, numeric range filter to SCSearchFilter 2021-02-05 13:50:18 +01:00
wulkanat@gmail.com
68aa377fe2 docs: update changelog 2021-02-05 12:59:54 +01:00
wulkanat@gmail.com
29f2c77ecc 0.40.0 2021-02-05 12:59:47 +01:00
Wieland Schöbl
29bc00616e feat: add range filter, date sorting support 2021-02-02 15:07:49 +01:00
Rainer Killinger
02920af4a4 refactor: make SCDish additives translatable 2021-02-01 13:24:12 +00:00
Rainer Killinger
0c14b0f1a0 test: change SCSemester sample data acronym 2020-12-02 17:22:17 +01:00
Rainer Killinger
db0a239761 refactor: change SCSemester acronym pattern 2020-12-02 17:19:46 +01:00
Jovan Krunić
377f55bbbe docs: update changelog 2020-12-01 17:16:02 +01:00
Jovan Krunić
8d7a0e10c6 0.39.0 2020-12-01 17:16:01 +01:00
Rainer Killinger
4865f911d1 refactor: utilize null coalescing 2020-11-23 10:06:14 +01:00
Rainer Killinger
15ae5e0873 refactor: remove narrow property value translation 2020-11-23 10:06:14 +01:00
Rainer Killinger
a246bdea84 feat: extend property value translation retrival 2020-11-23 10:06:13 +01:00
Wieland Schöbl
8641bfc877 docs: add @inheritTags documentation 2020-11-11 11:40:36 +01:00
Michel Jonathan Schmitz
d34e66fbbc docs: update changelog 2020-11-02 09:06:11 +01:00
Michel Jonathan Schmitz
c6273a85d9 0.38.1 2020-11-02 08:57:41 +01:00
Michel Jonathan Schmitz
5558d29c2b ci: remove caching 2020-10-30 15:01:00 +01:00
Michel Jonathan Schmitz
69dfd1ae39 build: replace deprecated dependencies 2020-10-30 09:50:46 +01:00
Michel Jonathan Schmitz
4638bb3684 build: update dependencies 2020-10-30 09:50:46 +01:00
Michel Jonathan Schmitz
6c687c6004 docs: update changelog 2020-10-30 09:49:52 +01:00
Michel Jonathan Schmitz
0bf1301733 0.38.0 2020-10-30 09:46:46 +01:00
Wieland Schöbl
827ba47892 refactor: swap out jsonschema package for json-schema 2020-10-29 15:14:25 +01:00
wulkanat@gmail.com
d3b620a745 docs: update changelog 2020-09-23 06:09:23 +02:00
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
Karl-Philipp Wulfert
3a65d4ba2f 0.26.0 2019-08-19 12:10:21 +02:00
Wieland Schöbl
88f579e09b feat: add pluginRequestTimeout field to backend config 2019-08-14 10:38:53 +02:00
Rainer Killinger
be2bfb4017 build: update dependencies 2019-08-05 11:28:47 +02:00
Rainer Killinger
bad15dc872 fix: complete german translations 2019-08-05 11:10:14 +02:00
Rainer Killinger
8b090af3ed refactor: add exercise category 2019-08-05 11:09:10 +02:00
Karl-Philipp Wulfert
747497699d docs: update changelog 2019-07-25 15:47:00 +02:00
Karl-Philipp Wulfert
80a102cb6a 0.25.0 2019-07-25 15:46:59 +02:00
Karl-Philipp Wulfert
234cb57070 docs: add missing contributor 2019-07-25 15:45:34 +02:00
Karl-Philipp Wulfert
d4a8ef6a9c fix: correct package job 2019-07-25 15:44:47 +02:00
Karl-Philipp Wulfert
689dc99414 build: update dependencies 2019-07-25 15:36:44 +02:00
Karl-Philipp Wulfert
27d97c4c95 docs: update changelog 2019-07-23 11:20:15 +02:00
Karl-Philipp Wulfert
e71dace32f 0.24.0 2019-07-23 11:20:14 +02:00
Roman Klopsch
180c966891 docs: apply changes mentioned in discussion 2019-07-23 09:27:18 +02:00
Roman Klopsch
65730d603a refactor: apply changes mentioned in discussion 2019-07-23 09:27:17 +02:00
Roman Klopsch
7fbe1620ee refactor: rename receivingOrganizations field 2019-07-23 09:27:17 +02:00
Roman Klopsch
d781dd6de5 feat: add new field receivingOrganisations to message 2019-07-23 09:27:17 +02:00
Karl-Philipp Wulfert
86f3f8dfae docs: update changelog 2019-07-15 11:42:27 +02:00
Karl-Philipp Wulfert
34fe32b404 0.23.1 2019-07-15 11:42:26 +02:00
Michel Jonathan Schmitz
f262a6b8fa fix: use correct generic for the distance filter 2019-07-15 11:04:41 +02:00
Karl-Philipp Wulfert
e1d4b2bc9d feat: add type maps from routes to requests and responses
Fixes #80
2019-07-04 14:56:48 +02:00
Jovan Krunić
c3a9606f9d docs: update changelog 2019-07-03 15:30:38 +02:00
Jovan Krunić
dd56d97945 0.23.0 2019-07-03 15:30:33 +02:00
Jovan Krunić
43851d2d35 feat: support 404 (resource not found) error on plugin register route 2019-07-03 15:13:38 +02:00
Karl-Philipp Wulfert
b6272e9229 test: update NYC configuration 2019-06-28 12:42:45 +02:00
Karl-Philipp Wulfert
13dae1fb06 build: update dependencies 2019-06-28 12:38:28 +02:00
Karl-Philipp Wulfert
c18e3c15f1 feat: add mapping type from response to request and vice versa
Fixes #80
2019-06-28 12:36:52 +02:00
Karl-Philipp Wulfert
54d44f1acb docs: update changelog 2019-06-28 11:32:37 +02:00
Karl-Philipp Wulfert
47b686dfd0 0.22.0 2019-06-28 11:32:36 +02:00
Wieland Schöbl
89eb10451c refactor: state types of generics explicitly 2019-06-27 12:16:29 +02:00
Karl-Philipp Wulfert
ceab7cc7ef refactor: tidy structure of source files
Fixes #79
2019-06-19 16:18:03 +02:00
Karl-Philipp Wulfert
5de9bf3794 docs: add missing copyright years 2019-06-19 14:24:06 +02:00
Karl-Philipp Wulfert
02593a013c docs: add missing contributor 2019-06-19 14:23:57 +02:00
Karl-Philipp Wulfert
472038ec62 docs: update changelog 2019-06-19 14:21:49 +02:00
Karl-Philipp Wulfert
3a84d12f26 0.21.0 2019-06-19 14:21:48 +02:00
Karl-Philipp Wulfert
b621a12689 refactor: adjust to new tslint settings 2019-06-18 17:26:54 +02:00
Karl-Philipp Wulfert
6ffa4efbaf build: add automatic publishing
Fixes #72
2019-06-17 15:40:40 +02:00
Karl-Philipp Wulfert
e41169a9c7 refactor: adjust model to not contain any 2019-06-17 10:06:38 +00:00
Karl-Philipp Wulfert
46194b177b test: walk along dependency chains 2019-06-17 10:06:38 +00:00
Karl-Philipp Wulfert
ff1f554e0b feat: add static typed test for consistency
Fixes #71
2019-06-17 10:06:38 +00:00
Benjamin Jöckel
9c424b0f96 feat: add ES annotations 2019-06-11 16:42:52 +02:00
Jovan Krunić
55b5248660 docs: update changelog 2019-06-11 16:21:56 +02:00
Jovan Krunić
961103c4e8 0.20.0 2019-06-11 16:21:37 +02:00
Rainer Killinger
771c417db8 docs: extend discription of getInstance() 2019-06-05 13:07:07 +00:00
Rainer Killinger
f847a2aa0c fix: add translations for every SCThing
fix: add field translations for  basic interfaces

fix: add translations for Message, Ticket & Video

fix: add translations for AcademicEvent, Article, Book and Building

fix: add translations

fix: add translations for Dish, Floor, Person and Room

fix: finalize  known translations

fix: add translations for setting

fix: add empty translations for fieldValues

style: applied tslint rules

fix: add missing fieldValueTranslations

fix: remove illegal nested translations
2019-06-05 12:31:48 +00:00
Wieland Schöbl
78b64bae08 fix: rename properties floor and message so that they are not identical to SCThingTypes 2019-05-29 14:02:27 +02:00
Jovan Krunić
e3ea846470 refactor: unify plugin conflict errors
Closes #58
2019-05-17 14:15:11 +02:00
Jovan Krunić
3f10129356 docs: update changelog 2019-05-17 12:34:01 +02:00
Jovan Krunić
68c5fcacbb 0.19.0 2019-05-17 12:33:37 +02:00
Karl-Philipp Wulfert
56d43bb59a build: update dependencies 2019-05-17 08:50:20 +00:00
Karl-Philipp Wulfert
2ad314eda6 docs: correct copyright years 2019-05-17 08:50:20 +00:00
Karl-Philipp Wulfert
f2a86fb6bd test: add tests to ensure consistency of model 2019-05-17 08:50:20 +00:00
Karl-Philipp Wulfert
198f48add4 test: adjust tests 2019-05-17 08:50:20 +00:00
Karl-Philipp Wulfert
5e29203e3d test: make sure to write report 2019-05-17 08:50:20 +00:00
Karl-Philipp Wulfert
ca72c20bd0 fix: adjust model to remove references from things without references
Fixes #69
2019-05-17 08:50:20 +00:00
Karl-Philipp Wulfert
da0507ee34 fix: add thing without references, split thing
References #69
2019-05-17 08:50:20 +00:00
Karl-Philipp Wulfert
1a73208c6f style: correct indentation and format in Thing.ts 2019-05-17 08:50:20 +00:00
Karl-Philipp Wulfert
1d6a2b7841 fix: remove references from origins
References #69
2019-05-17 08:50:20 +00:00
Jovan Krunić
e3d3d022c7 test: add test files for plugin routes 2019-05-16 17:05:25 +02:00
Jovan Krunić
bff6079f60 refactor: add plugin meta data interface
Closes #67
2019-05-16 17:05:24 +02:00
Jovan Krunić
bac09ffebc refactor: unify use of the image field
Closes #44
2019-05-15 14:22:35 +02:00
Karl-Philipp Wulfert
1c5a931e09 docs: update changelog 2019-05-14 14:42:41 +02:00
Karl-Philipp Wulfert
e8da621558 0.18.0 2019-05-14 14:42:35 +02:00
Rainer Killinger
6f12fbda94 test: add tests concerning the translators cache 2019-05-13 15:04:31 +02:00
Rainer Killinger
cf83692e71 refactor: simpify translator class functions 2019-05-13 15:04:31 +02:00
Jovan Krunić
27417e80e1 build: replace missing package
Closes #65
2019-05-09 17:15:03 +02:00
Sebastian Lange
bab675b806 refactor: remodel settings inputType
Flatten inputType to fit new core translation

Closes #59
2019-04-29 12:48:43 +02:00
Rainer Killinger
d3790adbd8 feat: add study module interface 2019-04-17 14:50:25 +02:00
Karl-Philipp Wulfert
d8aa023b28 docs: update changelog 2019-04-16 14:25:36 +02:00
Karl-Philipp Wulfert
4217e237fb 0.17.0 2019-04-16 14:25:33 +02:00
Karl-Philipp Wulfert
c7e2584472 build: adjust build script and add contributors 2019-04-16 14:09:29 +02:00
Karl-Philipp Wulfert
e30e04384f build: update dependencies 2019-04-16 14:08:16 +02:00
Karl-Philipp Wulfert
6fb9ccb821 docs: update changelog 2019-04-15 17:41:51 +02:00
Karl-Philipp Wulfert
9fb0a7c885 0.16.0 2019-04-15 17:41:48 +02:00
Karl-Philipp Wulfert
b5e0b76c24 build: exclude docs from package
Fixes #56
2019-04-15 15:51:25 +02:00
Karl-Philipp Wulfert
a2f44762f9 docs: update changelog 2019-04-09 17:14:55 +02:00
Karl-Philipp Wulfert
d46abbe29b 0.15.0 2019-04-09 17:14:52 +02:00
Rainer Killinger
4986042428 fix: change SCThingMeta getInstance() return value 2019-04-09 14:08:07 +00:00
Michel Jonathan Schmitz
3242411768 feat: provide context based search 2019-04-09 13:47:53 +00:00
Karl-Philipp Wulfert
37e5f6c490 build: update dependencies
Fixes #53
2019-04-09 12:36:22 +02:00
Karl-Philipp Wulfert
623ed613a9 fix: resolve issues with things that can be offered
Fixes #41
2019-04-04 13:47:30 +02:00
Karl-Philipp Wulfert
fd994e2c08 docs: update changelog 2019-04-03 16:23:56 +02:00
Karl-Philipp Wulfert
8dc40dbb00 0.14.0 2019-04-03 16:23:53 +02:00
Wieland Schöbl
c4e30c5fdd docs: add blank line before @param 2019-04-03 15:49:34 +02:00
Wieland Schöbl
81887315f8 feat: add model for plugin register route 2019-04-03 15:17:01 +02:00
Karl-Philipp Wulfert
55687daca9 docs: update changelog 2019-04-02 17:14:45 +02:00
Karl-Philipp Wulfert
2bf65a9086 0.13.0 2019-04-02 17:14:41 +02:00
Karl-Philipp Wulfert
d9347ece05 build: remove extraneous dependency 2019-04-02 16:52:32 +02:00
Karl-Philipp Wulfert
acdca2f554 test: add test for isThing guard 2019-04-02 16:24:40 +02:00
Karl-Philipp Wulfert
67868e9eb8 fix: correct isThing guard 2019-04-02 16:24:27 +02:00
Karl-Philipp Wulfert
bc00f62117 test: appropriately rename schema spec 2019-04-02 16:24:03 +02:00
Karl-Philipp Wulfert
75e833d841 refactor: adjust type to new requirements 2019-04-02 15:47:20 +02:00
Karl-Philipp Wulfert
a97805172c ci: allow audit stage to fail 2019-04-02 15:38:59 +02:00
Karl-Philipp Wulfert
c8bda2eae7 feat: add conditional "maps" for associated types
Fixes #50
2019-04-02 15:37:10 +02:00
Karl-Philipp Wulfert
1e9f36c4be refactor: apply structure to favorites and saveable things 2019-04-02 15:36:14 +02:00
Karl-Philipp Wulfert
6da9d73477 build: update dependencies 2019-04-02 15:34:38 +02:00
Rainer Killinger
bbe4fcac42 fix: update tslint dependencies 2019-04-01 14:10:14 +02:00
Jovan Krunić
5d1e79d487 feat: provide sample JSON files with the package
Closes #46
2019-03-21 17:34:28 +01:00
Jovan Krunić
7532a9bb62 test: use different UIDs for different things 2019-03-21 16:15:10 +01:00
Jovan Krunić
a4db76ec36 docs: update changelog 2019-03-14 10:16:50 +01:00
Jovan Krunić
2ff10692d5 0.12.0 2019-03-14 10:15:50 +01:00
Sebastian Lange
7c7f2726aa refactor: remodel buckets in SCFacet 2019-03-13 09:38:31 +01:00
Rainer Killinger
0679690a18 test: add nyc coverage report 2019-03-12 10:05:18 +01:00
Rainer Killinger
186ce89b91 test: add unit test for translation 2019-03-12 10:05:14 +01:00
Rainer Killinger
62975b9ded refactor: change meta class structure to include types.
Introduce requiredness of translations via implemented interface.
2019-02-28 10:51:37 +00:00
Rainer Killinger
90e3d22399 feat: add SCThingTranslator class. move functionality accordingly 2019-02-28 10:51:37 +00:00
Michel Jonathan Schmitz
797e5ca9de refactor: moved default price into SCPriceGroup 2019-02-27 13:59:14 +01:00
Karl-Philipp Wulfert
86d9696f58 build: ensure that correct dependencies are installed 2019-02-25 15:09:03 +00:00
Karl-Philipp Wulfert
94f528bb92 docs: explain how to update related projects
Fixes #37
2019-02-25 15:09:02 +00:00
Jovan Krunić
9a49442902 fix: add todo to SCThingsWithoutDiff and SCClasses
Closes #39
2019-02-25 11:52:51 +00:00
Karl-Philipp Wulfert
21a5986e3f docs: adjust documentation generation
Fixes #25
2019-02-22 11:01:30 +00:00
Michel Jonathan Schmitz
d2eeaeffd8 refactor: move location from the dish to its offers 2019-02-22 10:02:11 +01:00
Karl-Philipp Wulfert
ac08d226e9 docs: update changelog 2019-02-21 17:08:50 +01:00
Karl-Philipp Wulfert
c7462237eb 0.11.0 2019-02-21 17:08:43 +01:00
Wieland Schöbl
b5bd09e40b feat: add maxRequestBodySize in backend configuration 2019-02-21 15:16:37 +00:00
Michel Jonathan Schmitz
8f66abbb73 refactor: use the SCMap more consistently 2019-02-20 11:04:55 +01:00
Jovan Krunić
a0ab72e597 feat: add laboratory and computer as room categories
Closes #33
2019-02-18 12:23:13 +00:00
Karl-Philipp Wulfert
b4229aac35 docs: update changelog 2019-02-18 12:47:37 +01:00
Karl-Philipp Wulfert
824e841dad 0.10.0 2019-02-18 12:47:32 +01:00
Wieland Schöbl
bc3a0f6d11 feat: add model for requestBodyTooLargeError 2019-02-18 12:21:31 +01:00
Karl-Philipp Wulfert
a09aae5d5d docs: update changelog 2019-02-14 13:21:51 +01:00
Karl-Philipp Wulfert
c5c59412f4 0.9.0 2019-02-14 13:21:47 +01:00
Anselm Stordeur
85b62544bf build: update dependencies to fix security issues 2019-02-14 12:08:11 +01:00
Wieland Schöbl
e2ff4f4ec6 refactor: use constructor for checking error type in SCRoute
change SCRouteHttpVerbs from type to enum
2019-02-13 16:43:07 +01:00
Karl-Philipp Wulfert
f9c357fccf docs: update changelog 2019-02-13 14:25:47 +01:00
218 changed files with 15689 additions and 6390 deletions

View File

@@ -1,4 +1,3 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org
root = true
@@ -7,11 +6,10 @@ root = true
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
trim_trailing_whitespace = false

29
.gitignore vendored
View File

@@ -20,7 +20,7 @@ coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
@@ -29,14 +29,14 @@ bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
@@ -57,6 +57,29 @@ typings/
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
#DynamoDB Local files
.dynamodb/
########## end of https://github.com/github/gitignore/blob/master/Node.gitignore
# ignore ide files
.idea
.vscode

View File

@@ -1,17 +1,15 @@
image: registry.gitlab.com/openstapps/projectmanagement/node
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules
before_script:
- npm install
stages:
- build
- review
- test
- audit
- deploy
- publish
build:
tags:
@@ -24,10 +22,60 @@ build:
- lib
expire_in: 1 week
build-ts-3.8.3:
tags:
- performance
stage: build
script:
- npm uninstall typescript
- npm install typescript@3.8.3
- npm run build
docs_review:
dependencies:
- build
stage: review
script:
- npm run documentation
- ./node_modules/.bin/surge -p ./docs -d https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
when: manual
environment:
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
url: https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
on_stop: stop_review
except:
- master
- develop
tags:
- secrecy
stop_review:
stage: review
variables:
GIT_STRATEGY: none
script:
- ./node_modules/.bin/surge teardown $CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh
when: manual
environment:
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
action: stop
tags:
- secrecy
audit:
stage: test
stage: audit
script:
- npm audit
allow_failure: true
except:
- schedules
scheduled-audit:
stage: audit
script:
- npm audit --audit-level=high
only:
- schedules
test:
dependencies:
@@ -38,6 +86,37 @@ test:
artifacts:
paths:
- report
- coverage
mapping:
tags:
- performance
dependencies:
- build
stage: test
services:
- name: registry.gitlab.com/openstapps/database:master
alias: elasticsearch
script:
- npm run mappings-integration
artifacts:
paths:
- lib
package:
dependencies:
- build
tags:
- secrecy
stage: publish
script:
- echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
- npm publish
only:
- /^v[0-9]+.[0-9]+.[0-9]+$/
artifacts:
paths:
- lib
pages:
stage: deploy

5
.mailmap Normal file
View File

@@ -0,0 +1,5 @@
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <git@killinger.co>
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <killinge@hrz.uni-frankfurt.de>
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <killinger@hrz.uni-frankfurt.de>
Wieland Schöbl <wulkanat@gmail.com> wulkanat@gmail.com <wulkanat@gmail.com>
Wieland Schöbl <wulkanat@gmail.com> Wieland Schöbl <wieland.schoebl@campus.tu-berlin.de>

View File

@@ -1,12 +1,12 @@
# Ignore all files/folders by default
# See https://stackoverflow.com/a/29932318
/*
# Execept this files/folders
!docs
# Except these files/folders
!lib
lib/tsconfig.tsbuildinfo
!LICENSE
!package.json
!package-lock.json
!README.md
!src
!test/resources/

View File

@@ -1,3 +1,458 @@
# [0.55.0](https://gitlab.com/openstapps/core/compare/v0.54.0...v0.55.0) (2021-12-15)
# [0.54.0](https://gitlab.com/openstapps/core/compare/v0.53.0...v0.54.0) (2021-11-17)
### Features
* add SCAssessment ([7a2e0f2](https://gitlab.com/openstapps/core/commit/7a2e0f20d1c64ab1deb7ab30bfb4bab4daaabd6d))
# [0.53.0](https://gitlab.com/openstapps/core/compare/v0.52.0...v0.53.0) (2021-10-19)
# [0.52.0](https://gitlab.com/openstapps/core/compare/v0.51.0...v0.52.0) (2021-09-28)
### Features
* add about config ([aa294c4](https://gitlab.com/openstapps/core/commit/aa294c4e29e9191bef6d79487b0b321fbc34f6fb))
# [0.51.0](https://gitlab.com/openstapps/core/compare/v0.50.0...v0.51.0) (2021-09-10)
### Bug Fixes
* add physicalobject to book categories ([ded8e7d](https://gitlab.com/openstapps/core/commit/ded8e7dfd51094c02a86e1383a4e94c069c10e64))
# [0.50.0](https://gitlab.com/openstapps/core/compare/v0.49.5...v0.50.0) (2021-09-01)
## [0.49.5](https://gitlab.com/openstapps/core/compare/v0.49.3...v0.49.5) (2021-08-27)
### Bug Fixes
* test resources from hds2 ([dfe35d7](https://gitlab.com/openstapps/core/commit/dfe35d71a38c35064726365f99714abff3b30ba6))
## [0.49.3](https://gitlab.com/openstapps/core/compare/v0.49.2...v0.49.3) (2021-08-18)
## [0.49.2](https://gitlab.com/openstapps/core/compare/v0.49.1...v0.49.2) (2021-08-17)
## [0.49.1](https://gitlab.com/openstapps/core/compare/v0.49.0...v0.49.1) (2021-08-13)
### Bug Fixes
* documentation generation ([8a28d6f](https://gitlab.com/openstapps/core/commit/8a28d6fa8657d778d6ae0d38cda7da3531d6478c))
# [0.49.0](https://gitlab.com/openstapps/core/compare/v0.48.0...v0.49.0) (2021-08-12)
### Features
* add elasticsearch mappings to build ([21eeecd](https://gitlab.com/openstapps/core/commit/21eeecd5ee0d68a4faa93bb70d2187ce35807b01))
# [0.48.0](https://gitlab.com/openstapps/core/compare/v0.47.0...v0.48.0) (2021-07-14)
### Bug Fixes
* correct parameter name of thing update route ([872c1f5](https://gitlab.com/openstapps/core/commit/872c1f5fc3884b6df6f5025287873d98b27dd6b1))
### Features
* support geo shape queries ([882483e](https://gitlab.com/openstapps/core/commit/882483ee2490938014904bc26687bd1648992ae6))
# [0.47.0](https://gitlab.com/openstapps/core/compare/v0.46.0...v0.47.0) (2021-06-15)
### Bug Fixes
* set date-series frequency non translatable ([4a4cd4e](https://gitlab.com/openstapps/core/commit/4a4cd4e6d4b01ac34b5338dfcf4aeb959f54461d))
### Features
* make SCDateSeries.frequency compliant with schema.org ([942cd11](https://gitlab.com/openstapps/core/commit/942cd1146966aa9e60321160489a6605877925e9))
# [0.46.0](https://gitlab.com/openstapps/core/compare/v0.45.0...v0.46.0) (2021-05-04)
### Features
* change range offer to use date range ([9c6972a](https://gitlab.com/openstapps/core/commit/9c6972af787678567409877b6bc9f9417e1374e2))
# [0.45.0](https://gitlab.com/openstapps/core/compare/v0.44.0...v0.45.0) (2021-04-26)
# [0.44.0](https://gitlab.com/openstapps/core/compare/v0.43.0...v0.44.0) (2021-04-12)
### Features
* add support for multiple values in the value filter ([913c569](https://gitlab.com/openstapps/core/commit/913c5691da46ad2591fe14bcf7286f12b29ab5ee))
# [0.43.0](https://gitlab.com/openstapps/core/compare/v0.42.0...v0.43.0) (2021-04-07)
# [0.42.0](https://gitlab.com/openstapps/core/compare/v0.41.0...v0.42.0) (2021-02-16)
# [0.41.0](https://gitlab.com/openstapps/core/compare/v0.40.0...v0.41.0) (2021-02-08)
### Bug Fixes
* add date, numeric range filter to SCSearchFilter ([8510f11](https://gitlab.com/openstapps/core/commit/8510f11d7b4c62a6b239a70f47fe07e8cc86ab63))
# [0.40.0](https://gitlab.com/openstapps/core/compare/v0.39.0...v0.40.0) (2021-02-05)
### Features
* add range filter, date sorting support ([29bc006](https://gitlab.com/openstapps/core/commit/29bc00616e87a8d346d8c304fab2e3818921c75e))
# [0.39.0](https://gitlab.com/openstapps/core/compare/v0.38.1...v0.39.0) (2020-12-01)
### Features
* extend property value translation retrival ([a246bde](https://gitlab.com/openstapps/core/commit/a246bdea84e0ca390be6ab38723d637626db87d2))
## [0.38.1](https://gitlab.com/openstapps/core/compare/v0.38.0...v0.38.1) (2020-11-02)
# [0.38.0](https://gitlab.com/openstapps/core/compare/v0.37.0...v0.38.0) (2020-10-30)
# [0.37.0](https://gitlab.com/openstapps/core/compare/v0.36.0...v0.37.0) (2020-09-23)
### Bug Fixes
* remove keyword tag from steps ([c369c85](https://gitlab.com/openstapps/core/commit/c369c8520a2eed169555a35a50ce745c08e1f9da))
* remove redundant property declaration ([66075ef](https://gitlab.com/openstapps/core/commit/66075ef99b95198a9cd5c0a396603e089221bcd9))
# [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/d4a8ef6a9ca69849f8b981804da45e4ba907f37b))
# [0.24.0](https://gitlab.com/openstapps/core/compare/v0.23.1...v0.24.0) (2019-07-23)
### Features
* add new field receivingOrganisations to message ([d781dd6](https://gitlab.com/openstapps/core/commit/d781dd6de5cc7572b9218df959247b93cb2db305))
## [0.23.1](https://gitlab.com/openstapps/core/compare/v0.23.0...v0.23.1) (2019-07-15)
### Bug Fixes
* 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/e1d4b2bc9de60a2332788c9a2264760d151c8813)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
# [0.23.0](https://gitlab.com/openstapps/core/compare/v0.22.0...v0.23.0) (2019-07-03)
### Features
* 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))
# [0.22.0](https://gitlab.com/openstapps/core/compare/v0.21.0...v0.22.0) (2019-06-28)
# [0.21.0](https://gitlab.com/openstapps/core/compare/v0.20.0...v0.21.0) (2019-06-19)
### Features
* 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)
# [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/f847a2aa0cf576e2fd79197cdc7795638d929136))
* rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64bae08d9ca12badaedf921a24fa5ffe90552))
# [0.19.0](https://gitlab.com/openstapps/core/compare/v0.18.0...v0.19.0) (2019-05-17)
### Bug Fixes
* 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)
# [0.18.0](https://gitlab.com/openstapps/core/compare/v0.17.0...v0.18.0) (2019-05-14)
### Features
* add study module interface ([d3790ad](https://gitlab.com/openstapps/core/commit/d3790adbd82417923d79b4a5a35c74fcaab3e050))
# [0.17.0](https://gitlab.com/openstapps/core/compare/v0.16.0...v0.17.0) (2019-04-16)
# [0.16.0](https://gitlab.com/openstapps/core/compare/v0.15.0...v0.16.0) (2019-04-15)
# [0.15.0](https://gitlab.com/openstapps/core/compare/v0.14.0...v0.15.0) (2019-04-09)
### Bug Fixes
* 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/324241176849b338bee9f5d1dcaf1109f47a8bb9))
# [0.14.0](https://gitlab.com/openstapps/core/compare/v0.13.0...v0.14.0) (2019-04-03)
### Features
* add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/81887315f8c3038ec37c2197db8e193da835f6fc))
# [0.13.0](https://gitlab.com/openstapps/core/compare/v0.12.0...v0.13.0) (2019-04-02)
### Bug Fixes
* 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/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)
# [0.12.0](https://gitlab.com/openstapps/core/compare/v0.11.0...v0.12.0) (2019-03-14)
### Bug Fixes
* 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/90e3d2239921bbfcea27b64aef9344ffee270b6d))
# [0.11.0](https://gitlab.com/openstapps/core/compare/v0.10.0...v0.11.0) (2019-02-21)
### Features
* 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))
# [0.10.0](https://gitlab.com/openstapps/core/compare/v0.9.0...v0.10.0) (2019-02-18)
### Features
* add model for requestBodyTooLargeError ([bc3a0f6](https://gitlab.com/openstapps/core/commit/bc3a0f6d11cba836a55cbd5787d68cfe655b68a6))
# [0.9.0](https://gitlab.com/openstapps/core/compare/v0.8.0...v0.9.0) (2019-02-14)
# [0.8.0](https://gitlab.com/openstapps/core/compare/v0.7.0...v0.8.0) (2019-02-13)
### Features
* add config for maximum queries ([c7ab473](https://gitlab.com/openstapps/core/commit/c7ab47397e2a33b1c460b9038cbf53fec148316d))
# [0.7.0](https://gitlab.com/openstapps/core/compare/v0.6.0...v0.7.0) (2019-02-13)
@@ -11,7 +466,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))
@@ -20,7 +475,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))
@@ -29,13 +484,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)
@@ -44,7 +499,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))
@@ -53,9 +508,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))
@@ -63,12 +518,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

@@ -2,6 +2,59 @@
Please see the appropriate general group contributing guides in [project-management](https://gitlab.com/openstapps/projectmanagement/tree/master/project-docs/workflow).
## Updating and releasing related projects
Following semantic versioning patches to the core should not break existing usage.
### API
Every minor and major version of the core needs a corresponding version of the [API](https://openstapps.gitlab.io/api) to be used in the app and connectors.
Because the API is an integral part of the App and Node.js-based connectors this should be done for every new minor and major release of the core.
### Backend
The [backend](https://openstapps.gitlab.io/backend) uses the core to validate requests and responses. With the use of the [core tools](https://openstapps.gitlab.io/core-tools) it uses the core to set up the database according to the model.
Like for the API there should be a new release of the backend for every minor and major release of the core.
### Core tools
The [core tools](https://openstapps.gitlab.io/core-tools) are more or less not dependent on a specific core version and should normally not need adjustments for new core versions as long the structure of the code in the core stays the same.
### App and connectors
[App](https://openstapps.gitlab.io/app) and connectors use the API to communicate with the backend. To ensure compatibility the version of the used core must be the same as the one that is used in the used API.
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

@@ -29,3 +29,24 @@ To generate a documentation for the routes use the following command.
```shell
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 | 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. Fields are always sortable through generic sort, even without annotation. | sort method to be used: `ducet`, `price`, `distance` |
| `@text` | string field is interpreted as text | |
| `@date` | string field is interpreted as a date field | |
| `@validatable` | Marks the type for json schema generation, which can be checked at runtime. Any top-level type that is put into a database should always be marked as validatable. | |
| `@filterable` | non-object/nested field is filterable if the core schema is used to put data into a database/key-value store | |
| `@inheritTags` | inherit all tags from another field | `[SCThingType]::[field]` |
*Note: tags ignore casing, but for consistency they should use the variants proposed here.*

6604
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.8.0",
"version": "0.56.0",
"description": "StAppsCore - Generalized model of data",
"keywords": [
"Model",
@@ -14,51 +14,106 @@
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "npm run tslint && npm run compile && npm run pack && npm run schema && npm run documentation",
"build": "npm run tslint && npm run compile && npm run pack && npm run schema && npm run mappings",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'",
"check-configuration": "openstapps-configuration",
"compile": "tsc",
"documentation": "typedoc --includeDeclarations --excludeExternals --mode modules --out docs src",
"compile": "rimraf lib && tsc",
"documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks src",
"pack": "openstapps-core-tools pack",
"prepublishOnly": "npm run build",
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src/core lib/schema",
"test": "mocha --require ts-node/register --ui mocha-typescript test/*.spec.ts",
"tslint": "tslint 'src/**/*.ts'"
"postversion": "npm run changelog",
"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 lib/schema",
"mappings": "mkdir lib/mappings && openstapps-es-mapping-generator mapping ../core/src -i minlength,pattern,see,tjs-format -m lib/mappings/mappings.json -a lib/mappings/aggregations.json",
"mappings-integration": "openstapps-es-mapping-generator put-es-templates lib/mappings/mappings.json http://elasticsearch:9200/",
"test": "nyc mocha --require ts-node/register --recursive 'test/*.spec.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": [
"Anselm Stordeur <anselmstordeur@gmail.com>",
"Jovan Krunic <jovan.krunic@gmail.com>",
"Andreas Lehmann",
"Anselm Stordeur <anselmstordeur@gmail.com>",
"Axel Nieder-Vahrenholz",
"Benjamin Jöckel",
"Frank Nagel",
"Jovan Krunić <jovan.krunic@gmail.com>",
"Michel Jonathan Schmitz",
"Rainer Killinger <mail-openstapps@killinger.co>",
"Roman Klopsch",
"Sebastian Lange",
"Rainer Killinger",
"Imran Hossain"
"Wieland Schöbl"
],
"dependencies": {
"@openstapps/core-tools": "0.28.0",
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/json-schema": "7.0.9",
"@types/node": "14.18.0",
"fast-clone": "1.5.13",
"fast-deep-equal": "3.1.3",
"http-status-codes": "2.1.4",
"json-patch": "0.7.0",
"jsonschema": "1.2.4"
"json-schema": "0.4.0",
"ts-optchain": "0.1.8"
},
"devDependencies": {
"@openstapps/configuration": "0.5.0",
"@openstapps/core-tools": "0.2.0",
"@openstapps/logger": "0.0.3",
"@types/chai": "4.1.7",
"@types/humanize-string": "1.0.0",
"@types/node": "10.12.18",
"@types/rimraf": "2.0.2",
"async-pool-native": "0.1.0",
"chai": "4.2.0",
"commander": "2.19.0",
"conventional-changelog-cli": "2.0.11",
"humanize-string": "1.0.2",
"mocha": "5.2.0",
"mocha-typescript": "1.1.17",
"rimraf": "2.6.3",
"ts-node": "7.0.1",
"tslint": "5.12.0",
"typedoc": "0.14.0",
"typescript": "3.2.2"
"@openstapps/configuration": "0.29.0",
"@openstapps/es-mapping-generator": "0.0.4",
"@openstapps/logger": "0.8.0",
"@testdeck/mocha": "0.2.0",
"@types/chai": "4.3.0",
"@types/lodash": "4.14.178",
"@types/mocha": "9.0.0",
"@types/rimraf": "3.0.2",
"chai": "4.3.4",
"conditional-type-checks": "1.0.5",
"conventional-changelog-cli": "2.1.1",
"lodash": "4.17.21",
"mocha": "9.1.3",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"source-map-support": "0.5.21",
"surge": "0.23.0",
"ts-node": "10.4.0",
"tslint": "6.1.3",
"typedoc": "0.21.6",
"typescript": "4.3.5"
},
"nyc": {
"all": true,
"branches": 90,
"check-coverage": true,
"exclude": [],
"extension": [
".ts"
],
"functions": 95,
"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"
],
"lines": 95,
"per-file": true,
"reporter": [
"html",
"text-summary"
],
"require": [
"ts-node/register"
],
"statements": 95
},
"openstappsConfiguration": {
"hasCli": false,
"ignoreCiEntries": [
"build"
],
"standardBuild": false,
"standardDocumentation": false
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019-2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,11 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Polygon} from 'geojson';
import {SCSetting} from '../../things/Setting';
import {SCTranslations} from '../i18n';
import {SCTranslations} from '../general/i18n';
import {SCMap} from '../general/map';
import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting';
/**
* An app configuration menu item
@@ -79,6 +81,13 @@ export interface SCAppConfigurationMenuCategory {
* An app configuration
*/
export interface SCAppConfiguration {
/**
* The about page
*
* Mapping route -> page config
*/
aboutPages: SCMap<SCAboutPage>;
/**
* Polygon that encapsulates the main campus
*/
@@ -111,8 +120,9 @@ export interface SCAppConfiguration {
/**
* A list of available settings in the app
* !Important! Use provided specific settings, for other settings use general SCSetting
*/
settings: SCSetting[];
settings: Array<SCUserGroupSetting | SCLanguageSetting | SCSetting>;
/**
* Map of store URLs
@@ -126,11 +136,11 @@ export interface SCAppConfiguration {
}
/**
*
* Map of features
*/
export interface SCAppConfigurationFeature {
/**
*
* Whether or not widgets are enabled
*/
widgets: boolean;
}
@@ -148,7 +158,7 @@ export interface SCAppConfigurationStoreUrl {
*/
ios?: string;
/**
* Microsoft Store URL
* Microsoft Store URL
*/
uwp?: string;
}
@@ -172,3 +182,147 @@ export interface SCAppConfigurationMenuCategoryTranslationName {
*/
name: string;
}
export enum SCAboutPageContentType {
SECTION = 'section',
ROUTER_LINK = 'router link',
TABLE = 'table',
MARKDOWN = 'markdown',
}
export interface SCAboutPageTranslationTitle {
/**
* Translation of the title
*/
title: string;
}
export interface SCAboutPageTranslationValue {
/**
* Translation of the value
*/
value: string;
}
/**
* A (mostly) self-contained section, akin to markdown `# Title`
*/
export interface SCAboutPageSection {
/**
* If the section should be contained in a card
*/
card?: true;
/**
* The content of the section
*/
content: SCAboutPageContent;
/**
* The title of the section
*/
title: string;
/**
* Translations
*/
translations: SCTranslations<SCAboutPageTranslationTitle>;
/**
* Type
*/
type: SCAboutPageContentType.SECTION;
}
/**
* A router link that can lead to a new page
*
* For external links, prefer markdown `[destination](link)`
*/
export interface SCAboutPageRouterLink {
/**
* Icon of the destination
*/
icon?: string;
/**
* Router link
*/
link: string;
/**
* Title of the destination
*/
title: string;
/**
* Translations
*/
translations: SCTranslations<SCAboutPageTranslationTitle>;
/**
* Type
*/
type: SCAboutPageContentType.ROUTER_LINK;
}
/**
* A simple table element
*/
export interface SCAboutPageTable {
/**
* Rows of the table
*/
rows: SCAboutPageContent[][];
/**
* Type
*/
type: SCAboutPageContentType.TABLE;
}
/**
* A markdown element
*/
export interface SCAboutPageMarkdown {
/**
* Translations
*/
translations: SCTranslations<SCAboutPageTranslationValue>;
/**
* Type
*/
type: SCAboutPageContentType.MARKDOWN;
/**
* Value (Markdown)
*/
value: string;
}
export type SCAboutPageContent =
| SCAboutPageMarkdown
| SCAboutPageTable
| SCAboutPageSection
| SCAboutPageRouterLink;
/**
* Root of the about page
*/
export interface SCAboutPage {
/**
* Content of the page
*/
content: SCAboutPageContent[];
/**
* Header (title) of the page
*/
title: string;
/**
* Translations
*/
translations: SCTranslations<SCAboutPageTranslationTitle>;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,16 +12,23 @@
* 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 {SCThingType} from '../../Thing';
import {SCSearchSortType} from '../sorts/Abstract';
import {SCUuid} from '../UUID';
import {SCMap} from './../Map';
import {SCMonitoringConfiguration} from './Monitoring';
import {SCMap, SCRestrictedMap} from '../general/map';
import {SCUuid} from '../general/uuid';
import {SCSearchSortType} from '../protocol/search/sort';
import {SCThingType} from '../things/abstract/thing';
import {SCMonitoringConfiguration} from './monitoring';
/**
* A backend configuration
*/
export interface SCBackendConfiguration {
/**
* The maximum amount of time (milliseconds) an external program can take to provide a response to the backend
*
* This can be used for example for Plugins.
*/
externalRequestTimeout: number;
/**
* A list of hidden SC types
*
@@ -30,11 +37,23 @@ 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
*/
maxMultiSearchRouteQueries: number;
/**
* Maximum body size for requests
*/
maxRequestBodySize: number;
/**
* Name of university
*/
@@ -67,7 +86,7 @@ export interface SCBackendConfigurationSortableField {
/**
* A list of SC types on which this field exists
*
*
* If no type is given it is assumed it exists on every type
*/
onlyOnTypes?: SCThingType[];
@@ -80,22 +99,24 @@ export interface SCBackendConfigurationSortableField {
}
/**
* Values of a field that should be boosted by the given factors
* Possible context names to be used by the search request
*/
export interface SCBackendConfigurationSearchBoostingValues {
export type SCSearchContext =
| 'default'
| 'dining'
| 'place';
/**
* Value of the field that should be boosted by the given number
*
* For example `"SS 2019": 2`
*/
[valueOfField: string]: number;
}
/**
* A boosting configuration for one context
*/
export type SCBackendConfigurationSearchBoostingContext =
SCRestrictedMap<SCSearchContext,
SCBackendConfigurationSearchBoostingType[]>;
/**
* A boosting configuration for one SCType
*/
export interface SCBackendConfigurationSearchBoosting {
export interface SCBackendConfigurationSearchBoostingType {
/**
* The factor of which the scores matching this type should be multiplied by
@@ -103,11 +124,15 @@ export interface SCBackendConfigurationSearchBoosting {
factor: number;
/**
* Outer-Map:
* Fields of this type that should be boosted if they match a given value
*
* For nest fields you can use the `.` as a separator. For example `academicTerms.acronym`
*
* Inner-map:
* Value of the field that should be boosted by the given number
* For example `"SS 2019": 2`
*/
fields?: SCMap<SCBackendConfigurationSearchBoostingValues>;
fields?: SCMap<SCMap<number>>;
/**
* Type of things the factor should be applied to
@@ -147,7 +172,7 @@ export interface SCBackendInternalConfiguration {
* The resulting scores of matching objects can be boosted (multiplied by a number) to change the order in the
* set of results
*/
boostings: SCBackendConfigurationSearchBoosting[];
boostings: SCBackendConfigurationSearchBoostingContext;
/**
* Configuration of the database
@@ -163,14 +188,9 @@ export interface SCBackendInternalConfiguration {
/**
* Configuration of the database
*/
export interface SCBackendConfigurationDatabaseConfiguration {
export interface SCBackendConfigurationDatabaseConfiguration extends SCMap<unknown> {
/**
* Name of the database used by the backend
*/
name: string;
/**
* Allow additional configuration for the database
*/
[key: string]: any;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,9 +12,9 @@
* 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 {SCAppConfiguration} from '../types/config/App';
import {SCBackendConfiguration, SCBackendInternalConfiguration} from '../types/config/Backend';
import {SCLicensePlate} from '../types/namespaces';
import {SCLicensePlate} from '../general/namespaces';
import {SCAppConfiguration} from './app';
import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend';
/**
* A configuration file that configures app and backend

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -140,7 +140,7 @@ export interface SCMonitoringWatcher {
/**
* Query to execute against the database
*/
query: any;
query: unknown;
/**
* A list of triggers

View File

@@ -1,98 +0,0 @@
/*
* Copyright (C) 2018 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 {SCAcademicEvent, SCAcademicEventMeta} from './things/AcademicEvent';
import {SCArticle, SCArticleMeta} from './things/Article';
import {SCBook, SCBookMeta} from './things/Book';
import {SCBuilding, SCBuildingMeta} from './things/Building';
import {SCCatalog, SCCatalogMeta} from './things/Catalog';
import {SCDateSeries, SCDateSeriesMeta} from './things/DateSeries';
import {SCDiff, SCDiffMeta} from './things/Diff';
import {SCDish, SCDishMeta} from './things/Dish';
import {SCFavorite, SCFavoriteMeta} from './things/Favorite';
import {SCFloor, SCFloorMeta} from './things/Floor';
import {SCMessage, SCMessageMeta} from './things/Message';
import {SCOrganization, SCOrganizationMeta} from './things/Organization';
import {SCPerson, SCPersonMeta} from './things/Person';
import {SCPointOfInterest, SCPointOfInterestMeta} from './things/PointOfInterest';
import {SCRoom, SCRoomMeta} from './things/Room';
import {SCSemester, SCSemesterMeta} from './things/Semester';
import {SCSetting, SCSettingMeta} from './things/Setting';
import {SCSportCourse, SCSportCourseMeta} from './things/SportCourse';
import {SCTicket, SCTicketMeta} from './things/Ticket';
import {SCTour, SCTourMeta} from './things/Tour';
import {SCVideo, SCVideoMeta} from './things/Video';
/* tslint:disable:variable-name */
/**
* A map of things, from type to meta data
*/
export const SCClasses = {
/* tslint:enable */
'academic event': SCAcademicEventMeta,
article: SCArticleMeta,
book: SCBookMeta,
building: SCBuildingMeta,
catalog: SCCatalogMeta,
'date series': SCDateSeriesMeta,
diff: SCDiffMeta,
dish: SCDishMeta,
favorite: SCFavoriteMeta,
floor: SCFloorMeta,
message: SCMessageMeta,
organization: SCOrganizationMeta,
person: SCPersonMeta,
'point of interest': SCPointOfInterestMeta,
room: SCRoomMeta,
'semester': SCSemesterMeta,
setting: SCSettingMeta,
'sport course': SCSportCourseMeta,
ticket: SCTicketMeta,
tour: SCTourMeta,
video: SCVideoMeta,
};
export type SCThingsWithoutDiff =
SCAcademicEvent
| SCArticle
| SCBook
| SCBuilding
| SCCatalog
| SCDateSeries
| SCDish
| SCFavorite
| SCFloor
| SCMessage
| SCOrganization
| SCPerson
| SCPointOfInterest
| SCRoom
| SCSemester
| SCSetting
| SCSportCourse
| SCTicket
| SCTour
| SCVideo;
/**
* An object that exists in the StAppsCore
*/
export type SCThings =
SCThingsWithoutDiff
| SCDiff;
/**
* A field of a thing
*/
export type SCThingsField = keyof SCThings | string;

View File

@@ -1,155 +0,0 @@
/*
* Copyright (C) 2018 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/>.
*/
/**
* Possible HTTP verbs for routes
*/
import {SCBookAvailabilityRequest} from './protocol/routes/bookAvailability/BookAvailabilityRequest';
import {SCBookAvailabilityResponse} from './protocol/routes/bookAvailability/BookAvailabilityResponse';
import {SCBulkRequest} from './protocol/routes/bulk/BulkRequest';
import {SCBulkResponse} from './protocol/routes/bulk/BulkResponse';
import {SCBulkAddRequest} from './protocol/routes/bulk/UID/BulkAddRequest';
import {SCBulkAddResponse} from './protocol/routes/bulk/UID/BulkAddResponse';
import {SCBulkDoneRequest} from './protocol/routes/bulk/UID/BulkDoneRequest';
import {SCBulkDoneResponse} from './protocol/routes/bulk/UID/BulkDoneResponse';
import {SCFeedbackRequest} from './protocol/routes/feedback/FeedbackRequest';
import {SCFeedbackResponse} from './protocol/routes/feedback/FeedbackResponse';
import {SCIndexRequest} from './protocol/routes/INDEX/IndexRequest';
import {SCIndexResponse} from './protocol/routes/INDEX/IndexResponse';
import {SCMultiSearchRequest} from './protocol/routes/search/MultiSearchRequest';
import {SCMultiSearchResponse} from './protocol/routes/search/MultiSearchResponse';
import {SCSearchRequest} from './protocol/routes/search/SearchRequest';
import {SCSearchResponse} from './protocol/routes/search/SearchResponse';
import {SCThingUpdateRequest} from './protocol/routes/TYPE/UID/ThingUpdateRequest';
import {SCThingUpdateResponse} from './protocol/routes/TYPE/UID/ThingUpdateResponse';
import {SCMap} from './types/Map';
export type SCRouteHttpVerbs = 'GET' | 'POST' | 'PUT';
/**
* A description of a route
*/
export interface SCRoute {
/**
* A map of names of possible errors that can be returned by the route with their appropriate status codes
*/
errorNames: string[];
/**
* HTTP verb to use to request the route
*/
method: SCRouteHttpVerbs;
/**
* Map of obligatory parameters and their type that have to be set via the requested path
*/
obligatoryParameters?: SCMap<string>;
/**
* Name of the type of the request body
*/
requestBodyName: string;
/**
* Name of the type of the response body
*/
responseBodyName: string;
/**
* Status code for success
*/
statusCodeSuccess: number;
/**
* URL fragment of the route
*/
urlFragment: string;
}
/**
* An abstract route
*/
export abstract class SCAbstractRoute implements SCRoute {
errorNames = [
'SCErrorResponse',
];
method: SCRouteHttpVerbs = 'GET';
obligatoryParameters?: SCMap<string>;
requestBodyName = 'any';
responseBodyName = 'any';
statusCodeSuccess = 200;
urlFragment = '/';
public getUrlFragment(parameters?: SCMap<string>): string {
if (typeof parameters === 'undefined') {
parameters = {};
}
let obligatoryParameters: string[] = [];
if (typeof this.obligatoryParameters === 'object') {
obligatoryParameters = Object.keys(this.obligatoryParameters);
}
if (Object.keys(parameters).length > obligatoryParameters.length) {
throw new Error('Extraneous parameters provided.');
}
return this.urlFragment
.split('/')
.map((part) => {
if (part.indexOf(':') !== 0) {
return part;
}
const parameter = part.substr(1);
// @ts-ignore
if (typeof parameters[parameter] === 'undefined') {
throw new Error(`Parameter '${parameter}' not provided.`);
}
// @ts-ignore
return parameters[parameter];
}).join('/');
}
}
/**
* Possible requests
*/
export type SCRequests =
SCBookAvailabilityRequest
| SCBulkRequest
| SCBulkAddRequest
| SCBulkDoneRequest
| SCFeedbackRequest
| SCIndexRequest
| SCMultiSearchRequest
| SCSearchRequest
| SCThingUpdateRequest;
/**
* Possible responses
*/
export type SCResponses =
SCBookAvailabilityResponse
| SCBulkResponse
| SCBulkAddResponse
| SCBulkDoneResponse
| SCFeedbackResponse
| SCIndexResponse
| SCMultiSearchResponse
| SCSearchResponse
| SCThingUpdateResponse;

View File

@@ -1,80 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing} from '../Thing';
import {SCThingMeta} from '../Thing';
/**
* An academic degree without references
*/
export interface SCAcademicDegreeWithoutReferences extends SCThing {
/**
* The achievable academic degree
*/
academicDegree: SCGermanAcademicDegree;
/**
* The achievable academic degree with academic field specification
* (eg. Master of Science)
*/
academicDegreewithField: string;
/**
* The achievable academic degree with academic field specification
* shorted (eg. M.Sc.).
*/
academicDegreewithFieldShort: string;
}
export interface SCAcademicDegree extends SCAcademicDegreeWithoutReferences {
}
export class SCAcademicDegreeMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
de: {
academicDegree: 'Hochschulgrad',
academicDegreewithField: 'Abschlussbezeichnungen',
academicDegreewithFieldShort: 'Abschlussbezeichnungen (kurz)',
},
};
static fieldValueTranslations = {
...SCThingMeta.fieldValueTranslations,
de: {
academicDegree: {
'bachelor': 'Bachelor',
'diploma': 'Diplom',
'doctor': 'Doktor',
'licentiate': 'Lizenziat',
'magister': 'Magister',
'master': 'Master',
'masterstudent': 'Meisterschüler',
'state examination': 'Staatsexamen',
},
},
};
}
/**
* Types of (german) academic degrees
*/
export type SCGermanAcademicDegree = 'bachelor' |
'diploma' |
'doctor' |
'licentiate' |
'magister' |
'master' |
'master pupil' |
'state examination' ;

View File

@@ -1,46 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing} from '../Thing';
import {SCISO8601Date} from '../types/Time';
/**
* An academic term without references
*/
export interface SCAcademicTermWithoutReferences extends SCThing {
/**
* Short name of the academic term, using the given pattern
*/
acronym: string;
/**
* End date of the academic term
*/
endDate: SCISO8601Date;
/**
* End date of lectures in the academic term
*/
eventsEndDate?: SCISO8601Date;
/**
* Start date of lectures in the academic term
*/
eventsStartDate?: SCISO8601Date;
/**
* Start date of the academic term
*/
startDate: SCISO8601Date;
}

View File

@@ -1,80 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing, SCThingTranslatableProperties} from '../Thing';
import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCLanguage, SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties,
} from './ThingThatCanBeOffered';
/**
* A creative work without references
*/
export interface SCCreativeWorkWithoutReferences extends SCThing {
/**
* Date the creative work was published
*/
datePublished?: SCISO8601Date;
/**
* List of languages this creative work is written/recorded/... in
*/
inLanguages?: SCLanguage[];
/**
* Keywords of the creative work
*/
keywords?: string[];
/**
* Translated fields of the creative work
*/
translations?: SCTranslations<SCCreativeWorkTranslatableProperties>;
}
/**
* A creative work
*/
export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/**
* Authors of the creative work
*/
authors?: SCPersonWithoutReferences[];
/**
* List of publishers of the creative work
*/
publishers?: Array<SCPersonWithoutReferences | SCOrganizationWithoutReferences>;
/**
* Translated fields of the creative work
*/
translations?: SCTranslations<SCCreativeWorkTranslatableProperties>;
}
/**
* Translatable properties of creative works
*/
export interface SCCreativeWorkTranslatableProperties
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
/**
* Translation of the keywords of the creative work
*/
keywords?: string[];
}

View File

@@ -1,70 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing} from '../Thing';
import {SCCatalogWithoutReferences} from '../things/Catalog';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCSemesterWithoutReferences} from '../things/Semester';
import {SCCreativeWorkWithoutReferences} from './CreativeWork';
/**
* An event without references
*/
export interface SCEventWithoutReferences extends SCThing {
/**
* Maximum number of participants of the event
*
* A maximum number of people that can participate in the event.
*/
maximumParticipants?: number;
/**
* Remaining attendee capacity of the event
*
* This number represents the remaining open spots.
*/
remainingAttendeeCapacity?: number;
}
/**
* An event
*/
export interface SCEvent extends SCEventWithoutReferences {
/**
* Academic terms that an event belongs to, e.g. semester(s).
*/
academicTerms?: SCSemesterWithoutReferences[];
/**
* Catalogs to which an event belongs
*/
catalogs?: SCCatalogWithoutReferences[];
/**
* A list of creative works that are associated with this event
*
* This can be recommended books, CDs that can be bought, etc.
*/
creativeWorks?: SCCreativeWorkWithoutReferences[];
/**
* Organizers of the event
*/
organizers?: SCPersonWithoutReferences[];
/**
* Performers of the event
*/
performers?: SCPersonWithoutReferences[];
}

View File

@@ -1,41 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing} from '../Thing';
import {SCGeoInformation} from '../types/GeoInformation';
import {SCPostalAddress} from '../types/PostalAddress';
/**
* A place without references
*/
export interface SCPlaceWithoutReferences extends SCThing {
/**
* Address of the place
*/
address?: SCPostalAddress;
/**
* Positional information of the place
*
* !!! BEWARE !!!
* Can not be a GeometryCollection because ElasticSearch does not allow distance filtering/sorting on other types
*/
geo: SCGeoInformation;
/**
* Opening hours of the place
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
*/
openingHours?: string;
}

View File

@@ -1,31 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing} from '../Thing';
import {SCBuildingWithoutReferences} from '../things/Building';
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
import {SCRoomWithoutReferences} from '../things/Room';
/**
* A thing that is or happens in a place
*/
export interface SCThingInPlace extends SCThing {
/**
* Place the thing is or happens in
*/
inPlace?:
SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing} from '../Thing';
/**
* Types of payment that are accepted at a place.
*/
export type SCThingThatAcceptsPaymentsAcceptedPayments =
'Cash'
| 'Credit'
| 'Cafeteria Card';
/**
* A place without references that accepts payments
*/
export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThing {
/**
* Accepted payments of the place
*/
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];
}

View File

@@ -1,128 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing, SCThingTranslatableProperties} from '../Thing';
import {SCBuildingWithoutReferences} from '../things/Building';
import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
import {SCRoomWithoutReferences} from '../things/Room';
import {SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
/**
* A map from group name to price
*/
export interface SCPriceGroup {
[s: string]: number | undefined;
}
/**
* Price distinctions for academic context
*/
export interface SCAcademicPriceGroup extends SCPriceGroup {
/**
* Price for employees
*/
employee?: number;
/**
* Price for guests
*/
guest?: number;
/**
* Price for students
*/
student?: number;
}
/**
* A thing without references that has a price tag
*/
export interface SCThingThatCanBeOffered<T extends SCPriceGroup> extends SCThing {
/**
* List of offers for that thing
*/
offers?: Array<SCThingThatCanBeOfferedOffer<T>>;
/**
* Translations of a thing that can be offered
*/
translations?: SCTranslations<SCThingThatCanBeOfferedTranslatableProperties>;
}
/**
* Offer of a thing
*/
export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> {
/**
* Availability of an offer
*/
availability: SCThingThatCanBeOfferedAvailability;
/**
* The time when the thing becomes unavailable as an SCISO8601Date formatted string.
*/
availabilityEnds?: SCISO8601Date;
/**
* The time when the thing becomes available as an SCISO8601Date formatted string.
*/
availabilityStarts?: SCISO8601Date;
/**
* Default price of the thing
*/
price: number;
/**
* List of prices that are distinct for specific groups
*/
prices?: T;
/**
* Provider of an offer
*/
provider: SCThingThatCanBeOfferedProvider;
}
/**
* Translatable properties of a thing that can be offered
*/
export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTranslatableProperties {
/**
* Availability of an offer
*/
'offers[].availability'?: string;
}
/**
* Possible things a provider can be
*/
export type SCThingThatCanBeOfferedProvider =
SCBuildingWithoutReferences
| SCOrganizationWithoutReferences
| SCPersonWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
/**
* Availability of an Offer
*/
export type SCThingThatCanBeOfferedAvailability =
'in stock'
| 'out of stock'
| 'online only'
| 'limited availability';

View File

@@ -1,86 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing, SCThingTranslatableProperties} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCMap} from '../types/Map';
/**
* A thing without references with categories
*
* !!! BEWARE !!!
* `T` should be a union type - e.g. `T = 'foo' | 'bar' | 'foobar';`
*/
export interface SCThingWithCategoriesWithoutReferences<T,
U extends SCThingWithCategoriesSpecificValues>
extends SCThing {
/**
* Categories of a thing with categories
*/
categories: T[];
/**
* Use this to explicitly override general opening hours brought in scope by openingHoursSpecification or openingHours
*
* A map from categories to their specific values.
*/
categorySpecificValues?: SCMap<U>;
/**
* Translated fields of a thing with categories
*/
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
}
/**
* Translatable properties of a thing with categories
*/
export interface SCThingWithCategoriesTranslatableProperties extends SCThingTranslatableProperties {
/**
* translations of the categories of a thing with categories
*/
categories?: string[];
}
/**
* Category specific values of a thing with categories
*
* This interface contains properties that can be specific to a certain category.
*/
export interface SCThingWithCategoriesSpecificValues {
/**
* Category specific alternate names of a thing
*/
alternateNames?: string[];
/**
* Category specific description of a thing
*/
description?: string;
/**
* Category specific image of a thing
*/
image?: string;
/**
* Category specific name of a thing
*/
name?: string;
/**
* Category specific URL of a thing
*/
url?: string;
}

View File

@@ -1,23 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing, SCThingTranslatableProperties} from '../Thing';
import {SCTranslations} from '../types/i18n';
/**
* A thing that has translations
*/
export interface SCThingWithTranslations extends SCThing {
translations: SCTranslations<SCThingTranslatableProperties>;
}

View File

@@ -1,166 +0,0 @@
/*
* Copyright (C) 2018-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 {ValidationError} from 'jsonschema';
/**
* A generic error that can be returned by the backend if somethings fails during the processing of a request
*
* @validatable
*/
export interface SCErrorResponse extends Error {
/**
* Additional data that describes the error
*/
additionalData?: any;
/**
* HTTP status code to return this error with
*/
statusCode: number;
}
/**
* An error that can be created by the backend during the processing of a request
*/
export abstract class SCError implements SCErrorResponse {
/**
* Call stack of the error
*/
stack?: string;
/**
* Instatiate an SCError
* @param name Name of the error
* @param message Message of the error
* @param statusCode HTTP status code to return this error with
* @param stack Set to true if a stack trace should be created
*/
constructor(public name: string, public message: string, public statusCode: number, stack?: boolean) {
// generate stacktrace if needed
if (stack) {
this.stack = (new Error()).stack;
}
}
}
/**
* An error that is returned when the validation of a request fails
*/
export class SCValidationErrorResponse extends SCError {
/**
* List of validatation errors
*/
additionalData: ValidationError[];
/**
* Create a SCValidationErrorResponse
* @param errors List of validation errors
* @param stack Set to true if a stack trace should be created
*/
constructor(errors: ValidationError[], stack?: boolean) {
super('ValidationError', 'Validation of request failed', 400, stack);
this.additionalData = errors;
}
}
/**
* An error that is returned when the content type of the request is not supported
*/
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
/**
* Create a SCUnsupportedMediaTypeErrorResponse
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('UnsupportedMediaTypeError', 'Unsupported media type', 415, stack);
}
}
/**
* An error that is returned, when the used HTTP method is not allowed on the requested route
*/
export class SCMethodNotAllowedErrorResponse extends SCError {
/**
* Create a SCMethodNotAllowedErrorResponse
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', 405, stack);
}
}
/**
* An error that is returned, when to many request are submitted at once
*/
export class SCTooManyRequestsErrorResponse extends SCError {
/**
* Create a SCTooManyRequestsErrorResponse
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('TooManyRequestsError', 'Too many requests. You can not submit more than 5 queries an once', 429, stack);
}
}
/**
* An error that is returned when the requested route or resource was not found
*/
export class SCNotFoundErrorResponse extends SCError {
/**
* Create a SCNotFoundErrorResponse
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('NotFoundError', 'Resource not found', 404, stack);
}
}
/**
* An error that is returned whenever there is a syntax error
*/
export class SCSyntaxErrorResponse extends SCError {
/**
* Create a SyntaxError
* @param message Describes the syntax error
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('SyntaxError', message, 400, stack);
}
}
/**
* An error that is returned, when an internal server error occurred
*/
export class SCInternalServerErrorResponse extends SCError {
/**
* Internal error that occurred. If the stack is disabled this error is not set for security reasons
*/
additionalData?: Error;
/**
* Create a SCInternalServerErrorResponse
* @param err Internal server error
* @param stack Set to true if a stack trace should be created
* and the internal server error should be displayed to the client
*/
constructor(err?: Error, stack?: boolean) {
super('InternalServerError', 'Internal server error', 502, stack);
if (stack) {
this.additionalData = err;
}
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2018-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 {SCAbstractRoute} from '../../../Route';
/**
* Index request
*
* @validatable
*/
export interface SCIndexRequest {
}
/**
* Route to request meta information about the deployment
*/
export class SCIndexRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCSyntaxError',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
];
this.method = 'POST';
this.requestBodyName = 'SCIndexRequest';
this.responseBodyName = 'SCIndexResponse';
this.statusCodeSuccess = 200;
this.urlFragment = '/';
}
}

View File

@@ -1,49 +0,0 @@
/*
* Copyright (C) 2018-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 {SCThings} from '../../../../Classes';
import {SCAbstractRoute} from '../../../../Route';
/**
* Request to update an existing thing
*
* @validatable
*/
export type SCThingUpdateRequest = SCThings;
/**
* Route for updating existing things
*/
export class SCThingUpdateRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCNotFoundErrorResponse',
'SCSyntaxError',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
];
this.method = 'PUT';
this.obligatoryParameters = {
TYPE: 'SCThingTypes',
UID: 'SCUuid',
};
this.requestBodyName = 'SCThingUpdateRequest';
this.responseBodyName = 'SCThingUpdateResponse';
this.statusCodeSuccess = 200;
this.urlFragment = '/:TYPE/:UID';
}
}

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2018 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 {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../../base/ThingThatCanBeOffered';
/**
* List of availabilities of a book
* @validatable
*/
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;

View File

@@ -1,47 +0,0 @@
/*
* Copyright (C) 2018-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 {SCThings} from '../../../../Classes';
import {SCAbstractRoute} from '../../../../Route';
/**
* Request to add a thing to a bulk
* @validatable
*/
export type SCBulkAddRequest = SCThings;
/**
* Route for indexing SC things in a bulk
*/
export class SCBulkAddRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCNotFoundErrorResponse',
'SCSyntaxError',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
];
this.method = 'POST';
this.obligatoryParameters = {
UID: 'SCUuid',
};
this.requestBodyName = 'SCBulkAddRequest';
this.responseBodyName = 'SCBulkAddResponse';
this.statusCodeSuccess = 201;
this.urlFragment = '/bulk/:UID';
}
}

View File

@@ -1,20 +0,0 @@
/*
* Copyright (C) 2018 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/>.
*/
/**
* Response to a request to add a thing to a bulk
* @validatable
*/
export interface SCBulkAddResponse {
}

View File

@@ -1,47 +0,0 @@
/*
* Copyright (C) 2018-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 {SCAbstractRoute} from '../../../../Route';
/**
* Request to change the bulk state to done (close the bulk process)
* @validatable
*/
export interface SCBulkDoneRequest {
}
/**
* Route for closing bulks
*/
export class SCBulkDoneRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCNotFoundErrorResponse',
'SCSyntaxError',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
];
this.method = 'POST';
this.obligatoryParameters = {
UID: 'SCUuid',
};
this.requestBodyName = 'SCBulkDoneRequest';
this.responseBodyName = 'SCBulkDoneResponse';
this.statusCodeSuccess = 204;
this.urlFragment = '/bulk/:UID/done';
}
}

View File

@@ -1,20 +0,0 @@
/*
* Copyright (C) 2018 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/>.
*/
/**
* Response to a request to change the state of a bulk to done
* @validatable
*/
export interface SCBulkDoneResponse {
}

View File

@@ -1,51 +0,0 @@
/*
* Copyright (C) 2018-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 {SCAbstractRoute} from '../../../Route';
import {SCSearchQuery} from './SearchRequest';
/**
* A multi search request
*
* This is a map of [[SCSearchRequest]]s indexed by name.
*
* **CAUTION: This is limited to an amount of queries. Currently this limit is 5.**
*
* @validatable
*/
export interface SCMultiSearchRequest {
[k: string]: SCSearchQuery;
}
/**
* Route for submission of multiple search requests at once
*/
export class SCMultiSearchRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCSyntaxError',
'SCTooManyRequestsErrorResponse',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
];
this.method = 'POST';
this.requestBodyName = 'SCMultiSearchRequest';
this.responseBodyName = 'SCMultiSearchResponse';
this.statusCodeSuccess = 200;
this.urlFragment = '/search/multi';
}
}

View File

@@ -1,113 +0,0 @@
/*
* Copyright (C) 2018 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 {SCEvent, SCEventWithoutReferences} from '../base/Event';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
/**
* An academic event without references
*/
export interface SCAcademicEventWithoutReferences
extends SCEventWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues> {
/**
* Majors of the academic event that this event belongs to
*/
majors?: string[];
/**
* Original unmapped category from the source of the academic event
*/
originalCategory?: string;
/**
* Translated fields of an academic event
*/
translations?: SCTranslations<SCAcademicEventTranslatableProperties>;
/**
* Type of an academic event
*/
type: SCThingType.AcademicEvent;
}
/**
* An academic event
*
* @validatable
*/
export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferences {
/**
* Translated fields of an academic event
*/
translations?: SCTranslations<SCAcademicEventTranslatableProperties>;
/**
* Type of an academic event
*/
type: SCThingType.AcademicEvent;
}
/**
* Event meta data
*/
export class SCAcademicEventMeta extends SCThingMeta {
static fieldValueTranslations = {
...SCThingMeta.fieldValueTranslations,
de: {
type: 'Event',
},
};
}
/**
* Categories of academic events
*/
export type SCAcademicEventCategories =
'lecture'
| 'seminar'
| 'integrated course'
| 'written exam'
| 'tutorial'
| 'project'
| 'colloquium'
| 'practicum'
| 'introductory class'
| 'course'
| 'practicum introduction'
| 'excursion'
| 'special';
/**
* Translatable properties of an academic event
*/
export interface SCAcademicEventTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties {
/**
* Translations of the majors of the academic event that this event belongs to
*/
majors?: string[];
/**
* Translation of the original unmapped category from the source of the academic event
*/
originalCategory?: string;
}

View File

@@ -1,95 +0,0 @@
/*
* Copyright (C) 2018 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 {
SCCreativeWork,
SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
/**
* An article without references
*/
export interface SCArticleWithoutReferences
extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCArticleCategories,
SCThingWithCategoriesSpecificValues> {
/**
* Article itself as markdown
*/
articleBody: string;
/**
* Translated fields of an article
*/
translations?: SCTranslations<SCArticleTranslatableProperties>;
/**
* Type of an article
*/
type: SCThingType.Article;
}
/**
* An article
*
* @validatable
*/
export interface SCArticle extends SCCreativeWork, SCArticleWithoutReferences {
/**
* Translated fields of an article
*/
translations?: SCTranslations<SCArticleTranslatableProperties>;
/**
* Type of an article
*/
type: SCThingType.Article;
}
/**
* Meta information about an article
*/
export class SCArticleMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
de: {
articleBody: 'Artikeltext',
categories: 'Kategorien',
},
};
}
/**
* Categories of articles
*/
export type SCArticleCategories = 'unipedia';
/**
* Translatable properties of creative works
*/
export interface SCArticleTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
/**
* Translation of the article itself as markdown
*/
articleBody?: string[];
}

View File

@@ -1,100 +0,0 @@
/*
* Copyright (C) 2018 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 {
SCCreativeWork,
SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork';
import {SCThingWithCategoriesTranslatableProperties} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCPersonWithoutReferences} from './Person';
/**
* A book without references
*/
export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences {
/**
* Edition of a book
*/
bookEdition?: string;
/**
* ISBN of a book
*/
isbn: string;
/**
* Number of pages of a book
*/
numberOfPages?: number;
/**
* Translated properties of a book
*/
translations?: SCTranslations<SCBookTranslatableFields>;
/**
* Type of a book
*/
type: SCThingType.Book;
}
/**
* A book
*
* @validatable
*/
export interface SCBook extends SCCreativeWork, SCBookWithoutReferences {
/**
* Authors of the creative work
*/
authors: SCPersonWithoutReferences[];
/**
* Translated properties of a book
*/
translations?: SCTranslations<SCBookTranslatableFields>;
/**
* Type of a book
*/
type: SCThingType.Book;
}
/**
* Meta information about a book
*/
export class SCBookMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
de: {
bookEdition: 'Edition',
isbn: 'ISBN',
numberOfPages: 'Seitenanzahl',
},
};
}
/**
* Translatable properties of a book
*/
export interface SCBookTranslatableFields
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
/**
* Translation of an edition of a book
*/
bookEdition?: string;
}

View File

@@ -1,90 +0,0 @@
/*
* Copyright (C) 2018 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 {SCPlaceWithoutReferences} from '../base/Place';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
export type SCBuildingCategories =
'cafe'
| 'education'
| 'library'
| 'office'
| 'canteen'
| 'student canteen'
| 'restaurant'
| 'restroom';
export interface SCBuildingWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>,
SCPlaceWithoutReferences {
/**
* Categories of a building
*/
categories: SCBuildingCategories[];
/**
* List of floor names of the place
*/
floors?: string[];
/**
* Translated fields of a building
*/
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
/**
* Type of the building
*/
type: SCThingType.Building;
}
/**
* A building
*
* @validatable
*/
export interface SCBuilding extends SCBuildingWithoutReferences {
/**
* Type of the building
*/
type: SCThingType.Building;
}
/**
* Meta information about a place
*/
export class SCBuildingMeta extends SCThingMeta {
static fieldValueTranslations = {
...SCThingMeta.fieldValueTranslations,
de: {
categories: {
'cafe': 'Café',
'canteen': 'Kantine',
'education': 'Bildung',
'library': 'Bibliothek',
'office': 'Büro',
'restaurant': 'Restaurant',
'restroom': 'Toilette',
'student canteen': 'Mensa',
},
},
};
}

View File

@@ -1,74 +0,0 @@
/*
* Copyright (C) 2018 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 {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
import {SCThingWithCategoriesSpecificValues, SCThingWithCategoriesWithoutReferences} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
/**
* A catalog without references
*/
export interface SCCatalogWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCCatalogCategories,
SCThingWithCategoriesSpecificValues> {
/**
* 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.
*/
level: number;
/**
* Type of a catalog
*/
type: SCThingType.Catalog;
}
/**
* A catalog
*
* @validatable
*/
export interface SCCatalog extends SCCatalogWithoutReferences {
/**
* Academic term that a catalog belongs to (e.g. semester)
*/
academicTerm?: SCAcademicTermWithoutReferences;
/**
* The direct parent of a catalog
*/
superCatalog?: SCCatalogWithoutReferences;
/**
* An array of catalogs from the 'level 0' (root) catalog to the direct parent
*/
superCatalogs?: SCCatalogWithoutReferences[];
/**
* Type of a catalog
*/
type: SCThingType.Catalog;
}
/**
* Catalog meta data
*/
export class SCCatalogMeta extends SCThingMeta {
}
/**
* Categories of catalogs
*/
export type SCCatalogCategories = 'university events';

View File

@@ -1,134 +0,0 @@
/*
* Copyright (C) 2018 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 {SCAcademicDegree} from '../base/AcademicDegree';
import {SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCLanguage, SCTranslations} from '../types/i18n';
import {SCDateSeriesWithoutReferences} from './DateSeries';
import {SCOrganization} from './Organization';
/**
* A course of studies without references
*/
export interface SCCourseOfStudiesWithoutReferences extends
SCAcademicDegree,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/**
* The main language in which the course of studies
* is beeing offered
*/
mainLanguage: SCLanguage;
/**
* Actual major of the course of studies (eg. physics)
*/
major: string;
/**
* The modes the course of studies is offered in
*/
mode: SCCourseOfStudiesMode;
/**
* The time modes the course of studies is offered in
*/
timeMode: SCCourseOfStudiesTimeMode;
/**
* Translated fields of a dish
*/
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
/**
* Type of the course of studies
*/
type: SCThingType.CourseOfStudies;
}
/**
* A course of studies
*
* @validatable
*/
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
/**
* The department that manages the course of studies
*/
department: SCOrganization;
/**
* The secretary that administers requests and
* questions concerning the course of studies
*/
secretary: SCOrganization;
/**
* Dates at which the course of studies is planned to start
*/
startDates?: SCDateSeriesWithoutReferences[];
/**
* Type of the course of studies
*/
type: SCThingType.CourseOfStudies;
}
export interface SCCourseOfStudiesTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
}
/**
* course of studies meta data
*/
export class SCCourseOfStudiesMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
de: {
academicDegree: 'Hochschulabschluss',
department: 'Fachbereich',
major: 'Studienfach',
modes: 'Studiengangsarten',
secretary: 'Sekretariat',
},
};
static fieldValueTranslations = {
...SCThingMeta.fieldValueTranslations,
de: {
modes: {
combination: 'Kombinationsstudiengang',
dual: 'Dualer Studiengang',
fulltime: 'Vollzeitstudiengang',
parttime: 'Teilzeitstudiengang',
},
type: 'Studiengang',
},
};
}
/**
* Types of (german) course of studies modes
*/
export type SCCourseOfStudiesMode = 'combination' |
'dual' |
'double-degree' |
'standard' ;
/**
* Types of (german) course of studies time modes
*/
export type SCCourseOfStudiesTimeMode = 'fulltime' |
'parttime' ;

View File

@@ -1,122 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThingInPlace} from '../base/ThingInPlace';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties,
} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCISO8601Date, SCISO8601Duration} from '../types/Time';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCPersonWithoutReferences} from './Person';
import {SCSportCourseWithoutReferences} from './SportCourse';
/**
* Price groups for sport courses
*/
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
/**
* Price for alumnis
*/
alumni: number;
}
/**
* A date without references
*/
export interface SCDateSeriesWithoutReferences
extends SCThingThatCanBeOffered<SCSportCoursePriceGroup> {
/**
* Dates of the date series that are initially planned to be held
*/
dates: SCISO8601Date[];
/**
* Duration of the date series
*/
duration: SCISO8601Duration;
/**
* Dates that where initially planned to be held but are cancelled
*/
exceptions?: SCISO8601Date[];
/**
* Frequency of the date series
*/
frequency: string;
/**
* Translated properties
*/
translations?: SCTranslations<SCDateSeriesTranslatableProperties>;
/**
* Type of a date series
*/
type: SCThingType.DateSeries;
}
/**
* A date series
*
* @validatable
*/
export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace {
/**
* Event to which the date series belongs
*/
event: SCAcademicEventWithoutReferences
| SCSportCourseWithoutReferences;
/**
* Performers of the date series
*/
performers?: SCPersonWithoutReferences[];
/**
* Translated properties
*/
translations?: SCTranslations<SCDateSeriesTranslatableProperties>;
/**
* Type of a date series
*/
type: SCThingType.DateSeries;
}
/**
* Date series meta data
*/
export class SCDateSeriesMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
de: {
dates: 'Einzeltermine',
duration: 'Dauer',
frequency: 'Wiederholung',
},
};
}
/**
* Translatable properties of date series'
*/
export interface SCDateSeriesTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
frequency?: string;
}

View File

@@ -1,74 +0,0 @@
/*
* Copyright (C) 2018 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 * as jsonpatch from 'json-patch';
import {SCThingsWithoutDiff} from '../Classes';
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCISO8601Date} from '../types/Time';
/**
* A diff without references
*/
export interface SCDiffWithoutReferences extends SCThing {
/**
* Action of the diff
*/
action: 'changed' | 'removed';
/**
* Diff patch. Only when action === 'changed'
*/
changes?: jsonpatch.OpPatch[];
/**
* Creation date of the diff.
*/
dateCreated: SCISO8601Date;
/**
* Type of a diff
*/
type: SCThingType.Diff;
}
/**
* A diff
*
* @validatable
*/
export interface SCDiff extends SCDiffWithoutReferences {
/**
* Original object the diff was generated on
*/
object: SCThingsWithoutDiff;
/**
* Type of a diff
*/
type: SCThingType.Diff;
}
/**
* Diff meta data
*/
export class SCDiffMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
de: {
action: 'Aktion',
changes: 'Änderungen',
dateCreated: 'Erstellungsdatum',
},
};
}

View File

@@ -1,171 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThingInPlace} from '../base/ThingInPlace';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedTranslatableProperties,
} from '../base/ThingThatCanBeOffered';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
/**
* A dish without references
*/
export interface SCDishWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCDishCategories,
SCThingWithCategoriesSpecificValues>,
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
/**
* Additives of the dish
*/
additives?: string[];
/**
* Category of the dish
*/
categories: SCDishCategories[];
/**
* Characteristics of the dish
*/
characteristics?: SCDishCharacteristic[];
/**
* Nutrition information (calories and nutrients with amounts)
*/
nutrition?: SCNutritionInformation;
/**
* Translated fields of a dish
*/
translations?: SCTranslations<SCDishTranslatableProperties>;
/**
* Type of a dish
*/
type: SCThingType.Dish;
}
/**
* A dish
*
* @validatable
*/
export interface SCDish extends SCDishWithoutReferences, SCThingInPlace {
/**
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
*/
dishAddOns?: SCDishWithoutReferences[];
/**
* Translated fields of a dish
*/
translations?: SCTranslations<SCDishTranslatableProperties>;
/**
* Type of a dish
*/
type: SCThingType.Dish;
}
export interface SCDishTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
}
/**
* Dish meta data
*/
export class SCDishMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
de: {
categories: 'Kategorien',
},
};
}
/**
* Composition of properties of a food characteristic
*/
export interface SCDishCharacteristic {
/**
* URL to the image of the characteristic
*/
image?: string;
/**
* Name of the characteristic
*/
name: string;
}
/**
* A list of categories for dishes
*/
export type SCDishCategories =
'appetizer'
| 'salad'
| 'main dish'
| 'dessert'
| 'soup'
| 'side dish';
/**
* Type definition for SCNutritionInformation
*
* @see https://schema.org/NutritionInformation
*/
export interface SCNutritionInformation {
/**
* Number of calories contained (in kcal)
*/
calories?: number;
/**
* Content of carbohydrates (in grams)
*/
carbohydrateContent?: number;
/**
* Content of fat (in grams)
*/
fatContent?: number;
/**
* Content of proteins (in grams)
*/
proteinContent?: number;
/**
* Content of salt (in grams)
*/
saltContent?: number;
/**
* Content of saturated fat (in grams)
*/
saturatedFatContent?: number;
/**
* Content of sugar (in grams)
*/
sugarContent?: number;
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (C) 2018, 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 {SCSaveableThing} from '../base/SaveableThing';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCArticleWithoutReferences} from './Article';
import {SCBookWithoutReferences} from './Book';
import {SCBuildingWithoutReferences} from './Building';
import {SCPersonWithoutReferences} from './Person';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
import {SCRoomWithoutReferences} from './Room';
import {SCSportCourseWithoutReferences} from './SportCourse';
import {SCToDoWithoutReferences} from './ToDo';
/**
* Types that can be made a favorite (added as a favorite)
*/
export type SCFavoriteDataTypes = SCAcademicEventWithoutReferences
| SCArticleWithoutReferences
| SCBookWithoutReferences
| SCBuildingWithoutReferences
| SCPersonWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences
| SCSportCourseWithoutReferences
| SCToDoWithoutReferences;
/**
* A favorite
*
* @validatable
*/
export interface SCFavorite extends SCSaveableThing<SCFavoriteDataTypes> {
/**
* Type of a favorite
*/
type: SCThingType.Favorite;
}
/**
* Meta information about a favorite
*/
export class SCFavoriteMeta extends SCThingMeta {
}

View File

@@ -1,100 +0,0 @@
/*
* Copyright (C) 2018 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 {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
import {SCThingInPlace} from '../base/ThingInPlace';
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
import {SCRoomWithoutReferences} from './Room';
/**
* A floor without references
*/
export interface SCFloorWithoutReferences extends SCThing {
/**
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
*/
floorName: string;
/**
* Floor plan
*/
plan: SCFloorFeatureCollectionWithPlaces<LineString, any>;
/**
* Translated fields of a floor
*/
translations?: SCTranslations<SCFloorTranslatableProperties>;
/**
* Type of a floor
*/
type: SCThingType.Floor;
}
/**
* A floor
*
* @validatable
*/
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
/**
* Translated fields of a floor
*/
translations?: SCTranslations<SCFloorTranslatableProperties>;
/**
* Type of a floor
*/
type: SCThingType.Floor;
}
/**
* Meta information about a floor
*/
export class SCFloorMeta extends SCThingMeta {
}
/**
* A feature collection
*/
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject, P = any>
extends FeatureCollection<T, P> {
/**
* Features of the collection
*/
features: Array<SCFloorFeatureWithPlace<T, P>>;
}
/***
* A feature with a place
*/
export interface SCFloorFeatureWithPlace<T extends GeometryObject, P = any>
extends Feature<T, P> {
/**
* The place of the feature
*/
place?: SCRoomWithoutReferences | SCPointOfInterestWithoutReferences;
}
/**
* Translatable properties of a floor
*/
export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
/**
* Translation of the floor name
*/
floorName?: string;
}

View File

@@ -1,95 +0,0 @@
/*
* Copyright (C) 2018 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 {
SCCreativeWork,
SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork';
import {SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
/**
* A message without references
*/
export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferences {
/**
* Audience of the message
*/
audiences: SCMessageAudience[];
/**
* When the message was created
*/
dateCreated?: SCISO8601Date;
/**
* Message itself
*/
message: string;
/**
* Translated fields of a message
*/
translations?: SCTranslations<SCMessageTranslatableProperties>;
/**
* Type of a message
*/
type: SCThingType.Message;
}
/**
* A message
*
* @validatable
*/
export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
/**
* Translated fields of a message
*/
translations?: SCTranslations<SCMessageTranslatableProperties>;
/**
* Type of a message
*/
type: SCThingType.Message;
}
/**
* Meta information about a message
*/
export class SCMessageMeta extends SCThingMeta {
}
/**
* Audiences for messages
*/
export type SCMessageAudience =
'students'
| 'employees'
| 'guests';
/**
* Translatable properties of a message
*/
export interface SCMessageTranslatableProperties
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
/**
* Message itself
*/
message?: string;
}

View File

@@ -1,179 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCNationality} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
import {SCBuildingWithoutReferences} from './Building';
import {SCOrganizationWithoutReferences} from './Organization';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
import {SCRoomWithoutReferences} from './Room';
/**
* A person without references
*/
export interface SCPersonWithoutReferences extends SCThing {
/**
* Additional first names of the person.
*/
additionalName?: string;
/**
* The birth date of the person.
*/
birthDate?: SCISO8601Date;
/**
* The private email address of the person.
*
* @TJS-format email
*/
email?: string;
/**
* The family name of the person.
*/
familyName: string;
/**
* The private fax number of the person.
*/
faxNumber?: string;
/**
* The gender of the person.
*/
gender?: SCPersonGender;
/**
* The first name of the person.
*/
givenName: string;
/**
* Honorific prefix of the person.
*/
honorificPrefix?: string;
/**
* Honorific suffix of the person.
*/
honorificSuffix?: string;
/**
* Titles of jobs that the person has.
*/
jobTitles?: string[];
/**
* The complete name of the person combining all the parts of the name into one.
*/
name: string;
/**
* The nationality of the person.
*/
nationality?: SCNationality;
/**
* The private telephone number of the person.
*/
telephone?: string;
/**
* Type of a person
*/
type: SCThingType.Person;
}
/**
* A person
*
* @validatable
*/
export interface SCPerson extends SCPersonWithoutReferences {
/**
* Organization the person works for
*/
affiliations?: SCOrganizationWithoutReferences[];
/**
* A list of homes of the person
*/
homeLocations?: Array<SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences>;
/**
* Type of a person
*/
type: SCThingType.Person;
/**
* Locations where the person performs her/his work
*/
workLocations?: SCContactPoint[];
}
/**
* Meta information about a person
*/
export class SCPersonMeta extends SCThingMeta {
}
/**
* 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
*/
email?: string;
/**
* Fax number at the work location
*/
faxNumber?: string;
/**
* Times available for contacting at the work location
*/
hoursAvailable?: string;
/**
* Contact number at the work location
*/
telephone?: string;
/**
* URL at the work location
*/
url?: string;
}
/**
* Gender of a person
*/
export type SCPersonGender =
'male'
| 'female'
| 'inter'
| 'undefined';

View File

@@ -1,74 +0,0 @@
/*
* Copyright (C) 2018 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 {SCPlaceWithoutReferences} from '../base/Place';
import {SCThingInPlace} from '../base/ThingInPlace';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
/**
* A point of interest without references
*/
export interface SCPointOfInterestWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>,
SCPlaceWithoutReferences {
/**
* Translated properties of a point of interest
*/
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
/**
* Type of a point of interest
*/
type: SCThingType.PointOfInterest;
}
/**
* A point of interest
*
* @validatable
*/
export interface SCPointOfInterest extends SCPointOfInterestWithoutReferences, SCThingInPlace {
/**
* Translated properties of a point of interest
*/
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
/**
* Type of a point of interest
*/
type: SCThingType.PointOfInterest;
}
/**
* Categories of a point of interest
*/
export type SCPointOfInterestCategories =
'computer'
| 'validator'
| 'card charger'
| 'printer'
| 'disabled access';
/**
* Meta data of a point of interest
*/
export class SCPointOfInterestMeta extends SCThingMeta {
}

View File

@@ -1,123 +0,0 @@
/*
* Copyright (C) 2018 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 {SCPlaceWithoutReferences} from '../base/Place';
import {SCThingInPlace} from '../base/ThingInPlace';
import {SCThingThatAcceptsPaymentsWithoutReferences} from '../base/ThingThatAcceptsPayments';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCMap} from '../types/Map';
/**
* Categories of a room
*/
export type SCRoomCategories =
'cafe'
| 'education'
| 'learn'
| 'library'
| 'office'
| 'restaurant'
| 'canteen'
| 'student canteen'
| 'restroom'
| 'lounge'
| 'student union';
/**
* A room without references
*/
export interface SCRoomWithoutReferences
extends SCPlaceWithoutReferences, SCThingThatAcceptsPaymentsWithoutReferences,
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
/**
* The name of the floor in which the room is in.
*/
floor?: string;
/**
* The inventory of the place/room as a list of items and their quantity.
*/
inventory?: SCMap<number>;
/**
* Translations of specific values of the object
*
* Take precedence over "main" value for selected languages.
*/
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
/**
* Type of the room
*/
type: SCThingType.Room;
}
/**
* A room
*
* @validatable
*/
export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace {
/**
* Translations of specific values of the object
*
* Take precedence over "main" value for selected languages.
*/
translations?: SCTranslations<SCThingWithCategoriesTranslatableProperties>;
/**
* Type of the room
*/
type: SCThingType.Room;
}
/**
* Category specific values of a room
*/
export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
/**
* Category specific opening hours of the room
*/
openingHours?: string;
}
/**
* Meta information about a place
*/
export class SCRoomMeta extends SCThingMeta {
static fieldValueTranslations = {
...SCThingMeta.fieldValueTranslations,
de: {
categories: {
'cafe': 'Café',
'canteen': 'Kantine',
'education': 'Bildung',
'learn': 'Lernen',
'library': 'Bibliothek',
'lounge': 'Lounge',
'office': 'Büro',
'restaurant': 'Restaurant',
'restroom': 'Toilette',
'student canteen': 'Mensa',
'student union': 'Studentenvereinigung',
},
},
};
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright (C) 2018 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 {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
import {SCThingMeta, SCThingType} from '../Thing';
/**
* A semester without references
*/
export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences {
/**
* The short name of the semester, using the given pattern.
*
* @pattern ^(WS|SS) [0-9]{4}(/[0-9]{2})?$
*/
acronym: string;
/**
* Type of the semester
*/
type: SCThingType.Semester;
}
/**
* A semester
*
* @validatable
*/
export interface SCSemester extends SCSemesterWithoutReferences {
/**
* Type of the semester
*/
type: SCThingType.Semester;
}
/**
* Semester meta data
*/
export class SCSemesterMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
de: {
acronym: 'Abkürzung',
endDate: 'Ende',
eventsEndDate: 'Vorlesungsschluss',
eventsStartDate: 'Vorlesungsbeginn',
startDate: 'Beginn',
},
};
}

View File

@@ -1,132 +0,0 @@
/*
* Copyright (C) 2018 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 {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
export type SCSettingCategories = string;
/**
* A setting without references
*/
export interface SCSettingWithoutReferences
extends SCThingWithCategoriesWithoutReferences<SCSettingCategories, SCThingWithCategoriesSpecificValues> {
/**
* The type of input/value this setting is carrying
*/
input: SCSettingInputType;
/**
* The order number this setting should show up in its category list
*/
order: number;
/**
* Translated fields of a setting
*/
translations?: SCTranslations<SCSettingValueTranslatableProperties>;
/**
* The type of this model
*/
type: SCThingType.Setting;
}
/**
* The types of input/value a setting object can carry
*/
export type SCSettingInputType = SCSettingSingleChoice
| SCSettingMultipleChoice
| SCSettingNumber
| SCSettingText
| SCSettingPassword;
/**
* A setting with references
*
* @validatable
*/
export interface SCSetting extends SCSettingWithoutReferences {
/**
* The type of this model
*/
type: SCThingType.Setting;
}
/**
* Input type with single choice as value
*/
export interface SCSettingSingleChoice {
defaultValue: SCSettingValue;
inputType: 'singleChoice';
value?: SCSettingValue;
values: SCSettingValue[];
}
/**
* Input type with multiple choice as value
*/
export interface SCSettingMultipleChoice {
defaultValue: SCSettingValue[];
inputType: 'multipleChoice';
value?: SCSettingValue[];
values: SCSettingValue[];
}
export type SCSettingValue = string | number | boolean;
/**
* Input type with number as value
*/
export interface SCSettingNumber {
defaultValue: number;
inputType: 'number';
value?: number;
}
/**
* Input type with text as value
*/
export interface SCSettingText {
defaultValue: string;
inputType: 'text';
value?: string;
}
/**
* Input type with secret text (eq. password) as value
*/
export interface SCSettingPassword {
defaultValue: string;
inputType: 'password';
value?: string;
}
/**
* Translatable properties of a setting
*/
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
}
/**
* Meta information about a setting
*/
export class SCSettingMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
};
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (C) 2018 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 {SCEvent, SCEventWithoutReferences} from '../base/Event';
import {SCThingMeta, SCThingType} from '../Thing';
/**
* A sport course without references
*/
export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences {
/**
* Type of a sport course
*/
type: SCThingType.SportCourse;
}
/**
* A sport course
*
* @validatable
*/
export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
/**
* Type of a sport course
*/
type: SCThingType.SportCourse;
}
/**
* Sport course meta data
*/
export class SCSportCourseMeta extends SCThingMeta {
static fieldValueTranslations = {
...SCThingMeta.fieldValueTranslations,
de: {
type: 'Sportkurs',
},
};
}

View File

@@ -1,66 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThingInPlace} from '../base/ThingInPlace';
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCISO8601Duration} from '../types/Time';
/**
* A ticket without references
*/
export interface SCTicketWithoutReferences extends SCThing {
/**
* Approximate wait time
*/
approxWaitingTime: SCISO8601Duration;
/**
* Waiting number of the ticket
*/
currentTicketNumber: string;
/**
* Service type of the ticket
*/
serviceType: any;
/**
* Type of a ticket
*/
type: SCThingType.Ticket;
}
/**
* A ticket
*
* @validatable
*/
export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
/**
* Type of a ticket
*/
type: SCThingType.Ticket;
}
/**
* Meta information about a ticket
*/
export class SCTicketMeta extends SCThingMeta {
static fieldValueTranslations = {
...SCThingMeta.fieldValueTranslations,
de: {
type: 'Ticket',
},
};
}

View File

@@ -1,60 +0,0 @@
/*
* 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 {SCThingWithCategoriesSpecificValues, SCThingWithCategoriesWithoutReferences} from '../base/ThingWithCategories';
import {SCThingType} from '../Thing';
import {SCISO8601Date} from '../types/Time';
/**
* A "to do" without references
*/
export interface SCToDoWithoutReferences
extends SCThingWithCategoriesWithoutReferences<string, SCThingWithCategoriesSpecificValues> {
/**
* Whether or not the "to do" is already done
*/
done: boolean;
/**
* A date when the "to do" is due
*/
dueDate?: SCISO8601Date;
/**
* Priority of the "to do"
*/
priority: SCToDoPriority;
/**
* Type of the "to do"
*/
type: SCThingType.ToDo;
}
/**
* A "to do"
*
* @validatable
*/
export interface SCToDo extends SCToDoWithoutReferences {
}
/**
* A priority of a "to do"
*/
export enum SCToDoPriority {
LOW = 0,
NORMAL = 2,
HIGH = 5,
}

View File

@@ -1,69 +0,0 @@
/*
* Copyright (C) 2018 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 {SCThingWithTranslations} from '../base/ThingWithTranslations';
import {SCBulkResponse} from '../protocol/routes/bulk/BulkResponse';
import {SCMultiSearchResponse} from '../protocol/routes/search/MultiSearchResponse';
import {SCSearchResponse} from '../protocol/routes/search/SearchResponse';
import {SCThing} from '../Thing';
/**
* Type guard to check if translations exist
*
* @param {SCThing} thing Thing to check
*/
export function isThingWithTranslations(thing: SCThing): thing is SCThingWithTranslations {
return typeof thing.translations !== 'undefined';
}
/**
* Type guard to check if something is a bulk response
*
* @param {any} something Something to check
*/
export function isBulkResponse(something: any): something is SCBulkResponse {
return typeof something.expiration === 'string'
&& typeof something.source === 'string'
&& typeof something.state === 'string'
&& typeof something.type === 'string'
&& typeof something.uid === 'string';
}
/**
* Type guard to check if something is a search response
*
* @param {any} something Something to check
*/
export function isSearchResponse(something: any): something is SCSearchResponse {
return Array.isArray(something.data)
&& Array.isArray(something.facets)
&& typeof something.pagination !== 'undefined'
&& typeof something.pagination.count === 'number'
&& typeof something.pagination.offset === 'number'
&& typeof something.pagination.total === 'number'
&& typeof something.stats !== 'undefined'
&& typeof something.stats.time === 'number';
}
/**
* Type guard to check if something is a multi search response
*
*
* @param something Something to check
*/
export function isMultiSearchResponse(something: any): something is SCMultiSearchResponse {
return Object.keys(something).reduce((previousOnesAreSearchResponses, key) => {
return previousOnesAreSearchResponses && isSearchResponse(something[key]);
}, true);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -17,18 +17,22 @@
*/
export interface SCLanguage {
/**
* The Alpha-2 Code of the Language
* The two letter ISO 639-1 Code of the Language
*
* @filterable
*/
code: SCLanguageCode;
/**
* The Fulltext name of the Language
*
* @filterable
*/
name: SCLanguageName;
}
/**
* A list of possible languages
* A list of possible languages in english
*
* @see https://en.wikipedia.org/wiki/ISO_639-1
*/
@@ -220,7 +224,9 @@ export type SCLanguageName =
| 'zulu';
/**
* A List of all possible Languages as Alpha-2 Codes
* A List of all possible Languages as ISO 639-1 Codes
*
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/
export type SCLanguageCode =
'aa'
@@ -668,7 +674,7 @@ export type SCNationality =
/**
* Translations for specific languages
*
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/
export interface SCTranslations<T> {
/**
@@ -681,3 +687,43 @@ export interface SCTranslations<T> {
*/
en?: T;
}
/**
* Type to represent requiredness of translation properties.
* Will be changed from RecursivePartial to RecursiveRequired in the future.
* (Source: https://stackoverflow.com/a/51365037)
*/
type RecursivePartial<T> = {
[P in keyof T]-?:
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
T[P] extends object ? RecursivePartial<T[P]> :
T[P];
};
/**
* Type to recursively map keys in <T> to a string value (used for translation)
*/
type SCRequiredTranslationKeys<T> = {
[key in keyof RecursivePartial<T>]: string;
};
/**
* Type that allows mapping from available keys of SCTranslations to SCRequiredTranslationKeys
*/
type SCRequiredTranslation<T> = {
[key in keyof SCTranslations<T>]: SCRequiredTranslationKeys<T>;
};
/**
* Interface to be implemented by all Meta classes
*/
export interface SCMetaTranslations<T> {
/**
* Field translations
*/
fieldTranslations: SCRequiredTranslation<T>;
/**
* Field value translations
*/
fieldValueTranslations: unknown;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* 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.
@@ -15,10 +15,10 @@
/**
* Capsulation for a map with a string as key with values of type `T`
*
*
* !!! BEWARE !!!
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
*
*
* @typeparam T Can be any type.
*/
export interface SCMap<T> {
@@ -27,3 +27,20 @@ export interface SCMap<T> {
*/
[key: string]: T;
}
/**
* Restricted map with keys, limited to values of `U`, and corresponding values of type `T`
*
* !!! BEWARE !!!
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
* Also note, that this is a type not an interface
*
* @typeparam U Must be a type the `in` operator can be applied to and contains only strings or numbers
* @typeparam T Can be any type
*/
export type SCRestrictedMap<U extends string | number, T> = {
/**
* One value for each key
*/
[key in U]: T
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -16,8 +16,10 @@
/**
* An ISO8601 date
*
* @pattern ^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$
* @pattern ^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])(T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])([\.,][0-9]{0,7})?(Z|[+-](?:2[0-3]|[01][0-9])(:?[0-5][0-9])?)?)?$
* @see https://gist.github.com/philipashlock/8830168
*
* @date
*/
export type SCISO8601Date = string;
/* tslint:enable */
@@ -35,6 +37,6 @@ export type SCISO8601Duration = string;
/**
* An ISO8601 time
*
* @pattern \d{2}:\d{2}(:\d{2})?
* @pattern ^(2[0-3]|[01][0-9]):?([0-5][0-9]):?([0-5][0-9])$
*/
export type SCISO8601Time = string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -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
*/

126
src/guards.ts Normal file
View File

@@ -0,0 +1,126 @@
/*
* 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
* unknown 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 {SCTranslations} from './general/i18n';
import {SCBulkResponse} from './protocol/routes/bulk-request';
import {SCSearchResponse} from './protocol/routes/search';
import {SCMultiSearchResponse} from './protocol/routes/search-multi';
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './things/abstract/thing';
/**
* Type guard to check if something is a SCThing
*
* @param something Something to check
*/
export function isThing(something: unknown): something is SCThing {
if (typeof something !== 'object' || something === null) {
return false;
}
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 as SCThingType) >= 0;
}
/**
* Type guard to check if translations exist
*
* @param thing Thing to check
*/
export function isThingWithTranslations(thing: SCThingWithoutReferences)
// tslint:disable-next-line:completed-docs
: thing is SCThingWithoutReferences & { translations: SCTranslations<SCThingTranslatableProperties>; } {
return typeof thing.translations !== 'undefined';
}
/**
* Type guard to check if something is a bulk response
*
* @param something Something to check
*/
export function isBulkResponse(something: unknown): something is SCBulkResponse {
if (typeof something !== 'object' || something === null) {
return false;
}
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';
}
/**
* Type guard to check if something is a search response
*
* @param something Something to check
*/
export function isSearchResponse(something: unknown): something is SCSearchResponse {
if (!(typeof something === 'object') || something === null) {
return false;
}
const somethingObject = (something as { [key: string]: { [key: string]: string; }; });
return Array.isArray(somethingObject.data)
&& Array.isArray(somethingObject.facets)
&& typeof somethingObject.pagination !== 'undefined'
&& typeof somethingObject.pagination.count === 'number'
&& typeof somethingObject.pagination.offset === 'number'
&& typeof somethingObject.pagination.total === 'number'
&& typeof somethingObject.stats !== 'undefined'
&& typeof somethingObject.stats.time === 'number';
}
/**
* Type guard to check if something is a multi search response
*
* @param something Something to check
*/
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false;
return Object.keys(something as { [key: string]: string; })
.reduce((previousOnesAreSearchResponses, key) => {
return previousOnesAreSearchResponses && isSearchResponse((something as { [key: string]: string; })[key]);
}, initialValue as boolean);
}

190
src/meta.ts Normal file
View File

@@ -0,0 +1,190 @@
/*
* Copyright (C) 2019-2021 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 {SCThingType} from './things/abstract/thing';
import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/academic-event';
import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article';
import {SCAssessment, SCAssessmentMeta, SCAssessmentWithoutReferences} from './things/assessment';
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book';
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building';
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog';
import {SCContactPoint, SCContactPointMeta, SCContactPointWithoutReferences} from './things/contact-point';
import {SCCourseOfStudy, SCCourseOfStudyMeta, SCCourseOfStudyWithoutReferences} from './things/course-of-study';
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series';
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff';
import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish';
import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/favorite';
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/floor';
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/message';
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization';
import {SCPeriodical, SCPeriodicalMeta, SCPeriodicalWithoutReferences} from './things/periodical';
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person';
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest';
import {
SCPublicationEvent,
SCPublicationEventMeta,
SCPublicationEventWithoutReferences,
} from './things/publication-event';
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/room';
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/semester';
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/setting';
import {SCSportCourse, SCSportCourseMeta, SCSportCourseWithoutReferences} from './things/sport-course';
import {SCStudyModule, SCStudyModuleMeta, SCStudyModuleWithoutReferences} from './things/study-module';
import {SCTicket, SCTicketMeta, SCTicketWithoutReferences} from './things/ticket';
import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/todo';
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour';
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video';
/* tslint:disable:variable-name */
/**
* A map of things, from type to meta data
*/
export const SCClasses: { [K in SCThingType]: object } = {
/* tslint:enable */
'assessment': SCAssessmentMeta,
'academic event': SCAcademicEventMeta,
'article': SCArticleMeta,
'book': SCBookMeta,
'building': SCBuildingMeta,
'catalog': SCCatalogMeta,
'contact point': SCContactPointMeta,
'course of study': SCCourseOfStudyMeta,
'date series': SCDateSeriesMeta,
'diff': SCDiffMeta,
'dish': SCDishMeta,
'favorite': SCFavoriteMeta,
'floor': SCFloorMeta,
'message': SCMessageMeta,
'organization': SCOrganizationMeta,
'periodical': SCPeriodicalMeta,
'person': SCPersonMeta,
'point of interest': SCPointOfInterestMeta,
'publication event': SCPublicationEventMeta,
'room': SCRoomMeta,
'semester': SCSemesterMeta,
'setting': SCSettingMeta,
'sport course': SCSportCourseMeta,
'study module': SCStudyModuleMeta,
'ticket': SCTicketMeta,
'todo': SCToDoMeta,
'tour': SCTourMeta,
'video': SCVideoMeta,
};
export type SCIndexableThings =
SCAssessment
| SCAcademicEvent
| SCArticle
| SCBook
| SCBuilding
| SCCatalog
| SCContactPoint
| SCCourseOfStudy
| SCDateSeries
| SCDish
| SCFloor
| SCMessage
| SCOrganization
| SCPeriodical
| SCPerson
| SCPointOfInterest
| SCPublicationEvent
| SCRoom
| SCSemester
| SCSportCourse
| SCStudyModule
| SCTicket
| SCToDo
| SCTour
| SCVideo;
/**
* An object that exists in the StAppsCore
*/
export type SCThings =
SCIndexableThings
| SCDiff | SCFavorite | SCSetting;
/**
* A field of a thing
*/
export type SCThingsField = keyof SCThings | string;
/**
* Thing without references for a thing
*/
export type SCAssociatedThingWithoutReferences<THING extends SCThings> =
THING extends SCAssessment ? SCAssessmentWithoutReferences :
THING extends SCAcademicEvent ? SCAcademicEventWithoutReferences :
THING extends SCArticle ? SCArticleWithoutReferences :
THING extends SCBook ? SCBookWithoutReferences :
THING extends SCBuilding ? SCBuildingWithoutReferences :
THING extends SCCatalog ? SCCatalogWithoutReferences :
THING extends SCContactPoint ? SCContactPointWithoutReferences :
THING extends SCCourseOfStudy ? SCCourseOfStudyWithoutReferences :
THING extends SCDateSeries ? SCDateSeriesWithoutReferences :
THING extends SCDiff ? SCDiffWithoutReferences :
THING extends SCDish ? SCDishWithoutReferences :
THING extends SCFavorite ? SCFavoriteWithoutReferences :
THING extends SCFloor ? SCFloorWithoutReferences :
THING extends SCMessage ? SCMessageWithoutReferences :
THING extends SCOrganization ? SCOrganizationWithoutReferences :
THING extends SCPeriodical ? SCPeriodicalWithoutReferences :
THING extends SCPerson ? SCPersonWithoutReferences :
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences :
THING extends SCPublicationEvent ? SCPublicationEventWithoutReferences :
THING extends SCRoom ? SCRoomWithoutReferences :
THING extends SCSemester ? SCSemesterWithoutReferences :
THING extends SCSetting ? SCSettingWithoutReferences :
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
THING extends SCTicket ? SCTicketWithoutReferences :
THING extends SCToDo ? SCToDoWithoutReferences :
THING extends SCTour ? SCTourWithoutReferences :
THING extends SCVideo ? SCVideoWithoutReferences :
never;
/**
* Thing for a thing without references
*/
export type SCAssociatedThing<THING extends SCThings> =
THING extends SCAssessmentWithoutReferences ? SCAssessment :
THING extends SCAcademicEventWithoutReferences ? SCAcademicEvent :
THING extends SCArticleWithoutReferences ? SCArticle :
THING extends SCBookWithoutReferences ? SCBook :
THING extends SCBuildingWithoutReferences ? SCBuilding :
THING extends SCCatalogWithoutReferences ? SCCatalog :
THING extends SCContactPointWithoutReferences ? SCContactPoint :
THING extends SCCourseOfStudyWithoutReferences ? SCCourseOfStudy :
THING extends SCDateSeriesWithoutReferences ? SCDateSeries :
THING extends SCDiffWithoutReferences ? SCDiff :
THING extends SCDishWithoutReferences ? SCDish :
THING extends SCFavoriteWithoutReferences ? SCFavorite :
THING extends SCFloorWithoutReferences ? SCFloor :
THING extends SCMessageWithoutReferences ? SCMessage :
THING extends SCOrganizationWithoutReferences ? SCOrganization :
THING extends SCPeriodicalWithoutReferences ? SCPeriodical :
THING extends SCPersonWithoutReferences ? SCPerson :
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest :
THING extends SCPublicationEventWithoutReferences ? SCPublicationEvent :
THING extends SCRoomWithoutReferences ? SCRoom :
THING extends SCSemesterWithoutReferences ? SCSemester :
THING extends SCSettingWithoutReferences ? SCSetting :
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
THING extends SCTicketWithoutReferences ? SCTicket :
THING extends SCToDoWithoutReferences ? SCToDo :
THING extends SCTourWithoutReferences ? SCTour :
THING extends SCVideoWithoutReferences ? SCVideo :
never;

56
src/protocol/error.ts Normal file
View File

@@ -0,0 +1,56 @@
/*
* 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/>.
*/
/**
* A generic error that can be returned by the backend if somethings fails during the processing of a request
*
* @validatable
*/
export interface SCErrorResponse extends Error {
/**
* Additional data that describes the error
*/
additionalData?: unknown;
/**
* HTTP status code to return this error with
*/
statusCode: number;
}
/**
* An error that can be created by the backend during the processing of a request
*/
export abstract class SCError implements SCErrorResponse {
/**
* Call stack of the error
*/
stack?: string;
/**
* Instatiate an SCError
*
* @param name Name of the error
* @param message Message of the error
* @param statusCode HTTP status code to return this error with
* @param stack Set to true if a stack trace should be created
*/
constructor(public name: string, public message: string, public statusCode: number, stack = false) {
// generate stacktrace if needed
if (stack) {
this.stack = (new Error()).stack;
}
}
}

View File

@@ -0,0 +1,43 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned, when an internal server error occurred
*
* @validatable
*/
export class SCInternalServerErrorResponse extends SCError {
/**
* Internal error that occurred. If the stack is disabled this error is not set for security reasons
*/
additionalData?: Error;
/**
* Create a SCInternalServerErrorResponse
*
* @param err Internal server error
* @param stack Set to true if a stack trace should be created
* and the internal server error should be displayed to the client
*/
constructor(err?: Error, stack = false) {
super('InternalServerError', 'Internal server error', StatusCodes.BAD_GATEWAY, stack);
if (stack) {
this.additionalData = err;
}
}
}

View File

@@ -0,0 +1,32 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned, when the used HTTP method is not allowed on the requested route
*
* @validatable
*/
export class SCMethodNotAllowedErrorResponse extends SCError {
/**
* Create a SCMethodNotAllowedErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', StatusCodes.METHOD_NOT_ALLOWED, stack);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,25 +12,21 @@
* 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 {SCUuid} from '../../../types/UUID';
import {SCBulkParameters} from './BulkRequest';
import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* Requested Bulk from backend
* An error that is returned when the requested route or resource was not found
*
* @validatable
*/
export interface SCBulkResponse extends SCBulkParameters {
export class SCNotFoundErrorResponse extends SCError {
/**
* State of bulk
* Create a SCNotFoundErrorResponse
*
* The state is `in progress` while it accepts things to be added to the bulk.
* The state is `done` once it is closed.
* @param stack Set to true if a stack trace should be created
*/
state: 'in progress' | 'done';
/**
* Universally unique identifier of the bulk
*/
uid: SCUuid;
constructor(stack?: boolean) {
super('NotFoundError', 'Resource not found', StatusCodes.NOT_FOUND, stack);
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
* acceptable.
*
* @validatable
*/
export class SCParametersNotAcceptable extends SCError {
/**
* Create a ParametersNotAcceptable
*
* @param message contains more details to what you did wrong
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('ParametersNotAcceptable', message, StatusCodes.NOT_ACCEPTABLE, stack);
}
}

View File

@@ -0,0 +1,46 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
import {SCPluginMetaData} from '../routes/plugin-register';
/**
* An error that is returned when a plugin with the same name is already registered, to prevent two copies of a plugin
* running at the same time.
* This usually indicates that there is more than one instance a plugin running.
*
* @validatable
*/
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
/**
* Meta data of a registered plugin, which is in a conflict with the plugin we want to register.
* If the stack is disabled this is not set for security reasons
*/
additionalData?: SCPluginMetaData;
/**
* Create a SCPluginAlreadyRegisteredError
*
* @param message Provide further information why an already registered plugin matches the one 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
*/
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
super('SCPluginAlreadyRegisteredError', message, StatusCodes.CONFLICT, stack);
if (stack) {
this.additionalData = plugin;
}
}
}

View File

@@ -0,0 +1,33 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned whenever there is an unexpected error while creating a plugin
*
* @validatable
*/
export class SCPluginRegisteringFailedErrorResponse extends SCError {
/**
* Create a PluginRegisteringFailedError
*
* @param message Describes what went wrong wile registering the plugin
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('PluginRegisteringFailedError', message, StatusCodes.INTERNAL_SERVER_ERROR, stack);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,15 +12,21 @@
* 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 {SCSearchResult} from './SearchResponse';
import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* A multi search response
*
* This is a map of [[SCSearchResponse]]s indexed by name
* An error that is returned, when the request body is too large.
*
* @validatable
*/
export interface SCMultiSearchResponse {
[k: string]: SCSearchResult;
export class SCRequestBodyTooLargeErrorResponse extends SCError {
/**
* Create a SCRequestBodyTooLargeErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('RequestBodyTooLargeError', 'The request body is too large.', StatusCodes.REQUEST_TOO_LONG, stack);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,16 +12,22 @@
* 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 {SCAppConfiguration} from '../../../types/config/App';
import {SCBackendConfiguration} from '../../../types/config/Backend';
import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* A response to an index request
* An error that is returned whenever there is a syntax error
*
* @validatable
*/
export interface SCIndexResponse {
app: SCAppConfiguration;
backend: SCBackendConfiguration;
export class SCSyntaxErrorResponse extends SCError {
/**
* Create a SyntaxError
*
* @param message Describes the syntax error
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('SyntaxError', message, StatusCodes.BAD_REQUEST, stack);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,10 +12,26 @@
* 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 {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* Response for an entity update request
* An error that is returned, when to many request are submitted at once
*
* @validatable
*/
export interface SCThingUpdateResponse {
export class SCTooManyRequestsErrorResponse extends SCError {
/**
* Create a SCTooManyRequestsErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super(
'TooManyRequestsError',
'Too many requests. You can not submit more than 5 queries an once',
StatusCodes.TOO_MANY_REQUESTS,
stack,
);
}
}

View File

@@ -0,0 +1,32 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned when the content type of the request is not supported
*
* @validatable
*/
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
/**
* Create a SCUnsupportedMediaTypeErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('UnsupportedMediaTypeError', 'Unsupported media type', StatusCodes.UNSUPPORTED_MEDIA_TYPE, stack);
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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 {ValidationError} from '@openstapps/core-tools/lib/types/validator';
import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned when the validation of a request fails
*
* @validatable
*/
export class SCValidationErrorResponse extends SCError {
/**
* List of validatation errors
*/
additionalData: ValidationError[];
/**
* Create a SCValidationErrorResponse
*
* @param errors List of validation errors
* @param stack Set to true if a stack trace should be created
*/
constructor(errors: ValidationError[], stack?: boolean) {
super('ValidationError', 'Validation of request failed', StatusCodes.BAD_REQUEST, stack);
this.additionalData = errors;
}
}

240
src/protocol/route.ts Normal file
View File

@@ -0,0 +1,240 @@
/*
* 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 {SCMap} from '../general/map';
import {SCErrorResponse} from './error';
import {SCIndexRequest, SCIndexResponse, SCIndexRoute} from './routes';
import {
SCBookAvailabilityRequest,
SCBookAvailabilityResponse,
SCBookAvailabilityRoute,
} from './routes/book-availability';
import {SCBulkAddRequest, SCBulkAddResponse, SCBulkAddRoute} from './routes/bulk-add';
import {SCBulkDoneRequest, SCBulkDoneResponse, SCBulkDoneRoute} from './routes/bulk-done';
import {SCBulkRequest, SCBulkResponse, SCBulkRoute} from './routes/bulk-request';
import {SCFeedbackRequest, SCFeedbackResponse, SCFeedbackRoute} from './routes/feedback';
import {SCSearchRequest, SCSearchResponse, SCSearchRoute} from './routes/search';
import {SCMultiSearchRequest, SCMultiSearchResponse, SCMultiSearchRoute} from './routes/search-multi';
import {SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute} from './routes/thing-update';
/**
* Possible Verbs for HTTP requests
*/
export enum SCRouteHttpVerbs {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
}
/**
* The constructor of an error response
*/
// tslint:disable-next-line:no-any
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
/**
* A description of a route
*/
export interface SCRoute {
/**
* A map of names of possible errors that can be returned by the route with their appropriate status codes
*/
errorNames: SCErrorResponseConstructor[];
/**
* HTTP verb to use to request the route
*/
method: SCRouteHttpVerbs;
/**
* Map of obligatory parameters and their type that have to be set via the requested path
*/
obligatoryParameters?: SCMap<string>;
/**
* Name of the type of the request body
*/
requestBodyName: string;
/**
* Name of the type of the response body
*/
responseBodyName: string;
/**
* Status code for success
*/
statusCodeSuccess: number;
/**
* URL fragment of the route
*/
urlFragment: string;
}
/**
* An abstract route
*/
export abstract class SCAbstractRoute implements SCRoute {
/**
* @see SCRoute.errorNames
*/
errorNames: SCErrorResponseConstructor[] = [];
/**
* @see SCRoute.method
*/
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
/**
* @see SCRoute.obligatoryParameters
*/
obligatoryParameters?: SCMap<string>;
/**
* @see SCRoute.requestBodyName
*/
requestBodyName = 'any';
/**
* @see SCRoute.responseBodyName
*/
responseBodyName = 'any';
/**
* @see SCRoute.statusCodeSuccess
*/
statusCodeSuccess = 200;
/**
* @see SCRoute.urlFragment
*/
urlFragment = '/';
/**
* Get "compiled" URL fragment
*
* @param parameters Parameters to compile URL fragment with
*/
public getUrlFragment(parameters: SCMap<string> = {}): string {
let obligatoryParameters: string[] = [];
if (typeof this.obligatoryParameters === 'object') {
obligatoryParameters = Object.keys(this.obligatoryParameters);
}
if (Object.keys(parameters).length > obligatoryParameters.length) {
throw new Error('Extraneous parameters provided.');
}
return this.urlFragment
.split('/')
.map((part) => {
if (part.indexOf(':') !== 0) {
return part;
}
const parameter = part.substr(1);
if (typeof parameters[parameter] === 'undefined') {
throw new Error(`Parameter '${parameter}' not provided.`);
}
return parameters[parameter];
})
.join('/');
}
}
/**
* Possible requests
*/
export type SCRequests =
SCBookAvailabilityRequest
| SCBulkRequest
| SCBulkAddRequest
| SCBulkDoneRequest
| SCFeedbackRequest
| SCIndexRequest
| SCMultiSearchRequest
| SCSearchRequest
| SCThingUpdateRequest;
/**
* Possible responses
*/
export type SCResponses =
SCBookAvailabilityResponse
| SCBulkResponse
| SCBulkAddResponse
| SCBulkDoneResponse
| SCFeedbackResponse
| SCIndexResponse
| SCMultiSearchResponse
| SCSearchResponse
| SCThingUpdateResponse;
/**
* Associated response for a request
*/
export type SCAssociatedResponse<REQUEST> =
REQUEST extends SCBookAvailabilityRequest ? SCBookAvailabilityResponse :
REQUEST extends SCBulkRequest ? SCBulkResponse :
REQUEST extends SCBulkAddRequest ? SCBulkAddResponse :
REQUEST extends SCBulkDoneRequest ? SCBulkDoneResponse :
REQUEST extends SCFeedbackRequest ? SCFeedbackResponse :
REQUEST extends SCIndexRequest ? SCIndexResponse :
REQUEST extends SCMultiSearchRequest ? SCMultiSearchResponse :
REQUEST extends SCSearchRequest ? SCSearchResponse :
REQUEST extends SCThingUpdateRequest ? SCThingUpdateResponse :
never;
/**
* Associated request for a response
*/
export type SCAssociatedRequest<RESPONSE> =
RESPONSE extends SCBookAvailabilityResponse ? SCBookAvailabilityRequest :
RESPONSE extends SCBulkResponse ? SCBulkRequest :
RESPONSE extends SCBulkAddResponse ? SCBulkAddRequest :
RESPONSE extends SCBulkDoneResponse ? SCBulkDoneRequest :
RESPONSE extends SCFeedbackResponse ? SCFeedbackRequest :
RESPONSE extends SCIndexResponse ? SCIndexRequest :
RESPONSE extends SCMultiSearchResponse ? SCMultiSearchRequest :
RESPONSE extends SCSearchResponse ? SCSearchRequest :
RESPONSE extends SCThingUpdateResponse ? SCThingUpdateRequest :
never;
/**
* Associated request for a route
*/
export type SCAssignedRequest<ROUTE extends SCAbstractRoute> =
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityRequest :
ROUTE extends SCBulkRoute ? SCBulkRequest :
ROUTE extends SCBulkAddRoute ? SCBulkAddRequest :
ROUTE extends SCBulkDoneRoute ? SCBulkDoneRequest :
ROUTE extends SCFeedbackRoute ? SCFeedbackRequest :
ROUTE extends SCIndexRoute ? SCIndexRequest :
ROUTE extends SCMultiSearchRoute ? SCMultiSearchRequest :
ROUTE extends SCSearchRoute ? SCSearchRequest :
ROUTE extends SCThingUpdateRoute ? SCThingUpdateRequest :
never;
/**
* Associated response for a route
*/
export type SCAssignedResponse<ROUTE extends SCAbstractRoute> =
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityResponse :
ROUTE extends SCBulkRoute ? SCBulkResponse :
ROUTE extends SCBulkAddRoute ? SCBulkAddResponse :
ROUTE extends SCBulkDoneRoute ? SCBulkDoneResponse :
ROUTE extends SCFeedbackRoute ? SCFeedbackResponse :
ROUTE extends SCIndexRoute ? SCIndexResponse :
ROUTE extends SCMultiSearchRoute ? SCMultiSearchResponse :
ROUTE extends SCSearchRoute ? SCSearchResponse :
ROUTE extends SCThingUpdateRoute ? SCThingUpdateResponse :
never;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* 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.
@@ -12,11 +12,21 @@
* 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 {SCAbstractRoute} from '../../../Route';
import {SCUuid} from '../../../types/UUID';
import {StatusCodes} from 'http-status-codes';
import {SCUuid} from '../../general/uuid';
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Request to check the availability of books
*
* @validatable
*/
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
@@ -41,6 +51,13 @@ export interface SCBookAvailabilityRequestByUuid {
uid: SCUuid;
}
/**
* List of availabilities of a book
*
* @validatable
*/
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
/**
* Route for book availability
*
@@ -60,17 +77,18 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCNotFoundErrorResponse',
'SCSyntaxError',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = 'POST';
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCBookAvailabilityRequest';
this.responseBodyName = 'SCBookAvailabilityResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/bookAvailability';
}
}

View File

@@ -0,0 +1,65 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCThings} from '../../meta';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Request to add a thing to a bulk
*
* @validatable
*/
export type SCBulkAddRequest = SCThings;
/**
* Response to a request to add a thing to a bulk
*
* @validatable
*/
export interface SCBulkAddResponse {
}
/**
* Route for indexing SC things in a bulk
*/
export class SCBulkAddRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.obligatoryParameters = {
UID: 'SCUuid',
};
this.requestBodyName = 'SCBulkAddRequest';
this.responseBodyName = 'SCBulkAddResponse';
this.statusCodeSuccess = StatusCodes.CREATED;
this.urlFragment = '/bulk/:UID';
}
}

View File

@@ -0,0 +1,65 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Request to change the bulk state to done (close the bulk process)
*
* @validatable
*/
export interface SCBulkDoneRequest {
}
/**
* Response to a request to change the state of a bulk to done
*
* @validatable
*/
export interface SCBulkDoneResponse {
}
/**
* Route for closing bulks
*/
export class SCBulkDoneRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.obligatoryParameters = {
UID: 'SCUuid',
};
this.requestBodyName = 'SCBulkDoneRequest';
this.responseBodyName = 'SCBulkDoneResponse';
this.statusCodeSuccess = StatusCodes.NO_CONTENT;
this.urlFragment = '/bulk/:UID/done';
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* 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.
@@ -12,9 +12,17 @@
* 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 {SCAbstractRoute} from '../../../Route';
import {SCThingType} from '../../../Thing';
import {SCISO8601Date} from '../../../types/Time';
import {StatusCodes} from 'http-status-codes';
import {SCISO8601Date} from '../../general/time';
import {SCUuid} from '../../general/uuid';
import {SCThingType} from '../../things/abstract/thing';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* A bulk request
@@ -48,11 +56,31 @@ export interface SCBulkParameters {
/**
* Type of things that are indexed in this bulk.
*
*
*/
type: SCThingType;
}
/**
* Requested Bulk from backend
*
* @validatable
*/
export interface SCBulkResponse extends SCBulkParameters {
/**
* State of bulk
*
* The state is `in progress` while it accepts things to be added to the bulk.
* The state is `done` once it is closed.
*/
state: 'in progress' | 'done';
/**
* Universally unique identifier of the bulk
*/
uid: SCUuid;
}
/**
* Route for bulk creation
*/
@@ -60,16 +88,17 @@ export class SCBulkRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCSyntaxError',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = 'POST';
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCBulkRequest';
this.responseBodyName = 'SCBulkResponse';
this.statusCodeSuccess = 200;
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/bulk';
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* 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.
@@ -12,8 +12,15 @@
* 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 {SCAbstractRoute} from '../../../Route';
import {SCMessage} from '../../../things/Message';
import {StatusCodes} from 'http-status-codes';
import {SCMessage} from '../../things/message';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* User feedback
@@ -27,6 +34,14 @@ export interface SCFeedbackRequest extends SCMessage {
metaData: SCFeedbackRequestMetaData;
}
/**
* A response to a feedback request
*
* @validatable
*/
export interface SCFeedbackResponse {
}
/**
* Route for feedback submission
*/
@@ -34,16 +49,17 @@ export class SCFeedbackRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCSyntaxError',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = 'POST';
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCFeedbackRequest';
this.responseBodyName = 'SCFeedbackResponse';
this.statusCodeSuccess = 204;
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/feedback';
}
}
@@ -65,7 +81,7 @@ export interface SCFeedbackRequestMetaData {
/**
* Scope/app state at feedback invocation
*/
scope: any;
scope: unknown;
/**
* Whether or not the feedback is sendable
@@ -75,7 +91,7 @@ export interface SCFeedbackRequestMetaData {
/**
* App state that feedback was invoked from
*/
state: any;
state: unknown;
/**
* User agent

View File

@@ -0,0 +1,71 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCAppConfiguration} from '../../config/app';
import {SCBackendConfiguration} from '../../config/backend';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Index request
*
* @validatable
*/
export interface SCIndexRequest {
}
/**
* A response to an index request
*
* @validatable
*/
export interface SCIndexResponse {
/**
* @see SCAppConfiguration
*/
app: SCAppConfiguration;
/**
* @see SCBackendConfiguration
*/
backend: SCBackendConfiguration;
}
/**
* Route to request meta information about the deployment
*/
export class SCIndexRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCIndexRequest';
this.responseBodyName = 'SCIndexResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/';
}
}

View File

@@ -0,0 +1,128 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {JSONSchema7} from 'json-schema';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCParametersNotAcceptable} from '../errors/parameters-not-acceptable';
import {SCPluginAlreadyRegisteredErrorResponse} from '../errors/plugin-already-registered';
import {SCPluginRegisteringFailedErrorResponse} from '../errors/plugin-registering-failed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Plugin register request
*
* @validatable
*/
export type SCPluginRegisterRequest = SCPluginAdd | SCPluginRemove;
/**
* Plugin request for adding a plugin registration to the backend
*/
export interface SCPluginAdd {
/**
* The desired action, so whether the plugin should be added or removed
*/
action: 'add';
/**
* Plugin information needed for its registration
*/
plugin: SCPluginMetaData;
}
/**
* Plugin request for removing a plugin registration from the backend
*/
export interface SCPluginRemove {
/**
* The desired action, so whether the plugin should be added or removed
*/
action: 'remove';
/**
* The route of the plugin you want to remove
*/
route: string;
}
/**
* Plugin meta data - contains needed information for a plugin registration
*/
export interface SCPluginMetaData {
/**
* The address of the plugin, to which the backend routes the requests
*/
address: string;
/**
* The name of the plugin (for debugging purposes, to more easily identify conflicts)
*/
name: string;
/**
* How the requests of the plugin looks like, a JSON schema for validation
*/
requestSchema: JSONSchema7;
/**
* How the responses of the plugin looks like, a JSON schema for validation
*/
responseSchema: JSONSchema7;
/**
* The desired route, for example /feedback.
*/
route: string;
}
/**
* Plugin register response
*
* @validatable
*/
export interface SCPluginRegisterResponse {
/**
* Whether the desired action succeeded or failed (true for success, false if an error occurred)
*/
success: boolean;
}
/**
* Route to register plugins
*/
export class SCPluginRegisterRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCParametersNotAcceptable,
SCPluginAlreadyRegisteredErrorResponse,
SCPluginRegisteringFailedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCPluginRegisterRequest';
this.responseBodyName = 'SCPluginRegisterResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/plugin/register';
}
}

View File

@@ -0,0 +1,69 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCMap} from '../../general/map';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCTooManyRequestsErrorResponse} from '../errors/too-many-requests';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
import {SCSearchQuery} from '../search/query';
import {SCSearchResult} from '../search/result';
/**
* A multi search request
*
* This is a map of [[SCSearchRequest]]s indexed by name.
*
* **CAUTION: This is limited to an amount of queries. Currently this limit is 5.**
*
* @validatable
*/
export type SCMultiSearchRequest = SCMap<SCSearchQuery>;
/**
* A multi search response
*
* This is a map of [[SCSearchResponse]]s indexed by name
*
* @validatable
*/
export type SCMultiSearchResponse = SCMap<SCSearchResult>;
/**
* Route for submission of multiple search requests at once
*/
export class SCMultiSearchRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCTooManyRequestsErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCMultiSearchRequest';
this.responseBodyName = 'SCMultiSearchResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/search/multi';
}
}

View File

@@ -0,0 +1,62 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
import {SCSearchQuery} from '../search/query';
import {SCSearchResult} from '../search/result';
/**
* A search request
*
* @validatable
*/
export interface SCSearchRequest extends SCSearchQuery {
}
/**
* A search response
*
* @validatable
*/
export interface SCSearchResponse extends SCSearchResult {
}
/**
* Route for searching things
*/
export class SCSearchRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCSearchRequest';
this.responseBodyName = 'SCSearchResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/search';
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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 {StatusCodes} from 'http-status-codes';
import {SCThings} from '../../meta';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Request to update an existing thing
*
* @validatable
*/
export type SCThingUpdateRequest = SCThings;
/**
* Response for an entity update request
*
* @validatable
*/
export interface SCThingUpdateResponse {
}
/**
* Route for updating existing things
*/
export class SCThingUpdateRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = SCRouteHttpVerbs.PUT;
this.obligatoryParameters = {
TYPE: 'SCThingType',
UID: 'SCUuid',
};
this.requestBodyName = 'SCThingUpdateRequest';
this.responseBodyName = 'SCThingUpdateResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/:TYPE/:UID';
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,37 +12,40 @@
* 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 {SCThingsField} from '../../meta';
import {SCThingType} from '../../things/abstract/thing';
/**
* A postal address
* A search facet
*/
export interface SCPostalAddress {
export interface SCFacet {
/**
* Country of the address
* Buckets for the aggregation
*/
addressCountry: string;
buckets: SCFacetBucket[];
/**
* City of the address
* Field of the aggregation
*/
addressLocality: string;
field: SCThingsField;
/**
* State of the address
* Type of the aggregation
*/
addressRegion?: string;
/**
* Zip code of the address
*/
postalCode: string;
/**
* Optional post box number
*/
postOfficeBoxNumber?: string;
/**
* Street of the address - with house number!
*/
streetAddress: string;
onlyOnType?: SCThingType;
}
/**
* A bucket of a facet
*/
export interface SCFacetBucket {
/**
* Count of matching search results
*/
count: number;
/**
* Key of a bucket
*/
key: string;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,13 +12,16 @@
* 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 {SCMap} from '../../general/map';
/**
* All available filter types
*/
import {SCSearchAvailabilityFilter} from './Availability';
import {SCSearchBooleanFilter} from './Boolean';
import {SCSearchDistanceFilter} from './Distance';
import {SCSearchValueFilter} from './Value';
import {SCSearchAvailabilityFilter} from './filters/availability';
import {SCSearchBooleanFilter} from './filters/boolean';
import {SCSearchDistanceFilter} from './filters/distance';
import {SCGeoFilter} from './filters/geo';
import {SCSearchDateRangeFilter, SCSearchNumericRangeFilter} from './filters/range';
import {SCSearchValueFilter} from './filters/value';
/**
* Filter instruction types
@@ -27,7 +30,10 @@ export type SCSearchFilterType =
'availability'
| 'boolean'
| 'distance'
| 'value';
| 'value'
| 'date range'
| 'numeric range'
| 'geo';
/**
* Structure of a filter instruction
@@ -47,9 +53,7 @@ export interface SCSearchAbstractFilter<T extends SCSearchAbstractFilterArgument
/**
* Arguments for the filter instruction
*/
export interface SCSearchAbstractFilterArguments {
[key: string]: any;
}
export type SCSearchAbstractFilterArguments = SCMap<unknown>;
/**
* Available filter instructions
@@ -58,4 +62,7 @@ export type SCSearchFilter =
SCSearchAvailabilityFilter
| SCSearchBooleanFilter
| SCSearchDistanceFilter
| SCSearchValueFilter;
| SCSearchValueFilter
| SCSearchNumericRangeFilter
| SCSearchDateRangeFilter
| SCGeoFilter;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019-2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,9 @@
* 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 {SCThingsField} from '../../Classes';
import {SCISO8601Date} from '../Time';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
import {SCISO8601Date} from '../../../general/time';
import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/**
* An availability filter
@@ -22,6 +22,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstrac
* Filter for documents where it cannot be safely determined that they are not available
*/
export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAvailabilityFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'availability';
}
@@ -30,17 +33,17 @@ export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAva
*/
export interface SCAvailabilityFilterArguments extends SCSearchAbstractFilterArguments {
/**
* Field which marks the start of the availability
* Field which marks availability range
*/
fromField: SCThingsField;
field: SCThingsField;
/**
* Time to check. Defaults to 'now'
* If set, the provided time will apply to the full hour, day, week, etc.
*/
time?: SCISO8601Date | 'now';
scope?: 's' | 'm' | 'H' | 'd' | 'w' | 'M' | 'y';
/**
* Field which marks the end of the availability
* Time to check. Defaults current time if not set
*/
toField: SCThingsField;
time?: SCISO8601Date;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,7 +12,7 @@
* 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 {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter} from './Abstract';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter} from '../filter';
/**
* A boolean filter
@@ -20,6 +20,9 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter}
* This filter can be used to combine multiple filters with boolean operations.
*/
export interface SCSearchBooleanFilter extends SCSearchAbstractFilter<SCBooleanFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'boolean';
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,16 +12,20 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson';
import {SCThingsField} from '../../Classes';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/**
* A distance filter
*
* Filter for documents that are in the given distance of the given location
*/
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCSearchAbstractFilterArguments> {
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCDistanceFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'distance';
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (C) 2021 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/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Polygon} from 'geojson';
import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/**
* A geo filter
*
* Filter for documents that are in relation to some geo data
*/
export interface SCGeoFilter extends SCSearchAbstractFilter<SCGeoFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'geo';
}
/**
* Arguments for filter instruction by geo data
*/
export interface SCGeoFilterArguments extends SCSearchAbstractFilterArguments {
/**
* Field on which to filter
*/
field: SCThingsField;
/**
* Geo data to check up on
*/
shape: Polygon;
/**
* Spatial relation between the provided shape and the shape of the field.
*
* intersects - both shapes intersect (default)
* disjoint - both shapes don't intersect
* within - the search shape contains the field shape
* contains - the search shape is contained in the field shape
*/
spatialRelation?: 'intersects' | 'disjoint' | 'within' | 'contains';
}

View File

@@ -0,0 +1,121 @@
/*
* Copyright (C) 2020-2021 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 {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/**
* A date range filter
*
* Filter for documents with a date field that satisfies the given constraints
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_date_format_in_range_queries
*/
export interface SCSearchDateRangeFilter extends SCSearchAbstractFilter<SCDateRangeFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'date range';
}
/**
* A distance filter
*
* Filter for documents with a numeric field that satisfies the given constraints
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#query-dsl-range-query
*/
export interface SCSearchNumericRangeFilter extends SCSearchAbstractFilter<SCNumericRangeFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'numeric range';
}
/**
* Additional arguments for date range filters
*
* Filter uses a plain string to allow for date math expressions
* @see https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/date-math-expressions.html
*/
export interface SCDateRangeFilterArguments extends SCRangeFilterArguments<string> {
/**
* Optional date format specifier
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_date_format_in_range_queries
*/
format?: string;
/**
* Optional timezone specifier
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_time_zone_in_range_queries
*/
timeZone?: string;
}
/**
* Additional arguments for numeric range filters
*/
export type SCNumericRangeFilterArguments = SCRangeFilterArguments<number>;
/**
* Additional arguments for range filters
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#query-dsl-range-query
*/
export interface SCRangeFilterArguments<T> extends SCSearchAbstractFilterArguments {
/**
* Bounds of the range
*/
bounds: Bounds<T>;
/**
* Field where the filter will be applied
*/
field: SCThingsField;
/**
* Relation when searching on other range fields
*
* Intersects (Default): Both search and field range intersect
* Within: Search range is within the field range
* Contains: Search range contains the field range
*/
relation?: 'intersects' | 'within' | 'contains';
}
export interface Bounds<T> {
/**
* The lower bound
*/
lowerBound?: Bound<T>;
/**
* The upper bound
*/
upperBound?: Bound<T>;
}
export interface Bound<T> {
/**
* Limit of the bound
*/
limit: T;
/**
* Bound mode
*/
mode: 'inclusive' | 'exclusive';
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,13 +12,16 @@
* 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 {SCThingsField} from '../../Classes';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/**
* Filters for documents that match the value on the given field
*/
export interface SCSearchValueFilter extends SCSearchAbstractFilter<SCValueFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/
type: 'value';
}
@@ -29,7 +32,7 @@ export interface SCValueFilterArguments extends SCSearchAbstractFilterArguments
field: SCThingsField;
/**
* Value to filter. Value has to match the field exactly.
* Value to filter. One or more values has to match the field exactly.
*/
value: string;
value: string | string[];
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* 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.
@@ -12,24 +12,21 @@
* 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 {SCAbstractRoute} from '../../../Route';
import {SCSearchFilter} from '../../../types/filters/Abstract';
import {SCSearchSort} from '../../../types/sorts/Abstract';
/**
* A search request
*
* @validatable
*/
export interface SCSearchRequest extends SCSearchQuery {
}
import {SCSearchContext} from '../../config/backend';
import {SCSearchFilter} from './filter';
import {SCSearchSort} from './sort';
/**
* A search query
*/
export interface SCSearchQuery {
/**
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
* The context name from where the search query was initiated
*/
context?: SCSearchContext;
/**
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
*/
filter?: SCSearchFilter;
@@ -53,24 +50,3 @@ export interface SCSearchQuery {
*/
sort?: SCSearchSort[];
}
/**
* Route for searching things
*/
export class SCSearchRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
'SCInternalServerErrorResponse',
'SCMethodNotAllowedErrorResponse',
'SCSyntaxError',
'SCUnsupportedMediaTypeErrorResponse',
'SCValidationErrorResponse',
];
this.method = 'POST';
this.requestBodyName = 'SCSearchRequest';
this.responseBodyName = 'SCSearchResponse';
this.statusCodeSuccess = 200;
this.urlFragment = '/search';
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,16 +12,8 @@
* 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 {SCThings, SCThingsField} from '../../../Classes';
import {SCMap} from '../../../types/Map';
/**
* A search response
*
* @validatable
*/
export interface SCSearchResponse extends SCSearchResult {
}
import {SCThings} from '../../meta';
import {SCFacet} from './facet';
/**
* A search response
@@ -40,33 +32,18 @@ export interface SCSearchResult {
/**
* Pagination information
*/
pagination: SCSearchResponsePagination;
pagination: SCSearchResultPagination;
/**
* Stats of the search engine
*/
stats: SCSearchResponseSearchEngineStats;
}
/**
* A search facet
*/
export interface SCFacet {
/**
* Values for the aggregation
*/
buckets: Array<SCMap<number>>;
/**
* Field of the aggregation
*/
field: SCThingsField;
stats: SCSearchResultSearchEngineStats;
}
/**
* Stores information about Pagination
*/
export interface SCSearchResponsePagination {
export interface SCSearchResultPagination {
/**
* Count of given data. Same as data.length
*/
@@ -86,7 +63,7 @@ export interface SCSearchResponsePagination {
/**
* Statistics of search engine
*/
export interface SCSearchResponseSearchEngineStats {
export interface SCSearchResultSearchEngineStats {
/**
* Response time of the search engine in ms
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019, 2020 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,10 +12,12 @@
* 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 {SCThingsField} from '../../Classes';
import {SCDistanceSort} from './Distance';
import {SCDucetSort} from './Ducet';
import {SCPriceSort} from './Price';
import {SCMap} from '../../general/map';
import {SCThingsField} from '../../meta';
import {SCDistanceSort} from './sorts/distance';
import {SCDucetSort} from './sorts/ducet';
import {SCGenericSort} from './sorts/generic';
import {SCPriceSort} from './sorts/price';
/**
* Abstract sort instruction
@@ -40,12 +42,7 @@ export interface SCSearchAbstractSort<T extends SCSearchAbstractSortArguments> {
/**
* Map of arguments for the sort instruction
*/
export interface SCSearchAbstractSortArguments {
/**
* Index signature for additional arguments
*/
[key: string]: any;
export interface SCSearchAbstractSortArguments extends SCMap<unknown> {
/**
* Field to sort by
*/
@@ -55,9 +52,9 @@ export interface SCSearchAbstractSortArguments {
/**
* Type of a sort instruction
*/
export type SCSearchSortType = 'distance' | 'price' | 'ducet';
export type SCSearchSortType = 'distance' | 'price' | 'ducet' | 'generic';
/**
* A sort instruction
*/
export type SCSearchSort = SCDistanceSort | SCPriceSort | SCDucetSort;
export type SCSearchSort = SCDistanceSort | SCPriceSort | SCDucetSort | SCGenericSort;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,13 +12,17 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
/**
* Sort instruction to sort by distance
*/
export interface SCDistanceSort extends SCSearchAbstractSort<SCDistanceSortArguments> {
/**
* @see SCSearchAbstractSort.type
*/
type: 'distance';
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* 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.
@@ -12,11 +12,14 @@
* 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 {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
/**
* Sort instruction for ducet sort
*/
export interface SCDucetSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
/**
* @see SCSearchAbstractSort.type
*/
type: 'ducet';
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,18 +12,14 @@
* 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 {Point, Polygon} from 'geojson';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
/**
* Positional information
* Sort instruction for generic sort such as date
*/
export interface SCGeoInformation {
export interface SCGenericSort extends SCSearchAbstractSort<SCSearchAbstractSortArguments> {
/**
* Center point of a place
* @see SCSearchAbstractSort.type
*/
point: Point;
/**
* Shape of a place
*/
polygon?: Polygon;
type: 'generic';
}

Some files were not shown because too many files have changed in this diff Show More