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

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) {