mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-03 20:12:51 +00:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
937919f1a7 | ||
|
|
3249300dac | ||
|
|
5acf49fd52 | ||
|
|
07b5ad1618 | ||
|
|
d56c3d11a8 | ||
|
|
83f00f40bf | ||
|
|
782ee3758a | ||
|
|
8a28d6fa86 | ||
|
|
ed53c6595e | ||
|
|
49ea2c59ab | ||
|
|
869fa831ea | ||
|
|
21eeecd5ee | ||
|
|
2dfb64bafd | ||
|
|
4ab8770fbc | ||
|
|
2cf1027796 | ||
|
|
3aed37ecb4 | ||
|
|
ddb26b8207 | ||
|
|
805c1f0937 | ||
|
|
5377d026f3 | ||
|
|
148fd77f4d | ||
|
|
4036bfd193 | ||
|
|
f4f372b9ad | ||
|
|
872c1f5fc3 | ||
|
|
4f2ca30dab | ||
|
|
882483ee24 | ||
|
|
c998166938 | ||
|
|
d61e33de39 | ||
|
|
07d6c4770a | ||
|
|
aab3e9fa6c | ||
|
|
4a4cd4e6d4 | ||
|
|
942cd11469 | ||
|
|
fe090c7387 | ||
|
|
f0782d8820 | ||
|
|
a2461d5904 | ||
|
|
d2e0069dc2 | ||
|
|
9c6972af78 | ||
|
|
56b03aa0b9 | ||
|
|
b517837671 | ||
|
|
6f03ede8bf | ||
|
|
952207ace1 | ||
|
|
3d9d28c60c | ||
|
|
913c5691da | ||
|
|
03cdbc6f9b | ||
|
|
9f886a8968 | ||
|
|
e80afe2c93 | ||
|
|
6b10cc86d8 | ||
|
|
1aedd6332f | ||
|
|
790c8bbc3f | ||
|
|
e934017a65 | ||
|
|
88dbedd932 | ||
|
|
8b1b3444fd | ||
|
|
d5f3d71a41 | ||
|
|
cbcf9c9adb |
@@ -5,6 +5,7 @@ before_script:
|
|||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
- review
|
||||||
- test
|
- test
|
||||||
- audit
|
- audit
|
||||||
- deploy
|
- deploy
|
||||||
@@ -21,6 +22,46 @@ build:
|
|||||||
- lib
|
- lib
|
||||||
expire_in: 1 week
|
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:
|
audit:
|
||||||
stage: audit
|
stage: audit
|
||||||
script:
|
script:
|
||||||
@@ -47,6 +88,21 @@ test:
|
|||||||
- report
|
- report
|
||||||
- coverage
|
- 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:
|
package:
|
||||||
dependencies:
|
dependencies:
|
||||||
- build
|
- build
|
||||||
|
|||||||
5
.mailmap
Normal file
5
.mailmap
Normal 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>
|
||||||
89
CHANGELOG.md
89
CHANGELOG.md
@@ -1,3 +1,92 @@
|
|||||||
|
## [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)
|
# [0.40.0](https://gitlab.com/openstapps/core/compare/v0.39.0...v0.40.0) (2021-02-05)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ External dependencies can not be covered by the annotations. Documentation about
|
|||||||
| `@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` |
|
| `@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 | |
|
| `@text` | string field is interpreted as text | |
|
||||||
| `@date` | string field is interpreted as a date field | |
|
| `@date` | string field is interpreted as a date field | |
|
||||||
| `@validatable` | marks the type as validatable if the core schema is used to put data into a database/key-value store | |
|
| `@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 | |
|
| `@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]` |
|
| `@inheritTags` | inherit all tags from another field | `[SCThingType]::[field]` |
|
||||||
|
|
||||||
|
|||||||
3161
package-lock.json
generated
3161
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@openstapps/core",
|
"name": "@openstapps/core",
|
||||||
"version": "0.41.0",
|
"version": "0.49.3",
|
||||||
"description": "StAppsCore - Generalized model of data",
|
"description": "StAppsCore - Generalized model of data",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Model",
|
"Model",
|
||||||
@@ -14,17 +14,19 @@
|
|||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"types": "./lib/index.d.ts",
|
"types": "./lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run tslint && npm run compile && npm run pack && npm run schema",
|
"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'",
|
"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",
|
"check-configuration": "openstapps-configuration",
|
||||||
"compile": "rimraf lib && tsc",
|
"compile": "rimraf lib && tsc",
|
||||||
"documentation": "typedoc --name \"@openstapps/core\" --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks lib",
|
"documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks src",
|
||||||
"pack": "openstapps-core-tools pack",
|
"pack": "openstapps-core-tools pack",
|
||||||
"postversion": "npm run changelog",
|
"postversion": "npm run changelog",
|
||||||
"prepublishOnly": "npm ci && npm run build",
|
"prepublishOnly": "npm ci && npm run build",
|
||||||
"preversion": "npm run prepublishOnly",
|
"preversion": "npm run prepublishOnly",
|
||||||
"push": "git push && git push origin \"v$npm_package_version\"",
|
"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",
|
"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'",
|
"test": "nyc mocha --require ts-node/register --recursive 'test/*.spec.ts'",
|
||||||
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
|
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
|
||||||
},
|
},
|
||||||
@@ -32,44 +34,48 @@
|
|||||||
"contributors": [
|
"contributors": [
|
||||||
"Andreas Lehmann",
|
"Andreas Lehmann",
|
||||||
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
||||||
|
"Axel Nieder-Vahrenholz",
|
||||||
"Benjamin Jöckel",
|
"Benjamin Jöckel",
|
||||||
"Imran Hossain",
|
"Frank Nagel",
|
||||||
"Jovan Krunić <jovan.krunic@gmail.com>",
|
"Jovan Krunić <jovan.krunic@gmail.com>",
|
||||||
"Michel Jonathan Schmitz",
|
"Michel Jonathan Schmitz",
|
||||||
"Rainer Killinger <mail-openstapps@killinger.co>",
|
"Rainer Killinger <mail-openstapps@killinger.co>",
|
||||||
|
"Roman Klopsch",
|
||||||
"Sebastian Lange",
|
"Sebastian Lange",
|
||||||
"Wieland Schöbl",
|
"Wieland Schöbl"
|
||||||
"Roman Klopsch"
|
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@openstapps/core-tools": "0.16.0",
|
"@openstapps/core-tools": "0.23.2",
|
||||||
"@types/geojson": "1.0.6",
|
"@types/geojson": "1.0.6",
|
||||||
"@types/json-patch": "0.0.30",
|
"@types/json-patch": "0.0.30",
|
||||||
"@types/json-schema": "7.0.6",
|
"@types/json-schema": "7.0.9",
|
||||||
"@types/node": "10.17.44",
|
"@types/node": "14.17.9",
|
||||||
"fast-clone": "1.5.13",
|
"fast-clone": "1.5.13",
|
||||||
|
"fast-deep-equal": "3.1.3",
|
||||||
"http-status-codes": "2.1.4",
|
"http-status-codes": "2.1.4",
|
||||||
"json-patch": "0.7.0",
|
"json-patch": "0.7.0",
|
||||||
"json-schema": "0.2.5",
|
"json-schema": "0.3.0",
|
||||||
"ts-optchain": "0.1.8"
|
"ts-optchain": "0.1.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@openstapps/configuration": "0.25.0",
|
"@openstapps/configuration": "0.27.0",
|
||||||
"@openstapps/logger": "0.5.0",
|
"@openstapps/es-mapping-generator": "0.0.3",
|
||||||
|
"@openstapps/logger": "0.7.0",
|
||||||
"@testdeck/mocha": "0.1.2",
|
"@testdeck/mocha": "0.1.2",
|
||||||
"@types/chai": "4.2.14",
|
"@types/chai": "4.2.21",
|
||||||
"@types/rimraf": "3.0.0",
|
"@types/rimraf": "3.0.1",
|
||||||
"chai": "4.2.0",
|
"chai": "4.3.4",
|
||||||
"conditional-type-checks": "1.0.5",
|
"conditional-type-checks": "1.0.5",
|
||||||
"conventional-changelog-cli": "2.1.0",
|
"conventional-changelog-cli": "2.1.1",
|
||||||
"mocha": "8.2.0",
|
"mocha": "8.4.0",
|
||||||
"nyc": "15.1.0",
|
"nyc": "15.1.0",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"source-map-support": "0.5.19",
|
"source-map-support": "0.5.19",
|
||||||
"ts-node": "9.0.0",
|
"surge": "0.23.0",
|
||||||
|
"ts-node": "9.1.1",
|
||||||
"tslint": "6.1.3",
|
"tslint": "6.1.3",
|
||||||
"typedoc": "0.18.0",
|
"typedoc": "0.21.5",
|
||||||
"typescript": "3.8.3"
|
"typescript": "4.3.5"
|
||||||
},
|
},
|
||||||
"nyc": {
|
"nyc": {
|
||||||
"all": true,
|
"all": true,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// tslint:disable-next-line:no-implicit-dependencies
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Polygon} from 'geojson';
|
import {Polygon} from 'geojson';
|
||||||
import {SCTranslations} from '../general/i18n';
|
import {SCTranslations} from '../general/i18n';
|
||||||
import {SCSetting} from '../things/setting';
|
import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An app configuration menu item
|
* An app configuration menu item
|
||||||
@@ -112,8 +112,9 @@ export interface SCAppConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of available settings in the app
|
* 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
|
* Map of store URLs
|
||||||
|
|||||||
72
src/meta.ts
72
src/meta.ts
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -27,8 +27,14 @@ import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/
|
|||||||
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/floor';
|
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/floor';
|
||||||
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/message';
|
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/message';
|
||||||
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization';
|
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization';
|
||||||
|
import {SCPeriodical, SCPeriodicalMeta, SCPeriodicalWithoutReferences} from './things/periodical';
|
||||||
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person';
|
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person';
|
||||||
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest';
|
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest';
|
||||||
|
import {
|
||||||
|
SCPublicationEvent,
|
||||||
|
SCPublicationEventMeta,
|
||||||
|
SCPublicationEventWithoutReferences,
|
||||||
|
} from './things/publication-event';
|
||||||
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/room';
|
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/room';
|
||||||
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/semester';
|
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/semester';
|
||||||
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/setting';
|
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/setting';
|
||||||
@@ -59,8 +65,10 @@ export const SCClasses: { [K in SCThingType]: object } = {
|
|||||||
'floor': SCFloorMeta,
|
'floor': SCFloorMeta,
|
||||||
'message': SCMessageMeta,
|
'message': SCMessageMeta,
|
||||||
'organization': SCOrganizationMeta,
|
'organization': SCOrganizationMeta,
|
||||||
|
'periodical': SCPeriodicalMeta,
|
||||||
'person': SCPersonMeta,
|
'person': SCPersonMeta,
|
||||||
'point of interest': SCPointOfInterestMeta,
|
'point of interest': SCPointOfInterestMeta,
|
||||||
|
'publication event': SCPublicationEventMeta,
|
||||||
'room': SCRoomMeta,
|
'room': SCRoomMeta,
|
||||||
'semester': SCSemesterMeta,
|
'semester': SCSemesterMeta,
|
||||||
'setting': SCSettingMeta,
|
'setting': SCSettingMeta,
|
||||||
@@ -72,7 +80,7 @@ export const SCClasses: { [K in SCThingType]: object } = {
|
|||||||
'video': SCVideoMeta,
|
'video': SCVideoMeta,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SCThingsWithoutDiff =
|
export type SCIndexableThings =
|
||||||
SCAcademicEvent
|
SCAcademicEvent
|
||||||
| SCArticle
|
| SCArticle
|
||||||
| SCBook
|
| SCBook
|
||||||
@@ -82,15 +90,15 @@ export type SCThingsWithoutDiff =
|
|||||||
| SCCourseOfStudies
|
| SCCourseOfStudies
|
||||||
| SCDateSeries
|
| SCDateSeries
|
||||||
| SCDish
|
| SCDish
|
||||||
| SCFavorite
|
|
||||||
| SCFloor
|
| SCFloor
|
||||||
| SCMessage
|
| SCMessage
|
||||||
| SCOrganization
|
| SCOrganization
|
||||||
|
| SCPeriodical
|
||||||
| SCPerson
|
| SCPerson
|
||||||
| SCPointOfInterest
|
| SCPointOfInterest
|
||||||
|
| SCPublicationEvent
|
||||||
| SCRoom
|
| SCRoom
|
||||||
| SCSemester
|
| SCSemester
|
||||||
| SCSetting
|
|
||||||
| SCSportCourse
|
| SCSportCourse
|
||||||
| SCStudyModule
|
| SCStudyModule
|
||||||
| SCTicket
|
| SCTicket
|
||||||
@@ -102,8 +110,8 @@ export type SCThingsWithoutDiff =
|
|||||||
* An object that exists in the StAppsCore
|
* An object that exists in the StAppsCore
|
||||||
*/
|
*/
|
||||||
export type SCThings =
|
export type SCThings =
|
||||||
SCThingsWithoutDiff
|
SCIndexableThings
|
||||||
| SCDiff;
|
| SCDiff | SCFavorite | SCSetting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A field of a thing
|
* A field of a thing
|
||||||
@@ -128,18 +136,20 @@ export type SCAssociatedThingWithoutReferences<THING extends SCThings> =
|
|||||||
THING extends SCFloor ? SCFloorWithoutReferences :
|
THING extends SCFloor ? SCFloorWithoutReferences :
|
||||||
THING extends SCMessage ? SCMessageWithoutReferences :
|
THING extends SCMessage ? SCMessageWithoutReferences :
|
||||||
THING extends SCOrganization ? SCOrganizationWithoutReferences :
|
THING extends SCOrganization ? SCOrganizationWithoutReferences :
|
||||||
THING extends SCPerson ? SCPersonWithoutReferences :
|
THING extends SCPeriodical ? SCPeriodicalWithoutReferences :
|
||||||
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences :
|
THING extends SCPerson ? SCPersonWithoutReferences :
|
||||||
THING extends SCRoom ? SCRoomWithoutReferences :
|
THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences :
|
||||||
THING extends SCSemester ? SCSemesterWithoutReferences :
|
THING extends SCPublicationEvent ? SCPublicationEventWithoutReferences :
|
||||||
THING extends SCSetting ? SCSettingWithoutReferences :
|
THING extends SCRoom ? SCRoomWithoutReferences :
|
||||||
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
|
THING extends SCSemester ? SCSemesterWithoutReferences :
|
||||||
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
|
THING extends SCSetting ? SCSettingWithoutReferences :
|
||||||
THING extends SCTicket ? SCTicketWithoutReferences :
|
THING extends SCSportCourse ? SCSportCourseWithoutReferences :
|
||||||
THING extends SCToDo ? SCToDoWithoutReferences :
|
THING extends SCStudyModule ? SCStudyModuleWithoutReferences :
|
||||||
THING extends SCTour ? SCTourWithoutReferences :
|
THING extends SCTicket ? SCTicketWithoutReferences :
|
||||||
THING extends SCVideo ? SCVideoWithoutReferences :
|
THING extends SCToDo ? SCToDoWithoutReferences :
|
||||||
never;
|
THING extends SCTour ? SCTourWithoutReferences :
|
||||||
|
THING extends SCVideo ? SCVideoWithoutReferences :
|
||||||
|
never;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thing for a thing without references
|
* Thing for a thing without references
|
||||||
@@ -159,15 +169,17 @@ export type SCAssociatedThing<THING extends SCThings> =
|
|||||||
THING extends SCFloorWithoutReferences ? SCFloor :
|
THING extends SCFloorWithoutReferences ? SCFloor :
|
||||||
THING extends SCMessageWithoutReferences ? SCMessage :
|
THING extends SCMessageWithoutReferences ? SCMessage :
|
||||||
THING extends SCOrganizationWithoutReferences ? SCOrganization :
|
THING extends SCOrganizationWithoutReferences ? SCOrganization :
|
||||||
THING extends SCPersonWithoutReferences ? SCPerson :
|
THING extends SCPeriodicalWithoutReferences ? SCPeriodical :
|
||||||
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest :
|
THING extends SCPersonWithoutReferences ? SCPerson :
|
||||||
THING extends SCRoomWithoutReferences ? SCRoom :
|
THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest :
|
||||||
THING extends SCSemesterWithoutReferences ? SCSemester :
|
THING extends SCPublicationEventWithoutReferences ? SCPublicationEvent :
|
||||||
THING extends SCSettingWithoutReferences ? SCSetting :
|
THING extends SCRoomWithoutReferences ? SCRoom :
|
||||||
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
|
THING extends SCSemesterWithoutReferences ? SCSemester :
|
||||||
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
|
THING extends SCSettingWithoutReferences ? SCSetting :
|
||||||
THING extends SCTicketWithoutReferences ? SCTicket :
|
THING extends SCSportCourseWithoutReferences ? SCSportCourse :
|
||||||
THING extends SCToDoWithoutReferences ? SCToDo :
|
THING extends SCStudyModuleWithoutReferences ? SCStudyModule :
|
||||||
THING extends SCTourWithoutReferences ? SCTour :
|
THING extends SCTicketWithoutReferences ? SCTicket :
|
||||||
THING extends SCVideoWithoutReferences ? SCVideo :
|
THING extends SCToDoWithoutReferences ? SCToDo :
|
||||||
never;
|
THING extends SCTourWithoutReferences ? SCTour :
|
||||||
|
THING extends SCVideoWithoutReferences ? SCVideo :
|
||||||
|
never;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when an internal server error occurred
|
* An error that is returned, when an internal server error occurred
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCInternalServerErrorResponse extends SCError {
|
export class SCInternalServerErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when the used HTTP method is not allowed on the requested route
|
* An error that is returned, when the used HTTP method is not allowed on the requested route
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCMethodNotAllowedErrorResponse extends SCError {
|
export class SCMethodNotAllowedErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned when the requested route or resource was not found
|
* An error that is returned when the requested route or resource was not found
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCNotFoundErrorResponse extends SCError {
|
export class SCNotFoundErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ 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
|
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
|
||||||
* acceptable.
|
* acceptable.
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCParametersNotAcceptable extends SCError {
|
export class SCParametersNotAcceptable extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ 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
|
* 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.
|
* running at the same time.
|
||||||
* This usually indicates that there is more than one instance a plugin running.
|
* This usually indicates that there is more than one instance a plugin running.
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned whenever there is an unexpected error while creating a plugin
|
* An error that is returned whenever there is an unexpected error while creating a plugin
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when the request body is too large.
|
* An error that is returned, when the request body is too large.
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned whenever there is a syntax error
|
* An error that is returned whenever there is a syntax error
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCSyntaxErrorResponse extends SCError {
|
export class SCSyntaxErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when to many request are submitted at once
|
* An error that is returned, when to many request are submitted at once
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCTooManyRequestsErrorResponse extends SCError {
|
export class SCTooManyRequestsErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned when the content type of the request is not supported
|
* An error that is returned when the content type of the request is not supported
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import {SCError} from '../error';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned when the validation of a request fails
|
* An error that is returned when the validation of a request fails
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCValidationErrorResponse extends SCError {
|
export class SCValidationErrorResponse extends SCError {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
|
|||||||
];
|
];
|
||||||
this.method = SCRouteHttpVerbs.PUT;
|
this.method = SCRouteHttpVerbs.PUT;
|
||||||
this.obligatoryParameters = {
|
this.obligatoryParameters = {
|
||||||
TYPE: 'SCThingTypes',
|
TYPE: 'SCThingType',
|
||||||
UID: 'SCUuid',
|
UID: 'SCUuid',
|
||||||
};
|
};
|
||||||
this.requestBodyName = 'SCThingUpdateRequest';
|
this.requestBodyName = 'SCThingUpdateRequest';
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {SCMap} from '../../general/map';
|
|||||||
import {SCSearchAvailabilityFilter} from './filters/availability';
|
import {SCSearchAvailabilityFilter} from './filters/availability';
|
||||||
import {SCSearchBooleanFilter} from './filters/boolean';
|
import {SCSearchBooleanFilter} from './filters/boolean';
|
||||||
import {SCSearchDistanceFilter} from './filters/distance';
|
import {SCSearchDistanceFilter} from './filters/distance';
|
||||||
|
import {SCGeoFilter} from './filters/geo';
|
||||||
import {SCSearchDateRangeFilter, SCSearchNumericRangeFilter} from './filters/range';
|
import {SCSearchDateRangeFilter, SCSearchNumericRangeFilter} from './filters/range';
|
||||||
import {SCSearchValueFilter} from './filters/value';
|
import {SCSearchValueFilter} from './filters/value';
|
||||||
|
|
||||||
@@ -31,7 +32,8 @@ export type SCSearchFilterType =
|
|||||||
| 'distance'
|
| 'distance'
|
||||||
| 'value'
|
| 'value'
|
||||||
| 'date range'
|
| 'date range'
|
||||||
| 'numeric range';
|
| 'numeric range'
|
||||||
|
| 'geo';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure of a filter instruction
|
* Structure of a filter instruction
|
||||||
@@ -62,4 +64,5 @@ export type SCSearchFilter =
|
|||||||
| SCSearchDistanceFilter
|
| SCSearchDistanceFilter
|
||||||
| SCSearchValueFilter
|
| SCSearchValueFilter
|
||||||
| SCSearchNumericRangeFilter
|
| SCSearchNumericRangeFilter
|
||||||
| SCSearchDateRangeFilter;
|
| SCSearchDateRangeFilter
|
||||||
|
| SCGeoFilter;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -33,17 +33,17 @@ export interface SCSearchAvailabilityFilter extends SCSearchAbstractFilter<SCAva
|
|||||||
*/
|
*/
|
||||||
export interface SCAvailabilityFilterArguments extends SCSearchAbstractFilterArguments {
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
55
src/protocol/search/filters/geo.ts
Normal file
55
src/protocol/search/filters/geo.ts
Normal 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';
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 StApps
|
* Copyright (C) 2020-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -85,6 +85,15 @@ export interface SCRangeFilterArguments<T> extends SCSearchAbstractFilterArgumen
|
|||||||
* Field where the filter will be applied
|
* Field where the filter will be applied
|
||||||
*/
|
*/
|
||||||
field: SCThingsField;
|
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> {
|
export interface Bounds<T> {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export interface SCValueFilterArguments extends SCSearchAbstractFilterArguments
|
|||||||
field: SCThingsField;
|
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[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,15 +12,15 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
import {SCLanguageCode, SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
import {SCISO8601Date} from '../../general/time';
|
import {SCISO8601Date} from '../../general/time';
|
||||||
import {SCOrganizationWithoutReferences} from '../organization';
|
import {SCOrganizationWithoutReferences} from '../organization';
|
||||||
import {SCPersonWithoutReferences} from '../person';
|
import {SCPersonWithoutReferences} from '../person';
|
||||||
|
import {SCPublicationEventWithoutReferences} from '../publication-event';
|
||||||
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||||
import {
|
import {
|
||||||
SCAcademicPriceGroup,
|
SCAcademicPriceGroup,
|
||||||
SCThingThatCanBeOffered,
|
SCThingThatCanBeOffered, SCThingThatCanBeOfferedMeta,
|
||||||
SCThingThatCanBeOfferedMeta,
|
|
||||||
SCThingThatCanBeOfferedTranslatableProperties,
|
SCThingThatCanBeOfferedTranslatableProperties,
|
||||||
SCThingThatCanBeOfferedWithoutReferences,
|
SCThingThatCanBeOfferedWithoutReferences,
|
||||||
} from './thing-that-can-be-offered';
|
} from './thing-that-can-be-offered';
|
||||||
@@ -30,17 +30,37 @@ import {
|
|||||||
*/
|
*/
|
||||||
export interface SCCreativeWorkWithoutReferences
|
export interface SCCreativeWorkWithoutReferences
|
||||||
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Languages this creative work is available in
|
||||||
|
*/
|
||||||
|
availableLanguages?: SCLanguageCode[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date the creative work was published
|
* Date the creative work was published
|
||||||
*
|
|
||||||
* @filterable
|
|
||||||
*/
|
*/
|
||||||
datePublished?: SCISO8601Date;
|
datePublished?: SCISO8601Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of languages this creative work is written/recorded/... in
|
* Edition of a creative work (e.g. the book edition or edition of an article)
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
*/
|
*/
|
||||||
inLanguages?: SCLanguage[];
|
edition?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date (in text form) the creative work was published for the first time
|
||||||
|
*
|
||||||
|
* @keyword
|
||||||
|
*/
|
||||||
|
firstPublished?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Languages this creative work is written/recorded/... in
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
*/
|
||||||
|
inLanguage?: SCLanguageCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keywords of the creative work
|
* Keywords of the creative work
|
||||||
@@ -67,11 +87,26 @@ export interface SCCreativeWork
|
|||||||
*/
|
*/
|
||||||
authors?: SCPersonWithoutReferences[];
|
authors?: SCPersonWithoutReferences[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A creative work to which the creative work belongs
|
||||||
|
*/
|
||||||
|
isPartOf?: SCCreativeWorkWithoutReferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of events at which the creative work was published
|
||||||
|
*/
|
||||||
|
publications?: SCPublicationEventWithoutReferences[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of publishers of the creative work
|
* List of publishers of the creative work
|
||||||
*/
|
*/
|
||||||
publishers?: Array<SCPersonWithoutReferences | SCOrganizationWithoutReferences>;
|
publishers?: Array<SCPersonWithoutReferences | SCOrganizationWithoutReferences>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A text representing on organization on whose behalf the creator was working
|
||||||
|
*/
|
||||||
|
sourceOrganization?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated fields of the creative work
|
* Translated fields of the creative work
|
||||||
*/
|
*/
|
||||||
@@ -103,20 +138,36 @@ export class SCCreativeWorkMeta
|
|||||||
de: {
|
de: {
|
||||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||||
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
|
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
|
||||||
authors: 'Authoren',
|
name: 'Titel',
|
||||||
|
authors: 'beteiligte Personen',
|
||||||
|
availableLanguages: 'verfügbare Übersetzungen',
|
||||||
datePublished: 'Veröffentlichungsdatum',
|
datePublished: 'Veröffentlichungsdatum',
|
||||||
inLanguages: 'verfügbare Übersetzungen',
|
edition: 'Ausgabe',
|
||||||
|
firstPublished: 'erste Veröffentlichung',
|
||||||
|
inLanguage: 'Inhaltssprache',
|
||||||
|
isPartOf: 'erschienen in',
|
||||||
keywords: 'Schlagwörter',
|
keywords: 'Schlagwörter',
|
||||||
|
lastPublished: 'aktuellste Veröffentlichung',
|
||||||
publishers: 'Verleger',
|
publishers: 'Verleger',
|
||||||
|
publications: 'Veröffentlichungen',
|
||||||
|
sourceOrganization: 'Körperschaft',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||||
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
|
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
|
||||||
authors: 'authors',
|
name: 'title',
|
||||||
|
authors: 'involved persons',
|
||||||
|
availableLanguages: 'available languages',
|
||||||
datePublished: 'release date',
|
datePublished: 'release date',
|
||||||
inLanguages: 'available Languages',
|
edition: 'edition',
|
||||||
|
firstPublished: 'first published',
|
||||||
|
inLanguage: 'content language',
|
||||||
|
isPartOf: 'published in',
|
||||||
keywords: 'keywords',
|
keywords: 'keywords',
|
||||||
|
lastPublished: 'last published',
|
||||||
publishers: 'publishers',
|
publishers: 'publishers',
|
||||||
|
publications: 'publications',
|
||||||
|
sourceOrganization: 'corporation',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,7 +177,7 @@ export class SCCreativeWorkMeta
|
|||||||
fieldValueTranslations = {
|
fieldValueTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||||
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
|
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.de,
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||||
|
|||||||
64
src/things/abstract/range.ts
Normal file
64
src/things/abstract/range.ts
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
import {SCISO8601Date} from '../../general/time';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date Range
|
||||||
|
*
|
||||||
|
* CAUTION: Changing the name requires changes in the core-tools premaps
|
||||||
|
*/
|
||||||
|
export type SCISO8601DateRange = SCRange<SCISO8601Date>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic range type
|
||||||
|
*/
|
||||||
|
export type SCRange<T> = {
|
||||||
|
/**
|
||||||
|
* Greater than value
|
||||||
|
*/
|
||||||
|
gt?: never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Greater or equal to value
|
||||||
|
*/
|
||||||
|
gte?: T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Greater than value
|
||||||
|
*/
|
||||||
|
lt?: never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Greater or equal to value
|
||||||
|
*/
|
||||||
|
lte?: T;
|
||||||
|
} | {
|
||||||
|
// tslint:disable:completed-docs
|
||||||
|
gt?: T;
|
||||||
|
gte?: never;
|
||||||
|
lt?: T;
|
||||||
|
lte?: never;
|
||||||
|
} | {
|
||||||
|
gt?: T;
|
||||||
|
gte?: never;
|
||||||
|
lt?: never;
|
||||||
|
lte?: T;
|
||||||
|
} | {
|
||||||
|
gt?: never;
|
||||||
|
gte?: T;
|
||||||
|
lt?: T;
|
||||||
|
lte?: never;
|
||||||
|
// tslint:enable:completed-docs
|
||||||
|
};
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import {SCIndexableThings} from '../../meta';
|
||||||
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,18 +20,17 @@ import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
|
|||||||
*/
|
*/
|
||||||
export interface SCSaveableThingWithoutReferences
|
export interface SCSaveableThingWithoutReferences
|
||||||
extends SCThingWithoutReferences {
|
extends SCThingWithoutReferences {
|
||||||
// noop
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.
|
||||||
*/
|
*/
|
||||||
export interface SCSaveableThing<T extends SCThingWithoutReferences>
|
export interface SCSaveableThing
|
||||||
extends SCSaveableThingWithoutReferences, SCThing {
|
extends SCSaveableThingWithoutReferences, SCThing {
|
||||||
/**
|
/**
|
||||||
* The contained data
|
* The contained data
|
||||||
*/
|
*/
|
||||||
data: T;
|
data: SCIndexableThings;
|
||||||
/**
|
/**
|
||||||
* Type of the origin
|
* Type of the origin
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -13,10 +13,10 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
import {SCISO8601Date} from '../../general/time';
|
|
||||||
import {SCOrganizationWithoutReferences} from '../organization';
|
import {SCOrganizationWithoutReferences} from '../organization';
|
||||||
import {SCPersonWithoutReferences} from '../person';
|
import {SCPersonWithoutReferences} from '../person';
|
||||||
import {SCInPlace} from './place';
|
import {SCInPlace} from './place';
|
||||||
|
import {SCISO8601DateRange} from './range';
|
||||||
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,14 +100,9 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup>
|
|||||||
availability: SCThingThatCanBeOfferedAvailability;
|
availability: SCThingThatCanBeOfferedAvailability;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time when the thing becomes unavailable as an SCISO8601Date formatted string.
|
* The time when the thing is available.
|
||||||
*/
|
*/
|
||||||
availabilityEnds?: SCISO8601Date;
|
availabilityRange?: SCISO8601DateRange;
|
||||||
|
|
||||||
/**
|
|
||||||
* The time when the thing becomes available as an SCISO8601Date formatted string.
|
|
||||||
*/
|
|
||||||
availabilityStarts?: SCISO8601Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of prices that are distinct for specific groups
|
* List of prices that are distinct for specific groups
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
|
||||||
|
import {SCMap} from '../../general/map';
|
||||||
import {SCISO8601Date} from '../../general/time';
|
import {SCISO8601Date} from '../../general/time';
|
||||||
import {SCUuid} from '../../general/uuid';
|
import {SCUuid} from '../../general/uuid';
|
||||||
import {SCOrganizationWithoutReferences} from '../organization';
|
import {SCOrganizationWithoutReferences} from '../organization';
|
||||||
@@ -25,6 +26,7 @@ export enum SCThingType {
|
|||||||
AcademicEvent = 'academic event',
|
AcademicEvent = 'academic event',
|
||||||
Article = 'article',
|
Article = 'article',
|
||||||
Book = 'book',
|
Book = 'book',
|
||||||
|
Periodical = 'periodical',
|
||||||
Building = 'building',
|
Building = 'building',
|
||||||
Catalog = 'catalog',
|
Catalog = 'catalog',
|
||||||
ContactPoint = 'contact point',
|
ContactPoint = 'contact point',
|
||||||
@@ -38,6 +40,7 @@ export enum SCThingType {
|
|||||||
Organization = 'organization',
|
Organization = 'organization',
|
||||||
Person = 'person',
|
Person = 'person',
|
||||||
PointOfInterest = 'point of interest',
|
PointOfInterest = 'point of interest',
|
||||||
|
PublicationEvent = 'publication event',
|
||||||
Room = 'room',
|
Room = 'room',
|
||||||
Semester = 'semester',
|
Semester = 'semester',
|
||||||
Setting = 'setting',
|
Setting = 'setting',
|
||||||
@@ -60,6 +63,7 @@ export interface SCThingWithoutReferences {
|
|||||||
* @keyword
|
* @keyword
|
||||||
*/
|
*/
|
||||||
alternateNames?: string[];
|
alternateNames?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of the thing
|
* Description of the thing
|
||||||
*
|
*
|
||||||
@@ -67,12 +71,21 @@ export interface SCThingWithoutReferences {
|
|||||||
* @text
|
* @text
|
||||||
*/
|
*/
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier property represents any kind of additional identifier for any kind of SCThing
|
||||||
|
*
|
||||||
|
* E.g. GTIN codes, UUIDs, Database IDs etc.
|
||||||
|
*/
|
||||||
|
identifiers?: SCMap<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL of an image of the thing
|
* URL of an image of the thing
|
||||||
*
|
*
|
||||||
* @keyword
|
* @keyword
|
||||||
*/
|
*/
|
||||||
image?: string;
|
image?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the thing
|
* Name of the thing
|
||||||
*
|
*
|
||||||
@@ -82,12 +95,21 @@ export interface SCThingWithoutReferences {
|
|||||||
* @text
|
* @text
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL of a reference Web page that unambiguously indicates the item's identity
|
||||||
|
*
|
||||||
|
* E.g. the URL of the item's Wikipedia page, Wikidata entry, or official website.
|
||||||
|
*/
|
||||||
|
sameAs?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translations of specific values of the object
|
* Translations of specific values of the object
|
||||||
*
|
*
|
||||||
* Take precedence over "main" value for selected languages.
|
* Take precedence over "main" value for selected languages.
|
||||||
*/
|
*/
|
||||||
translations?: SCTranslations<SCThingTranslatableProperties>;
|
translations?: SCTranslations<SCThingTranslatableProperties>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the thing
|
* Type of the thing
|
||||||
*
|
*
|
||||||
@@ -96,16 +118,11 @@ export interface SCThingWithoutReferences {
|
|||||||
* @aggregatable global
|
* @aggregatable global
|
||||||
*/
|
*/
|
||||||
type: SCThingType;
|
type: SCThingType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Universally unique identifier of the thing
|
* Universally unique identifier of the thing
|
||||||
*/
|
*/
|
||||||
uid: SCUuid;
|
uid: SCUuid;
|
||||||
/**
|
|
||||||
* URL of the thing
|
|
||||||
*
|
|
||||||
* @filterable
|
|
||||||
*/
|
|
||||||
url?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,7 +269,7 @@ export interface SCThingTranslatablePropertyOrigin {
|
|||||||
*/
|
*/
|
||||||
export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
||||||
/**
|
/**
|
||||||
* Set type definiton for singleton instance
|
* Set type definition for singleton instance
|
||||||
*/
|
*/
|
||||||
protected static _instance = new Map<string, unknown>();
|
protected static _instance = new Map<string, unknown>();
|
||||||
|
|
||||||
@@ -263,24 +280,26 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
|||||||
de: {
|
de: {
|
||||||
alternateNames: 'alternative Namen',
|
alternateNames: 'alternative Namen',
|
||||||
description: 'Beschreibung',
|
description: 'Beschreibung',
|
||||||
|
identifiers: 'Alternative Identifikation',
|
||||||
image: 'Bild',
|
image: 'Bild',
|
||||||
name: 'Name',
|
name: 'Name',
|
||||||
origin: 'Ursprung',
|
origin: 'Ursprung',
|
||||||
|
sameAs: 'ursprünglicher Link',
|
||||||
translations: 'Übersetzungen',
|
translations: 'Übersetzungen',
|
||||||
type: 'Typ',
|
type: 'Typ',
|
||||||
uid: 'Identifikation',
|
uid: 'Identifikation',
|
||||||
url: 'URL',
|
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
alternateNames: 'alternate names',
|
alternateNames: 'alternate names',
|
||||||
description: 'description',
|
description: 'description',
|
||||||
|
identifiers: 'alternative identification',
|
||||||
image: 'image',
|
image: 'image',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
origin: 'origin',
|
origin: 'origin',
|
||||||
|
sameAs: 'original link',
|
||||||
translations: 'translations',
|
translations: 'translations',
|
||||||
type: 'type',
|
type: 'type',
|
||||||
uid: 'identification',
|
uid: 'identification',
|
||||||
url: 'URL',
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
21
src/things/abstract/user-groups.ts
Normal file
21
src/things/abstract/user-groups.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Types of data consumers
|
||||||
|
*/
|
||||||
|
export type SCUserGroup =
|
||||||
|
'students'
|
||||||
|
| 'employees'
|
||||||
|
| 'guests';
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -21,25 +21,37 @@ import {
|
|||||||
} from './abstract/creative-work';
|
} from './abstract/creative-work';
|
||||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
|
||||||
SCThingWithCategoriesSpecificValues,
|
SCThingWithCategoriesSpecificValues,
|
||||||
SCThingWithCategoriesTranslatableProperties,
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from './abstract/thing-with-categories';
|
} from './abstract/thing-with-categories';
|
||||||
|
import {SCPeriodicalWithoutReferences} from './periodical';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories of an article
|
||||||
|
*/
|
||||||
|
export type SCArticleCategories = 'unipedia'
|
||||||
|
| 'article'
|
||||||
|
| 'eArticle';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An article without references
|
* An article without references
|
||||||
*/
|
*/
|
||||||
export interface SCArticleWithoutReferences
|
export interface SCArticleWithoutReferences
|
||||||
extends SCCreativeWorkWithoutReferences,
|
extends SCCreativeWorkWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Article itself as markdown
|
* Article itself as markdown
|
||||||
*
|
*
|
||||||
* @text
|
* @text
|
||||||
*/
|
*/
|
||||||
articleBody: string;
|
articleBody?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories of an article
|
||||||
|
*/
|
||||||
|
categories: SCArticleCategories[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated fields of an article
|
* Translated fields of an article
|
||||||
@@ -59,8 +71,16 @@ export interface SCArticleWithoutReferences
|
|||||||
* @indexable
|
* @indexable
|
||||||
*/
|
*/
|
||||||
export interface SCArticle
|
export interface SCArticle
|
||||||
extends SCCreativeWork, SCArticleWithoutReferences,
|
extends SCCreativeWork, SCArticleWithoutReferences {
|
||||||
SCThingWithCategories<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
|
/**
|
||||||
|
* A periodical to which this article belongs
|
||||||
|
*/
|
||||||
|
isPartOf?: SCPeriodicalWithoutReferences;
|
||||||
|
/**
|
||||||
|
* Additional information about how to find the article inside of its "parent" (which is provided in 'isPartOf')
|
||||||
|
* e.g. "40, 2011, S. 2-3"
|
||||||
|
*/
|
||||||
|
reference?: string;
|
||||||
/**
|
/**
|
||||||
* Translated fields of an article
|
* Translated fields of an article
|
||||||
*/
|
*/
|
||||||
@@ -73,12 +93,7 @@ export interface SCArticle
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Categories of articles
|
* Translatable properties of an article
|
||||||
*/
|
|
||||||
export type SCArticleCategories = 'unipedia';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translatable properties of creative works
|
|
||||||
*/
|
*/
|
||||||
export interface SCArticleTranslatableProperties
|
export interface SCArticleTranslatableProperties
|
||||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||||
@@ -103,14 +118,18 @@ export class SCArticleMeta
|
|||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||||
.de,
|
.de,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
|
categories: 'Format',
|
||||||
|
reference: 'Referenz',
|
||||||
articleBody: 'Artikelinhalt',
|
articleBody: 'Artikelinhalt',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||||
.en,
|
.en,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
||||||
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
|
categories: 'format',
|
||||||
|
reference: 'reference',
|
||||||
articleBody: 'article body',
|
articleBody: 'article body',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -122,19 +141,22 @@ export class SCArticleMeta
|
|||||||
de: {
|
de: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
.fieldValueTranslations.de,
|
.fieldValueTranslations.de,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
|
||||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
|
||||||
categories: {
|
categories: {
|
||||||
'unipedia': 'Unipedia',
|
article: 'Artikel',
|
||||||
|
eArticle: 'E-Aufsatz',
|
||||||
|
unipedia: 'Unipedia',
|
||||||
},
|
},
|
||||||
type: 'Artikel',
|
type: 'Artikel',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
.fieldValueTranslations.en,
|
.fieldValueTranslations.en,
|
||||||
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
|
|
||||||
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
|
||||||
type: SCThingType.Article,
|
type: SCThingType.Article,
|
||||||
|
categories: {
|
||||||
|
article: 'article',
|
||||||
|
eArticle: 'E-Article',
|
||||||
|
unipedia: 'unipedia',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -20,29 +20,52 @@ import {
|
|||||||
SCCreativeWorkWithoutReferences,
|
SCCreativeWorkWithoutReferences,
|
||||||
} from './abstract/creative-work';
|
} from './abstract/creative-work';
|
||||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {SCThingWithCategoriesTranslatableProperties} from './abstract/thing-with-categories';
|
import {
|
||||||
import {SCPersonWithoutReferences} from './person';
|
SCThingWithCategoriesSpecificValues,
|
||||||
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
|
SCThingWithCategoriesWithoutReferences,
|
||||||
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
|
} from './abstract/thing-with-categories';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories of a book
|
||||||
|
*/
|
||||||
|
export type SCBookCategories = 'audio'
|
||||||
|
| 'book'
|
||||||
|
| 'cd'
|
||||||
|
| 'dvd'
|
||||||
|
| 'ePhoto'
|
||||||
|
| 'ebook'
|
||||||
|
| 'hierarchy'
|
||||||
|
| 'kit'
|
||||||
|
| 'manuscript'
|
||||||
|
| 'map'
|
||||||
|
| 'microfilm'
|
||||||
|
| 'musicalscore'
|
||||||
|
| 'photo'
|
||||||
|
| 'retro'
|
||||||
|
| 'sensorimage'
|
||||||
|
| 'unknown'
|
||||||
|
| 'video';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A book without references
|
* A book without references
|
||||||
*/
|
*/
|
||||||
export interface SCBookWithoutReferences
|
export interface SCBookWithoutReferences
|
||||||
extends SCCreativeWorkWithoutReferences {
|
extends SCCreativeWorkWithoutReferences,
|
||||||
|
SCThingWithCategoriesWithoutReferences<SCBookCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Edition of a book
|
* Categories of a book
|
||||||
*
|
|
||||||
* @filterable
|
|
||||||
* @keyword
|
|
||||||
*/
|
*/
|
||||||
bookEdition?: string;
|
categories: SCBookCategories[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ISBN of a book
|
* ISBNs of a book
|
||||||
*
|
*
|
||||||
* @filterable
|
* @filterable
|
||||||
* @keyword
|
* @keyword
|
||||||
*/
|
*/
|
||||||
isbn?: string;
|
ISBNs?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of pages of a book
|
* Number of pages of a book
|
||||||
@@ -70,11 +93,6 @@ export interface SCBookWithoutReferences
|
|||||||
*/
|
*/
|
||||||
export interface SCBook
|
export interface SCBook
|
||||||
extends SCCreativeWork, SCBookWithoutReferences {
|
extends SCCreativeWork, SCBookWithoutReferences {
|
||||||
/**
|
|
||||||
* Authors of the creative work
|
|
||||||
*/
|
|
||||||
authors: SCPersonWithoutReferences[];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated properties of a book
|
* Translated properties of a book
|
||||||
*/
|
*/
|
||||||
@@ -91,12 +109,6 @@ export interface SCBook
|
|||||||
*/
|
*/
|
||||||
export interface SCBookTranslatableFields
|
export interface SCBookTranslatableFields
|
||||||
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||||
/**
|
|
||||||
* Translation of an edition of a book
|
|
||||||
*
|
|
||||||
* @keyword
|
|
||||||
*/
|
|
||||||
bookEdition?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,17 +120,19 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
|
|||||||
*/
|
*/
|
||||||
fieldTranslations = {
|
fieldTranslations = {
|
||||||
de: {
|
de: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.de,
|
||||||
.de,
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories,
|
||||||
bookEdition: 'Buchausgabe',
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
isbn: 'ISBN',
|
categories: 'Format',
|
||||||
numberOfPages: 'Seitenzahl',
|
ISBNs: 'ISBN',
|
||||||
|
numberOfPages: 'Seitenanzahl',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.en,
|
||||||
.en,
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories,
|
||||||
bookEdition: 'book edition',
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
isbn: 'ISBN',
|
categories: 'format',
|
||||||
|
ISBNs: 'ISBN',
|
||||||
numberOfPages: 'number of pages',
|
numberOfPages: 'number of pages',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -130,12 +144,56 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
|
|||||||
de: {
|
de: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
.fieldValueTranslations.de,
|
.fieldValueTranslations.de,
|
||||||
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories,
|
||||||
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
||||||
|
categories: {
|
||||||
|
audio: 'Tonträger',
|
||||||
|
book: 'Buch',
|
||||||
|
cd: 'CD',
|
||||||
|
dvd: 'DVD',
|
||||||
|
ePhoto: 'E-Photo',
|
||||||
|
ebook: 'E-Book',
|
||||||
|
hierarchy: 'mehrteiliges Werk',
|
||||||
|
kit: 'Medienkombination',
|
||||||
|
manuscript: 'Handschrift',
|
||||||
|
map: 'Karte',
|
||||||
|
microfilm: 'Mikrofilm, Mikrofiche',
|
||||||
|
musicalscore: 'Noten',
|
||||||
|
photo: 'Abbildung',
|
||||||
|
physicalobject: 'Objekt',
|
||||||
|
retro: 'Retro (Buch)',
|
||||||
|
sensorimage: 'Blindenschrift',
|
||||||
|
unknown: 'Unbekannt',
|
||||||
|
video: 'Film',
|
||||||
|
},
|
||||||
type: 'Buch',
|
type: 'Buch',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
.fieldValueTranslations.en,
|
.fieldValueTranslations.en,
|
||||||
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBookCategories,
|
||||||
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
||||||
type: SCThingType.Book,
|
type: SCThingType.Book,
|
||||||
|
categories: {
|
||||||
|
audio: 'audio material',
|
||||||
|
book: 'book',
|
||||||
|
cd: 'CD',
|
||||||
|
dvd: 'DVD',
|
||||||
|
ePhoto: 'E-Photo',
|
||||||
|
ebook: 'E-Book',
|
||||||
|
hierarchy: 'multipart item',
|
||||||
|
kit: 'media combination',
|
||||||
|
manuscript: 'manuscript',
|
||||||
|
map: 'map',
|
||||||
|
microfilm: 'microfilm, microfiche',
|
||||||
|
musicalscore: 'sheet music',
|
||||||
|
photo: 'illustration',
|
||||||
|
physicalobject: 'object',
|
||||||
|
retro: 'retro (book)',
|
||||||
|
sensorimage: 'braille',
|
||||||
|
unknown: 'unknown',
|
||||||
|
video: 'film',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export interface SCCatalogWithoutReferences
|
|||||||
*
|
*
|
||||||
* Needed for keeping order in catalog inheritance array.
|
* Needed for keeping order in catalog inheritance array.
|
||||||
*
|
*
|
||||||
|
* @filterable
|
||||||
* @integer
|
* @integer
|
||||||
*/
|
*/
|
||||||
level: number;
|
level: number;
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ export interface SCDateSeriesWithoutReferences
|
|||||||
/**
|
/**
|
||||||
* Frequency of the date series
|
* Frequency of the date series
|
||||||
*
|
*
|
||||||
* @keyword
|
* @filterable
|
||||||
*/
|
*/
|
||||||
frequency: string;
|
repeatFrequency?: SCISO8601Duration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated properties
|
* Translated properties
|
||||||
@@ -131,7 +131,7 @@ export class SCDateSeriesMeta
|
|||||||
duration: 'Dauer',
|
duration: 'Dauer',
|
||||||
event: 'Event',
|
event: 'Event',
|
||||||
exceptions: 'Ausnahmen',
|
exceptions: 'Ausnahmen',
|
||||||
frequency: 'Frequenz',
|
repeatFrequency: 'Frequenz',
|
||||||
performers: 'Vortragende',
|
performers: 'Vortragende',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
@@ -143,7 +143,7 @@ export class SCDateSeriesMeta
|
|||||||
duration: 'duration',
|
duration: 'duration',
|
||||||
event: 'event',
|
event: 'event',
|
||||||
exceptions: 'exceptions',
|
exceptions: 'exceptions',
|
||||||
frequency: 'frequency',
|
repeatFrequency: 'frequency',
|
||||||
performers: 'performers',
|
performers: 'performers',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -174,8 +174,4 @@ export class SCDateSeriesMeta
|
|||||||
*/
|
*/
|
||||||
export interface SCDateSeriesTranslatableProperties
|
export interface SCDateSeriesTranslatableProperties
|
||||||
extends SCThingThatCanBeOfferedTranslatableProperties {
|
extends SCThingThatCanBeOfferedTranslatableProperties {
|
||||||
/**
|
|
||||||
* @see SCDateSeriesWithoutReferences.frequency
|
|
||||||
*/
|
|
||||||
frequency?: string;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
import * as jsonpatch from 'json-patch';
|
import * as jsonpatch from 'json-patch';
|
||||||
import {SCMetaTranslations} from '../general/i18n';
|
import {SCMetaTranslations} from '../general/i18n';
|
||||||
import {SCISO8601Date} from '../general/time';
|
import {SCISO8601Date} from '../general/time';
|
||||||
import {SCThingsWithoutDiff} from '../meta';
|
import {SCIndexableThings} from '../meta';
|
||||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,14 +48,13 @@ export interface SCDiffWithoutReferences
|
|||||||
* A diff
|
* A diff
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
* @indexable
|
|
||||||
*/
|
*/
|
||||||
export interface SCDiff
|
export interface SCDiff
|
||||||
extends SCDiffWithoutReferences, SCThing {
|
extends SCDiffWithoutReferences, SCThing {
|
||||||
/**
|
/**
|
||||||
* Original object the diff was generated on
|
* Original object the diff was generated on
|
||||||
*/
|
*/
|
||||||
object: SCThingsWithoutDiff;
|
object: SCIndexableThings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of a diff
|
* Type of a diff
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -14,45 +14,24 @@
|
|||||||
*/
|
*/
|
||||||
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-thing';
|
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-thing';
|
||||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {SCAcademicEventWithoutReferences} from './academic-event';
|
|
||||||
import {SCArticleWithoutReferences} from './article';
|
|
||||||
import {SCBookWithoutReferences} from './book';
|
|
||||||
import {SCBuildingWithoutReferences} from './building';
|
|
||||||
import {SCPersonWithoutReferences} from './person';
|
|
||||||
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
|
||||||
import {SCRoomWithoutReferences} from './room';
|
|
||||||
import {SCSportCourseWithoutReferences} from './sport-course';
|
|
||||||
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 without references
|
* A favorite without references
|
||||||
*/
|
*/
|
||||||
export interface SCFavoriteWithoutReferences
|
export interface SCFavoriteWithoutReferences
|
||||||
extends SCSaveableThingWithoutReferences {
|
extends SCSaveableThingWithoutReferences {
|
||||||
// noop
|
/**
|
||||||
|
* Type of a favorite
|
||||||
|
*/
|
||||||
|
type: SCThingType.Favorite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A favorite
|
* A favorite
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
* @indexable
|
|
||||||
*/
|
*/
|
||||||
export interface SCFavorite
|
export interface SCFavorite extends SCSaveableThing {
|
||||||
extends SCSaveableThing<SCFavoriteDataTypes>, SCFavoriteWithoutReferences {
|
|
||||||
/**
|
/**
|
||||||
* Type of a favorite
|
* Type of a favorite
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -22,13 +22,24 @@ import {
|
|||||||
} from './abstract/creative-work';
|
} from './abstract/creative-work';
|
||||||
import {SCThingMeta, SCThingType} from './abstract/thing';
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
|
import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
|
||||||
|
import {
|
||||||
|
SCThingWithCategoriesSpecificValues,
|
||||||
|
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
|
} from './abstract/thing-with-categories';
|
||||||
|
import {SCUserGroup} from './abstract/user-groups';
|
||||||
import {SCOrganizationWithoutReferences} from './organization';
|
import {SCOrganizationWithoutReferences} from './organization';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories of a message
|
||||||
|
*/
|
||||||
|
export type SCMessageCategories = 'news';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message without references
|
* A message without references
|
||||||
*/
|
*/
|
||||||
export interface SCMessageWithoutReferences
|
export interface SCMessageWithoutReferences
|
||||||
extends SCCreativeWorkWithoutReferences {
|
extends SCCreativeWorkWithoutReferences,
|
||||||
|
SCThingWithCategoriesWithoutReferences<SCMessageCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
/**
|
/**
|
||||||
* Organizational unit for which the message is intended
|
* Organizational unit for which the message is intended
|
||||||
*/
|
*/
|
||||||
@@ -39,7 +50,12 @@ export interface SCMessageWithoutReferences
|
|||||||
*
|
*
|
||||||
* @filterable
|
* @filterable
|
||||||
*/
|
*/
|
||||||
audiences: SCMessageAudience[];
|
audiences: SCUserGroup[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories of a message
|
||||||
|
*/
|
||||||
|
categories: SCMessageCategories[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the message was created
|
* When the message was created
|
||||||
@@ -90,14 +106,6 @@ export interface SCMessage
|
|||||||
type: SCThingType.Message;
|
type: SCThingType.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Audiences for messages
|
|
||||||
*/
|
|
||||||
export type SCMessageAudience =
|
|
||||||
'students'
|
|
||||||
| 'employees'
|
|
||||||
| 'guests';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translatable properties of a message
|
* Translatable properties of a message
|
||||||
*/
|
*/
|
||||||
@@ -124,6 +132,8 @@ export class SCMessageMeta
|
|||||||
de: {
|
de: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||||
.de,
|
.de,
|
||||||
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCMessageCategories,
|
||||||
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
audienceOrganizations: 'Zielgruppenorganisationen',
|
audienceOrganizations: 'Zielgruppenorganisationen',
|
||||||
audiences: 'Zielgruppen',
|
audiences: 'Zielgruppen',
|
||||||
dateCreated: 'Erstellungsdatum',
|
dateCreated: 'Erstellungsdatum',
|
||||||
@@ -133,6 +143,8 @@ export class SCMessageMeta
|
|||||||
en: {
|
en: {
|
||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
||||||
.en,
|
.en,
|
||||||
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCMessageCategories,
|
||||||
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
audienceOrganizations: 'audience organizations',
|
audienceOrganizations: 'audience organizations',
|
||||||
audiences: 'audiences',
|
audiences: 'audiences',
|
||||||
dateCreated: 'date created',
|
dateCreated: 'date created',
|
||||||
@@ -149,9 +161,12 @@ export class SCMessageMeta
|
|||||||
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
.fieldValueTranslations.de,
|
.fieldValueTranslations.de,
|
||||||
audiences: {
|
audiences: {
|
||||||
'employees': 'Angestellte',
|
employees: 'Angestellte',
|
||||||
'guests': 'Gäste',
|
guests: 'Gäste',
|
||||||
'students': 'Studenten',
|
students: 'Studenten',
|
||||||
|
},
|
||||||
|
categories: {
|
||||||
|
news: 'Neuigkeiten',
|
||||||
},
|
},
|
||||||
type: 'Nachricht',
|
type: 'Nachricht',
|
||||||
},
|
},
|
||||||
|
|||||||
137
src/things/periodical.ts
Normal file
137
src/things/periodical.ts
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {
|
||||||
|
SCCreativeWork,
|
||||||
|
SCCreativeWorkMeta,
|
||||||
|
SCCreativeWorkTranslatableProperties,
|
||||||
|
SCCreativeWorkWithoutReferences,
|
||||||
|
} from './abstract/creative-work';
|
||||||
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
|
import {
|
||||||
|
SCThingWithCategoriesSpecificValues,
|
||||||
|
SCThingWithCategoriesTranslatableProperties,
|
||||||
|
SCThingWithCategoriesWithoutReferences,
|
||||||
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
|
} from './abstract/thing-with-categories';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories of a periodical
|
||||||
|
*/
|
||||||
|
export type SCPeriodicalCategories = 'journal' | 'electronic';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A periodical without references
|
||||||
|
*/
|
||||||
|
export interface SCPeriodicalWithoutReferences
|
||||||
|
extends SCCreativeWorkWithoutReferences,
|
||||||
|
SCThingWithCategoriesWithoutReferences<SCPeriodicalCategories, SCThingWithCategoriesSpecificValues> {
|
||||||
|
/**
|
||||||
|
* Categories of a periodical
|
||||||
|
*/
|
||||||
|
categories: SCPeriodicalCategories[];
|
||||||
|
/**
|
||||||
|
* A list of ISSNs of a periodical
|
||||||
|
*
|
||||||
|
* @filterable
|
||||||
|
* @keyword
|
||||||
|
*/
|
||||||
|
ISSNs?: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translated properties of a periodical
|
||||||
|
*/
|
||||||
|
translations?: SCTranslations<SCPeriodicalTranslatableFields>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of a periodical
|
||||||
|
*/
|
||||||
|
type: SCThingType.Periodical;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A publication published at regular intervals (e.g. a magazine or newspaper)
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
* @indexable
|
||||||
|
*/
|
||||||
|
export interface SCPeriodical
|
||||||
|
extends SCCreativeWork, SCPeriodicalWithoutReferences {
|
||||||
|
/**
|
||||||
|
* Translated properties of a periodical
|
||||||
|
*/
|
||||||
|
translations?: SCTranslations<SCPeriodicalTranslatableFields>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of a periodical
|
||||||
|
*/
|
||||||
|
type: SCThingType.Periodical;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translatable properties of a periodical
|
||||||
|
*/
|
||||||
|
export interface SCPeriodicalTranslatableFields
|
||||||
|
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meta information about a periodical
|
||||||
|
*/
|
||||||
|
export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<SCPeriodical> {
|
||||||
|
/**
|
||||||
|
* Translations of fields
|
||||||
|
*/
|
||||||
|
fieldTranslations = {
|
||||||
|
de: {
|
||||||
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.de,
|
||||||
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPeriodicalCategories,
|
||||||
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
||||||
|
categories: 'Format',
|
||||||
|
ISSNs: 'ISSN',
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations.en,
|
||||||
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPeriodicalCategories,
|
||||||
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
||||||
|
categories: 'format',
|
||||||
|
ISSNs: 'ISSN',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translations of values of fields
|
||||||
|
*/
|
||||||
|
fieldValueTranslations = {
|
||||||
|
de: {
|
||||||
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
|
.fieldValueTranslations.de,
|
||||||
|
type: 'Periodikum',
|
||||||
|
categories: {
|
||||||
|
electronic: 'E-Journal',
|
||||||
|
journal: 'Zeitschrift',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
||||||
|
.fieldValueTranslations.en,
|
||||||
|
type: 'periodical',
|
||||||
|
categories: {
|
||||||
|
electronic: 'E-Journal',
|
||||||
|
journal: 'journal',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -57,7 +57,7 @@ export interface SCPersonWithoutReferences
|
|||||||
* @filterable
|
* @filterable
|
||||||
* @keyword
|
* @keyword
|
||||||
*/
|
*/
|
||||||
familyName: string;
|
familyName?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The private fax number of the person.
|
* The private fax number of the person.
|
||||||
@@ -80,7 +80,7 @@ export interface SCPersonWithoutReferences
|
|||||||
* @filterable
|
* @filterable
|
||||||
* @keyword
|
* @keyword
|
||||||
*/
|
*/
|
||||||
givenName: string;
|
givenName?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Honorific prefix of the person.
|
* Honorific prefix of the person.
|
||||||
|
|||||||
105
src/things/publication-event.ts
Normal file
105
src/things/publication-event.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
|
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
|
||||||
|
import {SCThingMeta, SCThingTranslatableProperties, SCThingType} from './abstract/thing';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An publication event without references
|
||||||
|
*/
|
||||||
|
export interface SCPublicationEventWithoutReferences
|
||||||
|
extends SCEventWithoutReferences {
|
||||||
|
/**
|
||||||
|
* All the locations related to the event (e.g. where a creative work was published)
|
||||||
|
*/
|
||||||
|
locations?: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An organization (or a person) that is publishing at the event
|
||||||
|
*/
|
||||||
|
publisher?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translated fields of an publication event
|
||||||
|
*/
|
||||||
|
translations?: SCTranslations<SCPublicationEventTranslatableProperties>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of an publication event
|
||||||
|
*/
|
||||||
|
type: SCThingType.PublicationEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An publication event
|
||||||
|
*
|
||||||
|
* @validatable
|
||||||
|
* @indexable
|
||||||
|
*/
|
||||||
|
export interface SCPublicationEvent
|
||||||
|
extends SCEvent, SCPublicationEventWithoutReferences {
|
||||||
|
/**
|
||||||
|
* Translated fields of an publication event
|
||||||
|
*/
|
||||||
|
translations?: SCTranslations<SCPublicationEventTranslatableProperties>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of an publication event
|
||||||
|
*/
|
||||||
|
type: SCThingType.PublicationEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translatable properties of an publication event
|
||||||
|
*/
|
||||||
|
export interface SCPublicationEventTranslatableProperties extends SCThingTranslatableProperties {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meta information about publication events
|
||||||
|
*/
|
||||||
|
export class SCPublicationEventMeta
|
||||||
|
extends SCThingMeta
|
||||||
|
implements SCMetaTranslations<SCPublicationEvent> {
|
||||||
|
/**
|
||||||
|
* Translations of fields
|
||||||
|
*/
|
||||||
|
fieldTranslations = {
|
||||||
|
de: {
|
||||||
|
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
|
||||||
|
locations: 'Erscheinungsorte',
|
||||||
|
publisher: 'Verlag',
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
|
||||||
|
locations: 'places of publication',
|
||||||
|
publisher: 'publisher',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translations of values of fields
|
||||||
|
*/
|
||||||
|
fieldValueTranslations = {
|
||||||
|
de: {
|
||||||
|
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
|
||||||
|
type: 'Veröffentlichung',
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
|
||||||
|
type: 'publication event',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 StApps
|
* Copyright (C) 2019-2021 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
import {SCLanguageCode, SCMetaTranslations, SCTranslations} from '../general/i18n';
|
||||||
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
|
||||||
import {
|
import {
|
||||||
SCThingWithCategories,
|
SCThingWithCategories,
|
||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
SCThingWithCategoriesWithoutReferences,
|
SCThingWithCategoriesWithoutReferences,
|
||||||
SCThingWithCategoriesWithoutReferencesMeta,
|
SCThingWithCategoriesWithoutReferencesMeta,
|
||||||
} from './abstract/thing-with-categories';
|
} from './abstract/thing-with-categories';
|
||||||
|
import {SCUserGroup} from './abstract/user-groups';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting without references
|
* A setting without references
|
||||||
@@ -83,7 +84,6 @@ export enum SCSettingInputType {
|
|||||||
* A setting with references
|
* A setting with references
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
* @indexable
|
|
||||||
*/
|
*/
|
||||||
export interface SCSetting
|
export interface SCSetting
|
||||||
extends SCSettingWithoutReferences, SCThing,
|
extends SCSettingWithoutReferences, SCThing,
|
||||||
@@ -177,3 +177,55 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A user group setting
|
||||||
|
*/
|
||||||
|
export interface SCUserGroupSetting extends SCSetting {
|
||||||
|
/**
|
||||||
|
* Exact categories of the setting
|
||||||
|
*/
|
||||||
|
categories: ['profile'];
|
||||||
|
/**
|
||||||
|
* The default value of the setting
|
||||||
|
*/
|
||||||
|
defaultValue: SCUserGroup;
|
||||||
|
/**
|
||||||
|
* Specific name of the setting
|
||||||
|
*/
|
||||||
|
name: 'group';
|
||||||
|
/**
|
||||||
|
* Chosen value of the setting
|
||||||
|
*/
|
||||||
|
value?: SCUserGroup;
|
||||||
|
/**
|
||||||
|
* The possible values of the setting
|
||||||
|
*/
|
||||||
|
values: SCUserGroup[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A language setting
|
||||||
|
*/
|
||||||
|
export interface SCLanguageSetting extends SCSetting {
|
||||||
|
/**
|
||||||
|
* Exact categories of the setting
|
||||||
|
*/
|
||||||
|
categories: ['profile'];
|
||||||
|
/**
|
||||||
|
* The default value of the setting
|
||||||
|
*/
|
||||||
|
defaultValue: SCLanguageCode;
|
||||||
|
/**
|
||||||
|
* Specific name of the setting
|
||||||
|
*/
|
||||||
|
name: 'language';
|
||||||
|
/**
|
||||||
|
* Chosen value of the setting
|
||||||
|
*/
|
||||||
|
value?: SCLanguageCode;
|
||||||
|
/**
|
||||||
|
* The possible values of the setting
|
||||||
|
*/
|
||||||
|
values: SCLanguageCode[];
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,8 +13,9 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import clone = require('fast-clone');
|
import clone = require('fast-clone');
|
||||||
|
import equal = require('fast-deep-equal/es6');
|
||||||
import {Defined, TSOCType} from 'ts-optchain';
|
import {Defined, TSOCType} from 'ts-optchain';
|
||||||
import {SCTranslations} from './general/i18n';
|
import {SCLanguageCode} from './general/i18n';
|
||||||
import {isThing} from './guards';
|
import {isThing} from './guards';
|
||||||
import {SCClasses} from './meta';
|
import {SCClasses} from './meta';
|
||||||
import {SCThing, SCThingType} from './things/abstract/thing';
|
import {SCThing, SCThingType} from './things/abstract/thing';
|
||||||
@@ -27,13 +28,32 @@ const standardCacheSize = 200;
|
|||||||
*/
|
*/
|
||||||
export class SCThingTranslator {
|
export class SCThingTranslator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for language property
|
||||||
|
*/
|
||||||
|
get language(): SCLanguageCode {
|
||||||
|
return this._language;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for language property. Also flushes translation cache
|
||||||
|
*
|
||||||
|
* @param language The language the translator instance will use from now on
|
||||||
|
*/
|
||||||
|
set language(language: SCLanguageCode) {
|
||||||
|
if (language !== this._language) {
|
||||||
|
this.cache.flush();
|
||||||
|
}
|
||||||
|
this._language = language;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property representing the translators target language
|
* Property representing the translators target language
|
||||||
*/
|
*/
|
||||||
private _language: keyof SCTranslations<SCThing>;
|
private _language: SCLanguageCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property representing the translators base language
|
* LRU cache containing already translated SCThings
|
||||||
* This means every translation is given for this language
|
|
||||||
*/
|
*/
|
||||||
private readonly cache: LRUCache<SCThing>;
|
private readonly cache: LRUCache<SCThing>;
|
||||||
|
|
||||||
@@ -42,36 +62,23 @@ export class SCThingTranslator {
|
|||||||
*/
|
*/
|
||||||
private readonly metaClasses: typeof SCClasses;
|
private readonly metaClasses: typeof SCClasses;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LRU cache containing SCThings translations have been provided for
|
||||||
|
*/
|
||||||
|
private readonly sourceCache: LRUCache<SCThing>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @example
|
* @example
|
||||||
* // returns translator instance for german
|
* // returns translator instance for german
|
||||||
* new SCThingTranslator('de');
|
* new SCThingTranslator('de');
|
||||||
*/
|
*/
|
||||||
constructor(language: keyof SCTranslations<SCThing>, cacheCapacity: number = standardCacheSize) {
|
constructor(language: SCLanguageCode, cacheCapacity: number = standardCacheSize) {
|
||||||
this.cache = new LRUCache(cacheCapacity);
|
this.cache = new LRUCache(cacheCapacity);
|
||||||
|
this.sourceCache = new LRUCache(cacheCapacity);
|
||||||
this._language = language;
|
this._language = language;
|
||||||
this.metaClasses = SCClasses;
|
this.metaClasses = SCClasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for language property
|
|
||||||
*/
|
|
||||||
get language(): keyof SCTranslations<SCThing> {
|
|
||||||
return this._language;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for language property. Also flushes translation cache
|
|
||||||
*
|
|
||||||
* @param language The language the translator instance will use from now on
|
|
||||||
*/
|
|
||||||
set language(language: keyof SCTranslations<SCThing>) {
|
|
||||||
if (language !== this._language) {
|
|
||||||
this.cache.flush();
|
|
||||||
}
|
|
||||||
this._language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get field value translation recursively
|
* Get field value translation recursively
|
||||||
*
|
*
|
||||||
@@ -101,8 +108,8 @@ export class SCThingTranslator {
|
|||||||
* @param language The language the thing property values are translated to
|
* @param language The language the thing property values are translated to
|
||||||
* @returns The thing with all known meta values translated
|
* @returns The thing with all known meta values translated
|
||||||
*/
|
*/
|
||||||
private getAllMetaFieldTranslations<T extends SCThing>(thingType: SCThingType,
|
private getAllMetaFieldTranslations(thingType: SCThingType,
|
||||||
language: keyof SCTranslations<T>): object | undefined {
|
language: SCLanguageCode): object | undefined {
|
||||||
const fieldTranslations = {};
|
const fieldTranslations = {};
|
||||||
const metaClass = this.getMetaClassInstance(thingType);
|
const metaClass = this.getMetaClassInstance(thingType);
|
||||||
if (typeof metaClass === 'undefined') {
|
if (typeof metaClass === 'undefined') {
|
||||||
@@ -151,7 +158,7 @@ export class SCThingTranslator {
|
|||||||
* @returns The thing with translated meta field values
|
* @returns The thing with translated meta field values
|
||||||
*/
|
*/
|
||||||
private replaceAvailableMetaFieldValueTranslations(instance: any,
|
private replaceAvailableMetaFieldValueTranslations(instance: any,
|
||||||
language: keyof SCTranslations<any>): any {
|
language: SCLanguageCode): any {
|
||||||
const metaClass = this.getMetaClassInstance(instance.type);
|
const metaClass = this.getMetaClassInstance(instance.type);
|
||||||
if (typeof metaClass === 'undefined') {
|
if (typeof metaClass === 'undefined') {
|
||||||
return instance;
|
return instance;
|
||||||
@@ -181,6 +188,60 @@ export class SCThingTranslator {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively translates the given object in-place
|
||||||
|
* Translated values overwrite current values (destructive)
|
||||||
|
*
|
||||||
|
* @param instance The thing / object that will be translated
|
||||||
|
* @returns The thing translated
|
||||||
|
*/
|
||||||
|
private translateThingInPlaceDestructively<T>(instance: T): T {
|
||||||
|
const targetLanguage = this.language;
|
||||||
|
|
||||||
|
let nextInstance = instance as any;
|
||||||
|
// Recursively call this function on all nested SCThings, arrays and objects
|
||||||
|
Object.keys(nextInstance)
|
||||||
|
.forEach((key) => {
|
||||||
|
if (
|
||||||
|
isThing(nextInstance[key]) ||
|
||||||
|
nextInstance[key] instanceof Array ||
|
||||||
|
nextInstance[key] instanceof Object) {
|
||||||
|
nextInstance[key] = this.translateThingInPlaceDestructively(nextInstance[key]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Spread variable translations given by the connector into thing
|
||||||
|
if (typeof nextInstance.translations?.[targetLanguage] !== 'undefined') {
|
||||||
|
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as T;
|
||||||
|
}
|
||||||
|
// Spread known translations from meta classes into (partly) translated thing
|
||||||
|
this.replaceAvailableMetaFieldValueTranslations(nextInstance, targetLanguage);
|
||||||
|
|
||||||
|
return nextInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively translates the given object in-place
|
||||||
|
* Translated values overwrite current values (destructive)
|
||||||
|
*
|
||||||
|
* @param instance The thing / object that will be translated
|
||||||
|
* @returns The thing translated
|
||||||
|
*/
|
||||||
|
public translate<T extends SCThing>(thing: T): T {
|
||||||
|
if (equal(this.sourceCache.get(thing), thing)) {
|
||||||
|
const cachedInstance = this.cache.get(thing);
|
||||||
|
if (typeof cachedInstance !== 'undefined') {
|
||||||
|
return cachedInstance as T;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const translatedInstance = this.translateThingInPlaceDestructively(clone(thing));
|
||||||
|
delete translatedInstance.translations;
|
||||||
|
this.cache.putObject(translatedInstance);
|
||||||
|
this.sourceCache.putObject(thing);
|
||||||
|
|
||||||
|
return translatedInstance as T;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get field value translation recursively
|
* Get field value translation recursively
|
||||||
* @example
|
* @example
|
||||||
@@ -191,21 +252,24 @@ export class SCThingTranslator {
|
|||||||
* dishTranslatedAccess.offers[0].inPlace.categories[1]();
|
* dishTranslatedAccess.offers[0].inPlace.categories[1]();
|
||||||
* // undoing the TSOCType<T>
|
* // undoing the TSOCType<T>
|
||||||
* const dishAsBefore: SCDish = dishTranslatedAccess()!;
|
* const dishAsBefore: SCDish = dishTranslatedAccess()!;
|
||||||
* @param data Top level object that gets passed through the recursion
|
* @param thing Top level object that gets passed through the recursion
|
||||||
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
|
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
|
||||||
*/
|
*/
|
||||||
public translate<T extends SCThing>(data: T): TSOCType<T> {
|
public translatedAccess<T extends SCThing>(thing: T): TSOCType<T> {
|
||||||
return new Proxy(
|
return new Proxy(
|
||||||
((defaultValue?: Defined<T>) => (data == null ? defaultValue : data)) as TSOCType<T>,
|
((defaultValue?: Defined<T>) => (thing == null ? defaultValue : thing)) as TSOCType<T>,
|
||||||
{
|
{
|
||||||
get: (target, key) => {
|
get: (target, key) => {
|
||||||
const obj: any = target();
|
const obj: any = target();
|
||||||
const objTranslatedFromCache = this.cache.get(data);
|
if (equal(this.sourceCache.get(thing), thing)) {
|
||||||
if (typeof objTranslatedFromCache !== 'undefined') {
|
const objTranslatedFromCache = this.cache.get(thing);
|
||||||
return this.deeptranslate((objTranslatedFromCache as any)[key]);
|
if (typeof objTranslatedFromCache !== 'undefined') {
|
||||||
|
return this.deeptranslate((objTranslatedFromCache as any)[key]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const objTranslated = this.translateWholeThingDestructively(clone(obj));
|
const objTranslated = this.translateThingInPlaceDestructively(clone(obj));
|
||||||
this.cache.putObject(objTranslated);
|
this.cache.putObject(objTranslated);
|
||||||
|
this.sourceCache.putObject(thing);
|
||||||
|
|
||||||
return this.deeptranslate(objTranslated[key]);
|
return this.deeptranslate(objTranslated[key]);
|
||||||
},
|
},
|
||||||
@@ -219,69 +283,31 @@ export class SCThingTranslator {
|
|||||||
* @example
|
* @example
|
||||||
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
|
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
|
||||||
* @param type The type whose property names will be translated
|
* @param type The type whose property names will be translated
|
||||||
* @param language The language all property names will be translated to
|
|
||||||
* @returns An object with the properties of the SCThingType where the values are the known property tranlations
|
* @returns An object with the properties of the SCThingType where the values are the known property tranlations
|
||||||
*/
|
*/
|
||||||
public translatedPropertyNames<T extends SCThing>(type: SCThingType,
|
public translatedPropertyNames<T extends SCThing>(type: SCThingType): T | undefined {
|
||||||
language?: keyof SCTranslations<T>): T | undefined {
|
return this.getAllMetaFieldTranslations(type, this.language) as T;
|
||||||
return this.getAllMetaFieldTranslations(type, language ?? this.language) as T;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a SCThingType and a corresponding property name it returns the known property value translation
|
* Given a SCThingType and a corresponding property name it returns the known property value translation
|
||||||
* Access pattern to the meta object containing the translation can be thought of as type.field[key] with key being optional
|
* Access pattern to the meta object containing the translation can be thought of as type.field[key] with key being optional
|
||||||
* @example
|
* @example
|
||||||
* const translatedMetaDish = translator.translatedPropertyNames(SCThingType.Dish, 'categories', 'main dish');
|
* const singleValueTranslation = translator.translatedPropertyValue(SCThingType.Dish, 'categories', 'main dish');
|
||||||
* @param type The type for whose property values a translation is required
|
* @param type The type for whose property values a translation is required
|
||||||
* @param field The property for which a translation is required
|
* @param field The property for which a translation is required
|
||||||
* @param key If specified tries to access the field with this key
|
* @param key If specified tries to access the field with this key
|
||||||
* @param language The language all property names will be translated to
|
|
||||||
* @returns Known translation for the property
|
* @returns Known translation for the property
|
||||||
*/
|
*/
|
||||||
public translatedPropertyValue<T extends unknown>(type: SCThingType,
|
public translatedPropertyValue(type: SCThingType,
|
||||||
field: string,
|
field: string,
|
||||||
key?: string,
|
key?: string): string | undefined {
|
||||||
language?: keyof SCTranslations<T>): string | undefined {
|
const fieldValueTranslations = this.getMetaClassInstance(type).fieldValueTranslations[this.language] ??
|
||||||
const fieldTranslation = this.getMetaClassInstance(type).fieldValueTranslations[language ?? this.language]?.[field];
|
this.getMetaClassInstance(type).fieldValueTranslations.en;
|
||||||
|
const fieldTranslation = fieldValueTranslations?.[field];
|
||||||
|
|
||||||
return fieldTranslation?.[key ?? ''] ?? key ?? fieldTranslation;
|
return fieldTranslation?.[key ?? ''] ?? key ?? fieldTranslation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursively translates the given object in-place
|
|
||||||
* Translated values overwrite current values (destructive)
|
|
||||||
*
|
|
||||||
* @param instance The thing / object that will be translated
|
|
||||||
* @param language The language the thing / object is translated to
|
|
||||||
* @returns The thing translated
|
|
||||||
*/
|
|
||||||
public translateWholeThingDestructively(instance: any,
|
|
||||||
language?: keyof SCTranslations<any>): any {
|
|
||||||
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
|
||||||
let nextInstance = instance;
|
|
||||||
// Recursively call this function on all nested SCThings, arrays and objects
|
|
||||||
Object.keys(nextInstance)
|
|
||||||
.forEach((key) => {
|
|
||||||
if (
|
|
||||||
isThing((nextInstance as any)[key]) ||
|
|
||||||
nextInstance[key] instanceof Array ||
|
|
||||||
nextInstance[key] instanceof Object) {
|
|
||||||
nextInstance[key] = this.translateWholeThingDestructively(nextInstance[key], targetLanguage);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Spread variable translations given by the connector into thing
|
|
||||||
if (typeof nextInstance.translations !== 'undefined') {
|
|
||||||
if (typeof nextInstance.translations![targetLanguage] !== 'undefined') {
|
|
||||||
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as typeof instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Spread known translations from meta classes into (partly) translated thing
|
|
||||||
this.replaceAvailableMetaFieldValueTranslations(nextInstance, targetLanguage);
|
|
||||||
|
|
||||||
return nextInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -116,8 +116,10 @@ export class GuardsSpec {
|
|||||||
@test
|
@test
|
||||||
public isSearchResponse() {
|
public isSearchResponse() {
|
||||||
const notASearchResponse = {...GuardsSpec.searchResponse};
|
const notASearchResponse = {...GuardsSpec.searchResponse};
|
||||||
|
// @ts-ignore
|
||||||
delete notASearchResponse.pagination;
|
delete notASearchResponse.pagination;
|
||||||
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
|
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
|
||||||
|
// @ts-ignore
|
||||||
delete notASearchResponse.data;
|
delete notASearchResponse.data;
|
||||||
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
|
expect(isSearchResponse(notASearchResponse)).to.be.equal(false);
|
||||||
expect(isSearchResponse(null)).to.be.equal(false);
|
expect(isSearchResponse(null)).to.be.equal(false);
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
"audiences": [
|
"audiences": [
|
||||||
"students"
|
"students"
|
||||||
],
|
],
|
||||||
|
"categories": [
|
||||||
|
"news"
|
||||||
|
],
|
||||||
"sequenceIndex": 1010,
|
"sequenceIndex": 1010,
|
||||||
"origin": {
|
"origin": {
|
||||||
"indexed": "2018-09-11T12:30:00Z",
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
"audiences": [
|
"audiences": [
|
||||||
"students"
|
"students"
|
||||||
],
|
],
|
||||||
|
"categories": [
|
||||||
|
"news"
|
||||||
|
],
|
||||||
"sequenceIndex": 1020,
|
"sequenceIndex": 1020,
|
||||||
"origin": {
|
"origin": {
|
||||||
"indexed": "2018-09-11T12:30:00Z",
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
|||||||
@@ -6,17 +6,67 @@
|
|||||||
"uid": "3af3ccaa-f066-5eff-9a3d-a70567f3d70d",
|
"uid": "3af3ccaa-f066-5eff-9a3d-a70567f3d70d",
|
||||||
"data": {
|
"data": {
|
||||||
"type": "academic event",
|
"type": "academic event",
|
||||||
"description": "Grundlagen, algebraische Grundbegriffe, Vektorräume, lineare Abbildungen und Gleichungen, Determinanten",
|
"description": "Fortsetzung der Algebra I: Galoistheorie mit Anwendungen, ausgewählte Spezialthemen.",
|
||||||
"uid": "b17eb963-42b5-5861-adce-2b7b2607ef0a",
|
"uid": "681a59a1-23c2-5d78-861a-8c86a3abf2b9",
|
||||||
"name": "Lineare Algebra I für Mathematiker",
|
"name": "Algebra II",
|
||||||
"categories": [
|
"categories": [
|
||||||
"lecture"
|
"lecture"
|
||||||
],
|
],
|
||||||
|
"academicTerms": [
|
||||||
|
{
|
||||||
|
"uid": "aacd5611-b5be-54ce-b39f-c52f7e9a631d",
|
||||||
|
"type": "semester",
|
||||||
|
"name": "Sommersemester 2018",
|
||||||
|
"acronym": "SS 2018",
|
||||||
|
"alternateNames": [
|
||||||
|
"SoSe 2018"
|
||||||
|
],
|
||||||
|
"startDate": "2018-04-01",
|
||||||
|
"endDate": "2018-09-30",
|
||||||
|
"eventsStartDate": "2018-04-09",
|
||||||
|
"eventsEndDate": "2018-07-13"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"performers": [
|
||||||
|
{
|
||||||
|
"type": "person",
|
||||||
|
"uid": "7f8ce700-2679-51a5-86b5-3dfba85a33ff",
|
||||||
|
"givenName": "Peter",
|
||||||
|
"familyName": "Bürgisser",
|
||||||
|
"gender": "male",
|
||||||
|
"honorificPrefix": "Prof. Dr.",
|
||||||
|
"name": "Peter Bürgisser"
|
||||||
|
}
|
||||||
|
],
|
||||||
"majors": [
|
"majors": [
|
||||||
"Wirtschaftsmathematik BSc",
|
"Mathematik D",
|
||||||
"Technomathematik BSc",
|
"Mathematik L2",
|
||||||
"Mathematik BSc"
|
"Mathematik StRGym",
|
||||||
]
|
"Mathematik StRBeruf",
|
||||||
|
"Mathematik BSc",
|
||||||
|
"Mathematik MSc"
|
||||||
|
],
|
||||||
|
"origin": {
|
||||||
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
"name": "Dummy",
|
||||||
|
"type": "remote",
|
||||||
|
"maintainer": {
|
||||||
|
"type": "organization",
|
||||||
|
"name": "tubIT",
|
||||||
|
"uid": "25f76840-db89-5da2-a8a2-75992f637613"
|
||||||
|
},
|
||||||
|
"modified": "2018-09-01T10:00:00Z",
|
||||||
|
"originalId": "foo bar",
|
||||||
|
"responsibleEntity": {
|
||||||
|
"type": "person",
|
||||||
|
"uid": "7f8ce700-2679-51a5-86b5-3dfba85a33ff",
|
||||||
|
"givenName": "Peter",
|
||||||
|
"familyName": "Bürgisser",
|
||||||
|
"gender": "male",
|
||||||
|
"honorificPrefix": "Prof. Dr.",
|
||||||
|
"name": "Peter Bürgisser"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"origin": {
|
"origin": {
|
||||||
"created": "2018-09-11T12:30:00Z",
|
"created": "2018-09-11T12:30:00Z",
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"fromField": "availabilityStarts",
|
"scope": "d",
|
||||||
"toField": "availabilityEnds",
|
"field": "availabilityRange",
|
||||||
"time": "2018-01-15T04:13:00+00:00"
|
"time": "2018-01-15T04:13:00+00:00"
|
||||||
},
|
},
|
||||||
"type": "availability"
|
"type": "availability"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"categories": [
|
"categories": [
|
||||||
"unipedia"
|
"unipedia"
|
||||||
],
|
],
|
||||||
"url": "https://www.mydesk.tu-berlin.de/wiki/abk%C3%BCrzungen",
|
"sameAs": "https://www.mydesk.tu-berlin.de/wiki/abk%C3%BCrzungen",
|
||||||
"name": "Abkürzungen",
|
"name": "Abkürzungen",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Abkürzungen",
|
"Abkürzungen",
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
"categories": [
|
"categories": [
|
||||||
"unipedia"
|
"unipedia"
|
||||||
],
|
],
|
||||||
"url": "https://www.mydesk.tu-berlin.de/wiki/ag_ziethen",
|
"sameAs": "https://www.mydesk.tu-berlin.de/wiki/ag_ziethen",
|
||||||
"name": "AG Ziethen",
|
"name": "AG Ziethen",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Bologna",
|
"Bologna",
|
||||||
36
test/resources/indexable/Article.3.json
Normal file
36
test/resources/indexable/Article.3.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"errorNames": [],
|
||||||
|
"instance": {
|
||||||
|
"type": "article",
|
||||||
|
"uid": "d541eda5-1542-59b2-969e-7dbbee0bd2a8",
|
||||||
|
"name": "Mozart und Frankfurt am Main : drei Generationen Mozart in Frankfurt am Main",
|
||||||
|
"description": "Ill.",
|
||||||
|
"categories": [
|
||||||
|
"article"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"type": "person",
|
||||||
|
"uid": "56d46c9b-8ede-52ae-a40f-6800cff577e5",
|
||||||
|
"name": "Greve, Clemens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"firstPublished": "2008",
|
||||||
|
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB198305427",
|
||||||
|
"origin": {
|
||||||
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
"name": "HeBIS HDS",
|
||||||
|
"originalId": "HEB198305427",
|
||||||
|
"type": "remote",
|
||||||
|
"url": "https://hds2test.hebis.de/ubffm/"
|
||||||
|
},
|
||||||
|
"isPartOf": {
|
||||||
|
"uid": "bc5e5399-a24c-5c01-9c1b-0c8b83272087",
|
||||||
|
"name": "Archiv für Frankfurts Geschichte und Kunst",
|
||||||
|
"type": "periodical",
|
||||||
|
"categories": []
|
||||||
|
},
|
||||||
|
"reference": "Band 71 (2008), Seite 27-40"
|
||||||
|
},
|
||||||
|
"schema": "SCArticle"
|
||||||
|
}
|
||||||
36
test/resources/indexable/Article.4.json
Normal file
36
test/resources/indexable/Article.4.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"errorNames": [],
|
||||||
|
"instance": {
|
||||||
|
"type": "article",
|
||||||
|
"uid": "554a4a89-df73-5197-ac85-c8a5a3a9c5b0",
|
||||||
|
"name": "Ursula Janik : [Markthändlerin]",
|
||||||
|
"description": "Ill.",
|
||||||
|
"categories": [
|
||||||
|
"article"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"type": "person",
|
||||||
|
"uid": "c6e44e1f-f76c-53f8-a18f-47fa54ae0e90",
|
||||||
|
"name": "Fröhlich, Ute B."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"firstPublished": "2002",
|
||||||
|
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB107025590",
|
||||||
|
"origin": {
|
||||||
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
"name": "HeBIS HDS",
|
||||||
|
"originalId": "HEB107025590",
|
||||||
|
"type": "remote",
|
||||||
|
"url": "https://hds2test.hebis.de/ubffm/"
|
||||||
|
},
|
||||||
|
"isPartOf": {
|
||||||
|
"uid": "f84c1851-042e-542f-ba7a-158b32dfb82f",
|
||||||
|
"name": "Frankfurter Allgemeine. R, Rhein-Main-Zeitung",
|
||||||
|
"type": "periodical",
|
||||||
|
"categories": []
|
||||||
|
},
|
||||||
|
"reference": "Heft 190 (17. 8 2002), Seite 62"
|
||||||
|
},
|
||||||
|
"schema": "SCArticle"
|
||||||
|
}
|
||||||
@@ -21,15 +21,15 @@
|
|||||||
"name": "Symposion Publishing"
|
"name": "Symposion Publishing"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"inLanguages": [
|
"inLanguage": "de",
|
||||||
{
|
"edition": "2., überarb. u. erw. Aufl.",
|
||||||
"name": "german",
|
"ISBNs": [
|
||||||
"code": "de"
|
"3936608776"
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"bookEdition": "2., überarb. u. erw. Aufl.",
|
|
||||||
"isbn": "3936608776",
|
|
||||||
"numberOfPages": 537,
|
"numberOfPages": 537,
|
||||||
|
"categories": [
|
||||||
|
"book"
|
||||||
|
],
|
||||||
"origin": {
|
"origin": {
|
||||||
"indexed": "2018-09-11T12:30:00Z",
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
"name": "Dummy",
|
"name": "Dummy",
|
||||||
@@ -4,6 +4,9 @@
|
|||||||
"type": "book",
|
"type": "book",
|
||||||
"uid": "db47f7f4-7699-5a37-afcc-24beaa998d36",
|
"uid": "db47f7f4-7699-5a37-afcc-24beaa998d36",
|
||||||
"name": "Minimal Book",
|
"name": "Minimal Book",
|
||||||
|
"categories": [
|
||||||
|
"ebook"
|
||||||
|
],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"type": "person",
|
"type": "person",
|
||||||
@@ -14,7 +17,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"datePublished": "2007-08-01",
|
"datePublished": "2007-08-01",
|
||||||
"isbn": "3936608776",
|
"ISBNs": [
|
||||||
|
"3936608776"
|
||||||
|
],
|
||||||
"origin": {
|
"origin": {
|
||||||
"indexed": "2018-09-11T12:30:00Z",
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
"name": "Dummy",
|
"name": "Dummy",
|
||||||
40
test/resources/indexable/Book.3.json
Normal file
40
test/resources/indexable/Book.3.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"errorNames": [],
|
||||||
|
"instance": {
|
||||||
|
"type": "book",
|
||||||
|
"uid": "188cb2bd-724d-543d-97ac-9aa1dda68cb7",
|
||||||
|
"name": "Frauen im Ingenieurberuf : FIB ; 1. Gesamtdeutsches Symposium VDI-FIB 17. - 18. November 1990, Bad Homburg ; 1. überregionales Treffen VDI-FIB 11. - 12. November 1989, Düsseldorf",
|
||||||
|
"description": "47 S. : Ill., Kt.",
|
||||||
|
"categories": [
|
||||||
|
"book"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"uid": "a276588c-ecee-5d2e-8b9c-73cb902bc165",
|
||||||
|
"name": "Saatweber, Jutta (Hrsg.)",
|
||||||
|
"type": "person"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"firstPublished": "[ca. 1991]",
|
||||||
|
"publications": [
|
||||||
|
{
|
||||||
|
"uid": "603a6574-8910-588a-9e83-cd26e6988c74",
|
||||||
|
"type": "publication event",
|
||||||
|
"locations": [
|
||||||
|
"Frankfurt/M"
|
||||||
|
],
|
||||||
|
"publisher": "VDI",
|
||||||
|
"name": "VDI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB022992618",
|
||||||
|
"origin": {
|
||||||
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
"name": "HeBIS HDS",
|
||||||
|
"originalId": "HEB022992618",
|
||||||
|
"type": "remote",
|
||||||
|
"url": "https://hds2test.hebis.de/ubffm/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": "SCBook"
|
||||||
|
}
|
||||||
43
test/resources/indexable/Book.4.json
Normal file
43
test/resources/indexable/Book.4.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"errorNames": [],
|
||||||
|
"instance": {
|
||||||
|
"type": "book",
|
||||||
|
"uid": "f6ee5744-a441-595d-9dae-a9f579c0660f",
|
||||||
|
"name": "Kant",
|
||||||
|
"description": "176 S.",
|
||||||
|
"categories": [
|
||||||
|
"book"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"uid": "7e198ecf-966a-5f99-8a45-266243583023",
|
||||||
|
"name": "Thouard, Denis",
|
||||||
|
"type": "person"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"firstPublished": "2001",
|
||||||
|
"publications": [
|
||||||
|
{
|
||||||
|
"uid": "603a6574-8910-588a-9e83-cd26e6988c74",
|
||||||
|
"type": "publication event",
|
||||||
|
"locations": [
|
||||||
|
"Paris"
|
||||||
|
],
|
||||||
|
"publisher": "Belles Lettres",
|
||||||
|
"name": "Belles Lettres"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB102248788",
|
||||||
|
"ISBNs": [
|
||||||
|
"2251760385"
|
||||||
|
],
|
||||||
|
"origin": {
|
||||||
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
"name": "HeBIS HDS",
|
||||||
|
"originalId": "HEB102248788",
|
||||||
|
"type": "remote",
|
||||||
|
"url": "https://hds2test.hebis.de/ubffm/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": "SCBook"
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"frequency": "once",
|
"repeatFrequency": "P1W",
|
||||||
"dates": [
|
"dates": [
|
||||||
"2016-04-15T17:00:00+00:00"
|
"2016-04-15T17:00:00+00:00"
|
||||||
],
|
],
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
"name": "EMH 225",
|
"name": "EMH 225",
|
||||||
"floorName": "2"
|
"floorName": "2"
|
||||||
},
|
},
|
||||||
"frequency": "once",
|
|
||||||
"dates": [
|
"dates": [
|
||||||
"2016-04-12T11:00:00+00:00"
|
"2016-04-12T11:00:00+00:00"
|
||||||
],
|
],
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
"name": "EMH 225",
|
"name": "EMH 225",
|
||||||
"floorName": "2"
|
"floorName": "2"
|
||||||
},
|
},
|
||||||
"frequency": "once",
|
|
||||||
"dates": [
|
"dates": [
|
||||||
"2016-04-12T11:00:00+00:00"
|
"2016-04-12T11:00:00+00:00"
|
||||||
],
|
],
|
||||||
@@ -43,8 +42,10 @@
|
|||||||
"offers": [
|
"offers": [
|
||||||
{
|
{
|
||||||
"availability": "in stock",
|
"availability": "in stock",
|
||||||
"availabilityStarts": "2017-01-30T00:00:00.000Z",
|
"availabilityRange": {
|
||||||
"availabilityEnds": "2017-01-30T23:59:59.999Z",
|
"gte": "2017-01-30T00:00:00.000Z",
|
||||||
|
"lte": "2017-01-30T23:59:59.999Z"
|
||||||
|
},
|
||||||
"prices": {
|
"prices": {
|
||||||
"default": 6.5,
|
"default": 6.5,
|
||||||
"student": 5,
|
"student": 5,
|
||||||
@@ -19,8 +19,10 @@
|
|||||||
"offers": [
|
"offers": [
|
||||||
{
|
{
|
||||||
"availability": "in stock",
|
"availability": "in stock",
|
||||||
"availabilityStarts": "2017-01-30T00:00:00.000Z",
|
"availabilityRange": {
|
||||||
"availabilityEnds": "2017-01-30T23:59:59.999Z",
|
"gte": "2017-01-30T00:00:00.000Z",
|
||||||
|
"lte": "2017-01-30T23:59:59.999Z"
|
||||||
|
},
|
||||||
"prices": {
|
"prices": {
|
||||||
"default": 4.85,
|
"default": 4.85,
|
||||||
"student": 2.85,
|
"student": 2.85,
|
||||||
@@ -20,8 +20,10 @@
|
|||||||
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
|
"uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634"
|
||||||
},
|
},
|
||||||
"availability": "in stock",
|
"availability": "in stock",
|
||||||
"availabilityStarts": "2017-01-30T00:00:00.000Z",
|
"availabilityRange": {
|
||||||
"availabilityEnds": "2017-01-30T23:59:59.999Z",
|
"gte": "2017-01-30T00:00:00.000Z",
|
||||||
|
"lte": "2017-01-30T23:59:59.999Z"
|
||||||
|
},
|
||||||
"inPlace": {
|
"inPlace": {
|
||||||
"geo": {
|
"geo": {
|
||||||
"point": {
|
"point": {
|
||||||
@@ -11,9 +11,11 @@
|
|||||||
],
|
],
|
||||||
"offers": [
|
"offers": [
|
||||||
{
|
{
|
||||||
"availabilityEnds": "2017-03-27T23:59:59.000Z",
|
|
||||||
"availabilityStarts": "2017-03-27T00:00:00.000Z",
|
|
||||||
"availability": "in stock",
|
"availability": "in stock",
|
||||||
|
"availabilityRange": {
|
||||||
|
"gte": "2017-03-27T00:00:00.000Z",
|
||||||
|
"lte": "2017-03-27T23:59:59.000Z"
|
||||||
|
},
|
||||||
"inPlace": {
|
"inPlace": {
|
||||||
"type": "room",
|
"type": "room",
|
||||||
"name": "Cafeteria LEVEL",
|
"name": "Cafeteria LEVEL",
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
"audiences": [
|
"audiences": [
|
||||||
"students"
|
"students"
|
||||||
],
|
],
|
||||||
|
"categories": [
|
||||||
|
"news"
|
||||||
|
],
|
||||||
"sequenceIndex": 1001,
|
"sequenceIndex": 1001,
|
||||||
"origin": {
|
"origin": {
|
||||||
"indexed": "2018-09-11T12:30:00Z",
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
@@ -11,6 +11,9 @@
|
|||||||
"audiences": [
|
"audiences": [
|
||||||
"students"
|
"students"
|
||||||
],
|
],
|
||||||
|
"categories": [
|
||||||
|
"news"
|
||||||
|
],
|
||||||
"sequenceIndex": 1004,
|
"sequenceIndex": 1004,
|
||||||
"origin": {
|
"origin": {
|
||||||
"indexed": "2018-09-11T12:30:00Z",
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
35
test/resources/indexable/Periodical.1.json
Normal file
35
test/resources/indexable/Periodical.1.json
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"errorNames": [],
|
||||||
|
"instance": {
|
||||||
|
"type": "periodical",
|
||||||
|
"uid": "d921479e-4d35-5cd1-b64a-939cbe40a5b0",
|
||||||
|
"name": "London magazine : a review of literature and the arts",
|
||||||
|
"categories": [
|
||||||
|
"journal"
|
||||||
|
],
|
||||||
|
"firstPublished": "1954",
|
||||||
|
"publications": [
|
||||||
|
{
|
||||||
|
"uid": "603a6574-8910-588a-9e83-cd26e6988c74",
|
||||||
|
"type": "publication event",
|
||||||
|
"locations": [
|
||||||
|
"London"
|
||||||
|
],
|
||||||
|
"publisher": "London Magazine",
|
||||||
|
"name": "London Magazine"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ISSNs": [
|
||||||
|
"0024-6085"
|
||||||
|
],
|
||||||
|
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB046847146",
|
||||||
|
"origin": {
|
||||||
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
"name": "HeBIS HDS",
|
||||||
|
"originalId": "HEB046847146",
|
||||||
|
"type": "remote",
|
||||||
|
"url": "https://hds2test.hebis.de/ubffm/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": "SCPeriodical"
|
||||||
|
}
|
||||||
32
test/resources/indexable/Periodical.2.json
Normal file
32
test/resources/indexable/Periodical.2.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"errorNames": [],
|
||||||
|
"instance": {
|
||||||
|
"type": "periodical",
|
||||||
|
"uid": "c8d7a4f7-88ac-5da3-86c7-32b93d16f00a",
|
||||||
|
"name": "[Frankfurter Allgemeine \/ R F A Z FAZ Republik Heroes], Frankfurter Allgemeine : Zeitung für Deutschland, R. Rhein-Main-Zeitung : Zeitung für Frankfurt",
|
||||||
|
"categories": [
|
||||||
|
"journal"
|
||||||
|
],
|
||||||
|
"firstPublished": "1988",
|
||||||
|
"publications": [
|
||||||
|
{
|
||||||
|
"uid": "64829217-9eea-532f-8730-7e609efffbca",
|
||||||
|
"type": "publication event",
|
||||||
|
"locations": [
|
||||||
|
"Frankfurt, M."
|
||||||
|
],
|
||||||
|
"publisher": "Frankfurter Allg. Zeitung",
|
||||||
|
"name": "Frankfurter Allg. Zeitung"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sameAs": "https://hds2test.hebis.de/ubffm/Record/HEB048624853",
|
||||||
|
"origin": {
|
||||||
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
|
"name": "HeBIS HDS",
|
||||||
|
"originalId": "HEB048624853",
|
||||||
|
"type": "remote",
|
||||||
|
"url": "https://hds2test.hebis.de/ubffm/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": "SCPeriodical"
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"instance": {
|
"instance": {
|
||||||
"type": "video",
|
"type": "video",
|
||||||
"uid": "e274cc82-f51c-566b-b8da-85763ff375e8",
|
"uid": "e274cc82-f51c-566b-b8da-85763ff375e8",
|
||||||
"url": "https://vimeo.com/1084537",
|
"sameAs": "https://vimeo.com/1084537",
|
||||||
"name": "Big Buck Bunny",
|
"name": "Big Buck Bunny",
|
||||||
"origin": {
|
"origin": {
|
||||||
"indexed": "2018-09-11T12:30:00Z",
|
"indexed": "2018-09-11T12:30:00Z",
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"instance": {
|
"instance": {
|
||||||
"type": "video",
|
"type": "video",
|
||||||
"uid": "2def52c8-f901-5b30-96fc-ba570a038508",
|
"uid": "2def52c8-f901-5b30-96fc-ba570a038508",
|
||||||
"url": "https://vimeo.com/1084537",
|
"sameAs": "https://vimeo.com/1084537",
|
||||||
"name": "Big Buck Bunny",
|
"name": "Big Buck Bunny",
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
@@ -12,21 +12,55 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {getProjectReflection} from '@openstapps/core-tools/lib/common';
|
import {getTsconfigPath} from '@openstapps/core-tools/lib/common';
|
||||||
import {validateFiles, writeReport} from '@openstapps/core-tools/lib/validate';
|
import {validateFiles, writeReport} from '@openstapps/core-tools/lib/validate';
|
||||||
import {Logger} from '@openstapps/logger';
|
import {Logger} from '@openstapps/logger';
|
||||||
import {fail} from 'assert';
|
import {fail} from 'assert';
|
||||||
import {expect} from 'chai';
|
import {expect} from 'chai';
|
||||||
import {mkdirSync} from 'fs';
|
import {mkdirSync, PathLike} from 'fs';
|
||||||
import {slow, suite, test, timeout} from '@testdeck/mocha';
|
import {slow, suite, test, timeout} from '@testdeck/mocha';
|
||||||
import {join, resolve} from 'path';
|
import {join, resolve} from 'path';
|
||||||
import {DeclarationReflection, ProjectReflection} from 'typedoc';
|
import {Application, DeclarationReflection, ProjectReflection, TSConfigReader} from 'typedoc';
|
||||||
import {ArrayType, IntrinsicType, ReferenceType, StringLiteralType, Type, UnionType} from 'typedoc/dist/lib/models';
|
import {ArrayType, IntrinsicType, ReferenceType, LiteralType, Type, UnionType} from 'typedoc/dist/lib/models';
|
||||||
|
|
||||||
process.on('unhandledRejection', (err) => {
|
process.on('unhandledRejection', (err) => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a project reflection from a path
|
||||||
|
*
|
||||||
|
* @param srcPath Path to get reflection from
|
||||||
|
* @param excludeExternals Exclude external dependencies
|
||||||
|
*/
|
||||||
|
export function getProjectReflection(srcPath: PathLike, excludeExternals = true): ProjectReflection {
|
||||||
|
Logger.info(`Generating project reflection for ${srcPath.toString()}.`);
|
||||||
|
|
||||||
|
const tsconfigPath = getTsconfigPath(srcPath.toString());
|
||||||
|
let inputFilePath = srcPath;
|
||||||
|
if (inputFilePath === tsconfigPath) {
|
||||||
|
inputFilePath = join(tsconfigPath, 'src');
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialize new Typedoc application
|
||||||
|
const app = new Application();
|
||||||
|
app.options.addReader(new TSConfigReader());
|
||||||
|
app.bootstrap({
|
||||||
|
entryPoints: [inputFilePath.toString()],
|
||||||
|
excludeExternals: excludeExternals,
|
||||||
|
tsconfig: join(tsconfigPath, 'tsconfig.json'),
|
||||||
|
});
|
||||||
|
|
||||||
|
// get project reflection from input files
|
||||||
|
const result = app.convert();
|
||||||
|
|
||||||
|
if (typeof result === 'undefined') {
|
||||||
|
throw new Error('Project reflection could not be generated.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if type is a union type
|
* Check if type is a union type
|
||||||
*
|
*
|
||||||
@@ -68,8 +102,8 @@ function isIntrinsicType(type: Type): type is IntrinsicType {
|
|||||||
*
|
*
|
||||||
* @param type Type to check
|
* @param type Type to check
|
||||||
*/
|
*/
|
||||||
function isStringLiteralType(type: Type): type is StringLiteralType {
|
function isLiteralType(type: Type): type is LiteralType {
|
||||||
return type.type === 'stringLiteral';
|
return type.type === 'literal';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +136,7 @@ function getExtendedTypes(thingReflection: DeclarationReflection,
|
|||||||
return extendedTypes;
|
return extendedTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@suite(timeout(10000), slow(5000))
|
@suite(timeout(15000), slow(10000))
|
||||||
export class SchemaSpec {
|
export class SchemaSpec {
|
||||||
static objects: { [name: string]: DeclarationReflection } = {};
|
static objects: { [name: string]: DeclarationReflection } = {};
|
||||||
static reflection: ProjectReflection;
|
static reflection: ProjectReflection;
|
||||||
@@ -121,7 +155,7 @@ export class SchemaSpec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const thingsReflection = SchemaSpec.objects.SCThingsWithoutDiff;
|
const thingsReflection = SchemaSpec.objects.SCIndexableThings;
|
||||||
|
|
||||||
// tslint:disable-next-line:no-unused-expression
|
// tslint:disable-next-line:no-unused-expression
|
||||||
expect(thingsReflection).not.to.be.undefined;
|
expect(thingsReflection).not.to.be.undefined;
|
||||||
@@ -182,6 +216,22 @@ export class SchemaSpec {
|
|||||||
|
|
||||||
@test
|
@test
|
||||||
'no property is an SCThing'() {
|
'no property is an SCThing'() {
|
||||||
|
const handleUnionType = (type: UnionType, thingName: string, property: DeclarationReflection) => {
|
||||||
|
for (const nestedType of type.types) {
|
||||||
|
if (isIntrinsicType(nestedType) || isLiteralType(nestedType)) {
|
||||||
|
continue;
|
||||||
|
} else if (isReferenceType(nestedType)) {
|
||||||
|
expect(SchemaSpec.thingNames).not.to.contain(
|
||||||
|
nestedType.name,
|
||||||
|
`Union property '${property.name}' on type '${thingName}' contains type '${nestedType.name}'.`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// tslint:disable-next-line:max-line-length
|
||||||
|
fail(`'${thingName}'#'${property.name}' union type '${nestedType.type}' is not handled by this test!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
for (const thingName of SchemaSpec.thingNames) {
|
for (const thingName of SchemaSpec.thingNames) {
|
||||||
const thingReflection = SchemaSpec.objects[`${thingName}`];
|
const thingReflection = SchemaSpec.objects[`${thingName}`];
|
||||||
|
|
||||||
@@ -199,8 +249,10 @@ export class SchemaSpec {
|
|||||||
} else if (isArrayType(type)) {
|
} else if (isArrayType(type)) {
|
||||||
const elementType = type.elementType;
|
const elementType = type.elementType;
|
||||||
|
|
||||||
if (isIntrinsicType(elementType)) {
|
if (isIntrinsicType(elementType) || isLiteralType(elementType)) {
|
||||||
continue;
|
continue;
|
||||||
|
} else if (isUnionType(elementType)) {
|
||||||
|
handleUnionType(elementType, thingName, property);
|
||||||
} else if (isReferenceType(elementType)) {
|
} else if (isReferenceType(elementType)) {
|
||||||
expect(SchemaSpec.thingNames).not.to.contain(
|
expect(SchemaSpec.thingNames).not.to.contain(
|
||||||
elementType.name,
|
elementType.name,
|
||||||
@@ -230,19 +282,7 @@ export class SchemaSpec {
|
|||||||
}
|
}
|
||||||
} while (isReferenceType(type));
|
} while (isReferenceType(type));
|
||||||
} else if (isUnionType(type)) {
|
} else if (isUnionType(type)) {
|
||||||
for (const nestedType of type.types) {
|
handleUnionType(type, thingName, property);
|
||||||
if (isIntrinsicType(nestedType) || isStringLiteralType(nestedType)) {
|
|
||||||
continue;
|
|
||||||
} else if (isReferenceType(nestedType)) {
|
|
||||||
expect(SchemaSpec.thingNames).not.to.contain(
|
|
||||||
nestedType.name,
|
|
||||||
`Union property '${property.name}' on type '${thingName}' contains type '${nestedType.name}'.`,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// tslint:disable-next-line:max-line-length
|
|
||||||
fail(`'${thingName}'#'${property.name}' union type '${nestedType.type}' is not handled by this test!`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
fail(`'${thingName}'#'${property.name}' with type '${type.type}' is not handled by this test!`);
|
fail(`'${thingName}'#'${property.name}' with type '${type.type}' is not handled by this test!`);
|
||||||
@@ -278,7 +318,10 @@ export class SchemaSpec {
|
|||||||
|
|
||||||
@test
|
@test
|
||||||
async 'validate against test files'() {
|
async 'validate against test files'() {
|
||||||
const errorsPerFile = await validateFiles(resolve('lib', 'schema'), resolve('test', 'resources'));
|
const errorsPerFile = {
|
||||||
|
...await validateFiles(resolve('lib', 'schema'), resolve('test', 'resources')),
|
||||||
|
...await validateFiles(resolve('lib', 'schema'), resolve('test', 'resources', 'indexable')),
|
||||||
|
};
|
||||||
|
|
||||||
let unexpected = false;
|
let unexpected = false;
|
||||||
Object.keys(errorsPerFile).forEach((file) => {
|
Object.keys(errorsPerFile).forEach((file) => {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
import {expect} from 'chai';
|
import {expect} from 'chai';
|
||||||
import clone = require('fast-clone');
|
import clone = require('fast-clone');
|
||||||
import {slow, suite, test, timeout} from '@testdeck/mocha';
|
import {slow, suite, test, timeout} from '@testdeck/mocha';
|
||||||
import {SCThingOriginType, SCThingType} from '../src/things/abstract/thing';
|
import {SCThingOriginType, SCThingType, SCThingRemoteOrigin} from '../src/things/abstract/thing';
|
||||||
import {SCBuildingWithoutReferences} from '../src/things/building';
|
import {SCBuildingWithoutReferences} from '../src/things/building';
|
||||||
import {SCDish, SCDishMeta} from '../src/things/dish';
|
import {SCDish, SCDishMeta} from '../src/things/dish';
|
||||||
import {SCSetting, SCSettingInputType} from '../src/things/setting';
|
import {SCSetting, SCSettingInputType} from '../src/things/setting';
|
||||||
@@ -105,142 +105,182 @@ const setting: SCSetting = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const translator = new SCThingTranslator('de');
|
const translator = new SCThingTranslator('de');
|
||||||
// tslint:disable-next-line:no-eval
|
const translatorEN = new SCThingTranslator('en');
|
||||||
const languageNonExistant = eval("'jp'");
|
|
||||||
// this will simulate a translator always utilizing the base language translations
|
// this will simulate a translator always utilizing the base language translations
|
||||||
const translatorWithFallback = new SCThingTranslator(languageNonExistant);
|
const translatorWithFallback = new SCThingTranslator('tt');
|
||||||
|
|
||||||
|
const translatedThingDE = translator.translate(dish);
|
||||||
|
const translatedThingFallback = translatorWithFallback.translate(dish);
|
||||||
|
|
||||||
// tslint:disable:max-line-length member-ordering newline-per-chained-call prefer-function-over-method completed-docs TranslationSpecInplace
|
// tslint:disable:max-line-length member-ordering newline-per-chained-call prefer-function-over-method completed-docs TranslationSpecInplace
|
||||||
@suite(timeout(10000), slow(5000))
|
@suite(timeout(10000), slow(5000))
|
||||||
export class TranslationSpecInplace {
|
export class TranslationSpecInplace {
|
||||||
@test
|
@test
|
||||||
public directEnumSingleValue () {
|
public directEnumSingleValue() {
|
||||||
expect(translator.translate(setting).inputType()).to.equal('einfache Auswahl');
|
expect(translator.translatedAccess(setting).inputType()).to.equal('einfache Auswahl');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directStringLiteralType() {
|
public directStringLiteralType() {
|
||||||
expect(translator.translate(dish).type()).to.equal('Essen');
|
expect(translator.translatedAccess(dish).type()).to.equal('Essen');
|
||||||
|
expect(translatedThingDE.type).to.equal('Essen');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directStringProperty() {
|
public directStringProperty() {
|
||||||
expect(translator.translate(dish).name()).to.equal('de-dish-name');
|
expect(translator.translatedAccess(dish).name()).to.equal('de-dish-name');
|
||||||
|
expect(translatedThingDE.name).to.equal('de-dish-name');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directArrayOfString() {
|
public directArrayOfString() {
|
||||||
expect(translator.translate(dish).characteristics()).to.deep
|
expect(translator.translatedAccess(dish).characteristics()).to.deep
|
||||||
.equal([{name: 'de-characteristic0'}, {name: 'de-characteristic1'}]);
|
.equal([{name: 'de-characteristic0'}, {name: 'de-characteristic1'}]);
|
||||||
|
expect(translatedThingDE.characteristics).to.deep
|
||||||
|
.equal([{name: 'de-characteristic0'}, {name: 'de-characteristic1'}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directArrayOfStringSubscript() {
|
public directArrayOfStringSubscript() {
|
||||||
expect(translator.translate(dish).characteristics[1]()).to.deep.equal({name: 'de-characteristic1'});
|
expect(translator.translatedAccess(dish).characteristics[1]()).to.deep.equal({name: 'de-characteristic1'});
|
||||||
|
expect(translatedThingDE.characteristics![1]).to.deep.equal({name: 'de-characteristic1'});
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directMetaArrayOfString() {
|
public directMetaArrayOfString() {
|
||||||
expect(translator.translate(dish).categories()).to.deep.equal(['Hauptgericht', 'Nachtisch']);
|
expect(translator.translatedAccess(dish).categories()).to.deep.equal(['Hauptgericht', 'Nachtisch']);
|
||||||
|
expect(translatedThingDE.categories).to.deep.equal(['Hauptgericht', 'Nachtisch']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directMetaArrayOfStringSubscript() {
|
public directMetaArrayOfStringSubscript() {
|
||||||
expect(translator.translate(dish).categories[1]()).to.equal('Nachtisch');
|
expect(translator.translatedAccess(dish).categories[1]()).to.equal('Nachtisch');
|
||||||
|
expect(translatedThingDE.categories[1]).to.equal('Nachtisch');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedStringLiteralType() {
|
public nestedStringLiteralType() {
|
||||||
expect(translator.translate(dish).offers[0].inPlace.type()).to.equal('Gebäude');
|
expect(translator.translatedAccess(dish).offers[0].inPlace.type()).to.equal('Gebäude');
|
||||||
|
expect(translatedThingDE.offers![0].inPlace!.type).to.equal('Gebäude');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedStringProperty() {
|
public nestedStringProperty() {
|
||||||
expect(translator.translate(dish).offers[0].inPlace.name()).to.equal('de-space-name');
|
expect(translator.translatedAccess(dish).offers[0].inPlace.name()).to.equal('de-space-name');
|
||||||
|
expect(translatedThingDE.offers![0].inPlace!.name).to.equal('de-space-name');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedMetaArrayOfString() {
|
public nestedMetaArrayOfString() {
|
||||||
expect(translator.translate(dish).offers[0].inPlace.categories()).to.deep.equal(['Büro', 'Bildung']);
|
expect(translator.translatedAccess(dish).offers[0].inPlace.categories()).to.deep.equal(['Büro', 'Bildung']);
|
||||||
|
expect(translatedThingDE.offers![0].inPlace!.categories).to.deep.equal(['Büro', 'Bildung']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedMetaArrayOfStringSubscript() {
|
public nestedMetaArrayOfStringSubscript() {
|
||||||
expect(translator.translate(dish).offers[0].inPlace.categories[1]()).to.equal('Bildung');
|
expect(translator.translatedAccess(dish).offers[0].inPlace.categories[1]()).to.equal('Bildung');
|
||||||
|
expect(translatedThingDE.offers![0].inPlace!.categories[1]).to.equal('Bildung');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directStringLiteralTypeFallback() {
|
public directStringLiteralTypeFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).type()).to.equal('dish');
|
expect(translatorWithFallback.translatedAccess(dish).type()).to.equal('dish');
|
||||||
|
expect(translatedThingFallback.type).to.equal('dish');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directStringPropertyFallback() {
|
public directStringPropertyFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).name()).to.equal('base-dish-name');
|
expect(translatorWithFallback.translatedAccess(dish).name()).to.equal('base-dish-name');
|
||||||
|
expect(translatedThingFallback.name).to.equal('base-dish-name');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directArrayOfStringSubscriptFallback() {
|
public directArrayOfStringSubscriptFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).characteristics[1]())
|
expect(translatorWithFallback.translatedAccess(dish).characteristics[1]())
|
||||||
|
.to.deep.equal({name: 'base-characteristic1'});
|
||||||
|
expect(translatedThingFallback.characteristics![1])
|
||||||
.to.deep.equal({name: 'base-characteristic1'});
|
.to.deep.equal({name: 'base-characteristic1'});
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directMetaArrayOfStringFallback() {
|
public directMetaArrayOfStringFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).categories()).to.deep.equal(['main dish', 'dessert']);
|
expect(translatorWithFallback.translatedAccess(dish).categories()).to.deep.equal(['main dish', 'dessert']);
|
||||||
|
expect(translatedThingFallback.categories).to.deep.equal(['main dish', 'dessert']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directMetaArrayOfStringSubscriptFallback() {
|
public directMetaArrayOfStringSubscriptFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).categories[1]()).to.equal('dessert');
|
expect(translatorWithFallback.translatedAccess(dish).categories[1]()).to.equal('dessert');
|
||||||
|
expect(translatedThingFallback.categories[1]).to.equal('dessert');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedStringLiteralTypeFallback() {
|
public nestedStringLiteralTypeFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).offers[0].inPlace.type()).to.equal('building');
|
expect(translatorWithFallback.translatedAccess(dish).offers[0].inPlace.type()).to.equal('building');
|
||||||
|
expect(translatedThingFallback.offers![0].inPlace!.type).to.equal('building');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedStringPropertyFallback() {
|
public nestedStringPropertyFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).offers[0].inPlace.name()).to.equal('base-space-name');
|
expect(translatorWithFallback.translatedAccess(dish).offers[0].inPlace.name()).to.equal('base-space-name');
|
||||||
|
expect(translatedThingFallback.offers![0].inPlace!.name).to.equal('base-space-name');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedMetaArrayOfStringFallback() {
|
public nestedMetaArrayOfStringFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).offers[0].inPlace.categories())
|
expect(translatorWithFallback.translatedAccess(dish).offers[0].inPlace.categories())
|
||||||
|
.to.deep.equal(['office', 'education']);
|
||||||
|
expect(translatedThingFallback.offers![0].inPlace!.categories)
|
||||||
.to.deep.equal(['office', 'education']);
|
.to.deep.equal(['office', 'education']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedMetaArrayOfStringSubscriptFallback() {
|
public nestedMetaArrayOfStringSubscriptFallback() {
|
||||||
expect(translatorWithFallback.translate(dish).offers[0].inPlace.categories[1]()).to.equal('education');
|
expect(translatorWithFallback.translatedAccess(dish).offers[0].inPlace.categories[1]()).to.equal('education');
|
||||||
|
expect(translatedThingFallback.offers![0].inPlace!.categories[1]).to.equal('education');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public directStringLiteralTypeUndefined() {
|
public directStringLiteralTypeUndefined() {
|
||||||
// tslint:disable-next-line:no-eval
|
// tslint:disable-next-line:no-eval
|
||||||
const undefinedThing = eval('(x) => undefined;');
|
const undefinedThing = eval('(x) => undefined;');
|
||||||
expect(translator.translate(undefinedThing())('defaultValue')).to.equal('defaultValue');
|
expect(translator.translatedAccess(undefinedThing())('defaultValue')).to.equal('defaultValue');
|
||||||
expect(translator.translate(dish).name('defaultValue')).to.not.equal('defaultValue');
|
expect(translator.translatedAccess(dish).name('defaultValue')).to.not.equal('defaultValue');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public nestedMetaArrayOfStringSubscriptUndefined() {
|
public nestedMetaArrayOfStringSubscriptUndefined() {
|
||||||
// tslint:disable-next-line: no-eval
|
// tslint:disable-next-line: no-eval
|
||||||
const workingTranslation = eval('translator.translate(dish).offers[0].inPlace.categories[1](\'printer\');');
|
const workingTranslation = eval('translator.translatedAccess(dish).offers[0].inPlace.categories[1](\'printer\');');
|
||||||
// tslint:disable-next-line: no-eval
|
// tslint:disable-next-line: no-eval
|
||||||
const defaultValueTranslation = eval('translator.translate(dish).offers[0].inPlace.categories[1234](\'printer\');');
|
const defaultValueTranslation = eval('translator.translatedAccess(dish).offers[0].inPlace.categories[1234](\'printer\');');
|
||||||
|
|
||||||
expect(defaultValueTranslation).to.equal('printer');
|
expect(defaultValueTranslation).to.equal('printer');
|
||||||
expect(workingTranslation).to.not.equal('printer');
|
expect(workingTranslation).to.not.equal('printer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test
|
||||||
|
public reaccessWithChangedSourceOmitsLRUCache() {
|
||||||
|
const translatorDE = new SCThingTranslator('de');
|
||||||
|
const dishCopy = clone(dish);
|
||||||
|
const translatedDish = translatorDE.translatedAccess(dish);
|
||||||
|
const distructivelyTranslatedDish = translatorDE.translate(dish);
|
||||||
|
|
||||||
|
(dishCopy.origin as SCThingRemoteOrigin).name = 'tranlator.spec';
|
||||||
|
expect(translatorDE.translatedAccess(dishCopy)).not.to.deep.equal(translatedDish);
|
||||||
|
expect(translatorDE.translate(dishCopy)).not.to.equal(distructivelyTranslatedDish);
|
||||||
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public changingTranslatorLanguageFlushesItsLRUCache() {
|
public changingTranslatorLanguageFlushesItsLRUCache() {
|
||||||
const translatorDE = new SCThingTranslator('de');
|
const translatorDE = new SCThingTranslator('de');
|
||||||
expect(translatorDE.translate(dish).name()).to.equal('de-dish-name');
|
expect(translatorDE.translatedAccess(dish).name()).to.equal('de-dish-name');
|
||||||
|
expect(translatorDE.translate(dish).name).to.equal('de-dish-name');
|
||||||
translatorDE.language = 'en';
|
translatorDE.language = 'en';
|
||||||
expect(translatorDE.translate(dish).name()).to.equal('base-dish-name');
|
expect(translatorDE.translatedAccess(dish).name()).to.equal('base-dish-name');
|
||||||
|
expect(translatorDE.translate(dish).name).to.equal('base-dish-name');
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
@@ -250,7 +290,7 @@ export class TranslationSpecInplace {
|
|||||||
for (let i = 0; i < 201; i++) {
|
for (let i = 0; i < 201; i++) {
|
||||||
const anotherDish = Object.assign({}, dish);
|
const anotherDish = Object.assign({}, dish);
|
||||||
anotherDish.uid = String(i);
|
anotherDish.uid = String(i);
|
||||||
expect(translatorDE.translate(anotherDish).name()).to.equal('de-dish-name');
|
expect(translatorDE.translatedAccess(anotherDish).name()).to.equal('de-dish-name');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -262,7 +302,7 @@ export class MetaTranslationSpec {
|
|||||||
@test
|
@test
|
||||||
public consistencyWithMetaClass() {
|
public consistencyWithMetaClass() {
|
||||||
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish.type);
|
const dishMetaTranslationsDE = translator.translatedPropertyNames(dish.type);
|
||||||
const dishMetaTranslationsEN = translator.translatedPropertyNames(dish.type, 'en');
|
const dishMetaTranslationsEN = translatorEN.translatedPropertyNames(dish.type);
|
||||||
expect(dishMetaTranslationsEN).to.not.deep.equal(dishMetaTranslationsDE);
|
expect(dishMetaTranslationsEN).to.not.deep.equal(dishMetaTranslationsDE);
|
||||||
expect(dishMetaTranslationsDE).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.de);
|
expect(dishMetaTranslationsDE).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.de);
|
||||||
expect(dishMetaTranslationsEN).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.en);
|
expect(dishMetaTranslationsEN).to.deep.equal(SCDishMeta.getInstance().fieldTranslations.en);
|
||||||
@@ -271,17 +311,17 @@ export class MetaTranslationSpec {
|
|||||||
@test
|
@test
|
||||||
public retrieveTranslatedPropertyValueType() {
|
public retrieveTranslatedPropertyValueType() {
|
||||||
const dishTypeDE = translator.translatedPropertyValue(dish.type, 'type');
|
const dishTypeDE = translator.translatedPropertyValue(dish.type, 'type');
|
||||||
const dishTypeEN = translator.translatedPropertyValue(dish.type, 'type', undefined, 'en');
|
const dishTypeEN = translatorEN.translatedPropertyValue(dish.type, 'type', undefined);
|
||||||
const dishTypeBASE = translatorWithFallback.translatedPropertyValue(dish.type, 'type');
|
const dishTypeBASE = translatorWithFallback.translatedPropertyValue(dish.type, 'type');
|
||||||
expect(dishTypeDE).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.de.type);
|
expect(dishTypeDE).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.de.type);
|
||||||
expect(dishTypeEN).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.en.type);
|
expect(dishTypeEN).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.en.type);
|
||||||
expect(dishTypeBASE).to.be.undefined;
|
expect(dishTypeBASE).to.deep.equal(SCDishMeta.getInstance().fieldValueTranslations.en.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
public retrieveTranslatedPropertyValueNested() {
|
public retrieveTranslatedPropertyValueNested() {
|
||||||
const dishTypeDE = translator.translatedPropertyValue<SCDish>(dish.type, 'categories', 'main dish');
|
const dishTypeDE = translator.translatedPropertyValue(dish.type, 'categories', 'main dish');
|
||||||
const dishTypeEN = translator.translatedPropertyValue<SCDish>(dish.type, 'categories', 'main dish', 'en');
|
const dishTypeEN = translatorEN.translatedPropertyValue(dish.type, 'categories', 'main dish');
|
||||||
const dishTypeBASE = translatorWithFallback.translatedPropertyValue(dish.type, 'categories', 'main dish');
|
const dishTypeBASE = translatorWithFallback.translatedPropertyValue(dish.type, 'categories', 'main dish');
|
||||||
expect(dishTypeDE).to.deep.equal(SCDishMeta.getInstance<SCDishMeta>().fieldValueTranslations.de.categories['main dish']);
|
expect(dishTypeDE).to.deep.equal(SCDishMeta.getInstance<SCDishMeta>().fieldValueTranslations.de.categories['main dish']);
|
||||||
expect(dishTypeEN).to.deep.equal(dish.categories[0]);
|
expect(dishTypeEN).to.deep.equal(dish.categories[0]);
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ import {SCTicket, SCTicketWithoutReferences} from '../src/things/ticket';
|
|||||||
import {SCToDo, SCToDoWithoutReferences} from '../src/things/todo';
|
import {SCToDo, SCToDoWithoutReferences} from '../src/things/todo';
|
||||||
import {SCTour, SCTourWithoutReferences} from '../src/things/tour';
|
import {SCTour, SCTourWithoutReferences} from '../src/things/tour';
|
||||||
import {SCVideo, SCVideoWithoutReferences} from '../src/things/video';
|
import {SCVideo, SCVideoWithoutReferences} from '../src/things/video';
|
||||||
|
import {SCPeriodical, SCPeriodicalWithoutReferences} from '../src/things/periodical';
|
||||||
|
import {SCPublicationEvent, SCPublicationEventWithoutReferences} from '../src/things/publication-event';
|
||||||
|
|
||||||
// tslint:disable:no-any
|
// tslint:disable:no-any
|
||||||
// tslint:disable:completed-docs
|
// tslint:disable:completed-docs
|
||||||
@@ -226,6 +228,17 @@ assert<Has<SCOrganizationPropertyTypes, SCThing>>(false);
|
|||||||
assert<Extends<SCOrganizationWithoutReferences, SCThing>>(false);
|
assert<Extends<SCOrganizationWithoutReferences, SCThing>>(false);
|
||||||
assert<Extends<SCOrganization, SCThing>>(true);
|
assert<Extends<SCOrganization, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCPeriodical
|
||||||
|
*/
|
||||||
|
type SCPeriodicalPropertyTypes = PropertyTypesNested<SCPeriodical>;
|
||||||
|
assert<NotHas<SCPeriodicalPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCPeriodicalPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCPeriodicalPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCPeriodicalPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCPeriodicalWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCPeriodical, SCThing>>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types of properties of SCPerson
|
* Types of properties of SCPerson
|
||||||
*/
|
*/
|
||||||
@@ -248,6 +261,17 @@ assert<Has<SCPointOfInterestPropertyTypes, SCThing>>(false);
|
|||||||
assert<Extends<SCPointOfInterestWithoutReferences, SCThing>>(false);
|
assert<Extends<SCPointOfInterestWithoutReferences, SCThing>>(false);
|
||||||
assert<Extends<SCPointOfInterest, SCThing>>(true);
|
assert<Extends<SCPointOfInterest, SCThing>>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of properties of SCPublicationEvent
|
||||||
|
*/
|
||||||
|
type SCPublicationEventPropertyTypes = PropertyTypesNested<SCPublicationEvent>;
|
||||||
|
assert<NotHas<SCPublicationEventPropertyTypes, SCThingWithoutReferences>>(false);
|
||||||
|
assert<Has<SCPublicationEventPropertyTypes, SCThingWithoutReferences>>(true);
|
||||||
|
assert<NotHas<SCPublicationEventPropertyTypes, SCThing>>(true);
|
||||||
|
assert<Has<SCPublicationEventPropertyTypes, SCThing>>(false);
|
||||||
|
assert<Extends<SCPublicationEventWithoutReferences, SCThing>>(false);
|
||||||
|
assert<Extends<SCPublicationEvent, SCThing>>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types of properties of SCRoom
|
* Types of properties of SCRoom
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user