Compare commits

...

36 Commits

Author SHA1 Message Date
Wieland Schöbl
bde71c7e3a 0.27.0 2019-09-03 12:57:41 +02:00
Wieland Schöbl
fec33715ad feat: add @filterable tags 2019-08-21 10:34:04 +02:00
Karl-Philipp Wulfert
6dcca89257 docs: update changelog 2019-08-19 12:10:22 +02:00
Karl-Philipp Wulfert
3a65d4ba2f 0.26.0 2019-08-19 12:10:21 +02:00
Wieland Schöbl
88f579e09b feat: add pluginRequestTimeout field to backend config 2019-08-14 10:38:53 +02:00
Rainer Killinger
be2bfb4017 build: update dependencies 2019-08-05 11:28:47 +02:00
Rainer Killinger
bad15dc872 fix: complete german translations 2019-08-05 11:10:14 +02:00
Rainer Killinger
8b090af3ed refactor: add exercise category 2019-08-05 11:09:10 +02:00
Karl-Philipp Wulfert
747497699d docs: update changelog 2019-07-25 15:47:00 +02:00
Karl-Philipp Wulfert
80a102cb6a 0.25.0 2019-07-25 15:46:59 +02:00
Karl-Philipp Wulfert
234cb57070 docs: add missing contributor 2019-07-25 15:45:34 +02:00
Karl-Philipp Wulfert
d4a8ef6a9c fix: correct package job 2019-07-25 15:44:47 +02:00
Karl-Philipp Wulfert
689dc99414 build: update dependencies 2019-07-25 15:36:44 +02:00
Karl-Philipp Wulfert
27d97c4c95 docs: update changelog 2019-07-23 11:20:15 +02:00
Karl-Philipp Wulfert
e71dace32f 0.24.0 2019-07-23 11:20:14 +02:00
Roman Klopsch
180c966891 docs: apply changes mentioned in discussion 2019-07-23 09:27:18 +02:00
Roman Klopsch
65730d603a refactor: apply changes mentioned in discussion 2019-07-23 09:27:17 +02:00
Roman Klopsch
7fbe1620ee refactor: rename receivingOrganizations field 2019-07-23 09:27:17 +02:00
Roman Klopsch
d781dd6de5 feat: add new field receivingOrganisations to message 2019-07-23 09:27:17 +02:00
Karl-Philipp Wulfert
86f3f8dfae docs: update changelog 2019-07-15 11:42:27 +02:00
Karl-Philipp Wulfert
34fe32b404 0.23.1 2019-07-15 11:42:26 +02:00
Michel Jonathan Schmitz
f262a6b8fa fix: use correct generic for the distance filter 2019-07-15 11:04:41 +02:00
Karl-Philipp Wulfert
e1d4b2bc9d feat: add type maps from routes to requests and responses
Fixes #80
2019-07-04 14:56:48 +02:00
Jovan Krunić
c3a9606f9d docs: update changelog 2019-07-03 15:30:38 +02:00
Jovan Krunić
dd56d97945 0.23.0 2019-07-03 15:30:33 +02:00
Jovan Krunić
43851d2d35 feat: support 404 (resource not found) error on plugin register route 2019-07-03 15:13:38 +02:00
Karl-Philipp Wulfert
b6272e9229 test: update NYC configuration 2019-06-28 12:42:45 +02:00
Karl-Philipp Wulfert
13dae1fb06 build: update dependencies 2019-06-28 12:38:28 +02:00
Karl-Philipp Wulfert
c18e3c15f1 feat: add mapping type from response to request and vice versa
Fixes #80
2019-06-28 12:36:52 +02:00
Karl-Philipp Wulfert
54d44f1acb docs: update changelog 2019-06-28 11:32:37 +02:00
Karl-Philipp Wulfert
47b686dfd0 0.22.0 2019-06-28 11:32:36 +02:00
Wieland Schöbl
89eb10451c refactor: state types of generics explicitly 2019-06-27 12:16:29 +02:00
Karl-Philipp Wulfert
ceab7cc7ef refactor: tidy structure of source files
Fixes #79
2019-06-19 16:18:03 +02:00
Karl-Philipp Wulfert
5de9bf3794 docs: add missing copyright years 2019-06-19 14:24:06 +02:00
Karl-Philipp Wulfert
02593a013c docs: add missing contributor 2019-06-19 14:23:57 +02:00
Karl-Philipp Wulfert
472038ec62 docs: update changelog 2019-06-19 14:21:49 +02:00
103 changed files with 2148 additions and 1854 deletions

View File

@@ -12,6 +12,7 @@ stages:
- build
- test
- deploy
- publish
build:
tags:
@@ -55,7 +56,7 @@ package:
- build
tags:
- secrecy
stage: deploy
stage: publish
script:
- echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
- npm publish

View File

