refactor: update all

This commit is contained in:
openstappsbot
2023-01-30 08:34:22 +00:00
committed by Rainer Killinger
parent bdaa1f0201
commit 3b0014abac
6 changed files with 279 additions and 460 deletions

693
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@
"Thea Schöbl"
],
"dependencies": {
"@openstapps/core-tools": "0.32.0",
"@openstapps/core-tools": "0.34.0",
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/json-schema": "7.0.11",
@@ -58,29 +58,29 @@
"ts-optchain": "0.1.8"
},
"devDependencies": {
"@openstapps/configuration": "0.33.0",
"@openstapps/configuration": "0.34.0",
"@openstapps/es-mapping-generator": "0.4.0",
"@openstapps/eslint-config": "1.1.0",
"@openstapps/logger": "1.1.1",
"@testdeck/mocha": "0.3.3",
"@types/chai": "4.3.4",
"@types/lodash": "4.14.182",
"@types/mocha": "9.1.1",
"@types/mocha": "10.0.1",
"@types/rimraf": "3.0.2",
"@typescript-eslint/eslint-plugin": "5.33.1",
"@typescript-eslint/parser": "5.33.1",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.49.0",
"chai": "4.3.7",
"conditional-type-checks": "1.0.6",
"conventional-changelog-cli": "2.2.2",
"eslint": "8.31.0",
"eslint": "8.33.0",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-jsdoc": "39.6.4",
"eslint-plugin-jsdoc": "39.7.4",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "43.0.2",
"eslint-plugin-unicorn": "45.0.2",
"lodash": "4.17.21",
"mocha": "10.2.0",
"nyc": "15.1.0",
"prettier": "2.8.2",
"prettier": "2.8.3",
"rimraf": "3.0.2",
"source-map-support": "0.5.21",
"surge": "0.23.1",

View File

@@ -54,7 +54,7 @@ export function isThing(something: unknown): something is SCThing {
export function isThingWithTranslations(
thing: SCThingWithoutReferences,
): thing is SCThingWithoutReferences & {translations: SCTranslations<SCThingTranslatableProperties>} {
return typeof thing.translations !== 'undefined';
return thing.translations !== undefined;
}
/**
@@ -108,11 +108,11 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
return (
Array.isArray(somethingObject.data) &&
Array.isArray(somethingObject.facets) &&
typeof somethingObject.pagination !== 'undefined' &&
somethingObject.pagination !== undefined &&
typeof somethingObject.pagination.count === 'number' &&
typeof somethingObject.pagination.offset === 'number' &&
typeof somethingObject.pagination.total === 'number' &&
typeof somethingObject.stats !== 'undefined' &&
somethingObject.stats !== undefined &&
typeof somethingObject.stats.time === 'number'
);
}

View File

@@ -147,7 +147,7 @@ export abstract class SCAbstractRoute implements SCRoute {
const parameter = part.slice(1);
if (typeof parameters[parameter] === 'undefined') {
if (parameters[parameter] === undefined) {
throw new TypeError(`Parameter '${parameter}' not provided.`);
}

View File

@@ -117,7 +117,7 @@ export interface SCThingWithCategoriesSpecificValues {
* Meta information about a thing without references that accepts payments
* It intentionally does not extend the SCThingMeta implementation to be able to include generics.
*/
export class SCThingWithCategoriesWithoutReferencesMeta<T, U>
export class SCThingWithCategoriesWithoutReferencesMeta<T, U extends SCThingWithCategoriesSpecificValues>
implements SCMetaTranslations<SCThingWithCategoriesWithoutReferences<T, U>>
{
/**

View File

@@ -117,19 +117,19 @@ export class SCThingTranslator {
private getAllMetaFieldTranslations(thingType: SCThingType, language: SCLanguageCode): object | undefined {
const fieldTranslations = {};
const metaClass = this.getMetaClassInstance(thingType);
if (typeof metaClass === 'undefined') {
if (metaClass === undefined) {
return undefined;
}
// Assigns every property in fieldTranslations to the known base language translation
if (typeof metaClass.fieldTranslations.en !== 'undefined') {
if (metaClass.fieldTranslations.en !== undefined) {
for (const key of Object.keys(metaClass.fieldTranslations.en)) {
(fieldTranslations as any)[key] = metaClass.fieldTranslations.en[key];
}
}
// Assigns every property in fieldTranslations to the known translation in given language
if (typeof metaClass.fieldTranslations[language] !== 'undefined') {
if (metaClass.fieldTranslations[language] !== undefined) {
for (const key of Object.keys(metaClass.fieldTranslations[language])) {
(fieldTranslations as any)[key] = metaClass.fieldTranslations[language][key];
}
@@ -162,10 +162,10 @@ export class SCThingTranslator {
*/
private replaceAvailableMetaFieldValueTranslations(instance: any, language: SCLanguageCode): any {
const metaClass = this.getMetaClassInstance(instance.type);
if (typeof metaClass === 'undefined') {
if (metaClass === undefined) {
return instance;
}
if (typeof metaClass.fieldValueTranslations[language] !== 'undefined') {
if (metaClass.fieldValueTranslations[language] !== undefined) {
for (const key of Object.keys(metaClass.fieldValueTranslations[language])) {
if (
metaClass.fieldValueTranslations[language][key] instanceof Object &&
@@ -215,7 +215,7 @@ export class SCThingTranslator {
}
// Spread variable translations given by the connector into thing
if (typeof nextInstance.translations?.[targetLanguage] !== 'undefined') {
if (nextInstance.translations?.[targetLanguage] !== undefined) {
nextInstance = {...nextInstance, ...nextInstance.translations![targetLanguage]} as T;
}
// Spread known translations from meta classes into (partly) translated thing
@@ -234,7 +234,7 @@ export class SCThingTranslator {
public translate<T extends SCThing>(thing: T): T {
if (equal(this.sourceCache.get(thing), thing)) {
const cachedInstance = this.cache.get(thing);
if (typeof cachedInstance !== 'undefined') {
if (cachedInstance !== undefined) {
return cachedInstance as T;
}
}
@@ -268,7 +268,7 @@ export class SCThingTranslator {
const object: any = target();
if (equal(this.sourceCache.get(thing), thing)) {
const objectTranslatedFromCache = this.cache.get(thing);
if (typeof objectTranslatedFromCache !== 'undefined') {
if (objectTranslatedFromCache !== undefined) {
return this.deeptranslate((objectTranslatedFromCache as any)[key]);
}
}
@@ -374,7 +374,7 @@ class LRUCache<T> {
}
const entry = this.entries.get(key);
if (typeof entry !== 'undefined') {
if (entry !== undefined) {
// LRU behavior
this.entries.delete(key);
this.entries.set(key, entry);