aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Recipe.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/Recipe.ts')
-rw-r--r--src/models/Recipe.ts56
1 files changed, 36 insertions, 20 deletions
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';
2import { pathExistsSync } from 'fs-extra'; 2import { pathExistsSync } from 'fs-extra';
3import { join } from 'path'; 3import { join } from 'path';
4import { DEFAULT_SERVICE_SETTINGS } from '../config'; 4import { DEFAULT_SERVICE_SETTINGS } from '../config';
5import { ifUndefinedString, ifUndefinedBoolean } from '../jsUtils'; 5import { ifUndefined } from '../jsUtils';
6 6
7interface IRecipe { 7interface IRecipe {
8 id: string; 8 id: string;
@@ -34,7 +34,7 @@ export default class Recipe {
34 34
35 name: string = ''; 35 name: string = '';
36 36
37 description = ''; 37 description: string = '';
38 38
39 version: string = ''; 39 version: string = '';
40 40
@@ -75,6 +75,19 @@ export default class Recipe {
75 // TODO: Is this being used? 75 // TODO: Is this being used?
76 local: boolean = false; 76 local: boolean = false;
77 77
78 // TODO Add types for this once we know if they are neccesary to pass
79 // on to the initialize-recipe ipc event.
80 overrideUserAgent: any;
81
82 buildUrl: any;
83
84 modifyRequestHeaders: any;
85
86 knownCertificateHosts: any;
87
88 events: any;
89 // End todo.
90
78 // TODO: Need to reconcile which of these are optional/mandatory 91 // TODO: Need to reconcile which of these are optional/mandatory
79 constructor(data: IRecipe) { 92 constructor(data: IRecipe) {
80 if (!data) { 93 if (!data) {
@@ -93,61 +106,64 @@ export default class Recipe {
93 } 106 }
94 107
95 // from the recipe 108 // from the recipe
96 this.id = ifUndefinedString(data.id, this.id); 109 this.id = ifUndefined<string>(data.id, this.id);
97 this.name = ifUndefinedString(data.name, this.name); 110 this.name = ifUndefined<string>(data.name, this.name);
98 this.version = ifUndefinedString(data.version, this.version); 111 this.version = ifUndefined<string>(data.version, this.version);
99 this.aliases = data.aliases || this.aliases; 112 this.aliases = data.aliases || this.aliases;
100 this.serviceURL = ifUndefinedString( 113 this.serviceURL = ifUndefined<string>(
101 data.config.serviceURL, 114 data.config.serviceURL,
102 this.serviceURL, 115 this.serviceURL,
103 ); 116 );
104 this.hasDirectMessages = ifUndefinedBoolean( 117 this.hasDirectMessages = ifUndefined<boolean>(
105 data.config.hasDirectMessages, 118 data.config.hasDirectMessages,
106 this.hasDirectMessages, 119 this.hasDirectMessages,
107 ); 120 );
108 this.hasIndirectMessages = ifUndefinedBoolean( 121 this.hasIndirectMessages = ifUndefined<boolean>(
109 data.config.hasIndirectMessages, 122 data.config.hasIndirectMessages,
110 this.hasIndirectMessages, 123 this.hasIndirectMessages,
111 ); 124 );
112 this.hasNotificationSound = ifUndefinedBoolean( 125 this.hasNotificationSound = ifUndefined<boolean>(
113 data.config.hasNotificationSound, 126 data.config.hasNotificationSound,
114 this.hasNotificationSound, 127 this.hasNotificationSound,
115 ); 128 );
116 this.hasTeamId = ifUndefinedBoolean(data.config.hasTeamId, this.hasTeamId); 129 this.hasTeamId = ifUndefined<boolean>(
117 this.hasCustomUrl = ifUndefinedBoolean( 130 data.config.hasTeamId,
131 this.hasTeamId,
132 );
133 this.hasCustomUrl = ifUndefined<boolean>(
118 data.config.hasCustomUrl, 134 data.config.hasCustomUrl,
119 this.hasCustomUrl, 135 this.hasCustomUrl,
120 ); 136 );
121 this.hasHostedOption = ifUndefinedBoolean( 137 this.hasHostedOption = ifUndefined<boolean>(
122 data.config.hasHostedOption, 138 data.config.hasHostedOption,
123 this.hasHostedOption, 139 this.hasHostedOption,
124 ); 140 );
125 this.urlInputPrefix = ifUndefinedString( 141 this.urlInputPrefix = ifUndefined<string>(
126 data.config.urlInputPrefix, 142 data.config.urlInputPrefix,
127 this.urlInputPrefix, 143 this.urlInputPrefix,
128 ); 144 );
129 this.urlInputSuffix = ifUndefinedString( 145 this.urlInputSuffix = ifUndefined<string>(
130 data.config.urlInputSuffix, 146 data.config.urlInputSuffix,
131 this.urlInputSuffix, 147 this.urlInputSuffix,
132 ); 148 );
133 this.disablewebsecurity = ifUndefinedBoolean( 149 this.disablewebsecurity = ifUndefined<boolean>(
134 data.config.disablewebsecurity, 150 data.config.disablewebsecurity,
135 this.disablewebsecurity, 151 this.disablewebsecurity,
136 ); 152 );
137 this.autoHibernate = ifUndefinedBoolean( 153 this.autoHibernate = ifUndefined<boolean>(
138 data.config.autoHibernate, 154 data.config.autoHibernate,
139 this.autoHibernate, 155 this.autoHibernate,
140 ); 156 );
141 this.local = ifUndefinedBoolean(data.config.local, this.local); 157 this.local = ifUndefined<boolean>(data.config.local, this.local);
142 this.message = ifUndefinedString(data.config.message, this.message); 158 this.message = ifUndefined<string>(data.config.message, this.message);
143 this.allowFavoritesDelineationInUnreadCount = ifUndefinedBoolean( 159 this.allowFavoritesDelineationInUnreadCount = ifUndefined<boolean>(
144 data.config.allowFavoritesDelineationInUnreadCount, 160 data.config.allowFavoritesDelineationInUnreadCount,
145 this.allowFavoritesDelineationInUnreadCount, 161 this.allowFavoritesDelineationInUnreadCount,
146 ); 162 );
147 163
148 // computed 164 // computed
149 this.path = data.path; 165 this.path = data.path;
150 this.partition = ifUndefinedString(data.config.partition, this.partition); 166 this.partition = ifUndefined<string>(data.config.partition, this.partition);
151 } 167 }
152 168
153 // TODO: Need to remove this if its not used anywhere 169 // TODO: Need to remove this if its not used anywhere