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

725
src/general/i18n.ts Normal file
View File

@@ -0,0 +1,725 @@
/*
* 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/>.
*/
/**
* An Language
*/
export interface SCLanguage {
/**
* The two letter ISO 639-1 Code of the Language
*/
code: SCLanguageCode;
/**
* The Fulltext name of the Language
*/
name: SCLanguageName;
}
/**
* A list of possible languages in english
*
* @see https://en.wikipedia.org/wiki/ISO_639-1
*/
export type SCLanguageName =
'afar'
| 'abkhazian'
| 'avestan'
| 'afrikaans'
| 'akan'
| 'amharic'
| 'aragonese'
| 'arabic'
| 'assamese'
| 'avaric'
| 'aymara'
| 'azerbaijani'
| 'bashkir'
| 'belarusian'
| 'bulgarian'
| 'bihari languages'
| 'bislama'
| 'bambara'
| 'bengali'
| 'tibetan'
| 'breton'
| 'bosnian'
| 'catalan; valencian'
| 'chechen'
| 'chamorro'
| 'corsican'
| 'cree'
| 'czech'
| 'church slavic; old slavonic; church slavonic; old bulgarian; old church slavonic'
| 'chuvash'
| 'welsh'
| 'danish'
| 'german'
| 'divehi; dhivehi; maldivian'
| 'dzongkha'
| 'ewe'
| 'greek, modern (1453-)'
| 'english'
| 'esperanto'
| 'spanish; castilian'
| 'estonian'
| 'basque'
| 'persian'
| 'fulah'
| 'finnish'
| 'fijian'
| 'filipino'
| 'faroese'
| 'french'
| 'western frisian'
| 'irish'
| 'gaelic; scottish gaelic'
| 'galician'
| 'guarani'
| 'gujarati'
| 'manx'
| 'hausa'
| 'hebrew'
| 'hindi'
| 'hiri motu'
| 'croatian'
| 'haitian; haitian creole'
| 'hungarian'
| 'armenian'
| 'herero'
| 'interlingua (international auxiliary language association)'
| 'indonesian'
| 'interlingue; occidental'
| 'igbo'
| 'sichuan yi; nuosu'
| 'inupiaq'
| 'ido'
| 'icelandic'
| 'italian'
| 'inuktitut'
| 'japanese'
| 'javanese'
| 'georgian'
| 'kongo'
| 'kikuyu; gikuyu'
| 'kuanyama; kwanyama'
| 'kazakh'
| 'kalaallisut; greenlandic'
| 'central khmer'
| 'kannada'
| 'korean'
| 'kanuri'
| 'kashmiri'
| 'kurdish'
| 'komi'
| 'cornish'
| 'kirghiz; kyrgyz'
| 'latin'
| 'luxembourgish; letzeburgesch'
| 'ganda'
| 'limburgan; limburger; limburgish'
| 'lingala'
| 'lao'
| 'lithuanian'
| 'luba-katanga'
| 'latvian'
| 'malagasy'
| 'marshallese'
| 'maori'
| 'macedonian'
| 'malayalam'
| 'mongolian'
| 'marathi'
| 'malay'
| 'maltese'
| 'burmese'
| 'nauru'
| 'bokmål, norwegian; norwegian bokmål'
| 'ndebele, north; north ndebele'
| 'nepali'
| 'ndonga'
| 'dutch; flemish'
| 'norwegian nynorsk; nynorsk, norwegian'
| 'norwegian'
| 'ndebele, south; south ndebele'
| 'navajo; navaho'
| 'chichewa; chewa; nyanja'
| 'occitan (post 1500); provençal'
| 'ojibwa'
| 'oromo'
| 'oriya'
| 'ossetian; ossetic'
| 'panjabi; punjabi'
| 'pali'
| 'polish'
| 'pushto; pashto'
| 'portuguese'
| 'quechua'
| 'romansh'
| 'rundi'
| 'romanian; moldavian; moldovan'
| 'russian'
| 'kinyarwanda'
| 'sanskrit'
| 'sardinian'
| 'sindhi'
| 'northern sami'
| 'sango'
| 'sinhala; sinhalese'
| 'slovak'
| 'slovenian'
| 'samoan'
| 'shona'
| 'somali'
| 'albanian'
| 'serbian'
| 'swati'
| 'sotho, southern'
| 'sundanese'
| 'swedish'
| 'swahili'
| 'tamil'
| 'telugu'
| 'tajik'
| 'thai'
| 'tigrinya'
| 'turkmen'
| 'tagalog'
| 'tswana'
| 'tonga (tonga islands)'
| 'turkish'
| 'tsonga'
| 'tatar'
| 'twi'
| 'tahitian'
| 'uighur; uyghur'
| 'ukrainian'
| 'urdu'
| 'uzbek'
| 'venda'
| 'vietnamese'
| 'volapük'
| 'walloon'
| 'wolof'
| 'xhosa'
| 'yiddish'
| 'yoruba'
| 'zhuang; chuang'
| 'chinese'
| 'zulu';
/**
* A List of all possible Languages as ISO 639-1 Codes
*
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/
export type SCLanguageCode =
'aa'
| 'ab'
| 'ae'
| 'af'
| 'ak'
| 'am'
| 'an'
| 'ar'
| 'as'
| 'av'
| 'ay'
| 'az'
| 'ba'
| 'be'
| 'bg'
| 'bh'
| 'bi'
| 'bm'
| 'bn'
| 'bo'
| 'br'
| 'bs'
| 'ca'
| 'ce'
| 'ch'
| 'co'
| 'cr'
| 'cs'
| 'cu'
| 'cv'
| 'cy'
| 'da'
| 'de'
| 'dv'
| 'dz'
| 'ee'
| 'el'
| 'en'
| 'eo'
| 'es'
| 'et'
| 'eu'
| 'fa'
| 'ff'
| 'fi'
| 'fj'
| 'fl'
| 'fo'
| 'fr'
| 'fy'
| 'ga'
| 'gd'
| 'gl'
| 'gn'
| 'gu'
| 'gv'
| 'ha'
| 'he'
| 'hi'
| 'ho'
| 'hr'
| 'ht'
| 'hu'
| 'hy'
| 'hz'
| 'ia'
| 'id'
| 'ia'
| 'ig'
| 'ii'
| 'ik'
| 'io'
| 'is'
| 'it'
| 'iu'
| 'ja'
| 'jv'
| 'ka'
| 'kg'
| 'ki'
| 'kj'
| 'kk'
| 'kl'
| 'km'
| 'kn'
| 'ko'
| 'kr'
| 'ks'
| 'ku'
| 'kv'
| 'kw'
| 'ky'
| 'la'
| 'lb'
| 'lg'
| 'li'
| 'ln'
| 'lo'
| 'lt'
| 'lu'
| 'lv'
| 'mg'
| 'mh'
| 'mi'
| 'mk'
| 'ml'
| 'mn'
| 'mr'
| 'ms'
| 'mt'
| 'my'
| 'na'
| 'nb'
| 'nd'
| 'ne'
| 'ng'
| 'nl'
| 'nn'
| 'no'
| 'nr'
| 'nv'
| 'ny'
| 'oc'
| 'oj'
| 'om'
| 'or'
| 'os'
| 'pa'
| 'pi'
| 'pl'
| 'ps'
| 'pt'
| 'qu'
| 'rm'
| 'rn'
| 'ro'
| 'ru'
| 'rw'
| 'sa'
| 'sc'
| 'sd'
| 'se'
| 'sg'
| 'si'
| 'sk'
| 'sl'
| 'sm'
| 'sn'
| 'so'
| 'sq'
| 'sr'
| 'ss'
| 'st'
| 'su'
| 'sv'
| 'sw'
| 'ta'
| 'te'
| 'tg'
| 'th'
| 'ti'
| 'tk'
| 'tl'
| 'tn'
| 'to'
| 'tr'
| 'ts'
| 'tt'
| 'tw'
| 'ty'
| 'ug'
| 'uk'
| 'ur'
| 'uz'
| 've'
| 'vi'
| 'vo'
| 'wa'
| 'wo'
| 'xh'
| 'yi'
| 'yo'
| 'za'
| 'zh'
| 'zu';
/**
* A list of possible nationalities
*
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
*/
export type SCNationality =
'Afghanistan'
| 'Åland Islands'
| 'Albania'
| 'Algeria'
| 'American Samoa'
| 'Andorra'
| 'Angola'
| 'Anguilla'
| 'Antarctica'
| 'Antigua and Barbuda'
| 'Argentina'
| 'Armenia'
| 'Aruba'
| 'Australia'
| 'Austria'
| 'Azerbaijan'
| 'Bahamas'
| 'Bahrain'
| 'Bangladesh'
| 'Barbados'
| 'Belarus'
| 'Belgium'
| 'Belize'
| 'Benin'
| 'Bermuda'
| 'Bhutan'
| 'Bolivia (Plurinational State of)'
| 'Bonaire, Sint Eustatius and Saba'
| 'Bosnia and Herzegovina'
| 'Botswana'
| 'Bouvet Island'
| 'Brazil'
| 'British Indian Ocean Territory'
| 'Brunei Darussalam'
| 'Bulgaria'
| 'Burkina Faso'
| 'Burundi'
| 'Cambodia'
| 'Cameroon'
| 'Canada'
| 'Cabo Verde'
| 'Cayman Islands'
| 'Central African Republic'
| 'Chad'
| 'Chile'
| 'China'
| 'Christmas Island'
| 'Cocos (Keeling) Islands'
| 'Colombia'
| 'Comoros'
| 'Congo'
| 'Congo (Democratic Republic of the)'
| 'Cook Islands'
| 'Costa Rica'
| 'Côte d\'Ivoire'
| 'Croatia'
| 'Cuba'
| 'Curaçao'
| 'Cyprus'
| 'Czech Republic'
| 'Denmark'
| 'Djibouti'
| 'Dominica'
| 'Dominican Republic'
| 'Ecuador'
| 'Egypt'
| 'El Salvador'
| 'Equatorial Guinea'
| 'Eritrea'
| 'Estonia'
| 'Ethiopia'
| 'Falkland Islands (Malvinas)'
| 'Faroe Islands'
| 'Fiji'
| 'Finland'
| 'France'
| 'French Guiana'
| 'French Polynesia'
| 'French Southern Territories'
| 'Gabon'
| 'Gambia'
| 'Georgia'
| 'Germany'
| 'Ghana'
| 'Gibraltar'
| 'Greece'
| 'Greenland'
| 'Grenada'
| 'Guadeloupe'
| 'Guam'
| 'Guatemala'
| 'Guernsey'
| 'Guinea'
| 'Guinea-Bissau'
| 'Guyana'
| 'Haiti'
| 'Heard Island and McDonald Islands'
| 'Holy See'
| 'Honduras'
| 'Hong Kong'
| 'Hungary'
| 'Iceland'
| 'India'
| 'Indonesia'
| 'Iran (Islamic Republic of)'
| 'Iraq'
| 'Ireland'
| 'Isle of Man'
| 'Israel'
| 'Italy'
| 'Jamaica'
| 'Japan'
| 'Jersey'
| 'Jordan'
| 'Kazakhstan'
| 'Kenya'
| 'Kiribati'
| 'Korea (Democratic People\'s Republic of)'
| 'Korea (Republic of)'
| 'Kuwait'
| 'Kyrgyzstan'
| 'Lao People\'s Democratic Republic'
| 'Latvia'
| 'Lebanon'
| 'Lesotho'
| 'Liberia'
| 'Libya'
| 'Liechtenstein'
| 'Lithuania'
| 'Luxembourg'
| 'Macao'
| 'Macedonia (the former Yugoslav Republic of)'
| 'Madagascar'
| 'Malawi'
| 'Malaysia'
| 'Maldives'
| 'Mali'
| 'Malta'
| 'Marshall Islands'
| 'Martinique'
| 'Mauritania'
| 'Mauritius'
| 'Mayotte'
| 'Mexico'
| 'Micronesia (Federated States of)'
| 'Moldova (Republic of)'
| 'Monaco'
| 'Mongolia'
| 'Montenegro'
| 'Montserrat'
| 'Morocco'
| 'Mozambique'
| 'Myanmar'
| 'Namibia'
| 'Nauru'
| 'Nepal'
| 'Netherlands'
| 'New Caledonia'
| 'New Zealand'
| 'Nicaragua'
| 'Niger'
| 'Nigeria'
| 'Niue'
| 'Norfolk Island'
| 'Northern Mariana Islands'
| 'Norway'
| 'Oman'
| 'Pakistan'
| 'Palau'
| 'Palestine, State of'
| 'Panama'
| 'Papua New Guinea'
| 'Paraguay'
| 'Peru'
| 'Philippines'
| 'Pitcairn'
| 'Poland'
| 'Portugal'
| 'Puerto Rico'
| 'Qatar'
| 'Réunion'
| 'Romania'
| 'Russian Federation'
| 'Rwanda'
| 'Saint Barthélemy'
| 'Saint Helena, Ascension and Tristan da Cunha'
| 'Saint Kitts and Nevis'
| 'Saint Lucia'
| 'Saint Martin (French part)'
| 'Saint Pierre and Miquelon'
| 'Saint Vincent and the Grenadines'
| 'Samoa'
| 'San Marino'
| 'Sao Tome and Principe'
| 'Saudi Arabia'
| 'Senegal'
| 'Serbia'
| 'Seychelles'
| 'Sierra Leone'
| 'Singapore'
| 'Sint Maarten (Dutch part)'
| 'Slovakia'
| 'Slovenia'
| 'Solomon Islands'
| 'Somalia'
| 'South Africa'
| 'South Georgia and the South Sandwich Islands'
| 'South Sudan'
| 'Spain'
| 'Sri Lanka'
| 'Sudan'
| 'Suriname'
| 'Svalbard and Jan Mayen'
| 'Swaziland'
| 'Sweden'
| 'Switzerland'
| 'Syrian Arab Republic'
| 'Taiwan, Province of China'
| 'Tajikistan'
| 'Tanzania, United Republic of'
| 'Thailand'
| 'Timor-Leste'
| 'Togo'
| 'Tokelau'
| 'Tonga'
| 'Trinidad and Tobago'
| 'Tunisia'
| 'Turkey'
| 'Turkmenistan'
| 'Turks and Caicos Islands'
| 'Tuvalu'
| 'Uganda'
| 'Ukraine'
| 'United Arab Emirates'
| 'United Kingdom of Great Britain and Northern Ireland'
| 'United States of America'
| 'United States Minor Outlying Islands'
| 'Uruguay'
| 'Uzbekistan'
| 'Vanuatu'
| 'Venezuela (Bolivarian Republic of)'
| 'Viet Nam'
| 'Virgin Islands (British)'
| 'Virgin Islands (U.S.)'
| 'Wallis and Futuna'
| 'Western Sahara'
| 'Yemen'
| 'Zambia'
| 'Zimbabwe';
/**
* Translations for specific languages
*
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
*/
export interface SCTranslations<T> {
/**
* German translations
*/
de?: T;
/**
* English translations
*/
en?: T;
}
/**
* Type to represent requiredness of translation properties.
* Will be changed from RecursivePartial to RecursiveRequired in the future.
* (Source: https://stackoverflow.com/a/51365037)
*/
type RecursivePartial<T> = {
[P in keyof T]-?:
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
T[P] extends object ? RecursivePartial<T[P]> :
T[P];
};
/**
* Type to recursively map keys in <T> to a string value (used for translation)
*/
type SCRequiredTranslationKeys<T> = {
[key in keyof RecursivePartial<T>]: string;
};
/**
* Type that allows mapping from available keys of SCTranslations to SCRequiredTranslationKeys
*/
type SCRequiredTranslation<T> = {
[key in keyof SCTranslations<T>]: SCRequiredTranslationKeys<T>;
};
/**
* Interface to be implemented by all Meta classes
*/
export interface SCMetaTranslations<T> {
/**
* Field translations
*/
fieldTranslations: SCRequiredTranslation<T>;
/**
* Field value translations
*/
fieldValueTranslations: unknown;
}

