refactor: tidy structure of source files

Fixes #79
This commit is contained in:
Karl-Philipp Wulfert
2019-06-19 15:04:59 +02:00
parent 5de9bf3794
commit ceab7cc7ef
99 changed files with 1395 additions and 1511 deletions

99
package-lock.json generated
View File

@@ -146,9 +146,9 @@
"dev": true "dev": true
}, },
"@openstapps/configuration": { "@openstapps/configuration": {
"version": "0.18.0", "version": "0.20.0",
"resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.18.0.tgz", "resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.20.0.tgz",
"integrity": "sha512-Ufi3jzCozVqCymNeaeRzuOHO2Yd5qXJ10uF4xNHk6Q4LFD9NAMMBkYbawkjmecZoNR+Llqs4AnwSxIkuEAxcxA==", "integrity": "sha512-BDgltSBmGQosJmVm1QWVvIw+GTWd0FbmCLxtuziuVdIOK520mGLhoaDrLKTEIAfNtemqxxe90J4/G9JcRiIK+w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "10.14.7", "@types/node": "10.14.7",
@@ -156,8 +156,8 @@
"@types/yaml": "1.0.2", "@types/yaml": "1.0.2",
"chalk": "2.4.2", "chalk": "2.4.2",
"commander": "2.20.0", "commander": "2.20.0",
"semver": "6.1.0", "semver": "6.1.1",
"tslint": "5.16.0", "tslint": "5.17.0",
"tslint-eslint-rules": "5.4.0", "tslint-eslint-rules": "5.4.0",
"yaml": "1.6.0" "yaml": "1.6.0"
}, },
@@ -169,39 +169,10 @@
"dev": true "dev": true
}, },
"semver": { "semver": {
"version": "6.1.0", "version": "6.1.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.1.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz",
"integrity": "sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ==", "integrity": "sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ==",
"dev": true "dev": true
},
"tslint": {
"version": "5.16.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz",
"integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
"builtin-modules": "^1.1.1",
"chalk": "^2.3.0",
"commander": "^2.12.1",
"diff": "^3.2.0",
"glob": "^7.1.1",
"js-yaml": "^3.13.0",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tsutils": "^2.29.0"
},
"dependencies": {
"semver": {
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
"dev": true
}
}
} }
} }
}, },
@@ -293,37 +264,37 @@
} }
}, },
"@openstapps/logger": { "@openstapps/logger": {
"version": "0.2.1", "version": "0.3.1",
"resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-0.2.1.tgz", "resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-0.3.1.tgz",
"integrity": "sha512-6+F1nxEBuNTrd3hhBxKnvkH8B84HvB/dVmoMP9Pmv2g3mL3pYJ9l2BBGaACDRA7oUCyLpbNQw+4Kf+VdyzOttw==", "integrity": "sha512-N8S4b6yoS+txN1IduxDxOnlJzhrPKWEMnVt02ZbMjSOcD55KNqxh+VgarFTQ1g6KRkquTNCo6c9IQN0UzSIg0g==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "10.14.7", "@types/node": "10.14.8",
"@types/nodemailer": "6.1.0", "@types/nodemailer": "6.2.0",
"chalk": "2.4.2", "chalk": "2.4.2",
"flatted": "2.0.0", "flatted": "2.0.0",
"nodemailer": "6.1.1" "nodemailer": "6.2.1"
}, },
"dependencies": { "dependencies": {
"@types/node": { "@types/node": {
"version": "10.14.7", "version": "10.14.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.7.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.8.tgz",
"integrity": "sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A==", "integrity": "sha512-I4+DbJEhLEg4/vIy/2gkWDvXBOOtPKV9EnLhYjMoqxcRW+TTZtUftkHktz/a8suoD5mUL7m6ReLrkPvSsCQQmw==",
"dev": true "dev": true
}, },
"@types/nodemailer": { "@types/nodemailer": {
"version": "6.1.0", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.1.0.tgz", "resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.2.0.tgz",
"integrity": "sha512-WysSJ4sGW2Aum1Cs6HFosZdlR3WUzX0XoSLsI53q77gLd4wDfE84OXffZu5/nLIjeKh4SwfTsdrKsgBL9WowMA==", "integrity": "sha512-WGGEk/BGRLuYF3gyoTwbtKg5tCexZzb5lkTsis2k7GkAzlg4x2299/SC6Ssdj3X/5TzT1BHVc8zcFg/7KSzBLw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "*" "@types/node": "*"
} }
}, },
"nodemailer": { "nodemailer": {
"version": "6.1.1", "version": "6.2.1",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.1.1.tgz", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.2.1.tgz",
"integrity": "sha512-/x5MRIh56VyuuhLfcz+DL2SlBARpZpgQIf2A4Ao4hMb69MHSgDIMPwYmFwesGT1lkRDZ0eBSoym5+JoIZ3N+cQ==", "integrity": "sha512-TagB7iuIi9uyNgHExo8lUDq3VK5/B0BpbkcjIgNvxbtVrjNqq0DwAOTuzALPVkK76kMhTSzIgHqg8X1uklVs6g==",
"dev": true "dev": true
} }
} }
@@ -422,9 +393,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "10.14.8", "version": "10.14.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.8.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.9.tgz",
"integrity": "sha512-I4+DbJEhLEg4/vIy/2gkWDvXBOOtPKV9EnLhYjMoqxcRW+TTZtUftkHktz/a8suoD5mUL7m6ReLrkPvSsCQQmw==" "integrity": "sha512-NelG/dSahlXYtSoVPErrp06tYFrvzj8XLWmKA+X8x0W//4MqbUyZu++giUG/v0bjAT6/Qxa8IjodrfdACyb0Fg=="
}, },
"@types/nodemailer": { "@types/nodemailer": {
"version": "4.6.5", "version": "4.6.5",
@@ -3618,9 +3589,9 @@
} }
}, },
"ts-node": { "ts-node": {
"version": "8.2.0", "version": "8.3.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.2.0.tgz", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.3.0.tgz",
"integrity": "sha512-m8XQwUurkbYqXrKqr3WHCW310utRNvV5OnRVeISeea7LoCWVcdfeB/Ntl8JYWFh+WRoUAdBgESrzKochQt7sMw==", "integrity": "sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"arg": "^4.1.0", "arg": "^4.1.0",
@@ -3696,9 +3667,9 @@
"dev": true "dev": true
}, },
"tsutils": { "tsutils": {
"version": "3.13.0", "version": "3.14.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.13.0.tgz", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.14.0.tgz",
"integrity": "sha512-wRtEjVU8Su72sDIDoqno5Scwt8x4eaF0teKO3m4hu8K1QFPnIZMM88CLafs2tapUeWnY9SwwO3bWeOt2uauBcg==", "integrity": "sha512-SmzGbB0l+8I0QwsPgjooFRaRvHLBLNYM8SeQ0k6rtNDru5sCGeLJcZdwilNndN+GysuFjF5EIYgN8GfFG6UeUw==",
"dev": true, "dev": true,
"requires": { "requires": {
"tslib": "^1.8.1" "tslib": "^1.8.1"
@@ -3761,9 +3732,9 @@
"dev": true "dev": true
}, },
"typescript": { "typescript": {
"version": "3.5.1", "version": "3.5.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.1.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.2.tgz",
"integrity": "sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw==", "integrity": "sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA==",
"dev": true "dev": true
}, },
"uglify-js": { "uglify-js": {

View File

@@ -24,7 +24,7 @@
"prepublishOnly": "npm ci && npm run build", "prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly", "preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"", "push": "git push && git push origin \"v$npm_package_version\"",
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src/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", "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'" "tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
}, },
@@ -43,7 +43,7 @@
"dependencies": { "dependencies": {
"@types/geojson": "1.0.6", "@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30", "@types/json-patch": "0.0.30",
"@types/node": "10.14.8", "@types/node": "10.14.9",
"fast-clone": "1.5.13", "fast-clone": "1.5.13",
"http-status-codes": "1.3.2", "http-status-codes": "1.3.2",
"json-patch": "0.7.0", "json-patch": "0.7.0",
@@ -52,9 +52,9 @@
}, },
"devDependencies": { "devDependencies": {
"@krlwlfrt/async-pool": "0.1.0", "@krlwlfrt/async-pool": "0.1.0",
"@openstapps/configuration": "0.18.0", "@openstapps/configuration": "0.20.0",
"@openstapps/core-tools": "0.6.0", "@openstapps/core-tools": "0.6.0",
"@openstapps/logger": "0.2.1", "@openstapps/logger": "0.3.1",
"@types/chai": "4.1.7", "@types/chai": "4.1.7",
"@types/rimraf": "2.0.2", "@types/rimraf": "2.0.2",
"chai": "4.2.0", "chai": "4.2.0",
@@ -66,10 +66,10 @@
"nyc": "14.1.1", "nyc": "14.1.1",
"rimraf": "2.6.3", "rimraf": "2.6.3",
"source-map-support": "0.5.12", "source-map-support": "0.5.12",
"ts-node": "8.2.0", "ts-node": "8.3.0",
"tslint": "5.17.0", "tslint": "5.17.0",
"typedoc": "0.14.2", "typedoc": "0.14.2",
"typescript": "3.5.1" "typescript": "3.5.2"
}, },
"nyc": { "nyc": {
"check-coverage": true, "check-coverage": true,
@@ -79,10 +79,10 @@
"functions": 95, "functions": 95,
"branches": 85, "branches": 85,
"include": [ "include": [
"src/core/Route.ts", "src/protocol/route.ts",
"src/core/Thing.ts", "src/things/abstract/thing.ts",
"src/core/Translator.ts", "src/translator.ts",
"src/core/types/Guards.ts" "src/guards.ts"
], ],
"exclude": [], "exclude": [],
"extension": [ "extension": [

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -14,8 +14,8 @@
*/ */
// tslint:disable-next-line:no-implicit-dependencies // tslint:disable-next-line:no-implicit-dependencies
import {Polygon} from 'geojson'; import {Polygon} from 'geojson';
import {SCSetting} from '../../things/Setting'; import {SCTranslations} from '../general/i18n';
import {SCTranslations} from '../i18n'; import {SCSetting} from '../things/setting';
/** /**
* An app configuration menu item * An app configuration menu item

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingType} from '../../Thing'; import {SCMap, SCRestrictedMap} from '../general/map';
import {SCSearchSortType} from '../sorts/Abstract'; import {SCUuid} from '../general/uuid';
import {SCUuid} from '../UUID'; import {SCSearchSortType} from '../protocol/search/sort';
import {SCMap, SCRestrictedMap} from './../Map'; import {SCThingType} from '../things/abstract/thing';
import {SCMonitoringConfiguration} from './Monitoring'; import {SCMonitoringConfiguration} from './monitoring';
/** /**
* A backend configuration * A backend configuration
@@ -96,10 +96,8 @@ export type SCSearchContext =
* A boosting configuration for one context * A boosting configuration for one context
*/ */
export type SCBackendConfigurationSearchBoostingContext = export type SCBackendConfigurationSearchBoostingContext =
SCRestrictedMap< SCRestrictedMap<SCSearchContext,
SCSearchContext, SCBackendConfigurationSearchBoostingType[]>;
SCBackendConfigurationSearchBoostingType[]
>;
/** /**
* A boosting configuration for one SCType * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCAppConfiguration} from '../types/config/App'; import {SCLicensePlate} from '../general/namespaces';
import {SCBackendConfiguration, SCBackendInternalConfiguration} from '../types/config/Backend'; import {SCAppConfiguration} from './app';
import {SCLicensePlate} from '../types/namespaces'; import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend';
/** /**
* A configuration file that configures app and backend * A configuration file that configures app and backend

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -691,9 +691,9 @@ export interface SCTranslations<T> {
*/ */
type RecursivePartial<T> = { type RecursivePartial<T> = {
[P in keyof 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] 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCBulkResponse} from '../protocol/routes/bulk/BulkResponse'; import {SCTranslations} from './general/i18n';
import {SCMultiSearchResponse} from '../protocol/routes/search/MultiSearchResponse'; import {SCBulkResponse} from './protocol/routes/bulk-request';
import {SCSearchResponse} from '../protocol/routes/search/SearchResponse'; import {SCSearchResponse} from './protocol/routes/search';
import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCMultiSearchResponse} from './protocol/routes/search-multi';
import {SCTranslations} from './i18n'; import {SCThing, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './things/abstract/thing';
/** /**
* Type guard to check if something is a SCThing * 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; }; }); const somethingObject = (something as { [key: string]: { [key: string]: string; }; });
return Array.isArray(somethingObject.data) return Array.isArray(somethingObject.data)
&& Array.isArray(somethingObject.facets) && Array.isArray(somethingObject.facets)
&& typeof somethingObject.pagination !== 'undefined' && typeof somethingObject.pagination !== 'undefined'
&& typeof somethingObject.pagination.count === 'number' && typeof somethingObject.pagination.count === 'number'
&& typeof somethingObject.pagination.offset === 'number' && typeof somethingObject.pagination.offset === 'number'
&& typeof somethingObject.pagination.total === 'number' && typeof somethingObject.pagination.total === 'number'
&& typeof somethingObject.stats !== 'undefined' && typeof somethingObject.stats !== 'undefined'
&& typeof somethingObject.stats.time === 'number'; && typeof somethingObject.stats.time === 'number';
} }
/** /**
@@ -117,7 +117,7 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
* @param something Something to check * @param something Something to check
*/ */
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse { 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; }) return Object.keys(something as { [key: string]: string; })
.reduce((previousOnesAreSearchResponses, key) => { .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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,31 +12,31 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingType} from './Thing'; import {SCThingType} from './things/abstract/thing';
import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/AcademicEvent'; import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/academic-event';
import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/Article'; import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article';
import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/Book'; import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book';
import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/Building'; import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building';
import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/Catalog'; import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog';
import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/CourseOfStudies'; import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/course-of-studies';
import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/DateSeries'; import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series';
import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/Diff'; import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff';
import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/Dish'; import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish';
import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/Favorite'; import {SCFavorite, SCFavoriteMeta, SCFavoriteWithoutReferences} from './things/favorite';
import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/Floor'; import {SCFloor, SCFloorMeta, SCFloorWithoutReferences} from './things/floor';
import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/Message'; import {SCMessage, SCMessageMeta, SCMessageWithoutReferences} from './things/message';
import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/Organization'; import {SCOrganization, SCOrganizationMeta, SCOrganizationWithoutReferences} from './things/organization';
import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/Person'; import {SCPerson, SCPersonMeta, SCPersonWithoutReferences} from './things/person';
import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/PointOfInterest'; import {SCPointOfInterest, SCPointOfInterestMeta, SCPointOfInterestWithoutReferences} from './things/point-of-interest';
import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/Room'; import {SCRoom, SCRoomMeta, SCRoomWithoutReferences} from './things/room';
import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/Semester'; import {SCSemester, SCSemesterMeta, SCSemesterWithoutReferences} from './things/semester';
import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/Setting'; import {SCSetting, SCSettingMeta, SCSettingWithoutReferences} from './things/setting';
import {SCSportCourse, SCSportCourseMeta, SCSportCourseWithoutReferences} from './things/SportCourse'; import {SCSportCourse, SCSportCourseMeta, SCSportCourseWithoutReferences} from './things/sport-course';
import {SCStudyModule, SCStudyModuleMeta, SCStudyModuleWithoutReferences} from './things/StudyModule'; import {SCStudyModule, SCStudyModuleMeta, SCStudyModuleWithoutReferences} from './things/study-module';
import {SCTicket, SCTicketMeta, SCTicketWithoutReferences} from './things/Ticket'; import {SCTicket, SCTicketMeta, SCTicketWithoutReferences} from './things/ticket';
import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/ToDo'; import {SCToDo, SCToDoMeta, SCToDoWithoutReferences} from './things/todo';
import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/Tour'; import {SCTour, SCTourMeta, SCTourWithoutReferences} from './things/tour';
import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/Video'; import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video';
/* tslint:disable:variable-name */ /* 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 * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {NOT_FOUND} from 'http-status-codes';
import {SCError} from '../error';
/** /**
* Plugin register response * An error that is returned when the requested route or resource was not found
*
* @validatable
*/ */
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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,25 +12,19 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCUuid} from '../../../types/UUID'; import {REQUEST_TOO_LONG} from 'http-status-codes';
import {SCBulkParameters} from './BulkRequest'; import {SCError} from '../error';
/** /**
* Requested Bulk from backend * An error that is returned, when the request body is too large.
*
* @validatable
*/ */
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. * @param stack Set to true if a stack trace should be created
* The state is `done` once it is closed.
*/ */
state: 'in progress' | 'done'; constructor(stack?: boolean) {
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
/** }
* Universally unique identifier of the bulk
*/
uid: SCUuid;
} }

View File

@@ -12,21 +12,20 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCBuildingWithoutReferences} from '../things/Building'; import {BAD_REQUEST} from 'http-status-codes';
import {SCPointOfInterestWithoutReferences} from '../things/PointOfInterest'; import {SCError} from '../error';
import {SCRoomWithoutReferences} from '../things/Room';
/** /**
* Something that is or happens in a place * An error that is returned whenever there is a syntax error
*
* !Important!
* This is not a SCThing.
*/ */
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?: constructor(message: string, stack?: boolean) {
SCBuildingWithoutReferences super('SyntaxError', message, BAD_REQUEST, stack);
| SCPointOfInterestWithoutReferences }
| SCRoomWithoutReferences;
} }

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;
}
}

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,29 +12,17 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/** import {SCMap} from '../general/map';
* Possible HTTP verbs for routes import {SCErrorResponse} from './error';
*/ import {SCIndexRequest, SCIndexResponse} from './routes';
import {SCErrorResponse} from './protocol/errors/ErrorResponse'; import {SCBookAvailabilityRequest, SCBookAvailabilityResponse} from './routes/book-availability';
import {SCBookAvailabilityRequest} from './protocol/routes/bookAvailability/BookAvailabilityRequest'; import {SCBulkAddRequest, SCBulkAddResponse} from './routes/bulk-add';
import {SCBookAvailabilityResponse} from './protocol/routes/bookAvailability/BookAvailabilityResponse'; import {SCBulkDoneRequest, SCBulkDoneResponse} from './routes/bulk-done';
import {SCBulkRequest} from './protocol/routes/bulk/BulkRequest'; import {SCBulkRequest, SCBulkResponse} from './routes/bulk-request';
import {SCBulkResponse} from './protocol/routes/bulk/BulkResponse'; import {SCFeedbackRequest, SCFeedbackResponse} from './routes/feedback';
import {SCBulkAddRequest} from './protocol/routes/bulk/UID/BulkAddRequest'; import {SCSearchRequest, SCSearchResponse} from './routes/search';
import {SCBulkAddResponse} from './protocol/routes/bulk/UID/BulkAddResponse'; import {SCMultiSearchRequest, SCMultiSearchResponse} from './routes/search-multi';
import {SCBulkDoneRequest} from './protocol/routes/bulk/UID/BulkDoneRequest'; import {SCThingUpdateRequest, SCThingUpdateResponse} from './routes/thing-update';
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 * Possible Verbs for HTTP requests

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,17 +13,16 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {OK} from 'http-status-codes'; import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCUuid} from '../../general/uuid';
import {SCUuid} from '../../../types/UUID'; import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered';
import { import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
SCInternalServerErrorResponse, import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCMethodNotAllowedErrorResponse, import {SCNotFoundErrorResponse} from '../errors/not-found';
SCNotFoundErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCRequestBodyTooLargeErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCSyntaxErrorResponse, import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCUnsupportedMediaTypeErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
SCValidationErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
} from '../../errors/ErrorResponse';
/** /**
* Request to check the availability of books * Request to check the availability of books
@@ -52,6 +51,13 @@ export interface SCBookAvailabilityRequestByUuid {
uid: SCUuid; uid: SCUuid;
} }
/**
* List of availabilities of a book
*
* @validatable
*/
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
/** /**
* Route for book availability * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,17 +13,15 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {CREATED} from 'http-status-codes'; import {CREATED} from 'http-status-codes';
import {SCThings} from '../../../../Classes'; import {SCThings} from '../../meta';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import { import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCInternalServerErrorResponse, import {SCNotFoundErrorResponse} from '../errors/not-found';
SCMethodNotAllowedErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCNotFoundErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCRequestBodyTooLargeErrorResponse, import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCSyntaxErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
SCUnsupportedMediaTypeErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
SCValidationErrorResponse,
} from '../../../errors/ErrorResponse';
/** /**
* Request to add a thing to a bulk * Request to add a thing to a bulk
@@ -32,6 +30,14 @@ import {
*/ */
export type SCBulkAddRequest = SCThings; 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 * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,16 +13,14 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {NO_CONTENT} from 'http-status-codes'; import {NO_CONTENT} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import { import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCInternalServerErrorResponse, import {SCNotFoundErrorResponse} from '../errors/not-found';
SCMethodNotAllowedErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCNotFoundErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCRequestBodyTooLargeErrorResponse, import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCSyntaxErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
SCUnsupportedMediaTypeErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
SCValidationErrorResponse,
} from '../../../errors/ErrorResponse';
/** /**
* Request to change the bulk state to done (close the bulk process) * Request to change the bulk state to done (close the bulk process)
@@ -32,6 +30,14 @@ import {
export interface SCBulkDoneRequest { export interface SCBulkDoneRequest {
} }
/**
* Response to a request to change the state of a bulk to done
*
* @validatable
*/
export interface SCBulkDoneResponse {
}
/** /**
* Route for closing bulks * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,17 +13,16 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {OK} from 'http-status-codes'; import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCISO8601Date} from '../../general/time';
import {SCThingType} from '../../../Thing'; import {SCUuid} from '../../general/uuid';
import {SCISO8601Date} from '../../../types/Time'; import {SCThingType} from '../../things/abstract/thing';
import { import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
SCInternalServerErrorResponse, import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCMethodNotAllowedErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCRequestBodyTooLargeErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCSyntaxErrorResponse, import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCUnsupportedMediaTypeErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
SCValidationErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
} from '../../errors/ErrorResponse';
/** /**
* A bulk request * A bulk request
@@ -62,6 +61,26 @@ export interface SCBulkParameters {
type: SCThingType; 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 * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,16 +13,14 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {NO_CONTENT} from 'http-status-codes'; import {NO_CONTENT} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCMessage} from '../../things/message';
import {SCMessage} from '../../../things/Message'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import { import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCInternalServerErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCMethodNotAllowedErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCRequestBodyTooLargeErrorResponse, import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCSyntaxErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
SCUnsupportedMediaTypeErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
SCValidationErrorResponse,
} from '../../errors/ErrorResponse';
/** /**
* User feedback * User feedback
@@ -36,6 +34,14 @@ export interface SCFeedbackRequest extends SCMessage {
metaData: SCFeedbackRequestMetaData; metaData: SCFeedbackRequestMetaData;
} }
/**
* A response to a feedback request
*
* @validatable
*/
export interface SCFeedbackResponse {
}
/** /**
* Route for feedback submission * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,15 +13,15 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {OK} from 'http-status-codes'; import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCAppConfiguration} from '../../config/app';
import { import {SCBackendConfiguration} from '../../config/backend';
SCInternalServerErrorResponse, import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
SCMethodNotAllowedErrorResponse, import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCRequestBodyTooLargeErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCSyntaxErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCUnsupportedMediaTypeErrorResponse, import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCValidationErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
} from '../../errors/ErrorResponse'; import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
/** /**
* Index request * Index request
@@ -31,6 +31,23 @@ import {
export interface SCIndexRequest { 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 * Route to request meta information about the deployment
*/ */

