diff options
Diffstat (limited to 'src/@types/stores.types.ts')
-rw-r--r-- | src/@types/stores.types.ts | 370 |
1 files changed, 370 insertions, 0 deletions
diff --git a/src/@types/stores.types.ts b/src/@types/stores.types.ts new file mode 100644 index 000000000..37b906239 --- /dev/null +++ b/src/@types/stores.types.ts | |||
@@ -0,0 +1,370 @@ | |||
1 | import Workspace from '../features/workspaces/models/Workspace'; | ||
2 | import Recipe from '../models/Recipe'; | ||
3 | import Service from '../models/Service'; | ||
4 | import User from '../models/User'; | ||
5 | import { Request } from '../stores/lib/Request'; | ||
6 | import { CachedRequest } from '../stores/lib/CachedRequest'; | ||
7 | import Reaction from '../stores/lib/Reaction'; | ||
8 | |||
9 | // TODO: This file will be removed in the future when all stores are | ||
10 | // correctly typed and the use of these interfaces are obsolete. | ||
11 | |||
12 | export interface FerdiumStores { | ||
13 | app: AppStore; | ||
14 | communityRecipes: CommunityRecipesStore; | ||
15 | features: FeaturesStore; | ||
16 | globalError: GlobalErrorStore; | ||
17 | recipePreviews: RecipePreviewsStore; | ||
18 | recipes: RecipeStore; | ||
19 | requests: RequestsStore; | ||
20 | router: RouterStore; | ||
21 | services: ServicesStore; | ||
22 | settings: SettingsStore; | ||
23 | todos: TodosStore; | ||
24 | ui: UIStore; | ||
25 | user: UserStore; | ||
26 | workspaces: WorkspacesStore; | ||
27 | } | ||
28 | |||
29 | export interface Stores { | ||
30 | app: AppStore; | ||
31 | communityRecipes: CommunityRecipesStore; | ||
32 | features: FeaturesStore; | ||
33 | globalError: GlobalErrorStore; | ||
34 | recipePreviews: RecipePreviewsStore; | ||
35 | recipes: RecipeStore; | ||
36 | requests: RequestsStore; | ||
37 | router: RouterStore; | ||
38 | services: ServicesStore; | ||
39 | settings: SettingsStore; | ||
40 | todos: TodosStore; | ||
41 | ui: UIStore; | ||
42 | user: UserStore; | ||
43 | workspaces: WorkspacesStore; | ||
44 | } | ||
45 | |||
46 | interface Actions { | ||
47 | app: AppStore; | ||
48 | recipePreviews: RecipePreviewsStore; | ||
49 | recipes: RecipeStore; | ||
50 | requests: RequestsStore; | ||
51 | services: ServicesStore; | ||
52 | settings: SettingsStore; | ||
53 | todos: TodosStore; | ||
54 | ui: UIStore; | ||
55 | user: UserStore; | ||
56 | workspaces: WorkspacesStore; | ||
57 | } | ||
58 | |||
59 | interface Api { | ||
60 | app: AppStore; | ||
61 | features: FeaturesStore; | ||
62 | local: {}; | ||
63 | recipePreviews: RecipePreviewsStore; | ||
64 | recipes: RecipeStore; | ||
65 | services: ServicesStore; | ||
66 | user: UserStore; | ||
67 | } | ||
68 | |||
69 | interface TypedStore { | ||
70 | actions: Actions; | ||
71 | api: Api; | ||
72 | stores: Stores; | ||
73 | _reactions: Reaction[]; | ||
74 | _status: any; | ||
75 | actionStatus: () => void; | ||
76 | initialize: () => void; | ||
77 | tearDown: () => void; | ||
78 | resetStatus: () => void; | ||
79 | } | ||
80 | |||
81 | interface AppStore extends TypedStore { | ||
82 | accentColor: string; | ||
83 | adaptableDarkMode: boolean; | ||
84 | progressbarAccentColor: string; | ||
85 | authRequestFailed: () => void; | ||
86 | autoLaunchOnStart: () => void; | ||
87 | automaticUpdates: boolean; | ||
88 | clearAppCacheRequest: () => void; | ||
89 | clipboardNotifications: boolean; | ||
90 | darkMode: boolean; | ||
91 | dictionaries: []; | ||
92 | enableSpellchecking: boolean; | ||
93 | fetchDataInterval: 4; | ||
94 | get(key: string): any; | ||
95 | getAppCacheSizeRequest: () => void; | ||
96 | healthCheckRequest: () => void; | ||
97 | isClearingAllCache: () => void; | ||
98 | isAppMuted: boolean; | ||
99 | isFocused: () => void; | ||
100 | isFullScreen: () => void; | ||
101 | isOnline: boolean; | ||
102 | isSystemDarkModeEnabled: () => void; | ||
103 | isSystemMuteOverridden: () => void; | ||
104 | locale: () => void; | ||
105 | lockedPassword: string; | ||
106 | reloadAfterResume: boolean; | ||
107 | reloadAfterResumeTime: number; | ||
108 | searchEngine: string; | ||
109 | spellcheckerLanguage: string; | ||
110 | splitMode: boolean; | ||
111 | splitColumns: number; | ||
112 | timeOfflineStart: () => void; | ||
113 | timeSuspensionStart: () => void; | ||
114 | updateStatus: () => void; | ||
115 | updateStatusTypes: { | ||
116 | CHECKING: 'CHECKING'; | ||
117 | AVAILABLE: 'AVAILABLE'; | ||
118 | NOT_AVAILABLE: 'NOT_AVAILABLE'; | ||
119 | DOWNLOADED: 'DOWNLOADED'; | ||
120 | FAILED: 'FAILED'; | ||
121 | }; | ||
122 | universalDarkMode: boolean; | ||
123 | cacheSize: () => void; | ||
124 | debugInfo: () => void; | ||
125 | } | ||
126 | |||
127 | interface CommunityRecipesStore extends TypedStore { | ||
128 | communityRecipes: () => void; | ||
129 | } | ||
130 | |||
131 | interface FeaturesStore extends TypedStore { | ||
132 | anonymousFeatures: () => void; | ||
133 | defaultFeaturesRequest: () => void; | ||
134 | features: () => void; | ||
135 | featuresRequest: CachedRequest; | ||
136 | _monitorLoginStatus: () => void; | ||
137 | _updateFeatures: () => void; | ||
138 | _setupFeatures: () => void; | ||
139 | } | ||
140 | |||
141 | interface GlobalErrorStore extends TypedStore { | ||
142 | error: () => void; | ||
143 | messages: () => void; | ||
144 | response: () => void; | ||
145 | _handleRequests: () => void; | ||
146 | } | ||
147 | |||
148 | interface RecipePreviewsStore extends TypedStore { | ||
149 | allRecipePreviewsRequest: () => void; | ||
150 | searchRecipePreviewsRequest: () => void; | ||
151 | all: Recipe[]; | ||
152 | dev: Recipe[]; | ||
153 | searchResults: () => void; | ||
154 | } | ||
155 | |||
156 | interface RecipeStore extends TypedStore { | ||
157 | allRecipesRequest: () => void; | ||
158 | getRecipeUpdatesRequest: () => void; | ||
159 | installRecipeRequest: () => void; | ||
160 | isInstalled: (id: string) => boolean; | ||
161 | active: () => void; | ||
162 | all: Recipe[]; | ||
163 | one: (id: string) => Recipe; | ||
164 | recipeIdForServices: () => void; | ||
165 | _install({ recipeId: string }): Promise<Recipe>; | ||
166 | } | ||
167 | |||
168 | interface RequestsStore extends TypedStore { | ||
169 | localServerPort: () => void; | ||
170 | retries: number; | ||
171 | retryDelay: number; | ||
172 | servicesRequest: () => void; | ||
173 | showRequiredRequestsError: () => void; | ||
174 | userInfoRequest: () => void; | ||
175 | areRequiredRequestsLoading: () => void; | ||
176 | areRequiredRequestsSuccessful: () => void; | ||
177 | } | ||
178 | |||
179 | interface RouterStore { | ||
180 | go: () => void; | ||
181 | goBack: () => void; | ||
182 | goForward: () => void; | ||
183 | history: () => void; | ||
184 | location: { | ||
185 | pathname: string; | ||
186 | search: string; | ||
187 | action: string; | ||
188 | key: string; | ||
189 | state: any; | ||
190 | query: any; | ||
191 | hash?: string; | ||
192 | basename?: string; | ||
193 | }; | ||
194 | push(path: string): void; | ||
195 | replace: () => void; | ||
196 | } | ||
197 | |||
198 | export interface ServicesStore extends TypedStore { | ||
199 | clearCacheRequest: () => void; | ||
200 | createServiceRequest: CachedRequest; | ||
201 | deleteServiceRequest: () => void; | ||
202 | allServicesRequest: CachedRequest; | ||
203 | filterNeedle: string; | ||
204 | lastUsedServices: () => void; | ||
205 | reorderServicesRequest: () => void; | ||
206 | serviceMaintenanceTick: () => void; | ||
207 | updateServiceRequest: () => void; | ||
208 | active: () => void; | ||
209 | activeSettings: () => void; | ||
210 | all: Service[]; | ||
211 | allDisplayed: () => void; | ||
212 | allDisplayedUnordered: () => void; | ||
213 | enabled: () => void; | ||
214 | filtered: () => void; | ||
215 | isTodosServiceActive: () => void; | ||
216 | isTodosServiceAdded: () => void; | ||
217 | } | ||
218 | |||
219 | // TODO: Create actual type based on the default config in config.ts | ||
220 | interface ISettings { | ||
221 | [key: string]: any; | ||
222 | } | ||
223 | |||
224 | export interface SettingsStore extends TypedStore { | ||
225 | update: (value: any) => void; | ||
226 | remove: (value: any) => void; | ||
227 | fileSystemSettingsTypes: any[]; | ||
228 | loaded: boolean; | ||
229 | updateAppSettingsRequest: () => void; | ||
230 | _fileSystemSettingsCache: () => void; | ||
231 | all: ISettings; | ||
232 | app: AppStore; | ||
233 | migration: () => void; | ||
234 | proxy: () => void; | ||
235 | service: ServicesStore; | ||
236 | stats: () => void; | ||
237 | } | ||
238 | |||
239 | interface TodosStore extends TypedStore { | ||
240 | isFeatureActive: () => void; | ||
241 | isInitialized: true; | ||
242 | userAgentModel: () => void; | ||
243 | webview: () => void; | ||
244 | _allReactions: any[]; | ||
245 | _firstLaunchReaction: () => void; | ||
246 | _goToService: () => void; | ||
247 | _handleNewWindowEvent: () => void; | ||
248 | _onTodosClientInitialized: () => void; | ||
249 | _openDevTools: () => void; | ||
250 | _reload: () => void; | ||
251 | _routeCheckReaction: () => void; | ||
252 | _updateSettings: () => void; | ||
253 | _updateTodosConfig: () => void; | ||
254 | isFeatureEnabledByUser: () => void; | ||
255 | isTodoUrlValid: () => void; | ||
256 | isTodosPanelForceHidden: () => void; | ||
257 | isTodosEnabled: boolean; | ||
258 | isTodosPanelVisible: () => void; | ||
259 | isUsingPredefinedTodoServer: () => void; | ||
260 | settings: { | ||
261 | isFeatureEnabledByUser: boolean; | ||
262 | }; | ||
263 | todoRecipeId: () => void; | ||
264 | todoUrl: () => void; | ||
265 | userAgent: () => void; | ||
266 | width: () => void; | ||
267 | _handleClientMessage: () => void; | ||
268 | _handleHostMessage: () => void; | ||
269 | _resize: () => void; | ||
270 | _setTodosWebview: () => void; | ||
271 | _toggleTodosFeatureVisibility: () => void; | ||
272 | _toggleTodosPanel: () => void; | ||
273 | } | ||
274 | |||
275 | interface UIStore extends TypedStore { | ||
276 | isOsDarkThemeActive: () => void; | ||
277 | showServicesUpdatedInfoBar: boolean; | ||
278 | isDarkThemeActive: () => void; | ||
279 | isSplitModeActive: () => void; | ||
280 | splitColumnsNo: () => void; | ||
281 | showMessageBadgesEvenWhenMuted: boolean; | ||
282 | theme: () => void; | ||
283 | } | ||
284 | |||
285 | export interface UserStore extends TypedStore { | ||
286 | BASE_ROUTE: '/auth'; | ||
287 | CHANGE_SERVER_ROUTE: '/auth/server'; | ||
288 | IMPORT_ROUTE: '/auth/signup/import'; | ||
289 | INVITE_ROUTE: '/auth/signup/invite'; | ||
290 | LOGIN_ROUTE: '/auth/login'; | ||
291 | LOGOUT_ROUTE: '/auth/logout'; | ||
292 | PASSWORD_ROUTE: '/auth/password'; | ||
293 | SETUP_ROUTE: '/auth/signup/setup'; | ||
294 | SIGNUP_ROUTE: '/auth/signup'; | ||
295 | WELCOME_ROUTE: '/auth/welcome'; | ||
296 | accountType: () => void; | ||
297 | authToken: () => void; | ||
298 | deleteAccountRequest: () => void; | ||
299 | fetchUserInfoInterval: null; | ||
300 | getLegacyServicesRequest: () => void; | ||
301 | getUserInfoRequest: CachedRequest; | ||
302 | hasCompletedSignup: () => void; | ||
303 | id: () => void; | ||
304 | importLegacyServices: () => Promise<void>; | ||
305 | inviteRequest: () => void; | ||
306 | isImportLegacyServicesCompleted: boolean; | ||
307 | isImportLegacyServicesExecuting: boolean; | ||
308 | isLoggingOut: () => void; | ||
309 | loginRequest: () => void; | ||
310 | logoutReason: () => void; | ||
311 | logoutReasonTypes: { SERVER: 'SERVER' }; | ||
312 | passwordRequest: Request; | ||
313 | retrievePassword: Promise<void>; | ||
314 | signupRequest: () => void; | ||
315 | updateUserInfoRequest: () => void; | ||
316 | userData: () => void; | ||
317 | _requireAuthenticatedUser: () => void; | ||
318 | _importLegacyServices: () => void; | ||
319 | _retrievePassword: () => void; | ||
320 | changeServerRoute: () => void; | ||
321 | data: User; | ||
322 | importRoute: string; | ||
323 | inviteRoute: string; | ||
324 | isLoggedIn: boolean; | ||
325 | isTokenExpired: boolean; | ||
326 | legacyServices: () => void; | ||
327 | loginRoute: string; | ||
328 | logoutRoute: string; | ||
329 | passwordRoute: string; | ||
330 | setupRoute: string; | ||
331 | signupRoute: string; | ||
332 | team: () => void; | ||
333 | } | ||
334 | |||
335 | export interface WorkspacesStore extends TypedStore { | ||
336 | activeWorkspace: () => void; | ||
337 | delete: ({ workspace }) => void; | ||
338 | update: ({ workspace }) => void; | ||
339 | create: ({ workspace }) => void; | ||
340 | edit: ({ workspace }) => void; | ||
341 | saving: boolean; | ||
342 | filterServicesByActiveWorkspace: () => void; | ||
343 | isFeatureActive: () => void; | ||
344 | isAnyWorkspaceActive: boolean; | ||
345 | isSettingsRouteActive: () => void; | ||
346 | isSwitchingWorkspace: () => void; | ||
347 | isWorkspaceDrawerOpen: () => void; | ||
348 | nextWorkspace: () => void; | ||
349 | workspaces: Workspace[]; | ||
350 | workspaceBeingEdited: () => void; | ||
351 | reorderServicesOfActiveWorkspace: ({ | ||
352 | oldIndex, | ||
353 | newIndex, | ||
354 | }: { | ||
355 | oldIndex: string; | ||
356 | newIndex: string; | ||
357 | }) => void; | ||
358 | settings: any; | ||
359 | _activateLastUsedWorkspaceReaction: () => void; | ||
360 | _allActions: any[]; | ||
361 | _allReactions: any[]; | ||
362 | _cleanupInvalidServiceReferences: () => void; | ||
363 | _getWorkspaceById: () => void; | ||
364 | _openDrawerWithSettingsReaction: () => void; | ||
365 | _setActiveServiceOnWorkspaceSwitchReaction: () => void; | ||
366 | _setWorkspaceBeingEditedReaction: () => void; | ||
367 | _toggleKeepAllWorkspacesLoadedSetting: () => void; | ||
368 | _updateSettings: () => void; | ||
369 | _wasDrawerOpenBeforeSettingsRoute: null; | ||
370 | } | ||