Compare commits

...

13 Commits

Author SHA1 Message Date
Jovan Krunić
95b2fc5c18 0.75.0 2023-02-28 14:22:05 +01:00
Jovan Krunić
28eacf7925 feat: add rating for things
Closes #152
2023-02-27 13:33:24 +01:00
Rainer Killinger
2afbdabc54 0.74.0 2023-01-30 13:59:40 +01:00
Rainer Killinger
4e521926d3 refactor: reorder version related asset generation 2023-01-30 13:27:27 +01:00
openstappsbot
3b0014abac refactor: update all 2023-01-30 13:26:34 +01:00
Rainer Killinger
bdaa1f0201 refactor: Feedback metaData has to be optiobal 2023-01-13 11:59:33 +01:00
Rainer Killinger
1703a3dd40 docs: update changelog 2023-01-12 19:12:43 +01:00
Rainer Killinger
877903dd1a 0.73.0 2023-01-12 19:12:41 +01:00
openstappsbot
2873e22038 refactor: update all 2023-01-12 19:02:40 +01:00
Jovan Krunić
7fdf6f7c25 docs: update changelog 2022-12-06 14:44:04 +01:00
Jovan Krunić
17dc720df6 0.72.0 2022-12-06 14:44:02 +01:00
Jovan Krunić
be98fd8c4c feat: add dish menu section and service times
Closes #150
2022-12-06 13:35:49 +01:00
Rainer Killinger
8c032209a0 docs: update changelog 2022-11-22 12:48:15 +01:00
11 changed files with 760 additions and 741 deletions

View File

