From 6b2c2b8dfb86245a1747bf7977159f5129461863 Mon Sep 17 00:00:00 2001 From: Ricardo Cino Date: Thu, 23 Jun 2022 18:10:39 +0200 Subject: chore: servicesStore + models into typescript (#344) --- src/models/Recipe.ts | 56 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'src/models/Recipe.ts') diff --git a/src/models/Recipe.ts b/src/models/Recipe.ts index be889d22c..eb8b0b1ff 100644 --- a/src/models/Recipe.ts +++ b/src/models/Recipe.ts @@ -2,7 +2,7 @@ import semver from 'semver'; import { pathExistsSync } from 'fs-extra'; import { join } from 'path'; import { DEFAULT_SERVICE_SETTINGS } from '../config'; -import { ifUndefinedString, ifUndefinedBoolean } from '../jsUtils'; +import { ifUndefined } from '../jsUtils'; interface IRecipe { id: string; @@ -34,7 +34,7 @@ export default class Recipe { name: string = ''; - description = ''; + description: string = ''; version: string = ''; @@ -75,6 +75,19 @@ export default class Recipe { // TODO: Is this being used? local: boolean = false; + // TODO Add types for this once we know if they are neccesary to pass + // on to the initialize-recipe ipc event. + overrideUserAgent: any; + + buildUrl: any; + + modifyRequestHeaders: any; + + knownCertificateHosts: any; + + events: any; + // End todo. + // TODO: Need to reconcile which of these are optional/mandatory constructor(data: IRecipe) { if (!data) { @@ -93,61 +106,64 @@ export default class Recipe { } // from the recipe - this.id = ifUndefinedString(data.id, this.id); - this.name = ifUndefinedString(data.name, this.name); - this.version = ifUndefinedString(data.version, this.version); + this.id = ifUndefined(data.id, this.id); + this.name = ifUndefined(data.name, this.name); + this.version = ifUndefined(data.version, this.version); this.aliases = data.aliases || this.aliases; - this.serviceURL = ifUndefinedString( + this.serviceURL = ifUndefined( data.config.serviceURL, this.serviceURL, ); - this.hasDirectMessages = ifUndefinedBoolean( + this.hasDirectMessages = ifUndefined( data.config.hasDirectMessages, this.hasDirectMessages, ); - this.hasIndirectMessages = ifUndefinedBoolean( + this.hasIndirectMessages = ifUndefined( data.config.hasIndirectMessages, this.hasIndirectMessages, ); - this.hasNotificationSound = ifUndefinedBoolean( + this.hasNotificationSound = ifUndefined( data.config.hasNotificationSound, this.hasNotificationSound, ); - this.hasTeamId = ifUndefinedBoolean(data.config.hasTeamId, this.hasTeamId); - this.hasCustomUrl = ifUndefinedBoolean( + this.hasTeamId = ifUndefined( + data.config.hasTeamId, + this.hasTeamId, + ); + this.hasCustomUrl = ifUndefined( data.config.hasCustomUrl, this.hasCustomUrl, ); - this.hasHostedOption = ifUndefinedBoolean( + this.hasHostedOption = ifUndefined( data.config.hasHostedOption, this.hasHostedOption, ); - this.urlInputPrefix = ifUndefinedString( + this.urlInputPrefix = ifUndefined( data.config.urlInputPrefix, this.urlInputPrefix, ); - this.urlInputSuffix = ifUndefinedString( + this.urlInputSuffix = ifUndefined( data.config.urlInputSuffix, this.urlInputSuffix, ); - this.disablewebsecurity = ifUndefinedBoolean( + this.disablewebsecurity = ifUndefined( data.config.disablewebsecurity, this.disablewebsecurity, ); - this.autoHibernate = ifUndefinedBoolean( + this.autoHibernate = ifUndefined( data.config.autoHibernate, this.autoHibernate, ); - this.local = ifUndefinedBoolean(data.config.local, this.local); - this.message = ifUndefinedString(data.config.message, this.message); - this.allowFavoritesDelineationInUnreadCount = ifUndefinedBoolean( + this.local = ifUndefined(data.config.local, this.local); + this.message = ifUndefined(data.config.message, this.message); + this.allowFavoritesDelineationInUnreadCount = ifUndefined( data.config.allowFavoritesDelineationInUnreadCount, this.allowFavoritesDelineationInUnreadCount, ); // computed this.path = data.path; - this.partition = ifUndefinedString(data.config.partition, this.partition); + this.partition = ifUndefined(data.config.partition, this.partition); } // TODO: Need to remove this if its not used anywhere -- cgit v1.2.3-70-g09d2