refactor: split api into api, api-cli & api-plugin

This commit is contained in:
2023-06-02 16:41:25 +02:00
parent 495a63977c
commit b21833de40
205 changed files with 1981 additions and 1492 deletions

View File

@@ -58,8 +58,6 @@
"@types/json-schema": "7.0.11",
"@types/mocha": "10.0.1",
"@types/node": "18.15.3",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.49.0",
"c8": "7.14.0",
"chai": "4.3.7",
"conditional-type-checks": "1.0.6",
@@ -69,7 +67,7 @@
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typedoc": "0.24.7",
"typescript": "4.8.4"
"typescript": "4.9.5"
},
"tsup": {
"entry": [

View File

@@ -17,7 +17,6 @@ import {SCUserConfigurationMap} from './user.js';
/**
* Supported authorization provider types
*
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-1.3.1
* @see https://github.com/gbv/paia
*/
@@ -74,7 +73,6 @@ export interface SCAuthorizationProviderEndpoints {
/**
* Mapping of how to create SCUser from userinfo endpoint response (using JSONPath syntax)
*
* @see https://www.npmjs.com/package/jsonpath
*/
mapping: SCUserConfigurationMap;

View File

@@ -19,7 +19,6 @@ import {SCBackendConfiguration, SCBackendInternalConfiguration} from './backend.
/**
* A configuration file that configures app and backend
*
* @validatable
*/
export interface SCConfigFile {

View File

@@ -18,14 +18,12 @@
export interface SCLanguage {
/**
* The two letter ISO 639-1 Code of the Language
*
* @filterable
*/
code: SCLanguageCode;
/**
* The Fulltext name of the Language
*
* @filterable
*/
name: SCLanguageName;
@@ -33,7 +31,6 @@ export interface SCLanguage {
/**
* A list of possible languages in english
*
* @see https://en.wikipedia.org/wiki/ISO_639-1
*/
export type SCLanguageName =
@@ -225,7 +222,6 @@ export type SCLanguageName =
/**
* A List of all possible Languages as ISO 639-1 Codes
*
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/
export type SCLanguageCode =
@@ -417,7 +413,6 @@ export type SCLanguageCode =
/**
* A list of possible nationalities
*
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
*/
export type SCNationality =
@@ -673,7 +668,6 @@ export type SCNationality =
/**
* Translations for specific languages
*
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/
export interface SCTranslations<T> {

View File

@@ -18,7 +18,6 @@
*
* !!! BEWARE !!!
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
*
* @typeparam T Can be any type.
*/
export interface SCMap<T> {
@@ -34,7 +33,6 @@ export interface SCMap<T> {
* !!! BEWARE !!!
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
* Also note, that this is a type not an interface
*
* @typeparam U Must be a type the `in` operator can be applied to and contains only strings or numbers
* @typeparam T Can be any type
*/

View File

@@ -14,7 +14,6 @@
*/
/**
* An ISO8601 date
*
* @pattern ^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])(T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])([\.,][0-9]{0,7})?(Z|[+-](?:2[0-3]|[01][0-9])(:?[0-5][0-9])?)?)?$
* @see https://gist.github.com/philipashlock/8830168
* @date
@@ -23,7 +22,6 @@ export type SCISO8601Date = string;
/**
* An ISO8601 duration
*
* @pattern ^(R\d*\/)?P(?:\d+(?:\.\d+)?Y)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?W)?(?:\d+(?:\.\d+)?D)?(?:T(?:\d+(?:\.\d+)?H)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?S)?)?$
* @see https://gist.github.com/philipashlock/8830168
*/
@@ -31,7 +29,6 @@ export type SCISO8601Duration = string;
/**
* An ISO8601 time
*
* @pattern ^(2[0-3]|[01][0-9]):?([0-5][0-9]):?([0-5][0-9])$
*/
export type SCISO8601Time = string;

View File

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

View File

@@ -25,7 +25,6 @@ import {
/**
* Type guard to check if something is a SCThing
*
* @param something Something to check
*/
export function isThing(something: unknown): something is SCThing {
@@ -48,7 +47,6 @@ export function isThing(something: unknown): something is SCThing {
/**
* Type guard to check if translations exist
*
* @param thing Thing to check
*/
export function isThingWithTranslations(
@@ -59,7 +57,6 @@ export function isThingWithTranslations(
/**
* Type guard to check if something is a bulk response
*
* @param something Something to check
*/
export function isBulkResponse(something: unknown): something is SCBulkResponse {
@@ -96,7 +93,6 @@ export function isBulkResponse(something: unknown): something is SCBulkResponse
/**
* Type guard to check if something is a search response
*
* @param something Something to check
*/
export function isSearchResponse(something: unknown): something is SCSearchResponse {
@@ -119,7 +115,6 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
/**
* Type guard to check if something is a multi search response
*
* @param something Something to check
*/
export function isMultiSearchResponse(something: unknown): something is SCMultiSearchResponse {

View File

@@ -15,7 +15,6 @@
/**
* 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 {
@@ -41,7 +40,6 @@ export abstract class SCError implements SCErrorResponse {
/**
* 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

View File

@@ -17,7 +17,6 @@ import {SCError} from '../error.js';
/**
* An error that is returned, when an internal server error occurred
*
* @validatable
*/
export class SCInternalServerErrorResponse extends SCError {
@@ -28,7 +27,6 @@ export class SCInternalServerErrorResponse extends SCError {
/**
* Create a SCInternalServerErrorResponse
*
* @param error 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

View File

@@ -17,13 +17,11 @@ import {SCError} from '../error.js';
/**
* An error that is returned, when the used HTTP method is not allowed on the requested route
*
* @validatable
*/
export class SCMethodNotAllowedErrorResponse extends SCError {
/**
* Create a SCMethodNotAllowedErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {

View File

@@ -17,13 +17,11 @@ import {SCError} from '../error.js';
/**
* An error that is returned when the requested route or resource was not found
*
* @validatable
*/
export class SCNotFoundErrorResponse extends SCError {
/**
* Create a SCNotFoundErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {

View File

@@ -18,13 +18,11 @@ import {SCError} from '../error.js';
/**
* An error that is returned when the request is in the right format, but contains parameters that are invalid or not
* acceptable.
*
* @validatable
*/
export class SCParametersNotAcceptable extends SCError {
/**
* Create a ParametersNotAcceptable
*
* @param message contains more details to what you did wrong
* @param stack Set to true if a stack trace should be created
*/

View File

@@ -20,7 +20,6 @@ import {SCPluginMetaData} from '../routes/plugin-register.js';
* An error that is returned when a plugin with the same name is already registered, to prevent two copies of a plugin
* running at the same time.
* This usually indicates that there is more than one instance a plugin running.
*
* @validatable
*/
export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
@@ -32,7 +31,6 @@ export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
/**
* 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

View File

@@ -17,13 +17,11 @@ import {SCError} from '../error.js';
/**
* An error that is returned whenever there is an unexpected error while creating a plugin
*
* @validatable
*/
export class SCPluginRegisteringFailedErrorResponse extends SCError {
/**
* Create a PluginRegisteringFailedError
*
* @param message Describes what went wrong wile registering the plugin
* @param stack Set to true if a stack trace should be created
*/

View File

@@ -17,13 +17,11 @@ import {SCError} from '../error.js';
/**
* An error that is returned, when the request body is too large.
*
* @validatable
*/
export class SCRequestBodyTooLargeErrorResponse extends SCError {
/**
* Create a SCRequestBodyTooLargeErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {

View File

@@ -17,13 +17,11 @@ import {SCError} from '../error.js';
/**
* An error that is returned whenever there is a syntax error
*
* @validatable
*/
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
*/

View File

@@ -17,13 +17,11 @@ import {SCError} from '../error.js';
/**
* An error that is returned, when to many request are submitted at once
*
* @validatable
*/
export class SCTooManyRequestsErrorResponse extends SCError {
/**
* Create a SCTooManyRequestsErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {

View File

@@ -17,13 +17,11 @@ import {SCError} from '../error.js';
/**
* An error that is returned when the content type of the request is not supported
*
* @validatable
*/
export class SCUnsupportedMediaTypeErrorResponse extends SCError {
/**
* Create a SCUnsupportedMediaTypeErrorResponse
*
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {

View File

@@ -18,7 +18,6 @@ import {SCError} from '../error.js';
/**
* An error that is returned when the validation of a request fails
*
* @validatable
*/
export class SCValidationErrorResponse extends SCError {
@@ -29,7 +28,6 @@ export class SCValidationErrorResponse extends SCError {
/**
* Create a SCValidationErrorResponse
*
* @param errors List of validation errors
* @param stack Set to true if a stack trace should be created
*/

View File

@@ -125,7 +125,6 @@ export abstract class SCAbstractRoute implements SCRoute {
/**
* Get "compiled" URL path
*
* @param parameters Parameters to compile URL path with
*/
public getUrlPath(parameters: SCMap<string> = {}): string {

View File

@@ -29,7 +29,6 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
/**
* Request to check the availability of books
*
* @validatable
*/
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;
@@ -56,7 +55,6 @@ export interface SCBookAvailabilityRequestByUuid {
/**
* List of availabilities of a book
*
* @validatable
*/
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;

View File

@@ -25,14 +25,12 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
/**
* Request to add a thing to a bulk
*
* @validatable
*/
export type SCBulkAddRequest = SCThings;
/**
* Response to a request to add a thing to a bulk
*
* @validatable
*/
export interface SCBulkAddResponse {}

View File

@@ -24,14 +24,12 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
/**
* Request to change the bulk state to done (close the bulk process)
*
* @validatable
*/
export interface SCBulkDoneRequest {}
/**
* Response to a request to change the state of a bulk to done
*
* @validatable
*/
export interface SCBulkDoneResponse {}

View File

@@ -28,7 +28,6 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
* A bulk request
*
* Parameters to be sent to request a new bulk.
*
* @validatable
*/
export type SCBulkRequest = SCBulkParameters;
@@ -62,7 +61,6 @@ export interface SCBulkParameters {
/**
* Requested Bulk from backend
*
* @validatable
*/
export interface SCBulkResponse extends SCBulkParameters {

View File

@@ -24,7 +24,6 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
/**
* User feedback
*
* @validatable
*/
export interface SCFeedbackRequest extends SCMessage {
@@ -36,7 +35,6 @@ export interface SCFeedbackRequest extends SCMessage {
/**
* A response to a feedback request
*
* @validatable
*/
export interface SCFeedbackResponse {}

View File

@@ -26,14 +26,12 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
/**
* Index request
*
* @validatable
*/
export interface SCIndexRequest {}
/**
* A response to an index request
*
* @validatable
*/
export interface SCIndexResponse {

View File

@@ -26,7 +26,6 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
/**
* Plugin register request
*
* @validatable
*/
export type SCPluginRegisterRequest = SCPluginAdd | SCPluginRemove;
@@ -93,7 +92,6 @@ export interface SCPluginMetaData {
/**
* Plugin register response
*
* @validatable
*/
export interface SCPluginRegisterResponse {

View File

@@ -27,7 +27,6 @@ import {SCValidationErrorResponse} from '../errors/validation.js';
* User rating from the app
* Plugin needs to define its own rating request to hit the target rating system.
* That request should extend this one and contain timestamp and other needed data.
*
* @validatable
*/
export interface SCRatingRequest {
@@ -49,7 +48,6 @@ export interface SCRatingRequest {
/**
* A response to a rating request
*
* @validatable
*/
export interface SCRatingResponse {}

View File

@@ -31,7 +31,6 @@ import {SCSearchResult} from '../search/result.js';
* This is a map of [[SCSearchRequest]]s indexed by name.
*
* **CAUTION: This is limited to an amount of queries. Currently this limit is 5.**
*
* @validatable
*/
export type SCMultiSearchRequest = SCMap<SCSearchQuery>;
@@ -40,7 +39,6 @@ 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>;

View File

@@ -25,14 +25,12 @@ import {SCSearchResult} from '../search/result.js';
/**
* A search request
*
* @validatable
*/
export type SCSearchRequest = SCSearchQuery;
/**
* A search response
*
* @validatable
*/
export type SCSearchResponse = SCSearchResult;

View File

@@ -25,14 +25,12 @@ import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
/**
* Request to update an existing thing
*
* @validatable
*/
export type SCThingUpdateRequest = SCThings;
/**
* Response for an entity update request
*
* @validatable
*/
export interface SCThingUpdateResponse {}

View File

@@ -19,7 +19,6 @@ import {SCSearchAbstractFilter, SCSearchAbstractFilterArguments} from '../filter
* A date range filter
*
* Filter for documents with a date field that satisfies the given constraints
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_date_format_in_range_queries
*/
export interface SCSearchDateRangeFilter extends SCSearchAbstractFilter<SCDateRangeFilterArguments> {
@@ -33,7 +32,6 @@ export interface SCSearchDateRangeFilter extends SCSearchAbstractFilter<SCDateRa
* A distance filter
*
* Filter for documents with a numeric field that satisfies the given constraints
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#query-dsl-range-query
*/
export interface SCSearchNumericRangeFilter extends SCSearchAbstractFilter<SCNumericRangeFilterArguments> {
@@ -47,20 +45,17 @@ export interface SCSearchNumericRangeFilter extends SCSearchAbstractFilter<SCNum
* Additional arguments for date range filters
*
* Filter uses a plain string to allow for date math expressions
*
* @see https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/date-math-expressions.html
*/
export interface SCDateRangeFilterArguments extends SCRangeFilterArguments<string> {
/**
* Optional date format specifier
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_date_format_in_range_queries
*/
format?: string;
/**
* Optional timezone specifier
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#_time_zone_in_range_queries
*/
timeZone?: string;
@@ -73,7 +68,6 @@ export type SCNumericRangeFilterArguments = SCRangeFilterArguments<number>;
/**
* Additional arguments for range filters
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-range-query.html#query-dsl-range-query
*/
export interface SCRangeFilterArguments<T> extends SCSearchAbstractFilterArguments {

View File

@@ -21,7 +21,6 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing.js';
export interface SCAcademicDegreeWithoutReferences extends SCThingWithoutReferences {
/**
* The achievable academic degree
*
* @filterable
* @sortable ducet
*/

View File

@@ -22,7 +22,6 @@ import {SCThing, SCThingMeta, SCThingWithoutReferences} from './thing.js';
export interface SCAcademicTermWithoutReferences extends SCThingWithoutReferences {
/**
* Short name of the academic term, using the given pattern
*
* @aggregatable
* @filterable
* @keyword
@@ -31,28 +30,24 @@ export interface SCAcademicTermWithoutReferences extends SCThingWithoutReference
/**
* End date of the academic term
*
* @filterable
*/
endDate: SCISO8601Date;
/**
* End date of lectures in the academic term
*
* @filterable
*/
eventsEndDate?: SCISO8601Date;
/**
* Start date of lectures in the academic term
*
* @filterable
*/
eventsStartDate?: SCISO8601Date;
/**
* Start date of the academic term
*
* @filterable
*/
startDate: SCISO8601Date;

View File

@@ -35,28 +35,24 @@ export interface SCCreativeWorkWithoutReferences extends SCThingWithoutReference
/**
* Edition of a creative work (e.g. the book edition or edition of an article)
*
* @keyword
*/
edition?: string;
/**
* Date (in text form) the creative work was published for the first time
*
* @keyword
*/
firstPublished?: string;
/**
* Languages this creative work is written/recorded/... in
*
* @filterable
*/
inLanguage?: SCLanguageCode;
/**
* Keywords of the creative work
*
* @aggregatable
* @filterable
* @keyword
@@ -65,7 +61,6 @@ export interface SCCreativeWorkWithoutReferences extends SCThingWithoutReference
/**
* Date (in text form) the creative work was most recently
*
* @keyword
*/
lastPublished?: string;
@@ -117,7 +112,6 @@ export interface SCCreativeWork extends SCCreativeWorkWithoutReferences, SCThing
export interface SCCreativeWorkTranslatableProperties extends SCThingTranslatableProperties {
/**
* Translation of the keywords of the creative work
*
* @keyword
*/
keywords?: string[];

View File

@@ -27,7 +27,6 @@ export interface SCEventWithoutReferences extends SCThingWithoutReferences {
* Maximum number of participants of the event
*
* A maximum number of people that can participate in the event.
*
* @integer
*/
maximumParticipants?: number;
@@ -36,7 +35,6 @@ export interface SCEventWithoutReferences extends SCThingWithoutReferences {
* Remaining attendee capacity of the event
*
* This number represents the remaining open spots.
*
* @integer
*/
remainingAttendeeCapacity?: number;

View File

@@ -39,42 +39,36 @@ export interface SCGeoInformation {
export interface SCPostalAddress {
/**
* Country of the address
*
* @filterable
*/
addressCountry: string;
/**
* City of the address
*
* @filterable
*/
addressLocality: string;
/**
* State of the address
*
* @filterable
*/
addressRegion?: string;
/**
* Zip code of the address
*
* @filterable
*/
postalCode: string;
/**
* Optional post box number
*
* @filterable
*/
postOfficeBoxNumber?: string;
/**
* Street of the address - with house number!
*
* @filterable
*/
streetAddress: string;
@@ -99,7 +93,6 @@ export interface SCPlaceWithoutReferences extends SCThingWithoutReferences {
/**
* Opening hours of the place
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
* @keyword
*/

View File

@@ -26,7 +26,6 @@ export type SCThingThatAcceptsPaymentsAcceptedPayments = 'cash' | 'credit' | 'ca
export interface SCThingThatAcceptsPaymentsWithoutReferences extends SCThingWithoutReferences {
/**
* Accepted payments of the place
*
* @filterable
*/
paymentsAccepted?: SCThingThatAcceptsPaymentsAcceptedPayments[];

View File

@@ -25,7 +25,6 @@ import {SCThing, SCThingMeta, SCThingTranslatableProperties, SCThingWithoutRefer
export interface SCPriceGroup {
/**
* Default price of the thing
*
* @sortable price
* @float
*/
@@ -38,7 +37,6 @@ export interface SCPriceGroup {
export interface SCAcademicPriceGroup extends SCPriceGroup {
/**
* Price for employees
*
* @sortable price
* @float
*/
@@ -46,7 +44,6 @@ export interface SCAcademicPriceGroup extends SCPriceGroup {
/**
* Price for guests
*
* @sortable price
* @float
*/
@@ -54,7 +51,6 @@ export interface SCAcademicPriceGroup extends SCPriceGroup {
/**
* Price for students
*
* @sortable price
* @float
*/
@@ -119,7 +115,6 @@ export interface SCThingThatCanBeOfferedOffer<T extends SCPriceGroup> extends SC
export interface SCThingThatCanBeOfferedTranslatableProperties extends SCThingTranslatableProperties {
/**
* Availability of an offer
*
* @keyword
*/
'offers[].availability'?: string;

View File

@@ -26,7 +26,6 @@ export interface SCThingWithCategoriesWithoutReferences<T, U extends SCThingWith
extends SCThingWithoutReferences {
/**
* Categories of a thing with categories
*
* @sortable ducet
* @aggregatable
* @filterable
@@ -64,7 +63,6 @@ export interface SCThingWithCategories<T, U extends SCThingWithCategoriesSpecifi
export interface SCThingWithCategoriesTranslatableProperties extends SCThingTranslatableProperties {
/**
* translations of the categories of a thing with categories
*
* @sortable ducet
*/
categories?: string[];
@@ -78,28 +76,24 @@ export interface SCThingWithCategoriesTranslatableProperties extends SCThingTran
export interface SCThingWithCategoriesSpecificValues {
/**
* Category specific alternate names of a thing
*
* @keyword
*/
alternateNames?: string[];
/**
* Category specific description of a thing
*
* @text
*/
description?: string;
/**
* URL of a category specific image of a thing
*
* @keyword
*/
image?: string;
/**
* Category specific name of a thing
*
* @sortable ducet
* @text
*/
@@ -107,7 +101,6 @@ export interface SCThingWithCategoriesSpecificValues {
/**
* Category specific URL of a thing
*
* @keyword
*/
url?: string;

View File

@@ -60,7 +60,6 @@ export enum SCThingType {
export interface SCThingWithoutReferences {
/**
* Alternate names of the thing
*
* @filterable
* @keyword
*/
@@ -68,7 +67,6 @@ export interface SCThingWithoutReferences {
/**
* Description of the thing
*
* @minLength 1
* @text
*/
@@ -83,14 +81,12 @@ export interface SCThingWithoutReferences {
/**
* URL of an image of the thing
*
* @keyword
*/
image?: string;
/**
* Name of the thing
*
* @filterable
* @minLength 1
* @sortable ducet
@@ -114,7 +110,6 @@ export interface SCThingWithoutReferences {
/**
* Type of the thing
*
* @sortable ducet
* @filterable
* @aggregatable global
@@ -178,7 +173,6 @@ export interface SCThingRemoteOrigin extends SCThingOrigin {
/**
* Name of the origin
*
* @text
*/
name: string;
@@ -237,13 +231,11 @@ export interface SCThingUserOrigin extends SCThingOrigin {
export interface SCThingTranslatableProperties {
/**
* Translation of the description of the thing
*
* @text
*/
description?: string;
/**
* Translation of the name of the thing
*
* @sortable ducet
* @text
*/
@@ -260,7 +252,6 @@ export interface SCThingTranslatableProperties {
export interface SCThingTranslatablePropertyOrigin {
/**
* Translation of the name of the origin
*
* @text
*/
name: string;

View File

@@ -31,7 +31,6 @@ export interface SCAcademicEventWithoutReferences
SCThingWithCategoriesWithoutReferences<SCAcademicEventCategories, SCThingWithCategoriesSpecificValues> {
/**
* Majors of the academic event that this event belongs to
*
* @aggregatable
* @filterable
* @keyword
@@ -40,7 +39,6 @@ export interface SCAcademicEventWithoutReferences
/**
* Original unmapped category from the source of the academic event
*
* @filterable
* @keyword
*/
@@ -59,7 +57,6 @@ export interface SCAcademicEventWithoutReferences
/**
* An academic event
*
* @validatable
* @indexable
*/
@@ -104,14 +101,12 @@ export type SCAcademicEventCategories =
export interface SCAcademicEventTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
/**
* Translations of the majors of the academic event that this event belongs to
*
* @keyword
*/
majors?: string[];
/**
* Translation of the original unmapped category from the source of the academic event
*
* @keyword
*/
originalCategory?: string;

View File

@@ -49,7 +49,6 @@ export interface SCArticleWithoutReferences
SCThingWithCategoriesWithoutReferences<SCArticleCategories, SCThingWithCategoriesSpecificValues> {
/**
* Article itself as markdown
*
* @text
*/
articleBody?: string;
@@ -72,7 +71,6 @@ export interface SCArticleWithoutReferences
/**
* An article
*
* @validatable
* @indexable
*/
@@ -109,7 +107,6 @@ export interface SCArticleTranslatableProperties
SCCreativeWorkTranslatableProperties {
/**
* Translation of the article itself as markdown
*
* @text
*/
articleBody?: string[];

View File

@@ -41,7 +41,6 @@ export interface SCAssessmentWithoutReferences
> {
/**
* Number of attempts
*
* @integer
*/
attempt?: number;
@@ -53,7 +52,6 @@ export interface SCAssessmentWithoutReferences
/**
* ECTS (credit-points)
*
* @float
*/
ects?: number;
@@ -81,7 +79,6 @@ export interface SCAssessmentWithoutReferences
/**
* An assessment
*
* @validatable
*/
export interface SCAssessment

View File

@@ -73,7 +73,6 @@ export interface SCBookWithoutReferences
/**
* ISBNs of a book
*
* @filterable
* @keyword
*/
@@ -81,7 +80,6 @@ export interface SCBookWithoutReferences
/**
* Number of pages of a book
*
* @integer
*/
numberOfPages?: number;
@@ -99,7 +97,6 @@ export interface SCBookWithoutReferences
/**
* A book
*
* @validatable
* @indexable
*/

View File

@@ -43,7 +43,6 @@ export interface SCBuildingWithoutReferences
SCPlaceWithoutReferences {
/**
* List of floor names of the place
*
* @filterable
* @keyword
*/
@@ -62,7 +61,6 @@ export interface SCBuildingWithoutReferences
/**
* A building
*
* @validatable
* @indexable
*/

View File

@@ -32,7 +32,6 @@ export interface SCCatalogWithoutReferences
* Level of the catalog (0 for 'root catalog', 1 for its subcatalog, 2 for its subcatalog etc.)
*
* Needed for keeping order in catalog inheritance array.
*
* @filterable
* @integer
*/
@@ -46,7 +45,6 @@ export interface SCCatalogWithoutReferences
/**
* A catalog
*
* @validatable
* @indexable
*/

View File

@@ -23,21 +23,18 @@ import {SCRoomWithoutReferences} from './room.js';
export interface SCContactPointWithoutReferences extends SCThingWithoutReferences {
/**
* E-mail at the work location
*
* @keyword
*/
email?: string;
/**
* Fax number at the work location
*
* @keyword
*/
faxNumber?: string;
/**
* Office hours for contacting someone at the work location
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
* @keyword
*/
@@ -45,7 +42,6 @@ export interface SCContactPointWithoutReferences extends SCThingWithoutReference
/**
* Contact number at the work location
*
* @keyword
*/
telephone?: string;
@@ -57,7 +53,6 @@ export interface SCContactPointWithoutReferences extends SCThingWithoutReference
/**
* URL at the work location
*
* @keyword
*/
url?: string;
@@ -65,7 +60,6 @@ export interface SCContactPointWithoutReferences extends SCThingWithoutReference
/**
* A contact point
*
* @see http://schema.org/ContactPoint
* @validatable
* @indexable

View File

@@ -43,14 +43,12 @@ export interface SCCourseOfStudyWithoutReferences
/**
* The modes the course of study is offered in
*
* @filterable
*/
mode?: SCCourseOfStudyMode;
/**
* The time modes the course of study is offered in
*
* @filterable
*/
timeMode?: SCCourseOfStudyTimeMode;
@@ -68,7 +66,6 @@ export interface SCCourseOfStudyWithoutReferences
/**
* A course of study
*
* @validatable
* @indexable
*/

View File

@@ -33,7 +33,6 @@ import {SCSportCourseWithoutReferences} from './sport-course.js';
export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
/**
* Price for alumnis
*
* @float
*/
alumni?: number;
@@ -45,7 +44,6 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup {
export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
/**
* Dates of the date series that are initially planned to be held
*
* @filterable
*/
dates: SCISO8601Date[];
@@ -62,7 +60,6 @@ export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWi
/**
* Frequency of the date series
*
* @filterable
*/
repeatFrequency?: SCISO8601Duration;
@@ -80,7 +77,6 @@ export interface SCDateSeriesWithoutReferences extends SCThingThatCanBeOfferedWi
/**
* A date series
*
* @validatable
* @indexable
*/

View File

@@ -45,7 +45,6 @@ export interface SCDiffWithoutReferences extends SCThingWithoutReferences {
/**
* A diff
*
* @validatable
*/
export interface SCDiff extends SCDiffWithoutReferences, SCThing {

View File

@@ -38,7 +38,6 @@ export interface SCDishWithoutReferences
SCThingWithCategoriesWithoutReferences<SCDishCategories, SCThingWithCategoriesSpecificValues> {
/**
* Additives of the dish
*
* @filterable
* @keyword
*/
@@ -72,7 +71,6 @@ export interface SCDishWithoutReferences
/**
* A dish
*
* @validatable
* @indexable
*/
@@ -106,7 +104,6 @@ export interface SCDishTranslatableProperties
SCThingThatCanBeOfferedTranslatableProperties {
/**
* Additives of the dish
*
* @filterable
* @keyword
*/
@@ -123,14 +120,12 @@ export interface SCDishTranslatableProperties
export interface SCDishCharacteristic {
/**
* URL of an image of the characteristic
*
* @keyword
*/
image?: string;
/**
* Name of the characteristic
*
* @filterable
* @text
*/
@@ -144,55 +139,47 @@ export type SCDishCategories = 'appetizer' | 'salad' | 'main dish' | 'dessert' |
/**
* Type definition for SCNutritionInformation
*
* @see https://schema.org/NutritionInformation
*/
export interface SCNutritionInformation {
/**
* Number of calories contained (in kcal)
*
* @float
*/
calories?: number;
/**
* Content of carbohydrates (in grams)
*
* @float
*/
carbohydrateContent?: number;
/**
* Content of fat (in grams)
*
* @float
*/
fatContent?: number;
/**
* Content of proteins (in grams)
*
* @float
*/
proteinContent?: number;
/**
* Content of salt (in grams)
*
* @float
*/
saltContent?: number;
/**
* Content of saturated fat (in grams)
*
* @float
*/
saturatedFatContent?: number;
/**
* Content of sugar (in grams)
*
* @float
*/
sugarContent?: number;
@@ -206,7 +193,6 @@ export interface SCMenuSection {
/**
* The time span when the dishes from the sections are available.
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
*/
servingHours?: string;

View File

@@ -27,7 +27,6 @@ export interface SCFavoriteWithoutReferences extends SCSaveableThingWithoutRefer
/**
* A favorite
*
* @validatable
*/
export interface SCFavorite extends SCSaveableThing {

View File

@@ -30,7 +30,6 @@ import {SCRoomWithoutReferences} from './room.js';
export interface SCFloorWithoutReferences extends SCThingWithoutReferences {
/**
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
*
* @text
*/
floorName: string;
@@ -53,7 +52,6 @@ export interface SCFloorWithoutReferences extends SCThingWithoutReferences {
/**
* A floor
*
* @validatable
* @indexable
*/
@@ -97,7 +95,6 @@ export interface SCFloorFeatureWithPlace<T extends GeometryObject>
export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
/**
* Translation of the floor name
*
* @text
*/
floorName?: string;

View File

@@ -48,7 +48,6 @@ export interface SCMessageWithoutReferences
/**
* Roles for which the message is intended
*
* @filterable
*/
audiences: SCUserGroup[];
@@ -60,14 +59,12 @@ export interface SCMessageWithoutReferences
/**
* When the message was created
*
* @filterable
*/
dateCreated?: SCISO8601Date;
/**
* Message itself
*
* @text
*/
messageBody: string;
@@ -90,7 +87,6 @@ export interface SCMessageWithoutReferences
/**
* A message
*
* @validatable
* @indexable
*/
@@ -114,7 +110,6 @@ export interface SCMessageTranslatableProperties
SCThingThatCanBeOfferedTranslatableProperties {
/**
* Message itself
*
* @text
*/
messageBody?: string;

View File

@@ -29,7 +29,6 @@ export interface SCOrganizationWithoutReferences extends SCThingWithoutReference
/**
* An organization
*
* @validatable
* @indexable
*/

View File

@@ -52,7 +52,6 @@ export interface SCPeriodicalWithoutReferences
categories: SCPeriodicalCategories[];
/**
* A list of ISSNs of a periodical
*
* @filterable
* @keyword
*/
@@ -71,7 +70,6 @@ export interface SCPeriodicalWithoutReferences
/**
* A publication published at regular intervals (e.g. a magazine or newspaper)
*
* @validatable
* @indexable
*/

View File

@@ -27,7 +27,6 @@ import {SCRoomWithoutReferences} from './room.js';
export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* Additional first names of the person.
*
* @filterable
* @keyword
*/
@@ -35,14 +34,12 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* The birth date of the person.
*
* @filterable
*/
birthDate?: SCISO8601Date;
/**
* The private email address of the person.
*
* @TJS-format email
* @filterable
* @keyword
@@ -51,7 +48,6 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* The family name of the person.
*
* @filterable
* @keyword
*/
@@ -59,7 +55,6 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* The private fax number of the person.
*
* @filterable
* @keyword
*/
@@ -67,14 +62,12 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* The gender of the person.
*
* @filterable
*/
gender?: SCPersonGender;
/**
* The first name of the person.
*
* @filterable
* @keyword
*/
@@ -82,7 +75,6 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* Honorific prefix of the person.
*
* @filterable
* @keyword
*/
@@ -90,7 +82,6 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* Honorific suffix of the person.
*
* @filterable
* @keyword
*/
@@ -98,7 +89,6 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* Titles of jobs that the person has.
*
* @filterable
* @keyword
*/
@@ -106,7 +96,6 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* The complete name of the person combining all the parts of the name into one.
*
* @filterable
* @text
*/
@@ -119,7 +108,6 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* The private telephone number of the person.
*
* @keyword
*/
telephone?: string;
@@ -132,7 +120,6 @@ export interface SCPersonWithoutReferences extends SCThingWithoutReferences {
/**
* A person
*
* @validatable
* @indexable
*/

View File

@@ -46,7 +46,6 @@ export interface SCPointOfInterestWithoutReferences
/**
* A point of interest
*
* @validatable
* @indexable
*/

View File

@@ -43,7 +43,6 @@ export interface SCPublicationEventWithoutReferences extends SCEventWithoutRefer
/**
* An publication event
*
* @validatable
* @indexable
*/

View File

@@ -58,7 +58,6 @@ export interface SCRoomWithoutReferences
SCThingWithCategoriesWithoutReferences<SCRoomCategories, SCRoomSpecificValues> {
/**
* The name of the floor in which the room is in.
*
* @filterable
* @text
*/
@@ -84,7 +83,6 @@ export interface SCRoomWithoutReferences
/**
* A room
*
* @validatable
* @indexable
*/
@@ -113,14 +111,12 @@ export interface SCRoom
export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValues {
/**
* Category specific opening hours of the room
*
* @keyword
*/
openingHours?: string;
/**
* Category specific service hours of the room (e.g. cooked food serving hours)
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
* @keyword
*/

View File

@@ -26,7 +26,6 @@ import {SCThingMeta, SCThingType} from './abstract/thing.js';
export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutReferences {
/**
* The short name of the semester, using the given pattern.
*
* @filterable
* @pattern ^(WS|SS|WiSe|SoSe) [0-9]{4}(/[0-9]{2})?$
* @keyword
@@ -41,7 +40,6 @@ export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutRefere
/**
* A semester
*
* @validatable
* @indexable
*/

View File

@@ -38,7 +38,6 @@ export interface SCSettingWithoutReferences
inputType: SCSettingInputType;
/**
* The order number this setting should show up in its category list
*
* @integer
*/
order: number;
@@ -78,7 +77,6 @@ export enum SCSettingInputType {
/**
* A setting with references
*
* @validatable
*/
export interface SCSetting
@@ -111,7 +109,6 @@ export type SCSettingValues = SCSettingValue[];
export interface SCSettingValueTranslatableProperties extends SCThingWithCategoriesTranslatableProperties {
/**
* The translations of the possible values of a setting
*
* @keyword
*/
values?: string[];

View File

@@ -28,7 +28,6 @@ export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences
/**
* A sport course
*
* @validatable
* @indexable
*/

View File

@@ -32,7 +32,6 @@ import {SCPersonWithoutReferences} from './person.js';
export interface SCStudyModuleWithoutReferences extends SCThingThatCanBeOfferedWithoutReferences {
/**
* ECTS points (European Credit Transfer System)
*
* @float
*/
ects: number;
@@ -44,7 +43,6 @@ export interface SCStudyModuleWithoutReferences extends SCThingThatCanBeOfferedW
/**
* Majors that this study module is meant for
*
* @filterable
* @keyword
*/
@@ -68,7 +66,6 @@ export interface SCStudyModuleWithoutReferences extends SCThingThatCanBeOfferedW
/**
* A study module
*
* @validatable
* @indexable
*/
@@ -115,7 +112,6 @@ export interface SCStudyModule
export interface SCStudyModuleTranslatableProperties extends SCThingThatCanBeOfferedTranslatableProperties {
/**
* Translations of the majors that this study module is meant for
*
* @keyword
*/
majors?: string[];

View File

@@ -28,7 +28,6 @@ export interface SCTicketWithoutReferences extends SCThingWithoutReferences {
/**
* Waiting number of the ticket
*
* @keyword
*/
currentTicketNumber: string;
@@ -46,7 +45,6 @@ export interface SCTicketWithoutReferences extends SCThingWithoutReferences {
/**
* A ticket
*
* @validatable
* @indexable
*/

View File

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

View File

@@ -21,7 +21,6 @@ import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abs
export interface SCTourWithoutReferences extends SCThingWithoutReferences {
/**
* Init script for the tour
*
* @text
*/
init?: string;
@@ -33,7 +32,6 @@ export interface SCTourWithoutReferences extends SCThingWithoutReferences {
/**
* Type of a tour
*
* @keyword
*/
type: SCThingType.Tour;
@@ -41,7 +39,6 @@ export interface SCTourWithoutReferences extends SCThingWithoutReferences {
/**
* A tour
*
* @validatable
* @indexable
*/
@@ -98,7 +95,6 @@ export type SCTourStep = SCTourStepMenu | SCTourStepLocation | SCTourStepTooltip
export interface SCTourStepLocation {
/**
* Location to go to
*
* @keyword
*/
location: string;
@@ -120,7 +116,6 @@ export interface SCTourStepTooltip {
/**
* Element that the tooltip shall be pointing at or a list of elements to try in the specified order
*
* @keyword
*/
element: string | string[];
@@ -137,14 +132,12 @@ export interface SCTourStepTooltip {
/**
* Text that the tooltip shall contain
*
* @text
*/
text: string;
/**
* How often it shall be retried
*
* @integer
*/
tries?: number;
@@ -181,7 +174,6 @@ export interface SCTourStepMenu {
export interface SCTourResolvedElement {
/**
* Element name
*
* @keyword
*/
element: string;
@@ -193,7 +185,6 @@ export interface SCTourResolvedElement {
export interface SCTourResolvedEvent {
/**
* Event name
*
* @keyword
*/
event: string;
@@ -215,7 +206,6 @@ export interface SCTourResolvedLocation {
export interface SCTourResolvedLocationTypeIs {
/**
* Specific location name
*
* @keyword
*/
is: string;
@@ -227,7 +217,6 @@ export interface SCTourResolvedLocationTypeIs {
export interface SCTourResolvedLocationTypeMatch {
/**
* Regex location name
*
* @keyword
*/
match: string;

View File

@@ -48,7 +48,6 @@ export interface SCVideoWithoutReferences
/**
* URLs to a thumbnails for the Video
*
* @keyword
*/
thumbnails?: string[];
@@ -60,7 +59,6 @@ export interface SCVideoWithoutReferences
/**
* A Transcript of the Video
*
* @text
*/
transcript?: string;
@@ -79,35 +77,30 @@ export interface SCVideoWithoutReferences
export interface SCVideoSource {
/**
* Pixel Height of the Video
*
* @integer
*/
height?: number;
/**
* MIME-Type of the source File
*
* @filterable
*/
mimeType: SCVideoMimeType;
/**
* Size of the Video File in bytes
*
* @integer
*/
size?: number;
/**
* URL to the Video File
*
* @keyword
*/
url: string;
/**
* Pixel Width of the Video
*
* @integer
*/
width?: number;
@@ -121,14 +114,12 @@ export interface SCVideoTrack {
/**
* Content Type of the Track File
*
* @filterable
*/
type: SCVideoTrackTypes;
/**
* URL to the Track File
*
* @keyword
*/
url: string;
@@ -136,7 +127,6 @@ export interface SCVideoTrack {
/**
* A video
*
* @validatable
* @indexable
*/

View File

@@ -36,7 +36,6 @@ export class SCThingTranslator {
/**
* Setter for language property. Also flushes translation cache
*
* @param language The language the translator instance will use from now on
*/
set language(language: SCLanguageCode) {
@@ -87,7 +86,6 @@ export class SCThingTranslator {
/**
* Get field value translation recursively
*
* @param data The intermediate object / primitive returned by the Proxys get() method
* @returns a T object allowing for access to translations or a translated value(s)
*/
@@ -101,7 +99,6 @@ export class SCThingTranslator {
/**
* Applies only known field translations of the given SCThings meta class to an instance
*
* @param thingType The type of thing that will be translated
* @param language The language the thing property values are translated to
* @returns The thing with all known meta values translated
@@ -132,7 +129,6 @@ export class SCThingTranslator {
/**
* Returns meta class needed for translations given a SCThingType
*
* @param thingType Type of the thing
* @returns An instance of the metaclass
*/
@@ -147,7 +143,6 @@ export class SCThingTranslator {
/**
* Applies known field value translations of the given SCThings meta class to an instance
* Translated values overwrite current values inplace (destructive)
*
* @param instance The thing / object that will be translated
* @param language The language the thing / object is translated to
* @returns The thing with translated meta field values
@@ -187,7 +182,6 @@ export class SCThingTranslator {
/**
* Recursively translates the given object in-place
* Translated values overwrite current values (destructive)
*
* @param instance The thing / object that will be translated
* @returns The thing translated
*/
@@ -219,7 +213,6 @@ export class SCThingTranslator {
/**
* Recursively translates the given object in-place
* Translated values overwrite current values (destructive)
*
* @param thing The thing / object that will be translated
* @returns The thing translated
*/
@@ -240,7 +233,6 @@ export class SCThingTranslator {
/**
* Get field value translation recursively
*
* @example
* const dish: SCDish = {...};
* translator.translate(dish).offers[0].inPlace.categories[1]());
@@ -274,7 +266,6 @@ export class SCThingTranslator {
/**
* Given a SCThingType this function returns an object with the same basic structure as the corresponding SCThing
* All the values will be set to the known translations of the property/key name
*
* @example
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudy>(SCThingType.CourseOfStudy);
* @param type The type whose property names will be translated
@@ -287,7 +278,6 @@ export class SCThingTranslator {
/**
* Given a SCThingType and a corresponding property name it returns the known property value translation
* Access pattern to the meta object containing the translation can be thought of as type.field[key] with key being optional
*
* @example
* const singleValueTranslation = translator.translatedPropertyValue(SCThingType.Dish, 'categories', 'main dish');
* @param type The type for whose property values a translation is required
@@ -348,7 +338,6 @@ class LRUCache<T> {
/**
* Get content from cache by key or by another objects uid
*
* @param somethingOrKey The key which maps to the cached content or an object for which content has been cached
* @returns If available the content connected to the key or somethingOrKey.uid property
*/
@@ -374,7 +363,6 @@ class LRUCache<T> {
/**
* Place content in cache by key
*
* @param key The key for which content should be cached
* @param content The content that should be cached
*/
@@ -389,7 +377,6 @@ class LRUCache<T> {
/**
* Place content in cache by another objects uid
*
* @param something The object that should be cached under something.uid
*/
public putObject<U extends SCThing>(something: U) {