@@ -1,3 +1,73 @@
# [0.26.0](https://gitlab.com/openstapps/core/compare/v0.25.0...v0.26.0) (2019-08-19)
### Bug Fixes
* complete german translations ([bad15dc](https://gitlab.com/openstapps/core/commit/bad15dc))
### Features
* add pluginRequestTimeout field to backend config ([88f579e](https://gitlab.com/openstapps/core/commit/88f579e))
# [0.25.0](https://gitlab.com/openstapps/core/compare/v0.24.0...v0.25.0) (2019-07-25)
### Bug Fixes
* correct package job ([d4a8ef6](https://gitlab.com/openstapps/core/commit/d4a8ef6))
# [0.24.0](https://gitlab.com/openstapps/core/compare/v0.23.1...v0.24.0) (2019-07-23)
### Features
* add new field receivingOrganisations to message ([d781dd6](https://gitlab.com/openstapps/core/commit/d781dd6))
## [0.23.1](https://gitlab.com/openstapps/core/compare/v0.23.0...v0.23.1) (2019-07-15)
### Bug Fixes
* use correct generic for the distance filter ([f262a6b](https://gitlab.com/openstapps/core/commit/f262a6b))
### Features
* add type maps from routes to requests and responses ([e1d4b2b](https://gitlab.com/openstapps/core/commit/e1d4b2b)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
# [0.23.0](https://gitlab.com/openstapps/core/compare/v0.22.0...v0.23.0) (2019-07-03)
### Features
* add mapping type from response to request and vice versa ([c18e3c1](https://gitlab.com/openstapps/core/commit/c18e3c1)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
* support 404 (resource not found) error on plugin register route ([43851d2](https://gitlab.com/openstapps/core/commit/43851d2))
# [0.22.0](https://gitlab.com/openstapps/core/compare/v0.21.0...v0.22.0) (2019-06-28)
# [0.21.0](https://gitlab.com/openstapps/core/compare/v0.20.0...v0.21.0) (2019-06-19)
### Features
* add ES annotations ([9c424b0](https://gitlab.com/openstapps/core/commit/9c424b0))
* add static typed test for consistency ([ff1f554](https://gitlab.com/openstapps/core/commit/ff1f554)), closes [#71](https://gitlab.com/openstapps/core/issues/71)
# [0.20.0](https://gitlab.com/openstapps/core/compare/v0.19.0...v0.20.0) (2019-06-11)

647
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@openstapps/core",
"version": "0.21.0",
"version": "0.27.0",
"description": "StAppsCore - Generalized model of data",
"keywords": [
"Model",
@@ -24,25 +24,27 @@
"prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"",
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src/core lib/schema",
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src lib/schema",
"test": "nyc mocha --require ts-node/register --require source-map-support/register --ui mocha-typescript test/*.spec.ts",
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
},
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
"contributors": [
"Anselm Stordeur <anselmstordeur@gmail.com>",
"Jovan Krunić <jovan.krunic@gmail.com>",
"Andreas Lehmann",
"Sebastian Lange",
"Rainer Killinger",
"Anselm Stordeur <anselmstordeur@gmail.com>",
"Benjamin Jöckel",
"Imran Hossain",
"Jovan Krunić <jovan.krunic@gmail.com>",
"Michel Jonathan Schmitz",
"Wieland Schöbl"
"Rainer Killinger",
"Sebastian Lange",
"Wieland Schöbl",
"Roman Klopsch"
],
"dependencies": {
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/node": "10.14.8",
"@types/node": "10.14.14",
"fast-clone": "1.5.13",
"http-status-codes": "1.3.2",
"json-patch": "0.7.0",
@@ -51,47 +53,50 @@
},
"devDependencies": {
"@krlwlfrt/async-pool": "0.1.0",
"@openstapps/configuration": "0.18.0",
"@openstapps/core-tools": "0.6.0",
"@openstapps/logger": "0.2.1",
"@openstapps/configuration": "0.21.1",
"@openstapps/core-tools": "0.8.0",
"@openstapps/logger": "0.4.0",
"@types/chai": "4.1.7",
"@types/rimraf": "2.0.2",
"chai": "4.2.0",
"commander": "2.20.0",
"conditional-type-checks": "1.0.1",
"conventional-changelog-cli": "2.0.21",
"mocha": "6.1.4",
"conventional-changelog-cli": "2.0.23",
"mocha": "6.2.0",
"mocha-typescript": "1.1.17",
"nyc": "14.1.1",
"rimraf": "2.6.3",
"source-map-support": "0.5.12",
"ts-node": "8.2.0",
"tslint": "5.17.0",
"source-map-support": "0.5.13",
"ts-node": "8.3.0",
"tslint": "5.18.0",
"typedoc": "0.14.2",
"typescript": "3.5.1"
"typescript": "3.5.3"
},
"nyc": {
"check-coverage": true,
"per-file": true,
"lines": 95,
"statements": 95,
"functions": 95,
"all": true,
"branches": 85,
"include": [
"src/core/Route.ts",
"src/core/Thing.ts",
"src/core/Translator.ts",
"src/core/types/Guards.ts"
],
"check-coverage": true,
"exclude": [],
"extension": [
".ts"
],
"functions": 95,
"include": [
"src/protocol/route.ts",
"src/things/abstract/thing.ts",
"src/translator.ts",
"src/guards.ts"
],
"lines": 95,
"per-file": true,
"reporter": [
"html",
"text-summary"
],
"all": true
"require": [
"ts-node/register"
],
"statements": 95
},
"openstappsConfiguration": {
"hasCli": false,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,8 +14,8 @@
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Polygon} from 'geojson';
import {SCSetting} from '../../things/Setting';
import {SCTranslations} from '../i18n';
import {SCTranslations} from '../general/i18n';
import {SCSetting} from '../things/setting';
/**
* An app configuration menu item
@@ -149,7 +149,7 @@ export interface SCAppConfigurationStoreUrl {
*/
ios?: string;
/**
* Microsoft Store URL
* Microsoft Store URL
*/
uwp?: string;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,16 +12,23 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingType} from '../../Thing';
import {SCSearchSortType} from '../sorts/Abstract';
import {SCUuid} from '../UUID';
import {SCMap, SCRestrictedMap} from './../Map';
import {SCMonitoringConfiguration} from './Monitoring';
import {SCMap, SCRestrictedMap} from '../general/map';
import {SCUuid} from '../general/uuid';
import {SCSearchSortType} from '../protocol/search/sort';
import {SCThingType} from '../things/abstract/thing';
import {SCMonitoringConfiguration} from './monitoring';
/**
* A backend configuration
*/
export interface SCBackendConfiguration {
/**
* The maximum amount of time (milliseconds) an external program can take to provide a response to the backend
*
* This can be used for example for Plugins.
*/
externalRequestTimeout: number;
/**
* A list of hidden SC types
*
@@ -96,10 +103,8 @@ export type SCSearchContext =
* A boosting configuration for one context
*/
export type SCBackendConfigurationSearchBoostingContext =
SCRestrictedMap<
SCSearchContext,
SCBackendConfigurationSearchBoostingType[]
>;
SCRestrictedMap<SCSearchContext,
SCBackendConfigurationSearchBoostingType[]>;
/**
* A boosting configuration for one SCType

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCAppConfiguration} from '../types/config/App';
import {SCBackendConfiguration, SCBackendInternalConfiguration} from '../types/config/Backend';
import {SCLicensePlate} from '../types/namespaces';
import {SCLicensePlate} from '../general/namespaces';
import {SCAppConfiguration} from './app';
import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend';
/**
* A configuration file that configures app and backend

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.

View File

@@ -1,188 +0,0 @@
/*
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Possible HTTP verbs for routes
*/
import {SCErrorResponse} from './protocol/errors/ErrorResponse';
import {SCBookAvailabilityRequest} from './protocol/routes/bookAvailability/BookAvailabilityRequest';
import {SCBookAvailabilityResponse} from './protocol/routes/bookAvailability/BookAvailabilityResponse';
import {SCBulkRequest} from './protocol/routes/bulk/BulkRequest';
import {SCBulkResponse} from './protocol/routes/bulk/BulkResponse';
import {SCBulkAddRequest} from './protocol/routes/bulk/UID/BulkAddRequest';
import {SCBulkAddResponse} from './protocol/routes/bulk/UID/BulkAddResponse';
import {SCBulkDoneRequest} from './protocol/routes/bulk/UID/BulkDoneRequest';
import {SCBulkDoneResponse} from './protocol/routes/bulk/UID/BulkDoneResponse';
import {SCFeedbackRequest} from './protocol/routes/feedback/FeedbackRequest';
import {SCFeedbackResponse} from './protocol/routes/feedback/FeedbackResponse';
import {SCIndexRequest} from './protocol/routes/INDEX/IndexRequest';
import {SCIndexResponse} from './protocol/routes/INDEX/IndexResponse';
import {SCMultiSearchRequest} from './protocol/routes/search/MultiSearchRequest';
import {SCMultiSearchResponse} from './protocol/routes/search/MultiSearchResponse';
import {SCSearchRequest} from './protocol/routes/search/SearchRequest';
import {SCSearchResponse} from './protocol/routes/search/SearchResponse';
import {SCThingUpdateRequest} from './protocol/routes/TYPE/UID/ThingUpdateRequest';
import {SCThingUpdateResponse} from './protocol/routes/TYPE/UID/ThingUpdateResponse';
import {SCMap} from './types/Map';
/**
* Possible Verbs for HTTP requests
*/
export enum SCRouteHttpVerbs {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
}
/**
* The constructor of an error response
*/
// tslint:disable-next-line:no-any
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
/**
* A description of a route
*/
export interface SCRoute {
/**
* A map of names of possible errors that can be returned by the route with their appropriate status codes
*/
errorNames: SCErrorResponseConstructor[];
/**
* HTTP verb to use to request the route
*/
method: SCRouteHttpVerbs;
/**
* Map of obligatory parameters and their type that have to be set via the requested path
*/
obligatoryParameters?: SCMap<string>;
/**
* Name of the type of the request body
*/
requestBodyName: string;
/**
* Name of the type of the response body
*/
responseBodyName: string;
/**
* Status code for success
*/
statusCodeSuccess: number;
/**
* URL fragment of the route
*/
urlFragment: string;
}
/**
* An abstract route
*/
export abstract class SCAbstractRoute implements SCRoute {
/**
* @see SCRoute.errorNames
*/
errorNames: SCErrorResponseConstructor[] = [];
/**
* @see SCRoute.method
*/
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
/**
* @see SCRoute.obligatoryParameters
*/
obligatoryParameters?: SCMap<string>;
/**
* @see SCRoute.requestBodyName
*/
requestBodyName = 'any';
/**
* @see SCRoute.responseBodyName
*/
responseBodyName = 'any';
/**
* @see SCRoute.statusCodeSuccess
*/
statusCodeSuccess = 200;
/**
* @see SCRoute.urlFragment
*/
urlFragment = '/';
/**
* Get "compiled" URL fragment
*
* @param parameters Parameters to compile URL fragment with
*/
public getUrlFragment(parameters: SCMap<string> = {}): string {
let obligatoryParameters: string[] = [];
if (typeof this.obligatoryParameters === 'object') {
obligatoryParameters = Object.keys(this.obligatoryParameters);
}
if (Object.keys(parameters).length > obligatoryParameters.length) {
throw new Error('Extraneous parameters provided.');
}
return this.urlFragment
.split('/')
.map((part) => {
if (part.indexOf(':') !== 0) {
return part;
}
const parameter = part.substr(1);
if (typeof parameters[parameter] === 'undefined') {
throw new Error(`Parameter '${parameter}' not provided.`);
}
return parameters[parameter];
})
.join('/');
}
}
/**
* Possible requests
*/
export type SCRequests =
SCBookAvailabilityRequest
| SCBulkRequest
| SCBulkAddRequest
| SCBulkDoneRequest
| SCFeedbackRequest
| SCIndexRequest
| SCMultiSearchRequest
| SCSearchRequest
| SCThingUpdateRequest;
/**
* Possible responses
*/
export type SCResponses =
SCBookAvailabilityResponse
| SCBulkResponse
| SCBulkAddResponse
| SCBulkDoneResponse
| SCFeedbackResponse
| SCIndexResponse
| SCMultiSearchResponse
| SCSearchResponse
| SCThingUpdateResponse;

View File

@@ -1,260 +0,0 @@
/*
* Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {
BAD_GATEWAY,
BAD_REQUEST, CONFLICT, INTERNAL_SERVER_ERROR,
METHOD_NOT_ALLOWED, NOT_ACCEPTABLE, NOT_FOUND,
REQUEST_TOO_LONG,
TOO_MANY_REQUESTS,
UNSUPPORTED_MEDIA_TYPE,
} from 'http-status-codes';
import {ValidationError} from 'jsonschema';
import {SCPluginMetaData} from '../routes/plugin/PluginRegisterRequest';
/**
* A generic error that can be returned by the backend if somethings fails during the processing of a request
*
* @validatable
*/
export interface SCErrorResponse extends Error {
/**
* Additional data that describes the error
*/
additionalData?: unknown;
/**
* HTTP status code to return this error with
*/
statusCode: number;
}
/**
* An error that can be created by the backend during the processing of a request
*/
export abstract class SCError implements SCErrorResponse {
/**
* Call stack of the error
*/
stack?: string;
/**
* Instatiate an SCError
*
* @param name Name of the error
* @param message Message of the error
* @param statusCode HTTP status code to return this error with
* @param stack Set to true if a stack trace should be created
*/
constructor(public name: string, public message: string, public statusCode: number, stack = false) {
// generate stacktrace if needed
if (stack) {
this.stack = (new Error()).stack;
}
}
}
/**
* An error that is returned when the validation of a request fails
*/
export class SCValidationErrorResponse extends SCError {
/**
* List of validatation errors
*/
additionalData: ValidationError[];
/**
* Create a SCValidationErrorResponse
*
* @param errors List of validation errors
* @param stack Set to true if a stack trace should be created
*/
constructor(errors: ValidationError[], stack?: boolean) {
super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
this.additionalData = errors;
}
}
/**
* An error that is returned when the content type of the request is not supported
*/
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
/**
* Create a SCUnsupportedMediaTypeErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
}
}
/**
* An error that is returned, when the used HTTP method is not allowed on the requested route
*/
export class SCMethodNotAllowedErrorResponse extends SCError {
/**
* Create a SCMethodNotAllowedErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', METHOD_NOT_ALLOWED, stack);
}
}
/**
* An error that is returned, when the request body is too large.
*/
export class SCRequestBodyTooLargeErrorResponse extends SCError {
/**
* Create a SCRequestBodyTooLargeErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
}
}
/**
* An error that is returned, when to many request are submitted at once
*/
export class SCTooManyRequestsErrorResponse extends SCError {
/**
* Create a SCTooManyRequestsErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super(
'TooManyRequestsError',
'Too many requests. You can not submit more than 5 queries an once',
TOO_MANY_REQUESTS,
stack,
);
}
}
/**
* An error that is returned when the requested route or resource was not found
*/
export class SCNotFoundErrorResponse extends SCError {
/**
* Create a SCNotFoundErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
}
}
/**
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
* acceptable.
*/
export class SCParametersNotAcceptable extends SCError {
/**
* Create a ParametersNotAcceptable
*
* @param message contains more details to what you did wrong
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
}
}
/**
* An error that is returned when a plugin with the same name is already registered, to prevent two copies of a plugin
* running at the same time.
* This usually indicates that there is more than one instance a plugin running.
*/
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
/**
* Meta data of a registered plugin, which is in a conflict with the plugin we want to register.
* If the stack is disabled this is not set for security reasons
*/
additionalData?: SCPluginMetaData;
/**
* Create a SCPluginAlreadyRegisteredError
*
* @param message Provide further information why an already registered plugin matches the one we want to register
* @param plugin Provides meta data of a registered plugin, which is in a conflict with the plugin we want to register
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
if (stack) {
this.additionalData = plugin;
}
}
}
/**
* An error that is returned whenever there is an unexpected error while creating a plugin
*/
export class SCPluginRegisteringFailedErrorResponse extends SCError {
/**
* Create a PluginRegisteringFailedError
*
* @param message Describes what went wrong wile registering the plugin
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
}
}
/**
* An error that is returned whenever there is a syntax error
*/
export class SCSyntaxErrorResponse extends SCError {
/**
* Create a SyntaxError
*
* @param message Describes the syntax error
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('SyntaxError', message, BAD_REQUEST, stack);
}
}
/**
* An error that is returned, when an internal server error occurred
*/
export class SCInternalServerErrorResponse extends SCError {
/**
* Internal error that occurred. If the stack is disabled this error is not set for security reasons
*/
additionalData?: Error;
/**
* Create a SCInternalServerErrorResponse
*
* @param err Internal server error
* @param stack Set to true if a stack trace should be created
* and the internal server error should be displayed to the client
*/
constructor(err?: Error, stack = false) {
super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
if (stack) {
this.additionalData = err;
}
}
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCAppConfiguration} from '../../../types/config/App';
import {SCBackendConfiguration} from '../../../types/config/Backend';
/**
* A response to an index request
*
* @validatable
*/
export interface SCIndexResponse {
/**
* @see SCAppConfiguration
*/
app: SCAppConfiguration;
/**
* @see SCBackendConfiguration
*/
backend: SCBackendConfiguration;
}

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Response for an entity update request
*
* @validatable
*/
export interface SCThingUpdateResponse {
}

View File

@@ -1,22 +0,0 @@
/*
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../../base/ThingThatCanBeOffered';
/**
* List of availabilities of a book
*
* @validatable
*/
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Response to a request to add a thing to a bulk
*
* @validatable
*/
export interface SCBulkAddResponse {
}

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Response to a request to change the state of a bulk to done
*
* @validatable
*/
export interface SCBulkDoneResponse {
}

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* A response to a feedback request
*
* @validatable
*/
export interface SCFeedbackResponse {
}

View File

@@ -1,25 +0,0 @@
/*
* Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMap} from '../../../types/Map';
import {SCSearchResult} from './SearchResponse';
/**
* A multi search response
*
* This is a map of [[SCSearchResponse]]s indexed by name
*
* @validatable
*/
export type SCMultiSearchResponse = SCMap<SCSearchResult>;

View File

@@ -1,48 +0,0 @@
/*
* Copyright (C) 2018 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* A postal address
*/
export interface SCPostalAddress {
/**
* Country of the address
*/
addressCountry: string;
/**
* City of the address
*/
addressLocality: string;
/**
* State of the address
*/
addressRegion?: string;
/**
* Zip code of the address
*/
postalCode: string;
/**
* Optional post box number
*/
postOfficeBoxNumber?: string;
/**
* Street of the address - with house number!
*/
streetAddress: string;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -29,7 +29,7 @@ export interface SCLanguage {
/**
* A list of possible languages in english
*
*
* @see https://en.wikipedia.org/wiki/ISO_639-1
*/
export type SCLanguageName =
@@ -221,7 +221,7 @@ export type SCLanguageName =
/**
* A List of all possible Languages as ISO 639-1 Codes
*
*
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/
export type SCLanguageCode =
@@ -691,9 +691,9 @@ export interface SCTranslations<T> {
*/
type RecursivePartial<T> = {
[P in keyof T]-?:
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
T[P] extends object ? RecursivePartial<T[P]> :
T[P];
T[P];
};
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCBulkResponse} from '../protocol/routes/bulk/BulkResponse';
import {SCMultiSearchResponse} from '../protocol/routes/search/MultiSearchResponse';
import {SCSearchResponse} from '../protocol/routes/search/SearchResponse';
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
import {SCTranslations} from './i18n';
import {SCTranslations} from './general/i18n';
import {SCBulkResponse} from './protocol/routes/bulk-request';
import {SCSearchResponse} from './protocol/routes/search';
import {SCMultiSearchResponse} from './protocol/routes/search-multi';
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './things/abstract/thing';
/**
* Type guard to check if something is a SCThing
@@ -102,13 +102,13 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
const somethingObject = (something as { [key: string]: { [key: string]: string; }; });
return Array.isArray(somethingObject.data)
&& Array.isArray(somethingObject.facets)
&& typeof somethingObject.pagination !== 'undefined'
&& typeof somethingObject.pagination.count === 'number'
&& typeof somethingObject.pagination.offset === 'number'
&& typeof somethingObject.pagination.total === 'number'
&& typeof somethingObject.stats !== 'undefined'
&& typeof somethingObject.stats.time === 'number';
&& Array.isArray(somethingObject.facets)
&& typeof somethingObject.pagination !== 'undefined'
&& typeof somethingObject.pagination.count === 'number'
&& typeof somethingObject.pagination.offset === 'number'
&& typeof somethingObject.pagination.total === 'number'
&& typeof somethingObject.stats !== 'undefined'
&& typeof somethingObject.stats.time === 'number';
}
/**
@@ -117,7 +117,7 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
* @param something Something to check
*/
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false;
const initialValue = Object.keys(something as { [key: string]: string; }).length > 0 ? true : false;
return Object.keys(something as { [key: string]: string; })
.reduce((previousOnesAreSearchResponses, key) => {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,31 +12,31 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingType} from './Thing';
import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/AcademicEvent';
import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/Article';
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/Book';
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/Building';
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/Catalog';
import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/CourseOfStudies';
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/DateSeries';
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/Diff';
import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/Dish';
import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/Favorite';
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/Floor';
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/Message';
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/Organization';
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/Person';
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/PointOfInterest';
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/Room';
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/Semester';
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/Setting';
import {SCSportCourse, SCSportCourseMeta, SCSportCourseWithoutReferences} from './things/SportCourse';
import {SCStudyModule, SCStudyModuleMeta, SCStudyModuleWithoutReferences} from './things/StudyModule';
import {SCTicket, SCTicketMeta, SCTicketWithoutReferences} from './things/Ticket';
import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/ToDo';
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/Tour';
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/Video';
import {SCThingType} from './things/abstract/thing';
import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/academic-event';
import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article';
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book';
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building';
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog';
import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/course-of-studies';
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series';
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff';
import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish';
import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/favorite';
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/floor';
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/message';
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization';
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person';
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest';
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/room';
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/semester';
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/setting';
import {SCSportCourse, SCSportCourseMeta, SCSportCourseWithoutReferences} from './things/sport-course';
import {SCStudyModule, SCStudyModuleMeta, SCStudyModuleWithoutReferences} from './things/study-module';
import {SCTicket, SCTicketMeta, SCTicketWithoutReferences} from './things/ticket';
import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/todo';
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour';
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video';
/* tslint:disable:variable-name */
/**

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

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* A generic error that can be returned by the backend if somethings fails during the processing of a request
*
* @validatable
*/
export interface SCErrorResponse extends Error {
/**
* Additional data that describes the error
*/
additionalData?: unknown;
/**
* HTTP status code to return this error with
*/
statusCode: number;
}
/**
* An error that can be created by the backend during the processing of a request
*/
export abstract class SCError implements SCErrorResponse {
/**
* Call stack of the error
*/
stack?: string;
/**
* Instatiate an SCError
*
* @param name Name of the error
* @param message Message of the error
* @param statusCode HTTP status code to return this error with
* @param stack Set to true if a stack trace should be created
*/
constructor(public name: string, public message: string, public statusCode: number, stack = false) {
// generate stacktrace if needed
if (stack) {
this.stack = (new Error()).stack;
}
}
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {BAD_GATEWAY} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned, when an internal server error occurred
*/
export class SCInternalServerErrorResponse extends SCError {
/**
* Internal error that occurred. If the stack is disabled this error is not set for security reasons
*/
additionalData?: Error;
/**
* Create a SCInternalServerErrorResponse
*
* @param err Internal server error
* @param stack Set to true if a stack trace should be created
* and the internal server error should be displayed to the client
*/
constructor(err?: Error, stack = false) {
super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
if (stack) {
this.additionalData = err;
}
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {METHOD_NOT_ALLOWED} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned, when the used HTTP method is not allowed on the requested route
*/
export class SCMethodNotAllowedErrorResponse extends SCError {
/**
* Create a SCMethodNotAllowedErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', METHOD_NOT_ALLOWED, stack);
}
}

View File

@@ -12,15 +12,19 @@
* 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 {NOT_FOUND} from 'http-status-codes';
import {SCError} from '../error';
/**
* Plugin register response
*
* @validatable
* An error that is returned when the requested route or resource was not found
*/
export interface SCPluginRegisterResponse {
export class SCNotFoundErrorResponse extends SCError {
/**
* Whether the desired action succeeded or failed (true for success, false if an error occurred)
* Create a SCNotFoundErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
success: boolean;
constructor(stack?: boolean) {
super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
}
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {NOT_ACCEPTABLE} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
* acceptable.
*/
export class SCParametersNotAcceptable extends SCError {
/**
* Create a ParametersNotAcceptable
*
* @param message contains more details to what you did wrong
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {CONFLICT} from 'http-status-codes';
import {SCError} from '../error';
import {SCPluginMetaData} from '../routes/plugin-register';
/**
* An error that is returned when a plugin with the same name is already registered, to prevent two copies of a plugin
* running at the same time.
* This usually indicates that there is more than one instance a plugin running.
*/
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
/**
* Meta data of a registered plugin, which is in a conflict with the plugin we want to register.
* If the stack is disabled this is not set for security reasons
*/
additionalData?: SCPluginMetaData;
/**
* Create a SCPluginAlreadyRegisteredError
*
* @param message Provide further information why an already registered plugin matches the one we want to register
* @param plugin Provides meta data of a registered plugin, which is in a conflict with the plugin we want to register
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
if (stack) {
this.additionalData = plugin;
}
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {INTERNAL_SERVER_ERROR} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned whenever there is an unexpected error while creating a plugin
*/
export class SCPluginRegisteringFailedErrorResponse extends SCError {
/**
* Create a PluginRegisteringFailedError
*
* @param message Describes what went wrong wile registering the plugin
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,25 +12,19 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCUuid} from '../../../types/UUID';
import {SCBulkParameters} from './BulkRequest';
import {REQUEST_TOO_LONG} from 'http-status-codes';
import {SCError} from '../error';
/**
* Requested Bulk from backend
*
* @validatable
* An error that is returned, when the request body is too large.
*/
export interface SCBulkResponse extends SCBulkParameters {
export class SCRequestBodyTooLargeErrorResponse extends SCError {
/**
* State of bulk
* Create a SCRequestBodyTooLargeErrorResponse
*
* The state is `in progress` while it accepts things to be added to the bulk.
* The state is `done` once it is closed.
* @param stack Set to true if a stack trace should be created
*/
state: 'in progress' | 'done';
/**
* Universally unique identifier of the bulk
*/
uid: SCUuid;
constructor(stack?: boolean) {
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
}
}

View File

@@ -12,21 +12,20 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCBuildingWithoutReferences} from '../things/Building';
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest';
import {SCRoomWithoutReferences} from '../things/Room';
import {BAD_REQUEST} from 'http-status-codes';
import {SCError} from '../error';
/**
* Something that is or happens in a place
*
* !Important!
* This is not a SCThing.
* An error that is returned whenever there is a syntax error
*/
export interface SCInPlace {
export class SCSyntaxErrorResponse extends SCError {
/**
* Place the thing is or happens in
* Create a SyntaxError
*
* @param message Describes the syntax error
* @param stack Set to true if a stack trace should be created
*/
inPlace?:
SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
constructor(message: string, stack?: boolean) {
super('SyntaxError', message, BAD_REQUEST, stack);
}
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {TOO_MANY_REQUESTS} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned, when to many request are submitted at once
*/
export class SCTooManyRequestsErrorResponse extends SCError {
/**
* Create a SCTooManyRequestsErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super(
'TooManyRequestsError',
'Too many requests. You can not submit more than 5 queries an once',
TOO_MANY_REQUESTS,
stack,
);
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {UNSUPPORTED_MEDIA_TYPE} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned when the content type of the request is not supported
*/
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
/**
* Create a SCUnsupportedMediaTypeErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
}
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {BAD_REQUEST} from 'http-status-codes';
import {ValidationError} from 'jsonschema';
import {SCError} from '../error';
/**
* An error that is returned when the validation of a request fails
*/
export class SCValidationErrorResponse extends SCError {
/**
* List of validatation errors
*/
additionalData: ValidationError[];
/**
* Create a SCValidationErrorResponse
*
* @param errors List of validation errors
* @param stack Set to true if a stack trace should be created
*/
constructor(errors: ValidationError[], stack?: boolean) {
super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
this.additionalData = errors;
}
}

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

@@ -0,0 +1,240 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMap} from '../general/map';
import {SCErrorResponse} from './error';
import {SCIndexRequest, SCIndexResponse, SCIndexRoute} from './routes';
import {
SCBookAvailabilityRequest,
SCBookAvailabilityResponse,
SCBookAvailabilityRoute,
} from './routes/book-availability';
import {SCBulkAddRequest, SCBulkAddResponse, SCBulkAddRoute} from './routes/bulk-add';
import {SCBulkDoneRequest, SCBulkDoneResponse, SCBulkDoneRoute} from './routes/bulk-done';
import {SCBulkRequest, SCBulkResponse, SCBulkRoute} from './routes/bulk-request';
import {SCFeedbackRequest, SCFeedbackResponse, SCFeedbackRoute} from './routes/feedback';
import {SCSearchRequest, SCSearchResponse, SCSearchRoute} from './routes/search';
import {SCMultiSearchRequest, SCMultiSearchResponse, SCMultiSearchRoute} from './routes/search-multi';
import {SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute} from './routes/thing-update';
/**
* Possible Verbs for HTTP requests
*/
export enum SCRouteHttpVerbs {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
}
/**
* The constructor of an error response
*/
// tslint:disable-next-line:no-any
export type SCErrorResponseConstructor = new (...args: any[]) => SCErrorResponse;
/**
* A description of a route
*/
export interface SCRoute {
/**
* A map of names of possible errors that can be returned by the route with their appropriate status codes
*/
errorNames: SCErrorResponseConstructor[];
/**
* HTTP verb to use to request the route
*/
method: SCRouteHttpVerbs;
/**
* Map of obligatory parameters and their type that have to be set via the requested path
*/
obligatoryParameters?: SCMap<string>;
/**
* Name of the type of the request body
*/
requestBodyName: string;
/**
* Name of the type of the response body
*/
responseBodyName: string;
/**
* Status code for success
*/
statusCodeSuccess: number;
/**
* URL fragment of the route
*/
urlFragment: string;
}
/**
* An abstract route
*/
export abstract class SCAbstractRoute implements SCRoute {
/**
* @see SCRoute.errorNames
*/
errorNames: SCErrorResponseConstructor[] = [];
/**
* @see SCRoute.method
*/
method: SCRouteHttpVerbs = SCRouteHttpVerbs.GET;
/**
* @see SCRoute.obligatoryParameters
*/
obligatoryParameters?: SCMap<string>;
/**
* @see SCRoute.requestBodyName
*/
requestBodyName = 'any';
/**
* @see SCRoute.responseBodyName
*/
responseBodyName = 'any';
/**
* @see SCRoute.statusCodeSuccess
*/
statusCodeSuccess = 200;
/**
* @see SCRoute.urlFragment
*/
urlFragment = '/';
/**
* Get "compiled" URL fragment
*
* @param parameters Parameters to compile URL fragment with
*/
public getUrlFragment(parameters: SCMap<string> = {}): string {
let obligatoryParameters: string[] = [];
if (typeof this.obligatoryParameters === 'object') {
obligatoryParameters = Object.keys(this.obligatoryParameters);
}
if (Object.keys(parameters).length > obligatoryParameters.length) {
throw new Error('Extraneous parameters provided.');
}
return this.urlFragment
.split('/')
.map((part) => {
if (part.indexOf(':') !== 0) {
return part;
}
const parameter = part.substr(1);
if (typeof parameters[parameter] === 'undefined') {
throw new Error(`Parameter '${parameter}' not provided.`);
}
return parameters[parameter];
})
.join('/');
}
}
/**
* Possible requests
*/
export type SCRequests =
SCBookAvailabilityRequest
| SCBulkRequest
| SCBulkAddRequest
| SCBulkDoneRequest
| SCFeedbackRequest
| SCIndexRequest
| SCMultiSearchRequest
| SCSearchRequest
| SCThingUpdateRequest;
/**
* Possible responses
*/
export type SCResponses =
SCBookAvailabilityResponse
| SCBulkResponse
| SCBulkAddResponse
| SCBulkDoneResponse
| SCFeedbackResponse
| SCIndexResponse
| SCMultiSearchResponse
| SCSearchResponse
| SCThingUpdateResponse;
/**
* Associated response for a request
*/
export type SCAssociatedResponse<REQUEST> =
REQUEST extends SCBookAvailabilityRequest ? SCBookAvailabilityResponse :
REQUEST extends SCBulkRequest ? SCBulkResponse :
REQUEST extends SCBulkAddRequest ? SCBulkAddResponse :
REQUEST extends SCBulkDoneRequest ? SCBulkDoneResponse :
REQUEST extends SCFeedbackRequest ? SCFeedbackResponse :
REQUEST extends SCIndexRequest ? SCIndexResponse :
REQUEST extends SCMultiSearchRequest ? SCMultiSearchResponse :
REQUEST extends SCSearchRequest ? SCSearchResponse :
REQUEST extends SCThingUpdateRequest ? SCThingUpdateResponse :
never;
/**
* Associated request for a response
*/
export type SCAssociatedRequest<RESPONSE> =
RESPONSE extends SCBookAvailabilityResponse ? SCBookAvailabilityRequest :
RESPONSE extends SCBulkResponse ? SCBulkRequest :
RESPONSE extends SCBulkAddResponse ? SCBulkAddRequest :
RESPONSE extends SCBulkDoneResponse ? SCBulkDoneRequest :
RESPONSE extends SCFeedbackResponse ? SCFeedbackRequest :
RESPONSE extends SCIndexResponse ? SCIndexRequest :
RESPONSE extends SCMultiSearchResponse ? SCMultiSearchRequest :
RESPONSE extends SCSearchResponse ? SCSearchRequest :
RESPONSE extends SCThingUpdateResponse ? SCThingUpdateRequest :
never;
/**
* Associated request for a route
*/
export type SCAssignedRequest<ROUTE extends SCAbstractRoute> =
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityRequest :
ROUTE extends SCBulkRoute ? SCBulkRequest :
ROUTE extends SCBulkAddRoute ? SCBulkAddRequest :
ROUTE extends SCBulkDoneRoute ? SCBulkDoneRequest :
ROUTE extends SCFeedbackRoute ? SCFeedbackRequest :
ROUTE extends SCIndexRoute ? SCIndexRequest :
ROUTE extends SCMultiSearchRoute ? SCMultiSearchRequest :
ROUTE extends SCSearchRoute ? SCSearchRequest :
ROUTE extends SCThingUpdateRoute ? SCThingUpdateRequest :
never;
/**
* Associated response for a route
*/
export type SCAssignedResponse<ROUTE extends SCAbstractRoute> =
ROUTE extends SCBookAvailabilityRoute ? SCBookAvailabilityResponse :
ROUTE extends SCBulkRoute ? SCBulkResponse :
ROUTE extends SCBulkAddRoute ? SCBulkAddResponse :
ROUTE extends SCBulkDoneRoute ? SCBulkDoneResponse :
ROUTE extends SCFeedbackRoute ? SCFeedbackResponse :
ROUTE extends SCIndexRoute ? SCIndexResponse :
ROUTE extends SCMultiSearchRoute ? SCMultiSearchResponse :
ROUTE extends SCSearchRoute ? SCSearchResponse :
ROUTE extends SCThingUpdateRoute ? SCThingUpdateResponse :
never;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,21 +13,20 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCUuid} from '../../../types/UUID';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../errors/ErrorResponse';
import {SCUuid} from '../../general/uuid';
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Request to check the availability of books
*
*
* @validatable
*/
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
@@ -52,6 +51,13 @@ export interface SCBookAvailabilityRequestByUuid {
uid: SCUuid;
}
/**
* List of availabilities of a book
*
* @validatable
*/
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
/**
* Route for book availability
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,25 +13,31 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {CREATED} from 'http-status-codes';
import {SCThings} from '../../../../Classes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../../errors/ErrorResponse';
import {SCThings} from '../../meta';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Request to add a thing to a bulk
*
*
* @validatable
*/
export type SCBulkAddRequest = SCThings;
/**
* Response to a request to add a thing to a bulk
*
* @validatable
*/
export interface SCBulkAddResponse {
}
/**
* Route for indexing SC things in a bulk
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,25 +13,31 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {NO_CONTENT} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../../errors/ErrorResponse';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Request to change the bulk state to done (close the bulk process)
*
*
* @validatable
*/
export interface SCBulkDoneRequest {
}
/**
* Response to a request to change the state of a bulk to done
*
* @validatable
*/
export interface SCBulkDoneResponse {
}
/**
* Route for closing bulks
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,17 +13,16 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCThingType} from '../../../Thing';
import {SCISO8601Date} from '../../../types/Time';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../errors/ErrorResponse';
import {SCISO8601Date} from '../../general/time';
import {SCUuid} from '../../general/uuid';
import {SCThingType} from '../../things/abstract/thing';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* A bulk request
@@ -57,11 +56,31 @@ export interface SCBulkParameters {
/**
* Type of things that are indexed in this bulk.
*
*
*/
type: SCThingType;
}
/**
* Requested Bulk from backend
*
* @validatable
*/
export interface SCBulkResponse extends SCBulkParameters {
/**
* State of bulk
*
* The state is `in progress` while it accepts things to be added to the bulk.
* The state is `done` once it is closed.
*/
state: 'in progress' | 'done';
/**
* Universally unique identifier of the bulk
*/
uid: SCUuid;
}
/**
* Route for bulk creation
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,16 +13,14 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {NO_CONTENT} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCMessage} from '../../../things/Message';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../errors/ErrorResponse';
import {SCMessage} from '../../things/message';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* User feedback
@@ -36,6 +34,14 @@ export interface SCFeedbackRequest extends SCMessage {
metaData: SCFeedbackRequestMetaData;
}
/**
* A response to a feedback request
*
* @validatable
*/
export interface SCFeedbackResponse {
}
/**
* Route for feedback submission
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,15 +13,15 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../errors/ErrorResponse';
import {SCAppConfiguration} from '../../config/app';
import {SCBackendConfiguration} from '../../config/backend';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Index request
@@ -31,6 +31,23 @@ import {
export interface SCIndexRequest {
}
/**
* A response to an index request
*
* @validatable
*/
export interface SCIndexResponse {
/**
* @see SCAppConfiguration
*/
app: SCAppConfiguration;
/**
* @see SCBackendConfiguration
*/
backend: SCBackendConfiguration;
}
/**
* Route to request meta information about the deployment
*/

View File

@@ -14,15 +14,15 @@
*/
import {OK} from 'http-status-codes';
import {Schema} from 'jsonschema';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse, SCParametersNotAcceptable,
SCPluginAlreadyRegisteredErrorResponse,
SCPluginRegisteringFailedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
} from '../../errors/ErrorResponse';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCParametersNotAcceptable} from '../errors/parameters-not-acceptable';
import {SCPluginAlreadyRegisteredErrorResponse} from '../errors/plugin-already-registered';
import {SCPluginRegisteringFailedErrorResponse} from '../errors/plugin-registering-failed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Plugin register request
@@ -91,6 +91,18 @@ export interface SCPluginMetaData {
route: string;
}
/**
* Plugin register response
*
* @validatable
*/
export interface SCPluginRegisterResponse {
/**
* Whether the desired action succeeded or failed (true for success, false if an error occurred)
*/
success: boolean;
}
/**
* Route to register plugins
*/
@@ -100,6 +112,7 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCParametersNotAcceptable,
SCPluginAlreadyRegisteredErrorResponse,
SCPluginRegisteringFailedErrorResponse,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,18 +13,17 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCMap} from '../../../types/Map';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCTooManyRequestsErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../errors/ErrorResponse';
import {SCSearchQuery} from './SearchRequest';
import {SCMap} from '../../general/map';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCTooManyRequestsErrorResponse} from '../errors/too-many-requests';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
import {SCSearchQuery} from '../search/query';
import {SCSearchResult} from '../search/result';
/**
* A multi search request
@@ -37,6 +36,15 @@ import {SCSearchQuery} from './SearchRequest';
*/
export type SCMultiSearchRequest = SCMap<SCSearchQuery>;
/**
* A multi search response
*
* This is a map of [[SCSearchResponse]]s indexed by name
*
* @validatable
*/
export type SCMultiSearchResponse = SCMap<SCSearchResult>;
/**
* Route for submission of multiple search requests at once
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,18 +13,15 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCSearchContext} from '../../../types/config/Backend';
import {SCSearchFilter} from '../../../types/filters/Abstract';
import {SCSearchSort} from '../../../types/sorts/Abstract';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../errors/ErrorResponse';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
import {SCSearchQuery} from '../search/query';
import {SCSearchResult} from '../search/result';
/**
* A search request
@@ -35,38 +32,11 @@ export interface SCSearchRequest extends SCSearchQuery {
}
/**
* A search query
* A search response
*
* @validatable
*/
export interface SCSearchQuery {
/**
* The context name from where the search query was initiated
*/
context?: SCSearchContext;
/**
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
*/
filter?: SCSearchFilter;
/**
* Number of things to skip in result set (paging)
*/
from?: number;
/**
* A term to search for
*/
query?: string;
/**
* Number of things to have in the result set (paging)
*/
size?: number;
/**
* A list of sorting parameters to order the result set by
*/
sort?: SCSearchSort[];
export interface SCSearchResponse extends SCSearchResult {
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,17 +13,15 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {SCThings} from '../../../../Classes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route';
import {
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCNotFoundErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../../errors/ErrorResponse';
import {SCThings} from '../../meta';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCValidationErrorResponse} from '../errors/validation';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/**
* Request to update an existing thing
@@ -32,6 +30,14 @@ import {
*/
export type SCThingUpdateRequest = SCThings;
/**
* Response for an entity update request
*
* @validatable
*/
export interface SCThingUpdateResponse {
}
/**
* Route for updating existing things
*/

View File

@@ -12,19 +12,34 @@
* 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 {Point, Polygon} from 'geojson';
import {SCThingsField} from '../../meta';
/**
* Positional information
* A search facet
*/
export interface SCGeoInformation {
export interface SCFacet {
/**
* Center point of a place
* Buckets for the aggregation
*/
point: Point;
buckets: SCFacetBucket[];
/**
* Shape of a place
* Field of the aggregation
*/
polygon?: Polygon;
field: SCThingsField;
}
/**
* A bucket of a facet
*/
export interface SCFacetBucket {
/**
* Count of matching search results
*/
count: number;
/**
* Key of a bucket
*/
key: string;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,14 +12,14 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMap} from '../Map';
import {SCMap} from '../../general/map';
/**
* All available filter types
*/
import {SCSearchAvailabilityFilter} from './Availability';
import {SCSearchBooleanFilter} from './Boolean';
import {SCSearchDistanceFilter} from './Distance';
import {SCSearchValueFilter} from './Value';
import {SCSearchAvailabilityFilter} from './filters/availability';
import {SCSearchBooleanFilter} from './filters/boolean';
import {SCSearchDistanceFilter} from './filters/distance';
import {SCSearchValueFilter} from './filters/value';
/**
* Filter instruction types

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingsField} from '../../Classes';
import {SCISO8601Date} from '../Time';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
import {SCISO8601Date} from '../../../general/time';
import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/**
* An availability filter

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter} from './Abstract';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments, SCSearchFilter} from '../filter';
/**
* A boolean filter

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,15 +14,15 @@
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson';
import {SCThingsField} from '../../Classes';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/**
* A distance filter
*
* Filter for documents that are in the given distance of the given location
*/
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCSearchAbstractFilterArguments> {
export interface SCSearchDistanceFilter extends SCSearchAbstractFilter<SCDistanceFilterArguments> {
/**
* @see SCSearchAbstractFilter.type
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingsField} from '../../Classes';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract';
import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/**
* Filters for documents that match the value on the given field

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCSearchContext} from '../../config/backend';
import {SCSearchFilter} from './filter';
import {SCSearchSort} from './sort';
/**
* A search query
*/
export interface SCSearchQuery {
/**
* The context name from where the search query was initiated
*/
context?: SCSearchContext;
/**
* A filter structure that combines any number of filters with boolean methods ('AND', 'OR', 'NOT')
*/
filter?: SCSearchFilter;
/**
* Number of things to skip in result set (paging)
*/
from?: number;
/**
* A term to search for
*/
query?: string;
/**
* Number of things to have in the result set (paging)
*/
size?: number;
/**
* A list of sorting parameters to order the result set by
*/
sort?: SCSearchSort[];
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,15 +12,8 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThings, SCThingsField} from '../../../Classes';
/**
* A search response
*
* @validatable
*/
export interface SCSearchResponse extends SCSearchResult {
}
import {SCThings} from '../../meta';
import {SCFacet} from './facet';
/**
* A search response
@@ -39,48 +32,18 @@ export interface SCSearchResult {
/**
* Pagination information
*/
pagination: SCSearchResponsePagination;
pagination: SCSearchResultPagination;
/**
* Stats of the search engine
*/
stats: SCSearchResponseSearchEngineStats;
}
/**
* A search facet
*/
export interface SCFacet {
/**
* Buckets for the aggregation
*/
buckets: SCFacetBucket[];
/**
* Field of the aggregation
*/
field: SCThingsField;
}
/**
* A bucket of a facet
*/
export interface SCFacetBucket {
/**
* Count of matching search results
*/
count: number;
/**
* Key of a bucket
*/
key: string;
stats: SCSearchResultSearchEngineStats;
}
/**
* Stores information about Pagination
*/
export interface SCSearchResponsePagination {
export interface SCSearchResultPagination {
/**
* Count of given data. Same as data.length
*/
@@ -100,7 +63,7 @@ export interface SCSearchResponsePagination {
/**
* Statistics of search engine
*/
export interface SCSearchResponseSearchEngineStats {
export interface SCSearchResultSearchEngineStats {
/**
* Response time of the search engine in ms
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingsField} from '../../Classes';
import {SCMap} from '../Map';
import {SCDistanceSort} from './Distance';
import {SCDucetSort} from './Ducet';
import {SCPriceSort} from './Price';
import {SCMap} from '../../general/map';
import {SCThingsField} from '../../meta';
import {SCDistanceSort} from './sorts/distance';
import {SCDucetSort} from './sorts/ducet';
import {SCPriceSort} from './sorts/price';
/**
* Abstract sort instruction

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,7 +14,7 @@
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
/**
* Sort instruction to sort by distance

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
/**
* Sort instruction for ducet sort

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCSportCoursePriceGroup} from '../../things/DateSeries';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract';
import {SCSportCoursePriceGroup} from '../../../things/date-series';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
/**
* Sort instruction to sort by price

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCMetaTranslations} from '../../general/i18n';
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/**
* An academic degree without references
@@ -28,7 +28,7 @@ export interface SCAcademicDegreeWithoutReferences
/**
* The achievable academic degree with academic field specification
* (eg. Master of Science)
*
*
* @keyword
*/
academicDegreewithField: string;
@@ -36,7 +36,7 @@ export interface SCAcademicDegreeWithoutReferences
/**
* The achievable academic degree with academic field specification
* shorted (eg. M.Sc.).
*
*
* @keyword
*/
academicDegreewithFieldShort: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
import {SCMetaTranslations} from '../../general/i18n';
import {SCISO8601Date} from '../../general/time';
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/**
* An academic term without references
@@ -23,8 +23,9 @@ export interface SCAcademicTermWithoutReferences
extends SCThingWithoutReferences {
/**
* Short name of the academic term, using the given pattern
*
*
* @aggregatable
* @filterable
* @keyword
*/
acronym: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,18 +12,18 @@
* 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 {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCISO8601Date} from '../../general/time';
import {SCOrganizationWithoutReferences} from '../organization';
import {SCPersonWithoutReferences} from '../person';
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './ThingThatCanBeOffered';
} from './thing-that-can-be-offered';
/**
* A creative work without references
@@ -42,8 +42,9 @@ export interface SCCreativeWorkWithoutReferences
/**
* Keywords of the creative work
*
*
* @aggregatable
* @filterable
* @keyword
*/
keywords?: string[];
@@ -82,7 +83,7 @@ export interface SCCreativeWorkTranslatableProperties
extends SCThingTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
/**
* Translation of the keywords of the creative work
*
*
* @keyword
*/
keywords?: string[];
@@ -98,8 +99,8 @@ export class SCCreativeWorkMeta
*/
fieldTranslations = {
de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
authors: 'Authoren',
datePublished: 'Veröffentlichungsdatum',
inLanguages: 'verfügbare Übersetzungen',
@@ -107,8 +108,8 @@ export class SCCreativeWorkMeta
publishers: 'Verleger',
},
en: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
authors: 'authors',
datePublished: 'release date',
inLanguages: 'available Languages',
@@ -123,11 +124,11 @@ export class SCCreativeWorkMeta
fieldValueTranslations = {
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
},
en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
},
};
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,12 +12,12 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
import {SCCatalogWithoutReferences} from '../things/Catalog';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCSemesterWithoutReferences} from '../things/Semester';
import {SCMetaTranslations} from '../types/i18n';
import {SCCreativeWorkWithoutReferences} from './CreativeWork';
import {SCMetaTranslations} from '../../general/i18n';
import {SCCatalogWithoutReferences} from '../catalog';
import {SCPersonWithoutReferences} from '../person';
import {SCSemesterWithoutReferences} from '../semester';
import {SCCreativeWorkWithoutReferences} from './creative-work';
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/**
* An event without references
@@ -28,7 +28,7 @@ export interface SCEventWithoutReferences
* Maximum number of participants of the event
*
* A maximum number of people that can participate in the event.
*
*
* @integer
*/
maximumParticipants?: number;
@@ -37,7 +37,7 @@ export interface SCEventWithoutReferences
* Remaining attendee capacity of the event
*
* This number represents the remaining open spots.
*
*
* @integer
*/
remainingAttendeeCapacity?: number;
@@ -86,7 +86,7 @@ export class SCEventMeta
*/
fieldTranslations = {
de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
academicTerms: 'Semester',
catalogs: 'Verzeichnis',
creativeWorks: 'begleitende Werke',
@@ -96,7 +96,7 @@ export class SCEventMeta
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
},
en: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
academicTerms: 'academic terms',
catalogs: 'catalogs',
creativeWorks: 'related material',

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,10 +12,62 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
import {SCGeoInformation} from '../types/GeoInformation';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCPostalAddress} from '../types/PostalAddress';
// tslint:disable-next-line:no-implicit-dependencies
import {Point, Polygon} from 'geojson';
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCBuildingWithoutReferences} from '../building';
import {SCPointOfInterestWithoutReferences} from '../point-of-interest';
import {SCRoomWithoutReferences} from '../room';
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
/**
* Positional information
*/
export interface SCGeoInformation {
/**
* Center point of a place
*/
point: Point;
/**
* Shape of a place
*/
polygon?: Polygon;
}
/**
* A postal address
*/
export interface SCPostalAddress {
/**
* Country of the address
*/
addressCountry: string;
/**
* City of the address
*/
addressLocality: string;
/**
* State of the address
*/
addressRegion?: string;
/**
* Zip code of the address
*/
postalCode: string;
/**
* Optional post box number
*/
postOfficeBoxNumber?: string;
/**
* Street of the address - with house number!
*/
streetAddress: string;
}
/**
* A place without references
@@ -37,7 +89,7 @@ export interface SCPlaceWithoutReferences
/**
* Opening hours of the place
*
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
* @keyword
*/
@@ -106,3 +158,19 @@ export class SCPlaceWithoutReferencesMeta
},
};
}
/**
* Something that is or happens in a place
*
* !Important!
* This is not a SCThing.
*/
export interface SCInPlace {
/**
* Place the thing is or happens in
*/
inPlace?:
SCBuildingWithoutReferences
| SCPointOfInterestWithoutReferences
| SCRoomWithoutReferences;
}

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from '../Thing';
import {SCThing, SCThingUserOrigin, SCThingWithoutReferences} from './thing';
/**
* An encapsulation of the data (e.g. a thing) that is saved, which provides additional information.

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCInPlace} from '../types/Places';
import {SCMetaTranslations} from '../../general/i18n';
import {SCInPlace} from './place';
import {SCThing, SCThingMeta} from './thing';
/**
* A thing that is or happens in a place

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCMetaTranslations} from '../../general/i18n';
import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/**
* Types of payment that are accepted at a place.
@@ -52,11 +52,11 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
*/
fieldTranslations = {
de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
paymentsAccepted: 'Bezahlmethoden',
},
en: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
paymentsAccepted: 'accepted payment methods',
},
};
@@ -66,7 +66,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
*/
fieldValueTranslations = {
de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
paymentsAccepted: {
'cafeteria card': 'Mensakarte',
'cash': 'Bar',

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,12 +12,12 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
import {SCOrganizationWithoutReferences} from '../things/Organization';
import {SCPersonWithoutReferences} from '../things/Person';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCInPlace} from '../types/Places';
import {SCISO8601Date} from '../types/Time';
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCISO8601Date} from '../../general/time';
import {SCOrganizationWithoutReferences} from '../organization';
import {SCPersonWithoutReferences} from '../person';
import {SCInPlace} from './place';
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
/**
* Default price without distinction
@@ -25,7 +25,7 @@ import {SCISO8601Date} from '../types/Time';
export interface SCPriceGroup {
/**
* Default price of the thing
*
*
* @sortable price
* @float
*/
@@ -39,7 +39,7 @@ export interface SCAcademicPriceGroup
extends SCPriceGroup {
/**
* Price for employees
*
*
* @sortable price
* @float
*/
@@ -47,7 +47,7 @@ export interface SCAcademicPriceGroup
/**
* Price for guests
*
*
* @sortable price
* @float
*/
@@ -55,7 +55,7 @@ export interface SCAcademicPriceGroup
/**
* Price for students
*
*
* @sortable price
* @float
*/
@@ -127,7 +127,7 @@ export interface SCThingThatCanBeOfferedTranslatableProperties
extends SCThingTranslatableProperties {
/**
* Availability of an offer
*
*
* @keyword
*/
'offers[].availability'?: string;
@@ -152,8 +152,8 @@ export type SCThingThatCanBeOfferedAvailability =
/**
* Meta information about a thing without references that accepts payments
*/
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
SCMetaTranslations<SCThingThatCanBeOffered<T>> {
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
implements SCMetaTranslations<SCThingThatCanBeOffered<T>> {
/**
* Instance
@@ -165,11 +165,11 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
*/
fieldTranslations = {
de: {
... SCThingMeta.getInstance().fieldTranslations.de,
...SCThingMeta.getInstance().fieldTranslations.de,
offers: 'Angebote',
},
en: {
... SCThingMeta.getInstance().fieldTranslations.en,
...SCThingMeta.getInstance().fieldTranslations.en,
offers: 'offers',
},
};
@@ -177,12 +177,12 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
/**
* Translations of values of fields
*/
fieldValueTranslations = {
fieldValueTranslations = {
de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
},
en: {
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
},
};
@@ -196,7 +196,9 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
}
return SCThingThatCanBeOfferedMeta._instance
.get(this.name) as SCThingThatCanBeOfferedMeta<T>;
.get(this.name) as SCThingThatCanBeOfferedMeta<T>;
}
protected constructor() {
}
protected constructor() {}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCMap} from '../types/Map';
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCMap} from '../../general/map';
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
/**
* A thing without references with categories
@@ -26,9 +26,10 @@ export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWith
extends SCThingWithoutReferences {
/**
* Categories of a thing with categories
*
*
* @sortable ducet
* @aggregatable
* @filterable
*/
categories: T[];
@@ -75,35 +76,35 @@ export interface SCThingWithCategoriesTranslatableProperties
export interface SCThingWithCategoriesSpecificValues {
/**
* Category specific alternate names of a thing
*
*
* @keyword
*/
alternateNames?: string[];
/**
* Category specific description of a thing
*
*
* @text
*/
description?: string;
/**
* URL of a category specific image of a thing
*
*
* @keyword
*/
image?: string;
/**
* Category specific name of a thing
*
*
* @text
*/
name?: string;
/**
* Category specific URL of a thing
*
*
* @keyword
*/
url?: string;
@@ -156,11 +157,11 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
if (!SCThingWithCategoriesWithoutReferencesMeta._instance.has(this.name)) {
SCThingWithCategoriesWithoutReferencesMeta._instance
.set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>());
.set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>());
}
return SCThingWithCategoriesWithoutReferencesMeta._instance
.get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>;
.get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>;
}
protected constructor() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCOrganizationWithoutReferences} from './things/Organization';
import {SCPersonWithoutReferences} from './things/Person';
import {SCMetaTranslations, SCTranslations} from './types/i18n';
import {SCISO8601Date} from './types/Time';
import {SCUuid} from './types/UUID';
import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCISO8601Date} from '../../general/time';
import {SCUuid} from '../../general/uuid';
import {SCOrganizationWithoutReferences} from '../organization';
import {SCPersonWithoutReferences} from '../person';
/**
* Types a thing can be
@@ -54,7 +54,7 @@ export enum SCThingType {
export interface SCThingWithoutReferences {
/**
* Alternate names of the thing
*
*
* @keyword
*/
alternateNames?: string[];
@@ -67,7 +67,7 @@ export interface SCThingWithoutReferences {
description?: string;
/**
* URL of an image of the thing
*
*
* @keyword
*/
image?: string;
@@ -87,8 +87,9 @@ export interface SCThingWithoutReferences {
translations?: SCTranslations<SCThingTranslatableProperties>;
/**
* Type of the thing
*
*
* @sortable ducet
* @filterable
* @aggregatable
*/
type: SCThingType;
@@ -153,7 +154,7 @@ export interface SCThingRemoteOrigin extends SCThingOrigin {
/**
* Name of the origin
*
*
* @text
*/
name: string;
@@ -212,13 +213,13 @@ export interface SCThingUserOrigin extends SCThingOrigin {
export interface SCThingTranslatableProperties {
/**
* Translation of the description of the thing
*
*
* @text
*/
description?: string;
/**
* Translation of the name of the thing
*
*
* @text
*/
name?: string;
@@ -234,7 +235,7 @@ export interface SCThingTranslatableProperties {
export interface SCThingTranslatablePropertyOrigin {
/**
* Translation of the name of the origin
*
*
* @text
*/
name: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from '../base/Event';
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
} from './abstract/thing-with-categories';
/**
* An academic event without references
@@ -31,15 +31,16 @@ export interface SCAcademicEventWithoutReferences
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
/**
* Majors of the academic event that this event belongs to
*
*
* @aggregatable
* @filterable
* @keyword
*/
majors?: string[];
/**
* Original unmapped category from the source of the academic event
*
*
* @keyword
*/
originalCategory?: string;
@@ -92,6 +93,7 @@ export type SCAcademicEventCategories =
| 'course'
| 'practicum introduction'
| 'excursion'
| 'exercise'
| 'special';
/**
@@ -101,14 +103,14 @@ export interface SCAcademicEventTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties {
/**
* Translations of the majors of the academic event that this event belongs to
*
*
* @keyword
*/
majors?: string[];
/**
* Translation of the original unmapped category from the source of the academic event
*
*
* @keyword
*/
originalCategory?: string;
@@ -126,19 +128,15 @@ export class SCAcademicEventMeta
fieldTranslations = {
de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
majors: 'Hauptfächer',
originalCategory: 'ursprüngliche Kategorie',
},
en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
majors: 'majors',
originalCategory: 'original category',
},
@@ -150,15 +148,14 @@ export class SCAcademicEventMeta
fieldValueTranslations = {
de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
categories: {
'colloquium': 'Kolloquium',
'course': 'Kurs',
'excursion': 'Exkursion',
'integrated course': '',
'exercise': 'Übung',
'integrated course': 'Integrierter Kurs',
'introductory class': 'Einführungsveranstaltung',
'lecture': 'Vorlesung',
'oral exam': 'mündliche Prüfung',
@@ -174,10 +171,8 @@ export class SCAcademicEventMeta
},
en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
type: SCThingType.AcademicEvent,
},
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,21 +12,21 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {
SCCreativeWork,
SCCreativeWorkMeta,
SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork';
} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
} from './abstract/thing-with-categories';
/**
* An article without references
@@ -36,7 +36,7 @@ export interface SCArticleWithoutReferences
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
/**
* Article itself as markdown
*
*
* @text
*/
articleBody: string;
@@ -84,7 +84,7 @@ export interface SCArticleTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
/**
* Translation of the article itself as markdown
*
*
* @text
*/
articleBody?: string[];
@@ -102,19 +102,15 @@ export class SCArticleMeta
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
articleBody: 'Artikelinhalt',
},
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
articleBody: 'article body',
},
};
@@ -126,10 +122,8 @@ export class SCArticleMeta
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
categories: {
'unipedia': 'Unipedia',
},
@@ -138,10 +132,8 @@ export class SCArticleMeta
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCArticleCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
type: SCThingType.Article,
},
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {
SCCreativeWork,
SCCreativeWorkMeta,
SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork';
import {SCThingWithCategoriesTranslatableProperties} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCPersonWithoutReferences} from './Person';
} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingWithCategoriesTranslatableProperties} from './abstract/thing-with-categories';
import {SCPersonWithoutReferences} from './person';
/**
* A book without references
@@ -30,21 +30,21 @@ export interface SCBookWithoutReferences
extends SCCreativeWorkWithoutReferences {
/**
* Edition of a book
*
*
* @keyword
*/
bookEdition?: string;
/**
* ISBN of a book
*
*
* @keyword
*/
isbn: string;
/**
* Number of pages of a book
*
*
* @integer
*/
numberOfPages?: number;
@@ -91,7 +91,7 @@ export interface SCBookTranslatableFields
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
/**
* Translation of an edition of a book
*
*
* @keyword
*/
bookEdition?: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,21 +12,21 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {
SCPlace,
SCPlaceWithoutReferences,
SCPlaceWithoutReferencesMeta,
SCPlaceWithoutReferencesTranslatableProperties,
} from '../base/Place';
} from './abstract/place';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
} from './abstract/thing-with-categories';
export type SCBuildingCategories =
'cafe'
@@ -43,15 +43,16 @@ export interface SCBuildingWithoutReferences
SCPlaceWithoutReferences {
/**
* Categories of a building
*
*
* @sortable ducet
* @aggregatable
* @filterable
*/
categories: SCBuildingCategories[];
/**
* List of floor names of the place
*
*
* @keyword
*/
floors?: string[];
@@ -106,23 +107,15 @@ export class SCBuildingMeta
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
floors: 'Etagen',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
floors: 'floors',
},
};
@@ -132,13 +125,9 @@ export class SCBuildingMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
categories: {
'cafe': 'Café',
'canteen': 'Kantine',
@@ -152,13 +141,9 @@ export class SCBuildingMeta
type: 'Gebäude',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCBuildingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
type: SCThingType.Building,
},
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCAcademicTermWithoutReferences} from './abstract/academic-term';
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
} from './abstract/thing-with-categories';
/**
* A catalog without references
@@ -32,7 +32,7 @@ export interface SCCatalogWithoutReferences
* Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.)
*
* Needed for keeping order in catalog inheritance array.
*
*
* @integer
*/
level: number;
@@ -46,7 +46,7 @@ export interface SCCatalogWithoutReferences
/**
* A catalog
*
* @validatable
* @validatable
* @indexable
*/
export interface SCCatalog
@@ -88,20 +88,16 @@ export class SCCatalogMeta
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
academicTerm: 'Semester',
level: 'Ebene',
superCatalog: 'übergeordnetes Verzeichniss',
superCatalogs: 'übergeordnete Verzeichnisse',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
academicTerm: 'academic term',
level: 'level',
superCatalog: 'parent catalog',
@@ -114,20 +110,16 @@ export class SCCatalogMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
categories: {
'university events': 'Universitätsveranstaltung',
},
type: 'Verzeichnis',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCCatalogCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
type: SCThingType.Catalog,
},
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,18 +12,18 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from '../base/AcademicDegree';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from './abstract/academic-degree';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCDateSeriesWithoutReferences} from './DateSeries';
import {SCOrganizationWithoutReferences} from './Organization';
} from './abstract/thing-that-can-be-offered';
import {SCDateSeriesWithoutReferences} from './date-series';
import {SCOrganizationWithoutReferences} from './organization';
/**
* A course of studies without references
@@ -38,7 +38,7 @@ export interface SCCourseOfStudiesWithoutReferences
/**
* Actual major of the course of studies (eg. physics)
*
*
* @keyword
*/
major: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,20 +12,20 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCISO8601Date, SCISO8601Duration} from '../general/time';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCISO8601Date, SCISO8601Duration} from '../types/Time';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCPersonWithoutReferences} from './Person';
import {SCSportCourseWithoutReferences} from './SportCourse';
} from './abstract/thing-that-can-be-offered';
import {SCAcademicEventWithoutReferences} from './academic-event';
import {SCPersonWithoutReferences} from './person';
import {SCSportCourseWithoutReferences} from './sport-course';
/**
* Price groups for sport courses
@@ -34,7 +34,7 @@ export interface SCSportCoursePriceGroup
extends SCAcademicPriceGroup {
/**
* Price for alumnis
*
*
* @float
*/
alumni?: number;
@@ -62,7 +62,7 @@ export interface SCDateSeriesWithoutReferences
/**
* Frequency of the date series
*
*
* @keyword
*/
frequency: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -13,10 +13,10 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import * as jsonpatch from 'json-patch';
import {SCThingsWithoutDiff} from '../Classes';
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
import {SCMetaTranslations} from '../general/i18n';
import {SCISO8601Date} from '../general/time';
import {SCThingsWithoutDiff} from '../meta';
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
/**
* A diff without references

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,22 +12,22 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
} from './abstract/thing-that-can-be-offered';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
} from './abstract/thing-with-categories';
/**
* A dish without references
@@ -37,16 +37,17 @@ export interface SCDishWithoutReferences
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
/**
* Additives of the dish
*
*
* @keyword
*/
additives?: string[];
/**
* Category of the dish
*
*
* @sortable ducet
* @aggregatable
* @filterable
*/
categories: SCDishCategories[];
@@ -110,14 +111,14 @@ export interface SCDishTranslatableProperties
export interface SCDishCharacteristic {
/**
* URL of an image of the characteristic
*
*
* @keyword
*/
image?: string;
/**
* Name of the characteristic
*
*
* @text
*/
name: string;
@@ -142,49 +143,49 @@ export type SCDishCategories =
export interface SCNutritionInformation {
/**
* Number of calories contained (in kcal)
*
*
* @float
*/
calories?: number;
/**
* Content of carbohydrates (in grams)
*
*
* @float
*/
carbohydrateContent?: number;
/**
* Content of fat (in grams)
*
*
* @float
*/
fatContent?: number;
/**
* Content of proteins (in grams)
*
*
* @float
*/
proteinContent?: number;
/**
* Content of salt (in grams)
*
*
* @float
*/
saltContent?: number;
/**
* Content of saturated fat (in grams)
*
*
* @float
*/
saturatedFatContent?: number;
/**
* Content of sugar (in grams)
*
*
* @float
*/
sugarContent?: number;
@@ -201,10 +202,8 @@ export class SCDishMeta
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
additives: 'Zusatzstoffe',
@@ -213,10 +212,8 @@ export class SCDishMeta
nutrition: 'Nährwertangaben',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.en,
additives: 'additives',
@@ -231,10 +228,8 @@ export class SCDishMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.de,
categories: {
@@ -248,10 +243,8 @@ export class SCDishMeta
type: 'Essen',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCDishCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.en,
type: SCThingType.Dish,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,17 +12,17 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCSaveableThing, SCSaveableThingWithoutReferences} from '../base/SaveableThing';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCArticleWithoutReferences} from './Article';
import {SCBookWithoutReferences} from './Book';
import {SCBuildingWithoutReferences} from './Building';
import {SCPersonWithoutReferences} from './Person';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
import {SCRoomWithoutReferences} from './Room';
import {SCSportCourseWithoutReferences} from './SportCourse';
import {SCToDoWithoutReferences} from './ToDo';
import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-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)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,11 +14,11 @@
*/
// tslint:disable-next-line:no-implicit-dependencies
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
import {SCRoomWithoutReferences} from './Room';
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
import {SCRoomWithoutReferences} from './room';
/**
* A floor without references
@@ -27,7 +27,7 @@ export interface SCFloorWithoutReferences
extends SCThingWithoutReferences {
/**
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
*
*
* @text
*/
floorName: string;
@@ -82,7 +82,8 @@ export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject>
* A feature with a place
*/
export interface SCFloorFeatureWithPlace<T extends GeometryObject>
extends Feature<T> {
// tslint:disable-next-line:no-any TODO
extends Feature<T, any> {
/**
* The place of the feature
*/
@@ -96,7 +97,7 @@ export interface SCFloorTranslatableProperties
extends SCThingTranslatableProperties {
/**
* Translation of the floor name
*
*
* @text
*/
floorName?: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,16 +12,17 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCISO8601Date} from '../general/time';
import {
SCCreativeWork,
SCCreativeWorkMeta,
SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork';
import {SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
import {SCOrganizationWithoutReferences} from './organization';
/**
* A message without references
@@ -29,7 +30,12 @@ import {SCISO8601Date} from '../types/Time';
export interface SCMessageWithoutReferences
extends SCCreativeWorkWithoutReferences {
/**
* Audience of the message
* Organizational unit for which the message is intended
*/
audienceOrganizations?: SCOrganizationWithoutReferences[];
/**
* Roles for which the message is intended
*/
audiences: SCMessageAudience[];
@@ -40,7 +46,7 @@ export interface SCMessageWithoutReferences
/**
* Message itself
*
*
* @text
*/
messageBody: string;
@@ -90,7 +96,7 @@ export interface SCMessageTranslatableProperties
extends SCCreativeWorkTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
/**
* Message itself
*
*
* @text
*/
messageBody?: string;
@@ -109,6 +115,7 @@ export class SCMessageMeta
de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de,
audienceOrganizations: 'Zielgruppenorganisationen',
audiences: 'Zielgruppen',
dateCreated: 'Erstellungsdatum',
messageBody: 'Nachrichteninhalt',
@@ -116,6 +123,7 @@ export class SCMessageMeta
en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en,
audienceOrganizations: 'audience organizations',
audiences: 'audiences',
dateCreated: 'date created',
messageBody: 'message body',

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCMetaTranslations} from '../general/i18n';
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
/**
* An organization without references

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,13 +12,13 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations, SCNationality} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
import {SCBuildingWithoutReferences} from './Building';
import {SCOrganizationWithoutReferences} from './Organization';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
import {SCRoomWithoutReferences} from './Room';
import {SCMetaTranslations, SCNationality} from '../general/i18n';
import {SCISO8601Date} from '../general/time';
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCBuildingWithoutReferences} from './building';
import {SCOrganizationWithoutReferences} from './organization';
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
import {SCRoomWithoutReferences} from './room';
/**
* A person without references
@@ -27,7 +27,7 @@ export interface SCPersonWithoutReferences
extends SCThingWithoutReferences {
/**
* Additional first names of the person.
*
*
* @keyword
*/
additionalName?: string;
@@ -41,21 +41,21 @@ export interface SCPersonWithoutReferences
* The private email address of the person.
*
* @TJS-format email
*
*
* @keyword
*/
email?: string;
/**
* The family name of the person.
*
*
* @keyword
*/
familyName: string;
/**
* The private fax number of the person.
*
*
* @keyword
*/
faxNumber?: string;
@@ -67,35 +67,35 @@ export interface SCPersonWithoutReferences
/**
* The first name of the person.
*
*
* @keyword
*/
givenName: string;
/**
* Honorific prefix of the person.
*
*
* @keyword
*/
honorificPrefix?: string;
/**
* Honorific suffix of the person.
*
*
* @keyword
*/
honorificSuffix?: string;
/**
* Titles of jobs that the person has.
*
*
* @keyword
*/
jobTitles?: string[];
/**
* The complete name of the person combining all the parts of the name into one.
*
*
* @text
*/
name: string;
@@ -107,7 +107,7 @@ export interface SCPersonWithoutReferences
/**
* The private telephone number of the person.
*
*
* @keyword
*/
telephone?: string;
@@ -231,35 +231,35 @@ export interface SCContactPoint {
/**
* E-mail at the work location
*
*
* @keyword
*/
email?: string;
/**
* Fax number at the work location
*
*
* @keyword
*/
faxNumber?: string;
/**
* Times available for contacting at the work location
*
*
* @keyword
*/
hoursAvailable?: string;
/**
* Contact number at the work location
*
*
* @keyword
*/
telephone?: string;
/**
* URL at the work location
*
*
* @keyword
*/
url?: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,17 +12,17 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from './abstract/place';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
} from './abstract/thing-with-categories';
/**
* A point of interest without references
@@ -82,24 +82,16 @@ export class SCPointOfInterestMeta
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
},
@@ -110,13 +102,9 @@ export class SCPointOfInterestMeta
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
categories: {
'card charger': 'Kartenaufwerter',
'computer': 'Computer',
@@ -127,13 +115,9 @@ export class SCPointOfInterestMeta
type: 'Sonderziel',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
type: SCThingType.PointOfInterest,
},
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,24 +12,24 @@
* 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 {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCMap} from '../general/map';
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from './abstract/place';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
import {
SCThingThatAcceptsPayments,
SCThingThatAcceptsPaymentsWithoutReferences,
SCThingThatAcceptsPaymentsWithoutReferencesMeta,
} from '../base/ThingThatAcceptsPayments';
} from './abstract/thing-that-accepts-payments';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCMap} from '../types/Map';
} from './abstract/thing-with-categories';
/**
* Categories of a room
@@ -57,7 +57,7 @@ export interface SCRoomWithoutReferences
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
/**
* The name of the floor in which the room is in.
*
*
* @text
*/
floorName?: string;
@@ -109,7 +109,7 @@ export interface SCRoomSpecificValues
extends SCThingWithCategoriesSpecificValues {
/**
* Category specific opening hours of the room
*
*
* @keyword
*/
openingHours?: string;
@@ -126,32 +126,22 @@ export class SCRoomMeta
*/
fieldTranslations = {
de: {
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
SCThingThatAcceptsPaymentsWithoutReferencesMeta
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
.fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de,
floorName: 'Etagenbezeichnung',
inventory: 'Bestand',
},
en: {
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
SCThingThatAcceptsPaymentsWithoutReferencesMeta
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
.fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en,
floorName: 'floor name',
@@ -164,16 +154,11 @@ export class SCRoomMeta
*/
fieldValueTranslations = {
de: {
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
SCThingThatAcceptsPaymentsWithoutReferencesMeta
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
.fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de,
categories: {
@@ -194,16 +179,11 @@ export class SCRoomMeta
type: 'Raum',
},
en: {
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<
SCThingThatAcceptsPaymentsWithoutReferencesMeta
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
.fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCRoomSpecificValues>().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en,
type: SCThingType.Room,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,13 +12,13 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations} from '../general/i18n';
import {
SCAcademicTerm,
SCAcademicTermWithoutReferences,
SCAcademicTermWithoutReferencesMeta,
} from '../base/AcademicTerm';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
} from './abstract/academic-term';
import {SCThingMeta, SCThingType} from './abstract/thing';
/**
* A semester without references
@@ -64,9 +64,7 @@ export class SCSemesterMeta
*/
fieldTranslations = {
de: {
...SCAcademicTermWithoutReferencesMeta.getInstance<
SCAcademicTermWithoutReferencesMeta
>().fieldTranslations.de,
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.de,
acronym: 'Abkürzung',
endDate: 'Ende',
eventsEndDate: 'Vorlesungsschluss',
@@ -74,9 +72,7 @@ export class SCSemesterMeta
startDate: 'Beginn',
},
en: {
...SCAcademicTermWithoutReferencesMeta.getInstance<
SCAcademicTermWithoutReferencesMeta
>().fieldTranslations.en,
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.en,
acronym: 'acronym',
endDate: 'end date',
eventsEndDate: 'semester ending',
@@ -90,15 +86,13 @@ export class SCSemesterMeta
*/
fieldValueTranslations = {
de: {
...SCAcademicTermWithoutReferencesMeta.getInstance<
SCAcademicTermWithoutReferencesMeta
>().fieldValueTranslations.de,
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
.fieldValueTranslations.de,
type: 'Semester',
},
en: {
...SCAcademicTermWithoutReferencesMeta.getInstance<
SCAcademicTermWithoutReferencesMeta
>().fieldValueTranslations.en,
...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
.fieldValueTranslations.en,
type: SCThingType.Semester,
},
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,15 +12,15 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
} from './abstract/thing-with-categories';
/**
* A setting without references
@@ -41,7 +41,7 @@ export interface SCSettingWithoutReferences
inputType: SCSettingInputType;
/**
* The order number this setting should show up in its category list
*
*
* @integer
*/
order: number;
@@ -118,7 +118,7 @@ export type SCSettingValues = SCSettingValue[];
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
/**
* The translations of the possible values of a setting
*
*
* @keyword
*/
values?: string[];
@@ -133,10 +133,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
defaultValue: 'Standard Wert',
inputType: 'Eingabetyp',
order: 'Position',
@@ -144,10 +142,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
values: 'Werte',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
defaultValue: 'default value',
inputType: 'input type',
order: 'position',
@@ -161,10 +157,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/
fieldValueTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
categories: {
credentials: 'Anmeldedaten',
others: 'Andere',
@@ -181,10 +175,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
type: 'Einstellung',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCSettingCategories,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
type: SCThingType.Setting,
},
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from '../base/Event';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCMetaTranslations} from '../general/i18n';
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
import {SCThingMeta, SCThingType} from './abstract/thing';
/**
* A sport course without references

View File

@@ -12,19 +12,19 @@
* 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 {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCMap} from '../general/map';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCMap} from '../types/Map';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCOrganizationWithoutReferences} from './Organization';
import {SCPersonWithoutReferences} from './Person';
} from './abstract/thing-that-can-be-offered';
import {SCAcademicEventWithoutReferences} from './academic-event';
import {SCOrganizationWithoutReferences} from './organization';
import {SCPersonWithoutReferences} from './person';
/**
* A study module without references
@@ -34,7 +34,7 @@ export interface SCStudyModuleWithoutReferences
/**
* ECTS points (European Credit Transfer System)
*
*
* @float
*/
ects: number;
@@ -46,7 +46,7 @@ export interface SCStudyModuleWithoutReferences
/**
* Majors that this study module is meant for
*
*
* @keyword
*/
majors: string[];
@@ -116,7 +116,7 @@ export interface SCStudyModuleTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
/**
* Translations of the majors that this study module is meant for
*
*
* @keyword
*/
majors?: string[];

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,10 +12,10 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace';
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCISO8601Duration} from '../types/Time';
import {SCMetaTranslations} from '../general/i18n';
import {SCISO8601Duration} from '../general/time';
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
/**
* A ticket without references
@@ -29,7 +29,7 @@ export interface SCTicketWithoutReferences
/**
* Waiting number of the ticket
*
*
* @keyword
*/
currentTicketNumber: string;

View File

@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCISO8601Date} from '../general/time';
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
} from './abstract/thing-with-categories';
/**
* A "to do" without references
@@ -86,19 +86,15 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
*/
fieldTranslations = {
de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
string,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
done: 'Erledigt',
dueDate: 'Fälligkeitsdatum',
priority: 'Priorität',
},
en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
string,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
done: 'done',
dueDate: 'due date',
priority: 'priority',

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCMetaTranslations} from '../general/i18n';
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
/**
* A tour without references
@@ -22,21 +22,21 @@ export interface SCTourWithoutReferences
extends SCThingWithoutReferences {
/**
* Init script for the tour
*
*
* @text
*/
init?: string;
/**
* Steps of a tour
*
*
* @keyword
*/
steps: SCTourStep[];
/**
* Type of a tour
*
*
* @keyword
*/
type: SCThingType.Tour;
@@ -107,7 +107,7 @@ export type SCTourStep =
export interface SCTourStepLocation {
/**
* Location to go to
*
*
* @keyword
*/
location: string;
@@ -129,7 +129,7 @@ export interface SCTourStepTooltip {
/**
* Element that the tooltip shall be pointing at or a list of elements to try in the specified order
*
*
* @keyword
*/
element: string | string[];
@@ -146,14 +146,14 @@ export interface SCTourStepTooltip {
/**
* Text that the tooltip shall contain
*
*
* @text
*/
text: string;
/**
* How often it shall be retried
*
*
* @integer
*/
tries?: number;
@@ -190,7 +190,7 @@ export interface SCTourStepMenu {
export interface SCTourResolvedElement {
/**
* Element name
*
*
* @keyword
*/
element: string;
@@ -202,7 +202,7 @@ export interface SCTourResolvedElement {
export interface SCTourResolvedEvent {
/**
* Event name
*
*
* @keyword
*/
event: string;
@@ -224,7 +224,7 @@ export interface SCTourResolvedLocation {
export interface SCTourResolvedLocationTypeIs {
/**
* Specific location name
*
*
* @keyword
*/
is: string;
@@ -236,7 +236,7 @@ export interface SCTourResolvedLocationTypeIs {
export interface SCTourResolvedLocationTypeMatch {
/**
* Regex location name
*
*
* @keyword
*/
match: string;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019 StApps
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCCreativeWork, SCCreativeWorkMeta, SCCreativeWorkWithoutReferences} from '../base/CreativeWork';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCLanguage, SCMetaTranslations} from '../types/i18n';
import {SCISO8601Duration} from '../types/Time';
import {SCPersonWithoutReferences} from './Person';
import {SCLanguage, SCMetaTranslations} from '../general/i18n';
import {SCISO8601Duration} from '../general/time';
import {SCCreativeWork, SCCreativeWorkMeta, SCCreativeWorkWithoutReferences} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCPersonWithoutReferences} from './person';
/**
* A video without references
@@ -35,7 +35,7 @@ export interface SCVideoWithoutReferences
/**
* URLs to a thumbnails for the Video
*
*
* @keyword
*/
thumbnails?: string[];
@@ -47,7 +47,7 @@ export interface SCVideoWithoutReferences
/**
* A Transcript of the Video
*
*
* @text
*/
transcript?: string;
@@ -61,7 +61,7 @@ export interface SCVideoWithoutReferences
export interface SCVideoSource {
/**
* Pixel Height of the Video
*
*
* @integer
*/
height?: number;
@@ -73,21 +73,21 @@ export interface SCVideoSource {
/**
* Size of the Video File in bytes
*
*
* @integer
*/
size?: number;
/**
* URL to the Video File
*
*
* @keyword
*/
url: string;
/**
* Pixel Width of the Video
*
*
* @integer
*/
width?: number;
@@ -106,7 +106,7 @@ export interface SCVideoTrack {
/**
* URL to the Track File
*
*
* @keyword
*/
url: string;

View File

@@ -12,14 +12,12 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCClasses} from './Classes';
import {SCThing, SCThingType} from './Thing';
import {isThing} from './types/Guards';
import {SCTranslations} from './types/i18n';
import clone = require('fast-clone');
import {Defined, OCType} from 'ts-optchain';
import {SCTranslations} from './general/i18n';
import {isThing} from './guards';
import {SCClasses} from './meta';
import {SCThing, SCThingType} from './things/abstract/thing';
// tslint:disable:no-any
const standardCacheSize = 200;
@@ -33,7 +31,6 @@ export class SCThingTranslator {
* Property representing the translators target language
*/
private _language: keyof SCTranslations<SCThing>;
/**
* Property representing the translators base language
* This means every translation is given for this language
@@ -45,7 +42,7 @@ export class SCThingTranslator {
*/
private readonly metaClasses: typeof SCClasses;
/**
/**
* @example
* // returns translator instance for german
* new SCThingTranslator('de');
@@ -115,17 +112,17 @@ export class SCThingTranslator {
// Assigns every property in fieldTranslations to the known base language translation
if (typeof metaClass.fieldTranslations.en !== 'undefined') {
Object.keys(metaClass.fieldTranslations.en)
.forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
});
.forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
});
}
// Assigns every property in fieldTranslations to the known translation in given language
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldTranslations[language])
.forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
});
.forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
});
}
return fieldTranslations;
@@ -161,19 +158,19 @@ export class SCThingTranslator {
}
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldValueTranslations[language])
.forEach((key) => {
if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
// Assigns known translations of subproperties to property in given language (e.g. categories)
Object.keys((instance as any)[key])
.forEach((subKey) => {
(instance as any)[key][subKey] =
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
});
} else {
// Assigns property to known translation of fieldValueTranslations in given language
(instance as any)[key] = metaClass.fieldValueTranslations[language][key];
}
});
.forEach((key) => {
if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
// Assigns known translations of subproperties to property in given language (e.g. categories)
Object.keys((instance as any)[key])
.forEach((subKey) => {
(instance as any)[key][subKey] =
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
});
} else {
// Assigns property to known translation of fieldValueTranslations in given language
(instance as any)[key] = metaClass.fieldValueTranslations[language][key];
}
});
}
return instance;
@@ -241,14 +238,14 @@ export class SCThingTranslator {
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) {
.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') {
@@ -265,7 +262,7 @@ export class SCThingTranslator {
}
/**
* LRUCache class
* LRUCache class
* Small last recently used cache intended to get used by SCThingTranslator
*/
class LRUCache<T> {
@@ -279,7 +276,7 @@ class LRUCache<T> {
*/
private readonly maxEntries: number;
/**
/**
* @example
* // returns LRUCache instance with a maximum capacity of 500
* new LRUCache(500);
@@ -308,7 +305,7 @@ class LRUCache<T> {
/**
* Get content from cache by key or by another objects uid
*
* @param somethingOrKey The key which maps to the cached content or an object for which content has been cached
* @param somethingOrKey The key which maps to the cached content or an object for which content has been cached
* @returns If available the content connected to the key or somethingOrKey.uid property
*/
public get<U extends SCThing>(somethingOrKey: string | U): T | undefined {
@@ -341,7 +338,7 @@ class LRUCache<T> {
if (this.entries.size >= this.maxEntries) {
// LRU behavior
const keyToDelete = this.entries.keys()
.next().value;
.next().value;
this.entries.delete(keyToDelete);
}
this.entries.set(key, content);
@@ -349,10 +346,10 @@ class LRUCache<T> {
/**
* Place content in cache by another objects uid
*
*
* @param something The object that should be cached under something.uid
*/
public putObject<U extends SCThing>(something: U) {
this.put(something.uid, (something as any) as T);
this.put(something.uid, (something as any) as T);
}
}

View File

@@ -14,18 +14,18 @@
*/
import {expect} from 'chai';
import {slow, suite, test, timeout} from 'mocha-typescript';
import {SCBulkResponse} from '../src/core/protocol/routes/bulk/BulkResponse';
import {SCMultiSearchResponse} from '../src/core/protocol/routes/search/MultiSearchResponse';
import {SCSearchResponse} from '../src/core/protocol/routes/search/SearchResponse';
import {SCThingOriginType, SCThingType} from '../src/core/Thing';
import {SCDish} from '../src/core/things/Dish';
import {SCBulkResponse} from '../src/protocol/routes/bulk-request';
import {SCMultiSearchResponse} from '../src/protocol/routes/search-multi';
import {SCSearchResponse} from '../src/protocol/routes/search';
import {SCThingOriginType, SCThingType} from '../src/things/abstract/thing';
import {SCDish} from '../src/things/dish';
import {
isBulkResponse,
isMultiSearchResponse,
isSearchResponse,
isThing,
isThingWithTranslations,
} from '../src/core/types/Guards';
} from '../src/guards';
@suite(timeout(10000), slow(5000))
export class GuardsSpec {

View File

@@ -12,6 +12,11 @@
"audiences": [
"students"
],
"audienceOrganizations": [{
"name": "TU Berlin",
"type": "organization",
"uid": "4806ef14-b631-5c20-91d1-3c627decca5a"
}],
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",

View File

@@ -14,9 +14,9 @@
*/
import {expect} from 'chai';
import {slow, suite, test, timeout} from 'mocha-typescript';
import {SCBulkRoute} from '../src/core/protocol/routes/bulk/BulkRequest';
import {SCBulkAddRoute} from '../src/core/protocol/routes/bulk/UID/BulkAddRequest';
import {SCThingUpdateRoute} from '../src/core/protocol/routes/TYPE/UID/ThingUpdateRequest';
import {SCBulkRoute} from '../src/protocol/routes/bulk-request';
import {SCBulkAddRoute} from '../src/protocol/routes/bulk-add';
import {SCThingUpdateRoute} from '../src/protocol/routes/thing-update';
@suite(timeout(10000), slow(5000))
export class RoutesSpec {

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