fix: build

This commit is contained in:
2023-03-14 18:04:29 +01:00
parent 3792a14e90
commit fd740b3091
185 changed files with 21932 additions and 71486 deletions

View File

@@ -1,5 +1,4 @@
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <git@killinger.co>
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <killinge@hrz.uni-frankfurt.de>
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <killinger@hrz.uni-frankfurt.de>
Wieland Schöbl <wulkanat@gmail.com> wulkanat@gmail.com <wulkanat@gmail.com>
Wieland Schöbl <wulkanat@gmail.com> Wieland Schöbl <wieland.schoebl@campus.tu-berlin.de>
Thea Schöbl <dev@theaninova.de>

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +1,9 @@
{
"name": "@openstapps/core",
"version": "1.1.0",
"description": "StAppsCore - Generalized model of data",
"keywords": [
"Model",
"StApps"
],
"repository": {
"type": "git",
"url": "git@gitlab.com:openstapps/core.git"
},
"version": "2.1.0",
"license": "GPL-3.0-only",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "npm run lint && npm run compile && npm run pack && npm run schema && npm run mappings",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"check-configuration": "openstapps-configuration",
"compile": "rimraf lib && tsc",
"documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src",
"pack": "openstapps-core-tools pack",
"version": "npm run changelog",
"prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"",
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/.bin/openstapps-core-tools schema src lib/schema",
"mappings": "mkdir lib/mappings && openstapps-es-mapping-generator mapping ../core/src -i minlength,pattern,see,tjs-format -m lib/mappings/mappings.json -a lib/mappings/aggregations.json",
"mappings-integration": "openstapps-es-mapping-generator put-es-templates lib/mappings/mappings.json http://elasticsearch:9200/",
"test": "nyc mocha --recursive 'test/*.spec.ts'",
"lint": "eslint --ext .ts src/",
"format": "prettier .",
"format:fix": "prettier --write ."
},
"repository": "git@gitlab.com:openstapps/core.git",
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
"contributors": [
"Andreas Lehmann",
@@ -46,29 +18,44 @@
"Sebastian Lange",
"Thea Schöbl"
],
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "pnpm run compile && pnpm run schema && pnpm run mappings",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"check-configuration": "openstapps-configuration",
"compile": "rimraf lib && tsc",
"documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src",
"lint": "eslint --ext .ts src/",
"mappings": "openstapps-es-mapping-generator mapping ../core/src -i minlength,pattern,see,tjs-format -m lib/mappings/mappings.json -a lib/mappings/aggregations.json",
"mappings-integration": "openstapps-es-mapping-generator put-es-templates lib/mappings/mappings.json http://elasticsearch:9200/",
"prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"",
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/@openstapps/core-tools/lib/cli.js schema src lib/schema",
"test": "nyc mocha --recursive 'test/*.spec.ts'",
"version": "npm run changelog"
},
"dependencies": {
"@openstapps/core-tools": "0.34.0",
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/json-schema": "7.0.11",
"@types/node": "14.18.36",
"@openstapps/core-tools": "workspace:*",
"fast-deep-equal": "3.1.3",
"http-status-codes": "2.2.0",
"json-patch": "0.7.0",
"json-schema": "0.4.0",
"rfdc": "1.3.0",
"ts-optchain": "0.1.8"
"rfdc": "1.3.0"
},
"devDependencies": {
"@openstapps/configuration": "0.34.0",
"@openstapps/es-mapping-generator": "0.6.0",
"@openstapps/eslint-config": "1.1.0",
"@openstapps/prettier-config": "1.0.0",
"@openstapps/logger": "1.1.1",
"@openstapps/configuration": "workspace:*",
"@openstapps/es-mapping-generator": "workspace:*",
"@openstapps/eslint-config": "workspace:*",
"@openstapps/logger": "workspace:*",
"@testdeck/mocha": "0.3.3",
"@types/chai": "4.3.4",
"@types/lodash": "4.14.182",
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/json-schema": "7.0.11",
"@types/mocha": "10.0.1",
"@types/node": "18.15.3",
"@types/rimraf": "3.0.2",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.49.0",
@@ -80,11 +67,10 @@
"eslint-plugin-jsdoc": "39.7.4",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "45.0.2",
"lodash": "4.17.21",
"mocha": "10.2.0",
"nyc": "15.1.0",
"prettier": "2.8.3",
"rimraf": "3.0.2",
"rimraf": "4.4.0",
"source-map-support": "0.5.21",
"surge": "0.23.1",
"ts-node": "10.9.1",
@@ -92,6 +78,10 @@
"typescript": "4.4.4"
},
"prettier": "@openstapps/prettier-config",
"keywords": [
"Model",
"StApps"
],
"nyc": {
"all": true,
"branches": 90,

102
packages/core/src/index.ts Normal file
View File

@@ -0,0 +1,102 @@
export * from './guards';
export * from './meta';
export * from './translator';
export * from './config/app';
export * from './config/authorization';
export * from './config/backend';
export * from './config/feature';
export * from './config/file';
export * from './config/monitoring';
export * from './config/user';
export * from './general/i18n';
export * from './general/map';
export * from './general/namespaces';
export * from './general/time';
export * from './general/uuid';
export * from './protocol/error';
export * from './protocol/route';
export * from './things/academic-event';
export * from './things/article';
export * from './things/assessment';
export * from './things/book';
export * from './things/building';
export * from './things/catalog';
export * from './things/contact-point';
export * from './things/course-of-study';
export * from './things/date-series';
export * from './things/diff';
export * from './things/dish';
export * from './things/favorite';
export * from './things/floor';
export * from './things/message';
export * from './things/organization';
export * from './things/periodical';
export * from './things/person';
export * from './things/point-of-interest';
export * from './things/publication-event';
export * from './things/room';
export * from './things/semester';
export * from './things/setting';
export * from './things/sport-course';
export * from './things/study-module';
export * from './things/ticket';
export * from './things/todo';
export * from './things/tour';
export * from './things/video';
export * from './protocol/errors/internal-server-error';
export * from './protocol/errors/method-not-allowed';
export * from './protocol/errors/not-found';
export * from './protocol/errors/parameters-not-acceptable';
export * from './protocol/errors/plugin-already-registered';
export * from './protocol/errors/plugin-registering-failed';
export * from './protocol/errors/request-body-too-large';
export * from './protocol/errors/syntax-error';
export * from './protocol/errors/too-many-requests';
export * from './protocol/errors/unsupported-media-type';
export * from './protocol/errors/validation';
export * from './protocol/routes/book-availability';
export * from './protocol/routes/bulk-add';
export * from './protocol/routes/bulk-done';
export * from './protocol/routes/bulk-request';
export * from './protocol/routes/feedback';
export * from './protocol/routes/index';
export * from './protocol/routes/plugin-register';
export * from './protocol/routes/rating';
export * from './protocol/routes/search-multi';
export * from './protocol/routes/search';
export * from './protocol/routes/thing-update';
export * from './protocol/search/facet';
export * from './protocol/search/filter';
export * from './protocol/search/query';
export * from './protocol/search/result';
export * from './protocol/search/sort';
export * from './things/abstract/academic-degree';
export * from './things/abstract/academic-term';
export * from './things/abstract/creative-work';
export * from './things/abstract/event';
export * from './things/abstract/place';
export * from './things/abstract/range';
export * from './things/abstract/saveable-thing';
export * from './things/abstract/thing-in-place';
export * from './things/abstract/thing-that-accepts-payments';
export * from './things/abstract/thing-that-can-be-offered';
export * from './things/abstract/thing-with-categories';
export * from './things/abstract/thing';
export * from './things/abstract/user-groups';
export * from './protocol/search/filters/availability';
export * from './protocol/search/filters/boolean';
export * from './protocol/search/filters/distance';
export * from './protocol/search/filters/geo';
export * from './protocol/search/filters/range';
export * from './protocol/search/filters/value';
export * from './protocol/search/sorts/distance';
export * from './protocol/search/sorts/ducet';
export * from './protocol/search/sorts/generic';
export * from './protocol/search/sorts/price';

View File

@@ -15,7 +15,6 @@
*/
import equal = require('fast-deep-equal/es6');
import clone = require('rfdc');
import {Defined, TSOCType} from 'ts-optchain';
import {SCLanguageCode} from './general/i18n';
import {isThing} from './guards';
import {SCClasses} from './meta';
@@ -90,21 +89,15 @@ export class SCThingTranslator {
* Get field value translation recursively
*
* @param data The intermediate object / primitive returned by the Proxys get() method
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
* @returns a T object allowing for access to translations or a translated value(s)
*/
private deeptranslate<T>(data?: T): TSOCType<T> {
const proxy = new Proxy(
((defaultValue?: Defined<T>) => (data == undefined ? defaultValue : data)) as TSOCType<T>,
private deeptranslate<T>(data: T): T {
return typeof data === 'object' ? new Proxy(
data as never,
{
get: (target, key) => {
const object: any = target();
return this.deeptranslate(object[key]);
},
get: (target, key) => this.deeptranslate(target[key as never]),
},
);
return proxy;
) as unknown as T : data;
}
/**
@@ -260,12 +253,12 @@ export class SCThingTranslator {
* @param thing Top level object that gets passed through the recursion
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
*/
public translatedAccess<T extends SCThing>(thing: T): TSOCType<T> {
public translatedAccess<T extends SCThing>(thing: T): T {
return new Proxy(
((defaultValue?: Defined<T>) => (thing == undefined ? defaultValue : thing)) as TSOCType<T>,
thing,
{
get: (target, key) => {
const object: any = target();
const object: any = target;
if (equal(this.sourceCache.get(thing), thing)) {
const objectTranslatedFromCache = this.cache.get(thing);
if (objectTranslatedFromCache !== undefined) {