View File

@@ -14,15 +14,14 @@
*/ */
import {OK} from 'http-status-codes'; import {OK} from 'http-status-codes';
import {Schema} from 'jsonschema'; import {Schema} from 'jsonschema';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import { import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCInternalServerErrorResponse, import {SCParametersNotAcceptable} from '../errors/parameters-not-acceptable';
SCMethodNotAllowedErrorResponse, SCParametersNotAcceptable, import {SCPluginAlreadyRegisteredErrorResponse} from '../errors/plugin-already-registered';
SCPluginAlreadyRegisteredErrorResponse, import {SCPluginRegisteringFailedErrorResponse} from '../errors/plugin-registering-failed';
SCPluginRegisteringFailedErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCRequestBodyTooLargeErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCSyntaxErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
} from '../../errors/ErrorResponse';
/** /**
* Plugin register request * Plugin register request
@@ -91,6 +90,18 @@ export interface SCPluginMetaData {
route: string; 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 * Route to register plugins
*/ */

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,18 +13,17 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {OK} from 'http-status-codes'; import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCMap} from '../../general/map';
import {SCMap} from '../../../types/Map'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import { import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCInternalServerErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCMethodNotAllowedErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCRequestBodyTooLargeErrorResponse, import {SCTooManyRequestsErrorResponse} from '../errors/too-many-requests';
SCSyntaxErrorResponse, import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCTooManyRequestsErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
SCUnsupportedMediaTypeErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
SCValidationErrorResponse, import {SCSearchQuery} from '../search/query';
} from '../../errors/ErrorResponse'; import {SCSearchResult} from '../search/result';
import {SCSearchQuery} from './SearchRequest';
/** /**
* A multi search request * A multi search request
@@ -37,6 +36,15 @@ import {SCSearchQuery} from './SearchRequest';
*/ */
export type SCMultiSearchRequest = SCMap<SCSearchQuery>; 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 * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,18 +13,15 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {OK} from 'http-status-codes'; import {OK} from 'http-status-codes';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCSearchContext} from '../../../types/config/Backend'; import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCSearchFilter} from '../../../types/filters/Abstract'; import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSearchSort} from '../../../types/sorts/Abstract'; import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import { import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCInternalServerErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
SCMethodNotAllowedErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
SCRequestBodyTooLargeErrorResponse, import {SCSearchQuery} from '../search/query';
SCSyntaxErrorResponse, import {SCSearchResult} from '../search/result';
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
} from '../../errors/ErrorResponse';
/** /**
* A search request * A search request
@@ -35,38 +32,11 @@ export interface SCSearchRequest extends SCSearchQuery {
} }
/** /**
* A search query * A search response
*
* @validatable
*/ */
export interface SCSearchQuery { export interface SCSearchResponse extends SCSearchResult {
/**
* 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,17 +13,15 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {OK} from 'http-status-codes'; import {OK} from 'http-status-codes';
import {SCThings} from '../../../../Classes'; import {SCThings} from '../../meta';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../../Route'; import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import { import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
SCInternalServerErrorResponse, import {SCNotFoundErrorResponse} from '../errors/not-found';
SCMethodNotAllowedErrorResponse, import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
SCNotFoundErrorResponse, import {SCSyntaxErrorResponse} from '../errors/syntax-error';
SCRequestBodyTooLargeErrorResponse, import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
SCSyntaxErrorResponse, import {SCValidationErrorResponse} from '../errors/validation';
SCUnsupportedMediaTypeErrorResponse, import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
SCValidationErrorResponse,
} from '../../../errors/ErrorResponse';
/** /**
* Request to update an existing thing * Request to update an existing thing
@@ -32,6 +30,14 @@ import {
*/ */
export type SCThingUpdateRequest = SCThings; export type SCThingUpdateRequest = SCThings;
/**
* Response for an entity update request
*
* @validatable
*/
export interface SCThingUpdateResponse {
}
/** /**
* Route for updating existing things * 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 * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// tslint:disable-next-line:no-implicit-dependencies import {SCThingsField} from '../../meta';
import {Point, Polygon} from 'geojson';
/** /**
* 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,14 +12,14 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMap} from '../Map'; import {SCMap} from '../../general/map';
/** /**
* All available filter types * All available filter types
*/ */
import {SCSearchAvailabilityFilter} from './Availability'; import {SCSearchAvailabilityFilter} from './filters/availability';
import {SCSearchBooleanFilter} from './Boolean'; import {SCSearchBooleanFilter} from './filters/boolean';
import {SCSearchDistanceFilter} from './Distance'; import {SCSearchDistanceFilter} from './filters/distance';
import {SCSearchValueFilter} from './Value'; import {SCSearchValueFilter} from './filters/value';
/** /**
* Filter instruction types * Filter instruction types

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

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

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -14,8 +14,8 @@
*/ */
// tslint:disable-next-line:no-implicit-dependencies // tslint:disable-next-line:no-implicit-dependencies
import {Position} from 'geojson'; import {Position} from 'geojson';
import {SCThingsField} from '../../Classes'; import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract'; import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/** /**
* A distance filter * A distance filter

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingsField} from '../../Classes'; import {SCThingsField} from '../../../meta';
import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from './Abstract'; import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter';
/** /**
* Filters for documents that match the value on the given field * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,15 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThings, SCThingsField} from '../../../Classes'; import {SCThings} from '../../meta';
import {SCFacet} from './facet';
/**
* A search response
*
* @validatable
*/
export interface SCSearchResponse extends SCSearchResult {
}
/** /**
* A search response * A search response
@@ -39,48 +32,18 @@ export interface SCSearchResult {
/** /**
* Pagination information * Pagination information
*/ */
pagination: SCSearchResponsePagination; pagination: SCSearchResultPagination;
/** /**
* Stats of the search engine * Stats of the search engine
*/ */
stats: SCSearchResponseSearchEngineStats; stats: SCSearchResultSearchEngineStats;
}
/**
* 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;
} }
/** /**
* Stores information about Pagination * Stores information about Pagination
*/ */
export interface SCSearchResponsePagination { export interface SCSearchResultPagination {
/** /**
* Count of given data. Same as data.length * Count of given data. Same as data.length
*/ */
@@ -100,7 +63,7 @@ export interface SCSearchResponsePagination {
/** /**
* Statistics of search engine * Statistics of search engine
*/ */
export interface SCSearchResponseSearchEngineStats { export interface SCSearchResultSearchEngineStats {
/** /**
* Response time of the search engine in ms * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingsField} from '../../Classes'; import {SCMap} from '../../general/map';
import {SCMap} from '../Map'; import {SCThingsField} from '../../meta';
import {SCDistanceSort} from './Distance'; import {SCDistanceSort} from './sorts/distance';
import {SCDucetSort} from './Ducet'; import {SCDucetSort} from './sorts/ducet';
import {SCPriceSort} from './Price'; import {SCPriceSort} from './sorts/price';
/** /**
* Abstract sort instruction * Abstract sort instruction

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

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

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCSportCoursePriceGroup} from '../../things/DateSeries'; import {SCSportCoursePriceGroup} from '../../../things/date-series';
import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from './Abstract'; import {SCSearchAbstractSort, SCSearchAbstractSortArguments} from '../sort';
/** /**
* Sort instruction to sort by price * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../../general/i18n';
import {SCMetaTranslations} from '../types/i18n'; import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/** /**
* An academic degree without references * An academic degree 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../../general/i18n';
import {SCMetaTranslations} from '../types/i18n'; import {SCISO8601Date} from '../../general/time';
import {SCISO8601Date} from '../types/Time'; import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/** /**
* An academic term without references * An academic term 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,18 +12,18 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing'; import {SCLanguage, SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCOrganizationWithoutReferences} from '../things/Organization'; import {SCISO8601Date} from '../../general/time';
import {SCPersonWithoutReferences} from '../things/Person'; import {SCOrganizationWithoutReferences} from '../organization';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCPersonWithoutReferences} from '../person';
import {SCISO8601Date} from '../types/Time'; import {SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
import { import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta, SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences, SCThingThatCanBeOfferedWithoutReferences,
} from './ThingThatCanBeOffered'; } from './thing-that-can-be-offered';
/** /**
* A creative work without references * A creative work without references
@@ -98,8 +98,8 @@ export class SCCreativeWorkMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de, ...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
authors: 'Authoren', authors: 'Authoren',
datePublished: 'Veröffentlichungsdatum', datePublished: 'Veröffentlichungsdatum',
inLanguages: 'verfügbare Übersetzungen', inLanguages: 'verfügbare Übersetzungen',
@@ -107,8 +107,8 @@ export class SCCreativeWorkMeta
publishers: 'Verleger', publishers: 'Verleger',
}, },
en: { en: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
... SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en, ...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
authors: 'authors', authors: 'authors',
datePublished: 'release date', datePublished: 'release date',
inLanguages: 'available Languages', inLanguages: 'available Languages',
@@ -123,11 +123,11 @@ export class SCCreativeWorkMeta
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
... SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en, ...SCThingThatCanBeOfferedMeta.getInstance().fieldValueTranslations.en,
}, },
en: { en: {
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,12 +12,12 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../../general/i18n';
import {SCCatalogWithoutReferences} from '../things/Catalog'; import {SCCatalogWithoutReferences} from '../catalog';
import {SCPersonWithoutReferences} from '../things/Person'; import {SCPersonWithoutReferences} from '../person';
import {SCSemesterWithoutReferences} from '../things/Semester'; import {SCSemesterWithoutReferences} from '../semester';
import {SCMetaTranslations} from '../types/i18n'; import {SCCreativeWorkWithoutReferences} from './creative-work';
import {SCCreativeWorkWithoutReferences} from './CreativeWork'; import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/** /**
* An event without references * An event without references
@@ -86,7 +86,7 @@ export class SCEventMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
academicTerms: 'Semester', academicTerms: 'Semester',
catalogs: 'Verzeichnis', catalogs: 'Verzeichnis',
creativeWorks: 'begleitende Werke', creativeWorks: 'begleitende Werke',
@@ -96,7 +96,7 @@ export class SCEventMeta
remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern', remainingAttendeeCapacity: 'verfügbare Anzahl an Teilnehmern',
}, },
en: { en: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
academicTerms: 'academic terms', academicTerms: 'academic terms',
catalogs: 'catalogs', catalogs: 'catalogs',
creativeWorks: 'related material', 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,10 +12,62 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing'; // tslint:disable-next-line:no-implicit-dependencies
import {SCGeoInformation} from '../types/GeoInformation'; import {Point, Polygon} from 'geojson';
import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCPostalAddress} from '../types/PostalAddress'; 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 * A place without references
@@ -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 * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {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. * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta} from '../Thing'; import {SCMetaTranslations} from '../../general/i18n';
import {SCMetaTranslations} from '../types/i18n'; import {SCInPlace} from './place';
import {SCInPlace} from '../types/Places'; import {SCThing, SCThingMeta} from './thing';
/** /**
* A thing that is or happens in a place * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../../general/i18n';
import {SCMetaTranslations} from '../types/i18n'; import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing';
/** /**
* Types of payment that are accepted at a place. * Types of payment that are accepted at a place.
@@ -52,11 +52,11 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de, ...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
paymentsAccepted: 'Bezahlmethoden', paymentsAccepted: 'Bezahlmethoden',
}, },
en: { en: {
... SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en, ...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
paymentsAccepted: 'accepted payment methods', paymentsAccepted: 'accepted payment methods',
}, },
}; };
@@ -66,7 +66,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
paymentsAccepted: { paymentsAccepted: {
'cafeteria card': 'Mensakarte', 'cafeteria card': 'Mensakarte',
'cash': 'Bar', '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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,12 +12,12 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCOrganizationWithoutReferences} from '../things/Organization'; import {SCISO8601Date} from '../../general/time';
import {SCPersonWithoutReferences} from '../things/Person'; import {SCOrganizationWithoutReferences} from '../organization';
import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCPersonWithoutReferences} from '../person';
import {SCInPlace} from '../types/Places'; import {SCInPlace} from './place';
import {SCISO8601Date} from '../types/Time'; import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
/** /**
* Default price without distinction * Default price without distinction
@@ -152,8 +152,8 @@ export type SCThingThatCanBeOfferedAvailability =
/** /**
* Meta information about a thing without references that accepts payments * Meta information about a thing without references that accepts payments
*/ */
export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup>
SCMetaTranslations<SCThingThatCanBeOffered<T>> { implements SCMetaTranslations<SCThingThatCanBeOffered<T>> {
/** /**
* Instance * Instance
@@ -165,11 +165,11 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
... SCThingMeta.getInstance().fieldTranslations.de, ...SCThingMeta.getInstance().fieldTranslations.de,
offers: 'Angebote', offers: 'Angebote',
}, },
en: { en: {
... SCThingMeta.getInstance().fieldTranslations.en, ...SCThingMeta.getInstance().fieldTranslations.en,
offers: 'offers', offers: 'offers',
}, },
}; };
@@ -177,12 +177,12 @@ export class SCThingThatCanBeOfferedMeta<T extends SCPriceGroup> implements
/** /**
* Translations of values of fields * Translations of values of fields
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
... SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de, ...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
}, },
en: { 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 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCMap} from '../../general/map';
import {SCMap} from '../types/Map'; import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutReferences} from './thing';
/** /**
* A thing without references with categories * A thing without references with categories
@@ -156,11 +156,11 @@ export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> { public static getInstance<T, U>(): SCThingWithCategoriesWithoutReferencesMeta<T, U> {
if (!SCThingWithCategoriesWithoutReferencesMeta._instance.has(this.name)) { if (!SCThingWithCategoriesWithoutReferencesMeta._instance.has(this.name)) {
SCThingWithCategoriesWithoutReferencesMeta._instance SCThingWithCategoriesWithoutReferencesMeta._instance
.set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>()); .set(this.name, new SCThingWithCategoriesWithoutReferencesMeta<T, U>());
} }
return SCThingWithCategoriesWithoutReferencesMeta._instance return SCThingWithCategoriesWithoutReferencesMeta._instance
.get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>; .get(this.name) as SCThingWithCategoriesWithoutReferencesMeta<T, U>;
} }
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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCOrganizationWithoutReferences} from './things/Organization'; import {SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCPersonWithoutReferences} from './things/Person'; import {SCISO8601Date} from '../../general/time';
import {SCMetaTranslations, SCTranslations} from './types/i18n'; import {SCUuid} from '../../general/uuid';
import {SCISO8601Date} from './types/Time'; import {SCOrganizationWithoutReferences} from '../organization';
import {SCUuid} from './types/UUID'; import {SCPersonWithoutReferences} from '../person';
/** /**
* Types a thing can be * Types a thing can be

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {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 { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
/** /**
* An academic event without references * An academic event without references
@@ -126,19 +126,15 @@ export class SCAcademicEventMeta
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de, ...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCAcademicEventCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
majors: 'Hauptfächer', majors: 'Hauptfächer',
originalCategory: 'ursprüngliche Kategorie', originalCategory: 'ursprüngliche Kategorie',
}, },
en: { en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en, ...SCEventMeta.getInstance<SCEventMeta>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCAcademicEventCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
majors: 'majors', majors: 'majors',
originalCategory: 'original category', originalCategory: 'original category',
}, },
@@ -150,10 +146,8 @@ export class SCAcademicEventMeta
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de, ...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCAcademicEventCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: { categories: {
'colloquium': 'Kolloquium', 'colloquium': 'Kolloquium',
'course': 'Kurs', 'course': 'Kurs',
@@ -174,10 +168,8 @@ export class SCAcademicEventMeta
}, },
en: { en: {
...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en, ...SCEventMeta.getInstance<SCEventMeta>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCAcademicEventCategories,
SCAcademicEventCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.AcademicEvent, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,21 +12,21 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import { import {
SCCreativeWork, SCCreativeWork,
SCCreativeWorkMeta, SCCreativeWorkMeta,
SCCreativeWorkTranslatableProperties, SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences, SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork'; } from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
/** /**
* An article without references * An article without references
@@ -102,19 +102,15 @@ export class SCArticleMeta
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations ...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.de, .de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCArticleCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
articleBody: 'Artikelinhalt', articleBody: 'Artikelinhalt',
}, },
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations ...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
.en, .en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCArticleCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
articleBody: 'article body', articleBody: 'article body',
}, },
}; };
@@ -126,10 +122,8 @@ export class SCArticleMeta
de: { de: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.de, .fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCArticleCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: { categories: {
'unipedia': 'Unipedia', 'unipedia': 'Unipedia',
}, },
@@ -138,10 +132,8 @@ export class SCArticleMeta
en: { en: {
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>() ...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
.fieldValueTranslations.en, .fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCArticleCategories,
SCArticleCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Article, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import { import {
SCCreativeWork, SCCreativeWork,
SCCreativeWorkMeta, SCCreativeWorkMeta,
SCCreativeWorkTranslatableProperties, SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences, SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork'; } from './abstract/creative-work';
import {SCThingWithCategoriesTranslatableProperties} from '../base/ThingWithCategories'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingWithCategoriesTranslatableProperties} from './abstract/thing-with-categories';
import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCPersonWithoutReferences} from './person';
import {SCPersonWithoutReferences} from './Person';
/** /**
* A book without references * A book 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,21 +12,21 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import { import {
SCPlace, SCPlace,
SCPlaceWithoutReferences, SCPlaceWithoutReferences,
SCPlaceWithoutReferencesMeta, SCPlaceWithoutReferencesMeta,
SCPlaceWithoutReferencesTranslatableProperties, SCPlaceWithoutReferencesTranslatableProperties,
} from '../base/Place'; } from './abstract/place';
import {SCThingMeta, SCThingType} from './abstract/thing';
import { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
export type SCBuildingCategories = export type SCBuildingCategories =
'cafe' 'cafe'
@@ -106,23 +106,15 @@ export class SCBuildingMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCBuildingCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
SCThingWithCategoriesSpecificValues ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.de,
floors: 'Etagen', floors: 'Etagen',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCBuildingCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
SCThingWithCategoriesSpecificValues ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.en,
floors: 'floors', floors: 'floors',
}, },
}; };
@@ -132,13 +124,9 @@ export class SCBuildingMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCBuildingCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
SCThingWithCategoriesSpecificValues ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.de,
categories: { categories: {
'cafe': 'Café', 'cafe': 'Café',
'canteen': 'Kantine', 'canteen': 'Kantine',
@@ -152,13 +140,9 @@ export class SCBuildingMeta
type: 'Gebäude', type: 'Gebäude',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
SCBuildingCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
SCThingWithCategoriesSpecificValues ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.en,
type: SCThingType.Building, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm'; import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCAcademicTermWithoutReferences} from './abstract/academic-term';
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
import { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
/** /**
* A catalog without references * A catalog without references
@@ -88,20 +88,16 @@ export class SCCatalogMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCCatalogCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
academicTerm: 'Semester', academicTerm: 'Semester',
level: 'Ebene', level: 'Ebene',
superCatalog: 'übergeordnetes Verzeichniss', superCatalog: 'übergeordnetes Verzeichniss',
superCatalogs: 'übergeordnete Verzeichnisse', superCatalogs: 'übergeordnete Verzeichnisse',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCCatalogCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
academicTerm: 'academic term', academicTerm: 'academic term',
level: 'level', level: 'level',
superCatalog: 'parent catalog', superCatalog: 'parent catalog',
@@ -114,20 +110,16 @@ export class SCCatalogMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCCatalogCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: { categories: {
'university events': 'Universitätsveranstaltung', 'university events': 'Universitätsveranstaltung',
}, },
type: 'Verzeichnis', type: 'Verzeichnis',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCCatalogCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Catalog, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,18 +12,18 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {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 { import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta, SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences, SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered'; } from './abstract/thing-that-can-be-offered';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCDateSeriesWithoutReferences} from './date-series';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCOrganizationWithoutReferences} from './organization';
import {SCDateSeriesWithoutReferences} from './DateSeries';
import {SCOrganizationWithoutReferences} from './Organization';
/** /**
* A course of studies without references * A course of studies 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,20 +12,20 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {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 { import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences, SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered'; } from './abstract/thing-that-can-be-offered';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCAcademicEventWithoutReferences} from './academic-event';
import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCPersonWithoutReferences} from './person';
import {SCISO8601Date, SCISO8601Duration} from '../types/Time'; import {SCSportCourseWithoutReferences} from './sport-course';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCPersonWithoutReferences} from './Person';
import {SCSportCourseWithoutReferences} from './SportCourse';
/** /**
* Price groups for sport courses * Price groups for sport courses

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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,10 +13,10 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import * as jsonpatch from 'json-patch'; import * as jsonpatch from 'json-patch';
import {SCThingsWithoutDiff} from '../Classes'; import {SCMetaTranslations} from '../general/i18n';
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCISO8601Date} from '../general/time';
import {SCMetaTranslations} from '../types/i18n'; import {SCThingsWithoutDiff} from '../meta';
import {SCISO8601Date} from '../types/Time'; import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
/** /**
* A diff without references * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,22 +12,22 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThingMeta, SCThingType} from './abstract/thing';
import { import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences, SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered'; } from './abstract/thing-that-can-be-offered';
import { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
/** /**
* A dish without references * A dish without references
@@ -201,10 +201,8 @@ export class SCDishMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCDishCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() ...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de, .fieldTranslations.de,
additives: 'Zusatzstoffe', additives: 'Zusatzstoffe',
@@ -213,10 +211,8 @@ export class SCDishMeta
nutrition: 'Nährwertangaben', nutrition: 'Nährwertangaben',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCDishCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() ...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.en, .fieldTranslations.en,
additives: 'additives', additives: 'additives',
@@ -231,10 +227,8 @@ export class SCDishMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCDishCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() ...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.de, .fieldValueTranslations.de,
categories: { categories: {
@@ -248,10 +242,8 @@ export class SCDishMeta
type: 'Essen', type: 'Essen',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCDishCategories,
SCDishCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>() ...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldValueTranslations.en, .fieldValueTranslations.en,
type: SCThingType.Dish, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,17 +12,17 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCSaveableThing, SCSaveableThingWithoutReferences} from '../base/SaveableThing'; import {SCSaveableThing, SCSaveableThingWithoutReferences} from './abstract/saveable-thing';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCAcademicEventWithoutReferences} from './AcademicEvent'; import {SCAcademicEventWithoutReferences} from './academic-event';
import {SCArticleWithoutReferences} from './Article'; import {SCArticleWithoutReferences} from './article';
import {SCBookWithoutReferences} from './Book'; import {SCBookWithoutReferences} from './book';
import {SCBuildingWithoutReferences} from './Building'; import {SCBuildingWithoutReferences} from './building';
import {SCPersonWithoutReferences} from './Person'; import {SCPersonWithoutReferences} from './person';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest'; import {SCPointOfInterestWithoutReferences} from './point-of-interest';
import {SCRoomWithoutReferences} from './Room'; import {SCRoomWithoutReferences} from './room';
import {SCSportCourseWithoutReferences} from './SportCourse'; import {SCSportCourseWithoutReferences} from './sport-course';
import {SCToDoWithoutReferences} from './ToDo'; import {SCToDoWithoutReferences} from './todo';
/** /**
* Types that can be made a favorite (added as a favorite) * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -14,11 +14,11 @@
*/ */
// tslint:disable-next-line:no-implicit-dependencies // tslint:disable-next-line:no-implicit-dependencies
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson'; import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace'; import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCThingMeta, SCThingTranslatableProperties, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest'; import {SCPointOfInterestWithoutReferences} from './point-of-interest';
import {SCRoomWithoutReferences} from './Room'; import {SCRoomWithoutReferences} from './room';
/** /**
* A floor without references * A floor 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCISO8601Date} from '../general/time';
import { import {
SCCreativeWork, SCCreativeWork,
SCCreativeWorkMeta, SCCreativeWorkMeta,
SCCreativeWorkTranslatableProperties, SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences, SCCreativeWorkWithoutReferences,
} from '../base/CreativeWork'; } from './abstract/creative-work';
import {SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingThatCanBeOfferedTranslatableProperties} from './abstract/thing-that-can-be-offered';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
/** /**
* A message without references * A message 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace'; import {SCMetaTranslations} from '../general/i18n';
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCMetaTranslations} from '../types/i18n'; import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
/** /**
* An organization without references * 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,13 +12,13 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations, SCNationality} from '../general/i18n';
import {SCMetaTranslations, SCNationality} from '../types/i18n'; import {SCISO8601Date} from '../general/time';
import {SCISO8601Date} from '../types/Time'; import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCBuildingWithoutReferences} from './Building'; import {SCBuildingWithoutReferences} from './building';
import {SCOrganizationWithoutReferences} from './Organization'; import {SCOrganizationWithoutReferences} from './organization';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest'; import {SCPointOfInterestWithoutReferences} from './point-of-interest';
import {SCRoomWithoutReferences} from './Room'; import {SCRoomWithoutReferences} from './room';
/** /**
* A person without references * A person 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,17 +12,17 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place'; import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace'; import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from './abstract/place';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
import { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
/** /**
* A point of interest without references * A point of interest without references
@@ -82,24 +82,16 @@ export class SCPointOfInterestMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
SCThingWithCategoriesSpecificValues ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
>().fieldTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de, .de,
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
SCThingWithCategoriesSpecificValues ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
>().fieldTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en, .en,
}, },
@@ -110,13 +102,9 @@ export class SCPointOfInterestMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
SCThingWithCategoriesSpecificValues ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
>().fieldValueTranslations.de,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.de,
categories: { categories: {
'card charger': 'Kartenaufwerter', 'card charger': 'Kartenaufwerter',
'computer': 'Computer', 'computer': 'Computer',
@@ -127,13 +115,9 @@ export class SCPointOfInterestMeta
type: 'Sonderziel', type: 'Sonderziel',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCPointOfInterestCategories,
SCPointOfInterestCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
SCThingWithCategoriesSpecificValues ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
>().fieldValueTranslations.en,
...SCPlaceWithoutReferencesMeta.getInstance<
SCPlaceWithoutReferencesMeta
>().fieldValueTranslations.en,
type: SCThingType.PointOfInterest, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,24 +12,24 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCPlace, SCPlaceWithoutReferences, SCPlaceWithoutReferencesMeta} from '../base/Place'; import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace'; 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 { import {
SCThingThatAcceptsPayments, SCThingThatAcceptsPayments,
SCThingThatAcceptsPaymentsWithoutReferences, SCThingThatAcceptsPaymentsWithoutReferences,
SCThingThatAcceptsPaymentsWithoutReferencesMeta, SCThingThatAcceptsPaymentsWithoutReferencesMeta,
} from '../base/ThingThatAcceptsPayments'; } from './abstract/thing-that-accepts-payments';
import { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCMap} from '../types/Map';
/** /**
* Categories of a room * Categories of a room
@@ -126,32 +126,22 @@ export class SCRoomMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCPlaceWithoutReferencesMeta.getInstance< ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
SCPlaceWithoutReferencesMeta ...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
>().fieldTranslations.de, .fieldTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCThingThatAcceptsPaymentsWithoutReferencesMeta SCRoomSpecificValues>().fieldTranslations.de,
>().fieldTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.de, .de,
floorName: 'Etagenbezeichnung', floorName: 'Etagenbezeichnung',
inventory: 'Bestand', inventory: 'Bestand',
}, },
en: { en: {
...SCPlaceWithoutReferencesMeta.getInstance< ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
SCPlaceWithoutReferencesMeta ...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
>().fieldTranslations.en, .fieldTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCThingThatAcceptsPaymentsWithoutReferencesMeta SCRoomSpecificValues>().fieldTranslations.en,
>().fieldTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations ...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>().fieldTranslations
.en, .en,
floorName: 'floor name', floorName: 'floor name',
@@ -164,16 +154,11 @@ export class SCRoomMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCPlaceWithoutReferencesMeta.getInstance< ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
SCPlaceWithoutReferencesMeta ...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
>().fieldValueTranslations.de, .fieldValueTranslations.de,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCThingThatAcceptsPaymentsWithoutReferencesMeta SCRoomSpecificValues>().fieldValueTranslations.de,
>().fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldValueTranslations.de,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>() ...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.de, .fieldValueTranslations.de,
categories: { categories: {
@@ -194,16 +179,11 @@ export class SCRoomMeta
type: 'Raum', type: 'Raum',
}, },
en: { en: {
...SCPlaceWithoutReferencesMeta.getInstance< ...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
SCPlaceWithoutReferencesMeta ...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance<SCThingThatAcceptsPaymentsWithoutReferencesMeta>()
>().fieldValueTranslations.en, .fieldValueTranslations.en,
...SCThingThatAcceptsPaymentsWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCRoomCategories,
SCThingThatAcceptsPaymentsWithoutReferencesMeta SCRoomSpecificValues>().fieldValueTranslations.en,
>().fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<
SCRoomCategories,
SCRoomSpecificValues
>().fieldValueTranslations.en,
...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>() ...SCThingInPlaceMeta.getInstance<SCThingInPlaceMeta>()
.fieldValueTranslations.en, .fieldValueTranslations.en,
type: SCThingType.Room, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,13 +12,13 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMetaTranslations} from '../general/i18n';
import { import {
SCAcademicTerm, SCAcademicTerm,
SCAcademicTermWithoutReferences, SCAcademicTermWithoutReferences,
SCAcademicTermWithoutReferencesMeta, SCAcademicTermWithoutReferencesMeta,
} from '../base/AcademicTerm'; } from './abstract/academic-term';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCMetaTranslations} from '../types/i18n';
/** /**
* A semester without references * A semester without references
@@ -64,9 +64,7 @@ export class SCSemesterMeta
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCAcademicTermWithoutReferencesMeta.getInstance< ...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.de,
SCAcademicTermWithoutReferencesMeta
>().fieldTranslations.de,
acronym: 'Abkürzung', acronym: 'Abkürzung',
endDate: 'Ende', endDate: 'Ende',
eventsEndDate: 'Vorlesungsschluss', eventsEndDate: 'Vorlesungsschluss',
@@ -74,9 +72,7 @@ export class SCSemesterMeta
startDate: 'Beginn', startDate: 'Beginn',
}, },
en: { en: {
...SCAcademicTermWithoutReferencesMeta.getInstance< ...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>().fieldTranslations.en,
SCAcademicTermWithoutReferencesMeta
>().fieldTranslations.en,
acronym: 'acronym', acronym: 'acronym',
endDate: 'end date', endDate: 'end date',
eventsEndDate: 'semester ending', eventsEndDate: 'semester ending',
@@ -90,15 +86,13 @@ export class SCSemesterMeta
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCAcademicTermWithoutReferencesMeta.getInstance< ...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
SCAcademicTermWithoutReferencesMeta .fieldValueTranslations.de,
>().fieldValueTranslations.de,
type: 'Semester', type: 'Semester',
}, },
en: { en: {
...SCAcademicTermWithoutReferencesMeta.getInstance< ...SCAcademicTermWithoutReferencesMeta.getInstance<SCAcademicTermWithoutReferencesMeta>()
SCAcademicTermWithoutReferencesMeta .fieldValueTranslations.en,
>().fieldValueTranslations.en,
type: SCThingType.Semester, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,15 +12,15 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
import { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
/** /**
* A setting without references * A setting without references
@@ -133,10 +133,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCSettingCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
defaultValue: 'Standard Wert', defaultValue: 'Standard Wert',
inputType: 'Eingabetyp', inputType: 'Eingabetyp',
order: 'Position', order: 'Position',
@@ -144,10 +142,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
values: 'Werte', values: 'Werte',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCSettingCategories, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
defaultValue: 'default value', defaultValue: 'default value',
inputType: 'input type', inputType: 'input type',
order: 'position', order: 'position',
@@ -161,10 +157,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
*/ */
fieldValueTranslations = { fieldValueTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCSettingCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.de,
categories: { categories: {
credentials: 'Anmeldedaten', credentials: 'Anmeldedaten',
others: 'Andere', others: 'Andere',
@@ -181,10 +175,8 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
type: 'Einstellung', type: 'Einstellung',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCSettingCategories,
SCSettingCategories, SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldValueTranslations.en,
type: SCThingType.Setting, 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCEvent, SCEventMeta, SCEventWithoutReferences} from '../base/Event'; import {SCMetaTranslations} from '../general/i18n';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCEvent, SCEventMeta, SCEventWithoutReferences} from './abstract/event';
import {SCMetaTranslations} from '../types/i18n'; import {SCThingMeta, SCThingType} from './abstract/thing';
/** /**
* A sport course without references * 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 * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCMap} from '../general/map';
import {SCThingMeta, SCThingType} from './abstract/thing';
import { import {
SCAcademicPriceGroup, SCAcademicPriceGroup,
SCThingThatCanBeOffered, SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences, SCThingThatCanBeOfferedWithoutReferences,
} from '../base/ThingThatCanBeOffered'; } from './abstract/thing-that-can-be-offered';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCAcademicEventWithoutReferences} from './academic-event';
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../types/i18n'; import {SCOrganizationWithoutReferences} from './organization';
import {SCMap} from '../types/Map'; import {SCPersonWithoutReferences} from './person';
import {SCThingThatCanBeOfferedMeta} from './../base/ThingThatCanBeOffered';
import {SCAcademicEventWithoutReferences} from './AcademicEvent';
import {SCOrganizationWithoutReferences} from './Organization';
import {SCPersonWithoutReferences} from './Person';
/** /**
* A study module without references * A study module 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,10 +12,10 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingInPlace, SCThingInPlaceMeta} from '../base/ThingInPlace'; import {SCMetaTranslations} from '../general/i18n';
import {SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCISO8601Duration} from '../general/time';
import {SCMetaTranslations} from '../types/i18n'; import {SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
import {SCISO8601Duration} from '../types/Time'; import {SCThingInPlace, SCThingInPlaceMeta} from './abstract/thing-in-place';
/** /**
* A ticket without references * A ticket without references

View File

@@ -12,16 +12,16 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCISO8601Date} from '../general/time';
import {SCThing, SCThingMeta, SCThingType} from './abstract/thing';
import { import {
SCThingWithCategories, SCThingWithCategories,
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta, SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories'; } from './abstract/thing-with-categories';
import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
import {SCISO8601Date} from '../types/Time';
/** /**
* A "to do" without references * A "to do" without references
@@ -86,19 +86,15 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
*/ */
fieldTranslations = { fieldTranslations = {
de: { de: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
string, SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.de,
done: 'Erledigt', done: 'Erledigt',
dueDate: 'Fälligkeitsdatum', dueDate: 'Fälligkeitsdatum',
priority: 'Priorität', priority: 'Priorität',
}, },
en: { en: {
...SCThingWithCategoriesWithoutReferencesMeta.getInstance< ...SCThingWithCategoriesWithoutReferencesMeta.getInstance<string,
string, SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
SCThingWithCategoriesSpecificValues
>().fieldTranslations.en,
done: 'done', done: 'done',
dueDate: 'due date', dueDate: 'due date',
priority: 'priority', 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from '../Thing'; import {SCMetaTranslations} from '../general/i18n';
import {SCMetaTranslations} from '../types/i18n'; import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
/** /**
* A tour without references * A tour 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 * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCCreativeWork, SCCreativeWorkMeta, SCCreativeWorkWithoutReferences} from '../base/CreativeWork'; import {SCLanguage, SCMetaTranslations} from '../general/i18n';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCISO8601Duration} from '../general/time';
import {SCLanguage, SCMetaTranslations} from '../types/i18n'; import {SCCreativeWork, SCCreativeWorkMeta, SCCreativeWorkWithoutReferences} from './abstract/creative-work';
import {SCISO8601Duration} from '../types/Time'; import {SCThingMeta, SCThingType} from './abstract/thing';
import {SCPersonWithoutReferences} from './Person'; import {SCPersonWithoutReferences} from './person';
/** /**
* A video without references * A video without references

View File

@@ -12,14 +12,12 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCClasses} from './Classes';
import {SCThing, SCThingType} from './Thing';
import {isThing} from './types/Guards';
import {SCTranslations} from './types/i18n';
import clone = require('fast-clone'); import clone = require('fast-clone');
import {Defined, OCType} from 'ts-optchain'; import {Defined, OCType} from 'ts-optchain';
import {SCTranslations} from './general/i18n';
import {isThing} from './guards';
import {SCClasses} from './meta';
import {SCThing, SCThingType} from './things/abstract/thing';
// tslint:disable:no-any // tslint:disable:no-any
const standardCacheSize = 200; const standardCacheSize = 200;
@@ -33,7 +31,6 @@ export class SCThingTranslator {
* Property representing the translators target language * Property representing the translators target language
*/ */
private _language: keyof SCTranslations<SCThing>; private _language: keyof SCTranslations<SCThing>;
/** /**
* Property representing the translators base language * Property representing the translators base language
* This means every translation is given for this language * This means every translation is given for this language
@@ -115,17 +112,17 @@ export class SCThingTranslator {
// Assigns every property in fieldTranslations to the known base language translation // Assigns every property in fieldTranslations to the known base language translation
if (typeof metaClass.fieldTranslations.en !== 'undefined') { if (typeof metaClass.fieldTranslations.en !== 'undefined') {
Object.keys(metaClass.fieldTranslations.en) Object.keys(metaClass.fieldTranslations.en)
.forEach((key) => { .forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key]; (fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
}); });
} }
// Assigns every property in fieldTranslations to the known translation in given language // Assigns every property in fieldTranslations to the known translation in given language
if (typeof metaClass.fieldTranslations[language] !== 'undefined') { if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldTranslations[language]) Object.keys(metaClass.fieldTranslations[language])
.forEach((key) => { .forEach((key) => {
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key]; (fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
}); });
} }
return fieldTranslations; return fieldTranslations;
@@ -161,19 +158,19 @@ export class SCThingTranslator {
} }
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') { if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
Object.keys(metaClass.fieldValueTranslations[language]) Object.keys(metaClass.fieldValueTranslations[language])
.forEach((key) => { .forEach((key) => {
if (metaClass.fieldValueTranslations[language][key] instanceof Object) { if (metaClass.fieldValueTranslations[language][key] instanceof Object) {
// Assigns known translations of subproperties to property in given language (e.g. categories) // Assigns known translations of subproperties to property in given language (e.g. categories)
Object.keys((instance as any)[key]) Object.keys((instance as any)[key])
.forEach((subKey) => { .forEach((subKey) => {
(instance as any)[key][subKey] = (instance as any)[key][subKey] =
metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]]; metaClass.fieldValueTranslations[language][key][(instance as any)[key][subKey]];
}); });
} else { } else {
// Assigns property to known translation of fieldValueTranslations in given language // Assigns property to known translation of fieldValueTranslations in given language
(instance as any)[key] = metaClass.fieldValueTranslations[language][key]; (instance as any)[key] = metaClass.fieldValueTranslations[language][key];
} }
}); });
} }
return instance; return instance;
@@ -241,14 +238,14 @@ export class SCThingTranslator {
let nextInstance = instance; let nextInstance = instance;
// Recursively call this function on all nested SCThings, arrays and objects // Recursively call this function on all nested SCThings, arrays and objects
Object.keys(nextInstance) Object.keys(nextInstance)
.forEach((key) => { .forEach((key) => {
if ( if (
isThing((nextInstance as any)[key]) || isThing((nextInstance as any)[key]) ||
nextInstance[key] instanceof Array || nextInstance[key] instanceof Array ||
nextInstance[key] instanceof Object) { nextInstance[key] instanceof Object) {
nextInstance[key] = this.translateWholeThingDestructively(nextInstance[key], targetLanguage); nextInstance[key] = this.translateWholeThingDestructively(nextInstance[key], targetLanguage);
} }
}); });
// Spread variable translations given by the connector into thing // Spread variable translations given by the connector into thing
if (typeof nextInstance.translations !== 'undefined') { if (typeof nextInstance.translations !== 'undefined') {
@@ -341,7 +338,7 @@ class LRUCache<T> {
if (this.entries.size >= this.maxEntries) { if (this.entries.size >= this.maxEntries) {
// LRU behavior // LRU behavior
const keyToDelete = this.entries.keys() const keyToDelete = this.entries.keys()
.next().value; .next().value;
this.entries.delete(keyToDelete); this.entries.delete(keyToDelete);
} }
this.entries.set(key, content); this.entries.set(key, content);
@@ -353,6 +350,6 @@ class LRUCache<T> {
* @param something The object that should be cached under something.uid * @param something The object that should be cached under something.uid
*/ */
public putObject<U extends SCThing>(something: U) { 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 {expect} from 'chai';
import {slow, suite, test, timeout} from 'mocha-typescript'; import {slow, suite, test, timeout} from 'mocha-typescript';
import {SCBulkResponse} from '../src/core/protocol/routes/bulk/BulkResponse'; import {SCBulkResponse} from '../src/protocol/routes/bulk-request';
import {SCMultiSearchResponse} from '../src/core/protocol/routes/search/MultiSearchResponse'; import {SCMultiSearchResponse} from '../src/protocol/routes/search-multi';
import {SCSearchResponse} from '../src/core/protocol/routes/search/SearchResponse'; import {SCSearchResponse} from '../src/protocol/routes/search';
import {SCThingOriginType, SCThingType} from '../src/core/Thing'; import {SCThingOriginType, SCThingType} from '../src/things/abstract/thing';
import {SCDish} from '../src/core/things/Dish'; import {SCDish} from '../src/things/dish';
import { import {
isBulkResponse, isBulkResponse,
isMultiSearchResponse, isMultiSearchResponse,
isSearchResponse, isSearchResponse,
isThing, isThing,
isThingWithTranslations, isThingWithTranslations,
} from '../src/core/types/Guards'; } from '../src/guards';
@suite(timeout(10000), slow(5000)) @suite(timeout(10000), slow(5000))
export class GuardsSpec { export class GuardsSpec {

View File

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

View File

@@ -15,15 +15,14 @@
import {expect} from 'chai'; import {expect} from 'chai';
import clone = require('fast-clone'); import clone = require('fast-clone');
import {slow, suite, test, timeout} from 'mocha-typescript'; import {slow, suite, test, timeout} from 'mocha-typescript';
import {SCThingOriginType, SCThingType} from '../src/things/abstract/thing';
import {SCThingOriginType, SCThingType} from '../src/core/Thing'; import {SCBuildingWithoutReferences} from '../src/things/building';
import {SCBuildingWithoutReferences} from '../src/core/things/Building'; import {SCDish, SCDishMeta} from '../src/things/dish';
import {SCDish, SCDishMeta} from '../src/core/things/Dish'; import {SCThingTranslator} from '../src/translator';
import {SCThingTranslator} from '../src/core/Translator';
const building: SCBuildingWithoutReferences = { const building: SCBuildingWithoutReferences = {
address: { address: {
addressCountry : 'base-address.addressCountry', addressCountry: 'base-address.addressCountry',
addressLocality: 'base-address.addressLocality', addressLocality: 'base-address.addressLocality',
postalCode: 'base-address.postalCode', postalCode: 'base-address.postalCode',
streetAddress: 'base-address.streetAddress', streetAddress: 'base-address.streetAddress',
@@ -40,7 +39,7 @@ const building: SCBuildingWithoutReferences = {
translations: { translations: {
de: { de: {
address: { address: {
addressCountry : 'de-address.addressCountry', addressCountry: 'de-address.addressCountry',
addressLocality: 'de-address.addressLocality', addressLocality: 'de-address.addressLocality',
postalCode: 'de-address.postalCode', postalCode: 'de-address.postalCode',
streetAddress: 'de-address.streetAddress', streetAddress: 'de-address.streetAddress',
@@ -60,15 +59,15 @@ const dish: SCDish = {
name: 'base-dish-name', name: 'base-dish-name',
offers: [ offers: [
{ {
availability: 'in stock', availability: 'in stock',
inPlace: building, inPlace: building,
prices: { prices: {
default: 23.42, default: 23.42,
}, },
provider: { provider: {
name: 'base-provider', name: 'base-provider',
type: SCThingType.Organization, type: SCThingType.Organization,
uid: '540862f3-ea30-5b8f-8678-56b4dc217141', uid: '540862f3-ea30-5b8f-8678-56b4dc217141',
}, },
}, },
], ],
@@ -110,7 +109,7 @@ export class TranslationSpecInplace {
@test @test
public directArrayOfString() { public directArrayOfString() {
expect(translator.translate(dish).characteristics()).to.deep expect(translator.translate(dish).characteristics()).to.deep
.equal([{name: 'de-characteristic0'}, {name: 'de-characteristic1'}]); .equal([{name: 'de-characteristic0'}, {name: 'de-characteristic1'}]);
} }
@test @test
@@ -161,7 +160,7 @@ export class TranslationSpecInplace {
@test @test
public directArrayOfStringSubscriptFallback() { public directArrayOfStringSubscriptFallback() {
expect(translatorWithFallback.translate(dish).characteristics[1]()) expect(translatorWithFallback.translate(dish).characteristics[1]())
.to.deep.equal({name: 'base-characteristic1'}); .to.deep.equal({name: 'base-characteristic1'});
} }
@test @test
@@ -187,7 +186,7 @@ export class TranslationSpecInplace {
@test @test
public nestedMetaArrayOfStringFallback() { public nestedMetaArrayOfStringFallback() {
expect(translatorWithFallback.translate(dish).offers[0].inPlace.categories()) expect(translatorWithFallback.translate(dish).offers[0].inPlace.categories())
.to.deep.equal(['office', 'education']); .to.deep.equal(['office', 'education']);
} }
@test @test

View File

@@ -1,29 +1,46 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {assert, Has, IsAny, IsNever, NotHas} from 'conditional-type-checks'; import {assert, Has, IsAny, IsNever, NotHas} from 'conditional-type-checks';
import {SCThing, SCThingWithoutReferences} from '../src/core/Thing'; import {SCThing, SCThingWithoutReferences} from '../src/things/abstract/thing';
import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/core/things/AcademicEvent'; import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/things/academic-event';
import {SCArticle, SCArticleWithoutReferences} from '../src/core/things/Article'; import {SCArticle, SCArticleWithoutReferences} from '../src/things/article';
import {SCBook, SCBookWithoutReferences} from '../src/core/things/Book'; import {SCBook, SCBookWithoutReferences} from '../src/things/book';
import {SCBuilding, SCBuildingWithoutReferences} from '../src/core/things/Building'; import {SCBuilding, SCBuildingWithoutReferences} from '../src/things/building';
import {SCCatalog, SCCatalogWithoutReferences} from '../src/core/things/Catalog'; import {SCCatalog, SCCatalogWithoutReferences} from '../src/things/catalog';
import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/core/things/CourseOfStudies'; import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/things/course-of-studies';
import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/core/things/DateSeries'; import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/things/date-series';
import {SCDiff, SCDiffWithoutReferences} from '../src/core/things/Diff'; import {SCDiff, SCDiffWithoutReferences} from '../src/things/diff';
import {SCDish, SCDishWithoutReferences} from '../src/core/things/Dish'; import {SCDish, SCDishWithoutReferences} from '../src/things/dish';
import {SCFavorite, SCFavoriteWithoutReferences} from '../src/core/things/Favorite'; import {SCFavorite, SCFavoriteWithoutReferences} from '../src/things/favorite';
import {SCFloor, SCFloorWithoutReferences} from '../src/core/things/Floor'; import {SCFloor, SCFloorWithoutReferences} from '../src/things/floor';
import {SCMessage, SCMessageWithoutReferences} from '../src/core/things/Message'; import {SCMessage, SCMessageWithoutReferences} from '../src/things/message';
import {SCOrganization, SCOrganizationWithoutReferences} from '../src/core/things/Organization'; import {SCOrganization, SCOrganizationWithoutReferences} from '../src/things/organization';
import {SCPerson, SCPersonWithoutReferences} from '../src/core/things/Person'; import {SCPerson, SCPersonWithoutReferences} from '../src/things/person';
import {SCPointOfInterest, SCPointOfInterestWithoutReferences} from '../src/core/things/PointOfInterest'; import {SCPointOfInterest, SCPointOfInterestWithoutReferences} from '../src/things/point-of-interest';
import {SCRoom, SCRoomWithoutReferences} from '../src/core/things/Room'; import {SCRoom, SCRoomWithoutReferences} from '../src/things/room';
import {SCSemester, SCSemesterWithoutReferences} from '../src/core/things/Semester'; import {SCSemester, SCSemesterWithoutReferences} from '../src/things/semester';
import {SCSetting, SCSettingWithoutReferences} from '../src/core/things/Setting'; import {SCSetting, SCSettingWithoutReferences} from '../src/things/setting';
import {SCSportCourse, SCSportCourseWithoutReferences} from '../src/core/things/SportCourse'; import {SCSportCourse, SCSportCourseWithoutReferences} from '../src/things/sport-course';
import {SCStudyModule, SCStudyModuleWithoutReferences} from '../src/core/things/StudyModule'; import {SCStudyModule, SCStudyModuleWithoutReferences} from '../src/things/study-module';
import {SCTicket, SCTicketWithoutReferences} from '../src/core/things/Ticket'; import {SCTicket, SCTicketWithoutReferences} from '../src/things/ticket';
import {SCToDo, SCToDoWithoutReferences} from '../src/core/things/ToDo'; import {SCToDo, SCToDoWithoutReferences} from '../src/things/todo';
import {SCTour, SCTourWithoutReferences} from '../src/core/things/Tour'; import {SCTour, SCTourWithoutReferences} from '../src/things/tour';
import {SCVideo, SCVideoWithoutReferences} from '../src/core/things/Video'; import {SCVideo, SCVideoWithoutReferences} from '../src/things/video';
// tslint:disable:no-any
// tslint:disable:completed-docs
/** /**
* Check if E extends T * Check if E extends T

View File

@@ -1,7 +1,6 @@
{ {
"extends": "./node_modules/@openstapps/configuration/tslint.json", "extends": "./node_modules/@openstapps/configuration/tslint.json",
"rules": { "rules": {
"no-empty-interface": false, "no-empty-interface": false
"file-name-casing": [false, "camel-case"]
} }
} }