@@ -1,3 +1,33 @@
# [0.75.0](https://gitlab.com/openstapps/core/compare/v0.74.0...v0.75.0) (2023-02-28)
### Features
* add rating for things ([28eacf7](https://gitlab.com/openstapps/core/commit/28eacf7925f84caa129cad4b94fb449effd4d6ea)), closes [#152](https://gitlab.com/openstapps/core/issues/152)
# [0.74.0](https://gitlab.com/openstapps/core/compare/v0.73.0...v0.74.0) (2023-01-30)
# [0.73.0](https://gitlab.com/openstapps/core/compare/v0.72.0...v0.73.0) (2023-01-12)
# [0.72.0](https://gitlab.com/openstapps/core/compare/v0.71.1...v0.72.0) (2022-12-06)
### Features
* add dish menu section and service times ([be98fd8](https://gitlab.com/openstapps/core/commit/be98fd8c4c2fbb01eb80808bf3aa609b08b90ec6)), closes [#150](https://gitlab.com/openstapps/core/issues/150)
## [0.71.1](https://gitlab.com/openstapps/core/compare/v0.71.0...v0.71.1) (2022-11-22)
# [0.71.0](https://gitlab.com/openstapps/core/compare/v0.70.0...v0.71.0) (2022-10-11) # [0.71.0](https://gitlab.com/openstapps/core/compare/v0.70.0...v0.71.0) (2022-10-11)

1282
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/core", "name": "@openstapps/core",
"version": "0.71.1", "version": "0.75.0",
"description": "StAppsCore - Generalized model of data", "description": "StAppsCore - Generalized model of data",
"keywords": [ "keywords": [
"Model", "Model",
@@ -15,12 +15,12 @@
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"scripts": { "scripts": {
"build": "npm run lint && npm run compile && npm run pack && npm run schema && npm run mappings", "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 && git commit -m 'docs: update changelog'", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"check-configuration": "openstapps-configuration", "check-configuration": "openstapps-configuration",
"compile": "rimraf lib && tsc", "compile": "rimraf lib && tsc",
"documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src", "documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src",
"pack": "openstapps-core-tools pack", "pack": "openstapps-core-tools pack",
"postversion": "npm run changelog", "version": "npm run changelog",
"prepublishOnly": "npm ci && npm run build", "prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly", "preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"", "push": "git push && git push origin \"v$npm_package_version\"",
@@ -45,11 +45,11 @@
"Thea Schöbl" "Thea Schöbl"
], ],
"dependencies": { "dependencies": {
"@openstapps/core-tools": "0.32.0", "@openstapps/core-tools": "0.34.0",
"@types/geojson": "1.0.6", "@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30", "@types/json-patch": "0.0.30",
"@types/json-schema": "7.0.11", "@types/json-schema": "7.0.11",
"@types/node": "14.18.24", "@types/node": "14.18.36",
"fast-deep-equal": "3.1.3", "fast-deep-equal": "3.1.3",
"http-status-codes": "2.2.0", "http-status-codes": "2.2.0",
"json-patch": "0.7.0", "json-patch": "0.7.0",
@@ -58,29 +58,29 @@
"ts-optchain": "0.1.8" "ts-optchain": "0.1.8"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/configuration": "0.33.0", "@openstapps/configuration": "0.34.0",
"@openstapps/es-mapping-generator": "0.3.0", "@openstapps/es-mapping-generator": "0.4.0",
"@openstapps/eslint-config": "1.1.0", "@openstapps/eslint-config": "1.1.0",
"@openstapps/logger": "1.0.0", "@openstapps/logger": "1.1.1",
"@testdeck/mocha": "0.2.0", "@testdeck/mocha": "0.3.3",
"@types/chai": "4.3.3", "@types/chai": "4.3.4",
"@types/lodash": "4.14.182", "@types/lodash": "4.14.182",
"@types/mocha": "9.1.1", "@types/mocha": "10.0.1",
"@types/rimraf": "3.0.2", "@types/rimraf": "3.0.2",
"@typescript-eslint/eslint-plugin": "5.33.1", "@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.33.1", "@typescript-eslint/parser": "5.49.0",
"chai": "4.3.6", "chai": "4.3.7",
"conditional-type-checks": "1.0.6", "conditional-type-checks": "1.0.6",
"conventional-changelog-cli": "2.2.2", "conventional-changelog-cli": "2.2.2",
"eslint": "8.22.0", "eslint": "8.33.0",
"eslint-config-prettier": "8.5.0", "eslint-config-prettier": "8.6.0",
"eslint-plugin-jsdoc": "39.3.6", "eslint-plugin-jsdoc": "39.7.4",
"eslint-plugin-prettier": "4.2.1", "eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "43.0.2", "eslint-plugin-unicorn": "45.0.2",
"lodash": "4.17.21", "lodash": "4.17.21",
"mocha": "10.0.0", "mocha": "10.2.0",
"nyc": "15.1.0", "nyc": "15.1.0",
"prettier": "2.7.1", "prettier": "2.8.3",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"source-map-support": "0.5.21", "source-map-support": "0.5.21",
"surge": "0.23.1", "surge": "0.23.1",

View File

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

View File

@@ -27,6 +27,7 @@ import {SCFeedbackRequest, SCFeedbackResponse, SCFeedbackRoute} from './routes/f
import {SCSearchRequest, SCSearchResponse, SCSearchRoute} from './routes/search'; import {SCSearchRequest, SCSearchResponse, SCSearchRoute} from './routes/search';
import {SCMultiSearchRequest, SCMultiSearchResponse, SCMultiSearchRoute} from './routes/search-multi'; import {SCMultiSearchRequest, SCMultiSearchResponse, SCMultiSearchRoute} from './routes/search-multi';
import {SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute} from './routes/thing-update'; import {SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute} from './routes/thing-update';
import {SCRatingRequest, SCRatingResponse, SCRatingRoute} from './routes/rating';
/** /**
* Possible Verbs for HTTP requests * Possible Verbs for HTTP requests
@@ -147,7 +148,7 @@ export abstract class SCAbstractRoute implements SCRoute {
const parameter = part.slice(1); const parameter = part.slice(1);
if (typeof parameters[parameter] === 'undefined') { if (parameters[parameter] === undefined) {
throw new TypeError(`Parameter '${parameter}' not provided.`); throw new TypeError(`Parameter '${parameter}' not provided.`);
} }
@@ -166,6 +167,7 @@ export type SCRequests =
| SCBulkAddRequest | SCBulkAddRequest
| SCBulkDoneRequest | SCBulkDoneRequest
| SCFeedbackRequest | SCFeedbackRequest
| SCRatingRequest
| SCIndexRequest | SCIndexRequest
| SCMultiSearchRequest | SCMultiSearchRequest
| SCSearchRequest | SCSearchRequest
@@ -180,6 +182,7 @@ export type SCResponses =
| SCBulkAddResponse | SCBulkAddResponse
| SCBulkDoneResponse | SCBulkDoneResponse
| SCFeedbackResponse | SCFeedbackResponse
| SCRatingResponse
| SCIndexResponse | SCIndexResponse
| SCMultiSearchResponse | SCMultiSearchResponse
| SCSearchResponse | SCSearchResponse
@@ -198,6 +201,8 @@ export type SCAssociatedResponse<REQUEST> = REQUEST extends SCBookAvailabilityRe
? SCBulkDoneResponse ? SCBulkDoneResponse
: REQUEST extends SCFeedbackRequest : REQUEST extends SCFeedbackRequest
? SCFeedbackResponse ? SCFeedbackResponse
: REQUEST extends SCRatingRequest
? SCRatingResponse
: REQUEST extends SCIndexRequest : REQUEST extends SCIndexRequest
? SCIndexResponse ? SCIndexResponse
: REQUEST extends SCMultiSearchRequest : REQUEST extends SCMultiSearchRequest
@@ -221,6 +226,8 @@ export type SCAssociatedRequest<RESPONSE> = RESPONSE extends SCBookAvailabilityR
? SCBulkDoneRequest ? SCBulkDoneRequest
: RESPONSE extends SCFeedbackResponse : RESPONSE extends SCFeedbackResponse
? SCFeedbackRequest ? SCFeedbackRequest
: RESPONSE extends SCRatingResponse
? SCRatingRequest
: RESPONSE extends SCIndexResponse : RESPONSE extends SCIndexResponse
? SCIndexRequest ? SCIndexRequest
: RESPONSE extends SCMultiSearchResponse : RESPONSE extends SCMultiSearchResponse
@@ -244,6 +251,8 @@ export type SCAssignedRequest<ROUTE extends SCAbstractRoute> = ROUTE extends SCB
? SCBulkDoneRequest ? SCBulkDoneRequest
: ROUTE extends SCFeedbackRoute : ROUTE extends SCFeedbackRoute
? SCFeedbackRequest ? SCFeedbackRequest
: ROUTE extends SCRatingRoute
? SCRatingRequest
: ROUTE extends SCIndexRoute : ROUTE extends SCIndexRoute
? SCIndexRequest ? SCIndexRequest
: ROUTE extends SCMultiSearchRoute : ROUTE extends SCMultiSearchRoute
@@ -267,6 +276,8 @@ export type SCAssignedResponse<ROUTE extends SCAbstractRoute> = ROUTE extends SC
? SCBulkDoneResponse ? SCBulkDoneResponse
: ROUTE extends SCFeedbackRoute : ROUTE extends SCFeedbackRoute
? SCFeedbackResponse ? SCFeedbackResponse
: ROUTE extends SCRatingRoute
? SCRatingResponse
: ROUTE extends SCIndexRoute : ROUTE extends SCIndexRoute
? SCIndexResponse ? SCIndexResponse
: ROUTE extends SCMultiSearchRoute : ROUTE extends SCMultiSearchRoute

View File

@@ -31,7 +31,7 @@ export interface SCFeedbackRequest extends SCMessage {
/** /**
* Meta data that helps to understand the feedback * Meta data that helps to understand the feedback
*/ */
metaData: SCFeedbackRequestMetaData; metaData?: SCFeedbackRequestMetaData;
} }
/** /**

View File

@@ -0,0 +1,77 @@
/*
* Copyright (C) 2019-2023 Open 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/>.
*/
import {StatusCodes} from 'http-status-codes';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
import {SCSyntaxErrorResponse} from '../errors/syntax-error';
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type';
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route';
import {SCThing} from '../../things/abstract/thing';
import {SCUserGroupSetting} from '../../things/setting';
import {SCValidationErrorResponse} from '../errors/validation';
/**
* 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 {
/**
* Number of rating stars
*/
rating: 1 | 2 | 3 | 4 | 5;
/**
* User's group in the app
*/
userGroup: SCUserGroupSetting['value'];
/**
* UID of the thing that is rated
*/
uid: SCThing['uid'];
}
/**
* A response to a rating request
*
* @validatable
*/
export interface SCRatingResponse {}
/**
* Route for rating submission
*/
export class SCRatingRoute extends SCAbstractRoute {
constructor() {
super();
this.errorNames = [
SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse,
SCRequestBodyTooLargeErrorResponse,
SCSyntaxErrorResponse,
SCUnsupportedMediaTypeErrorResponse,
SCValidationErrorResponse,
];
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCRatingRequest';
this.responseBodyName = 'SCRatingResponse';
this.statusCodeSuccess = StatusCodes.OK;
this.urlPath = '/rating';
}
}

View File

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

View File

@@ -53,6 +53,11 @@ export interface SCDishWithoutReferences
*/ */
nutrition?: SCNutritionInformation; nutrition?: SCNutritionInformation;
/**
* Section of the restaurant menu to which the dish belongs
*/
menuSection?: SCMenuSection;
/** /**
* Translated fields of a dish * Translated fields of a dish
*/ */
@@ -187,6 +192,20 @@ export interface SCNutritionInformation {
sugarContent?: number; sugarContent?: number;
} }
export interface SCMenuSection {
/**
* Name of the menu section (mostly to be used as a section title)
*/
name: 'breakfast' | 'lunch' | 'dinner';
/**
* The time span when the dishes from the sections are available.
*
* @see http://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
*/
servingHours?: string;
}
/** /**
* Meta information about a dish * Meta information about a dish
*/ */
@@ -205,6 +224,7 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
characteristics: 'Merkmale', characteristics: 'Merkmale',
dishAddOns: 'Beilagen', dishAddOns: 'Beilagen',
nutrition: 'Nährwertangaben', nutrition: 'Nährwertangaben',
menuSection: 'Menüabschnitt',
}, },
en: { en: {
...new SCThingWithCategoriesWithoutReferencesMeta< ...new SCThingWithCategoriesWithoutReferencesMeta<
@@ -216,6 +236,7 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
characteristics: 'characteristics', characteristics: 'characteristics',
dishAddOns: 'side dishes', dishAddOns: 'side dishes',
nutrition: 'nutrition information', nutrition: 'nutrition information',
menuSection: 'menu section',
}, },
}; };

View File

@@ -117,6 +117,14 @@ export interface SCRoomSpecificValues extends SCThingWithCategoriesSpecificValue
* @keyword * @keyword
*/ */
openingHours?: string; 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
*/
serviceHours?: string;
} }
/** /**
@@ -135,6 +143,7 @@ export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom
...new SCThingInPlaceMeta().fieldTranslations.de, ...new SCThingInPlaceMeta().fieldTranslations.de,
floorName: 'Etagenbezeichnung', floorName: 'Etagenbezeichnung',
inventory: 'Bestand', inventory: 'Bestand',
serviceHours: 'Servicezeiten',
}, },
en: { en: {
...new SCPlaceWithoutReferencesMeta().fieldTranslations.en, ...new SCPlaceWithoutReferencesMeta().fieldTranslations.en,
@@ -144,6 +153,7 @@ export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom
...new SCThingInPlaceMeta().fieldTranslations.en, ...new SCThingInPlaceMeta().fieldTranslations.en,
floorName: 'floor name', floorName: 'floor name',
inventory: 'inventory', inventory: 'inventory',
serviceHours: 'service hours',
}, },
}; };

View File

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