46
src/general/map.ts Normal file
View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Capsulation for a map with a string as key with values of type `T`
*
* !!! BEWARE !!!
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
*
* @typeparam T Can be any type.
*/
export interface SCMap<T> {
/**
* One value for each key
*/
[key: string]: T;
}
/**
* Restricted map with keys, limited to values of `U`, and corresponding values of type `T`
*
* !!! BEWARE !!!
* Can't be refactored to a `Map<K, V>`, because it can't be serialized via JSON.stringify(map)
* Also note, that this is a type not an interface
*
* @typeparam U Must be a type the `in` operator can be applied to and contains only strings or numbers
* @typeparam T Can be any type
*/
export type SCRestrictedMap<U extends string | number, T> = {
/**
* One value for each key
*/
[key in U]: T
};

815
src/general/namespaces.ts Normal file
View File

@@ -0,0 +1,815 @@
/*
* 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/>.
*/
/**
* The license plate of a university e.g. the UID of the university
*/
export type SCLicensePlate = 'ac-kf' |
'ac-fk' |
'ac-fh' |
'ac-hm' |
'ac-th' |
'dn-fh' |
'aa-fh' |
'sig-f2' |
'su-ah' |
'rd-vf' |
'am-f2' |
'am-fh' |
'an-fh' |
'ik-fh' |
'ab-fh' |
'asl-vf' |
'a-hm' |
'a-u' |
'a-fh' |
'hef-fh' |
'hg-hs' |
'su-if' |
'cw-ih' |
'tbb-dh' |
'eu-vf' |
'los-pf' |
'esw-pf' |
'ba-u' |
'bt-kh' |
'bt-u' |
'gap-kh' |
'wr-vf' |
'pb-f2' |
'b-ah' |
'b-am' |
'b-fs' |
'b-ab' |
'b-pf' |
'b-tf' |
'b-mu' |
'b-dk' |
'b-p2' |
'b-bs' |
'b-eh' |
'b-hw' |
'b-es' |
'b-em' |
'b-ec' |
'b-ef' |
'b-vf' |
'b-gb' |
'b-hs' |
'b-pk' |
'b-mh' |
'b-ft' |
'b-p3' |
'b-fb' |
'b-wt' |
'b-u2' |
'b-u' |
'b-v2' |
'b-fw' |
'b-p4' |
'b-ih' |
'b-kf' |
'b-mf' |
'b-dh' |
'b-pu' |
'b-ph' |
'b-qh' |
'b-ot' |
'b-fh' |
'b-su' |
'b-tk' |
'b-tc' |
'b-hk' |
'b-wb' |
'b-fp' |
'b-v3' |
'b-fu' |
'b-h3' |
'b-hm' |
'b-kh' |
'b-h4' |
'b-f3' |
'b-f5' |
'b-f2' |
'b-tu' |
'ber-vf' |
'bbg-fh' |
'bbg-hs' |
'w-k2' |
'bi-kh' |
'bc-fh' |
'bi-du' |
'bi-fm' |
'pb-f4' |
'bi-u' |
'bi-fh' |
'bi-vf' |
'wm-hs' |
'mz-fh' |
'tr-f2' |
'bo-eb' |
'bo-fh' |
'bo-f1' |
'bo-fg' |
'bo-hm' |
'bo-f3' |
'bo-kf' |
'bo-u' |
'bn-sg' |
'bn-pf' |
'bn-vf' |
'bn-fh' |
'bn-u' |
'bot-fh' |
'brb-vf' |
'brb-fh' |
'bs-fh' |
'bs-hk' |
'bs-tu' |
'hb-ah' |
'hb-hi' |
'hb-fh' |
'hb-iu' |
'hb-hk' |
'hb-u' |
'hb-vf' |
'hb-h' |
'ka-pu' |
'bm-eu' |
'bm-fb' |
'std-hs' |
'std-fh' |
'cw-fh' |
'cw-hs' |
'ce-pf' |
'c-tu' |
'c-th' |
'gs-tu' |
'co-fh' |
'co-hs' |
'co-f2' |
'cb-fh' |
'cb-tu' |
'da-kf' |
'da-vf' |
'da-fh' |
'da-pf' |
'da-tu' |
'da-v2' |
'deg-fh' |
'de-fh' |
'dt-fl' |
'lip-h2' |
'lip-hm' |
'dt-hm' |
'da-v3' |
'dh-fh' |
'do-fh' |
'do-mh' |
'do-is' |
'do-pf' |
'do-u' |
'do-hm' |
'do-vf' |
'dd-ec' |
'dd-fh' |
'dd-hs' |
'dd-ak' |
'dd-ph' |
'dd-pf' |
'dd-pu' |
'dd-hl' |
'dd-ht' |
'dd-hk' |
'dd-ma' |
'dd-hm' |
'dd-p2' |
'dd-p3' |
'dd-tu' |
'dd-hv' |
'd-iu' |
'du-hm' |
'du-pf' |
'du-ug' |
'du-vf' |
'du-u' |
'd-am' |
'd-eb' |
'd-ff' |
'd-pf' |
'd-fh' |
'd-vf' |
'd-hk' |
'd-hm' |
'd-u' |
'bar-fh' |
'ew-fh' |
'eck-fh' |
'ld-vf' |
'ei-u' |
'pi-f2' |
'ol-f2' |
'hvl-hs' |
'hvl-fh' |
'emd-fh' |
'ed-pf' |
'ef-fh' |
'ef-mh' |
'ef-pf' |
'ef-kh' |
'ef-u' |
'ef-ph' |
'er-u' |
'e-fh' |
'e-p2' |
'e-pf' |
'e-uk' |
'e-u' |
'e-ug' |
'e-hm' |
'es-ft' |
'es-fs' |
'fl-fh' |
'fl-ph' |
'fl-u' |
'f-hb' |
'f-ms' |
'f-u' |
'f-v2' |
'f-fh' |
'f-hk' |
'f-hm' |
'f-kh' |
'f-pf' |
'f-vf' |
'ff-eu' |
'fg-u' |
'fr-fh' |
'fr-kf' |
'fr-u' |
'fr-hm' |
'fr-ph' |
'fb-fh' |
'hal-kh' |
'fn-dh' |
'fn-u' |
'fd-fh' |
'fd-kh' |
'ffb-vf' |
'vs-fh' |
'wi-f2' |
'ul-f2' |
'ge-f3' |
'ge-fh' |
'ge-f2' |
'ge-vf' |
'g-pf' |
'ger-u' |
'gi-ft' |
'gi-fh' |
'gi-vf' |
'gi-u' |
'gp-fh' |
'zi-hw' |
'gth-vf' |
'g-hs' |
'goe-fh' |
'goe-u' |
'goe-pf' |
'gw-u' |
'nb-u' |
'gw-u2' |
'gw-u1' |
'hgw-u' |
'gue-fh' |
'gue-vf' |
'pb-f3' |
'gt-pf' |
'ww-vf' |
'ha-ug' |
'ha-fh' |
'ha-f2' |
'ha-vf' |
'hbs-fh' |
'hbs-vf' |
'hal-eh' |
'hal-hk' |
'hal-ph' |
'hal-u' |
'hal-u2' |
'koet-ph' |
'hal-uw' |
'hh-am' |
'hh-bs' |
'hh-pf' |
'hh-bc' |
'hh-ef' |
'hh-fh' |
'hh-hu' |
'hh-ub' |
'hh-ff' |
'hh-vf' |
'hh-fi' |
'hh-ba' |
'hh-ib' |
'hh-mf' |
'hh-ms' |
'hh-hf' |
'hh-u' |
'hh-hs' |
'hh-uk' |
'hh-fs' |
'hh-hk' |
'hh-hm' |
'hh-tu' |
'hm-hs' |
'ham-f2' |
'ham-fh' |
'h-fg' |
'h-fh' |
'h-hm' |
'h-vf' |
'h-la' |
'h-u' |
'h-fb' |
'h-kf' |
'h-mh' |
'h-f3' |
'h-pf' |
'h-ti' |
'hei-fh' |
'hd-hm' |
'hd-ph' |
'hd-kh' |
'hd-u' |
'hd-fh' |
'hdh-dh' |
'hn-dh' |
'hn-bs' |
'hn-fh' |
'hn-f2' |
'su-f3' |
'su-k2' |
'he-hk' |
'sta-v2' |
'hi-fg' |
'hi-fs' |
'hi-fh' |
'hi-v2' |
'hi-vf' |
'hi-u' |
'hi-v3' |
'ho-fh' |
'ho-f2' |
'ho-vf' |
's-u2' |
'ww-fh' |
'hol-fh' |
'fds-dh' |
'hx-fh' |
'lip-h3' |
'hx-ug' |
'tr-f3' |
'mz-f5' |
'wi-f5' |
'wi-f4' |
'rued-pf' |
'ik-tu' |
'il-th' |
'in-fh' |
'in-u' |
'mk-ts' |
'mk-fh' |
'rv-pf' |
'j-fh' |
'j-u' |
'kl-fh' |
'kl-u' |
'wes-fh' |
'ka-dh' |
'ka-fh' |
'ka-pf' |
'ka-u' |
'ka-hk' |
'ka-hg' |
'ka-hm' |
'ka-ph' |
'ks-cv' |
'ks-pf' |
'ks-fh' |
'ks-ms' |
'ks-u3' |
'ks-ug' |
'ks-vf' |
'ks-u2' |
'og-vf' |
'ke-fh' |
'ki-u' |
'ki-fh' |
'ki-f2' |
'ki-f6' |
'ki-hk' |
'ki-f3' |
'ki-f4' |
'ki-f5' |
'ki-ph' |
'kle-fh' |
'ko-fh' |
'ko-u3' |
'ko-u' |
'ko-vf' |
'k-iu' |
'k-cb' |
'k-fm' |
'k-fp' |
'k-kf' |
'k-mf' |
'k-p2' |
'k-u' |
'k-fb' |
'k-u2' |
'k-fh' |
'k-vf' |
'k-hk' |
'k-hm' |
'k-pf' |
'k-v2' |
'k-f2' |
'kw-fh' |
'kn-fh' |
'kn-f2' |
'kn-u' |
'koet-fh' |
'koet-th' |
'koet-u' |
'kr-fh' |
'og-fw' |
'ld-u' |
'la-fh' |
'da-v4' |
'ler-fh' |
'l-fb' |
'l-f2' |
'l-kh' |
'l-h3' |
'l-hh' |
'l-hm' |
'l-h2' |
'l-ph' |
'l-hs' |
'l-ht' |
'l-th' |
'l-u' |
'mer-th' |
'lev-pf' |
'lev-fh' |
'fg-fh' |
'lip-f2' |
'lip-h1' |
'lip-fh' |
'so-f2' |
'loe-dh' |
'hl-fh' |
'hl-vf' |
'hl-f3' |
'hl-uk' |
'hl-u' |
'hl-f2' |
'hl-hm' |
'lb-v2' |
'lb-fh' |
'lb-ph' |
'lb-p2' |
'lb-vf' |
'lu-fh' |
'lu-kf' |
'lg-u' |
'lg-fh' |
'md-f2' |
'md-fh' |
'md-tu' |
'md-f3' |
'md-mh' |
'md-ph' |
'md-u' |
'mz-f4' |
'mz-u2' |
'mz-vf' |
'mz-f3' |
'mz-f2' |
'mz-u' |
'mz-kf' |
'ma-dh' |
'ma-fg' |
'ma-ft' |
'ma-ba' |
'ma-v3' |
'ma-v2' |
'ma-hm' |
'ma-fs' |
'ma-u' |
'mr-eh' |
'mr-fh' |
'mr-u' |
're-pf' |
'myk-vf' |
'mgn-vf' |
'mei-fh' |
'mei-fv' |
'mei-f2' |
'sk-hs' |
'hal-fh' |
'hsk-fh' |
'me-fh' |
'rt-hs' |
'mi-fh' |
'c-fh' |
'mw-ht' |
'hc-ih' |
'mtw-ht' |
'mg-fh' |
'z-fh' |
'mos-dh' |
'mh-fh' |
'm-am' |
'm-b2' |
'm-bw' |
'm-ea' |
'm-vf' |
'm-as' |
'm-mf' |
'm-hk' |
'm-hs' |
'm-fh' |
'm-kf' |
'm-hm' |
'm-kh' |
'm-hp' |
'm-fp' |
'm-tu' |
'm-u' |
'gap-ks' |
'm-u2' |
'm-t2' |
'ms-ph' |
'ms-kf' |
'ms-u' |
'ms-fh' |
'ms-vf' |
'ms-hk' |
'ms-hm' |
'ms-kh' |
'ms-v2' |
'nmb-kh' |
'nb-fh' |
'm-ah' |
'm-k3' |
'ne-eu' |
'ne-hs' |
'ne-pf' |
'nu-fh' |
'h-f2' |
'ndh-fh' |
'coe-vf' |
'n-kf' |
'n-hm' |
'n-hk' |
'n-k1' |
'n-k2' |
'n-k3' |
'n-fh' |
'n-u' |
'nt-fh' |
'nt-f3' |
'gp-f2' |
'gr-kh' |
'hg-kh' |
'wi-eb' |
'of-hk' |
'fr-f2' |
'ol-fh' |
'ol-pf' |
'ol-u' |
'os-f2' |
'os-fh' |
'os-f3' |
'os-u' |
'os-kf' |
'ver-fh' |
'pb-fh' |
'pb-kf' |
'pb-kh' |
'pb-ug' |
'pb-f1' |
'pb-u2' |
'pa-u' |
'pf-fg' |
'pf-fh' |
'ps-fh' |
'pl-fh' |
'p-bs' |
'p-f2' |
'p-sh' |
'p-pf' |
'p-u' |
'p-fh' |
'p-hf' |
'brb-f2' |
'dd-f2' |
'rv-fh' |
'rv-dh' |
'r-kh' |
'r-u' |
'r-fh' |
'rd-v2' |
'ko-f2' |
'rd-bf' |
'rd-fh' |
'rt-fh' |
'rt-ts' |
'rt-ft' |
'su-f2' |
'st-mh' |
'bc-f2' |
'rie-fh' |
'shg-vf' |
'ro-fh' |
'ros-hm' |
'ros-im' |
'hro-hu' |
'hro-u' |
'hro-hm' |
'rof-vf' |
'nol-fh' |
'tue-fh' |
'wi-f3' |
'sb-f2' |
'sb-hm' |
'sb-hs' |
'sb-vf' |
'sb-hk' |
'sb-fh' |
'sb-kf' |
'sb-u' |
'sz-fh' |
'sm-fh' |
'aa-fg' |
'aa-ph' |
'sha-ht' |
'sha-kh' |
'sad-pf' |
'ru-fh' |
'wue-f2' |
'lds-bc' |
'sn-hm' |
'hd-vf' |
'sfb-fh' |
'si-pf' |
'si-ug' |
'sig-fh' |
'so-fh' |
'so-vf' |
'so-ug' |
'sp-u' |
'su-fh' |
'su-kh' |
'sta-vf' |
'st-fh' |
'sdl-fh' |
'hst-fh' |
'hst-f2' |
'sr-fh' |
'og-fh' |
's-dp' |
's-dh' |
's-f2' |
's-im' |
's-kf' |
's-u' |
's-va' |
's-wh' |
's-hk' |
's-fh' |
's-fb' |
's-hm' |
's-mf' |
's-f3' |
's-th' |
'ue-fh' |
'k-v3' |
'k-f3' |
'tr-fh' |
'tr-kh' |
'tr-u' |
'an-f2' |
'tut-hm' |
'tue-u' |
'tut-f3' |
'ul-fh' |
'ul-f4' |
'ul-u' |
'myk-kh' |
'vec-fh' |
'vec-u' |
'vec-kf' |
'bo-f2' |
'vs-vf' |
'vs-dh' |
'vs-f2' |
'ros-hs' |
'ro-vf' |
'pi-fh' |
'fs-fh' |
'we-hm' |
'we-u' |
'we-vf' |
'we-th' |
'kn-ph' |
'rv-ph' |
'wsf-pf' |
'wr-fh' |
'wr-v2' |
'qlb-vf' |
'ldk-fh' |
'wi-bs' |
'wi-v1' |
'wi-fh' |
'wi-vf' |
'kw-th' |
'whv-fh' |
'hwi-fh' |
'wis-th' |
'wis-fh' |
'en-u' |
'wf-fh' |
'wob-fh' |
'wo-fh' |
'w-hm' |
'w-kh' |
'w-ug' |
'w-vf' |
'wue-hm' |
'wue-u' |
'wue-fh' |
'wue-f3' |
'zi-ht' |
'zi-ih' |
'zi-th' |
'zw-fh' |
'z-t3' |
'z-t2' |
'z-pf' |
'z-hs' |
'z-ph' |
'z-th' |
'z-tu' |
'z-ht' |
'rc-hs' |
'z-p2';
/* tslint:disable:variable-name */
/**
* Namespaces for universities for UUID generation
*/
export const SCNamespaces: { [id in SCLicensePlate]?: string } = {
/* tslint:enable:variable-name */
/**
* Namespace for Hochschule Aschaffenburg
*/
'ab-fh': 'b28746bb-e95e-4d4d-bf21-1c0a3bb7e83e',
/**
* Namespace for Technische Universität Berlin
*/
'b-tu': '909a8cbc-8520-456c-b474-ef1525f14209',
/**
* Namespace for Goethe-Universität Frankfurt am Main
*/
'f-u': 'fa256ea6-942d-4ead-96da-5d7678e9e965',
/**
* Namespace for Hochschule Fulda
*/
'fd-fh': 'f1aa9ac0-ed3d-493b-987c-f98aeeba154b',
/**
* Namespace for Technische Hochschule Mittelhessen
*/
'gi-fh': 'f599f1d1-5b76-4654-a394-d37680d75e22',
/**
* Namespace for Justus-Liebig-Universität Gießen
*/
'gi-u': '9884e6f2-cbbb-4341-8d30-5ba3f1514927',
/**
* Namespace for Universität Kassel
*/
'ks-ug': '277fe8f6-dbc9-4ec2-9f87-d30e0dc347af',
};

40
src/general/time.ts Normal file
View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* tslint:disable:max-line-length */
/**
* An ISO8601 date
*
* @pattern ^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$
* @see https://gist.github.com/philipashlock/8830168
*/
export type SCISO8601Date = string;
/* tslint:enable */
/* tslint:disable:max-line-length */
/**
* 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
*/
export type SCISO8601Duration = string;
/* tslint:enable */
/**
* An ISO8601 time
*
* @pattern \d{2}:\d{2}(:\d{2})?
*/
export type SCISO8601Time = string;

21
src/general/uuid.ts Normal file
View File

@@ -0,0 +1,21 @@
/*
* 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/>.
*/
/**
* Universally unique identifier of the thing
*
* @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
*/
export type SCUuid = string;