diff options
author | 2022-06-22 00:32:18 +0200 | |
---|---|---|
committer | 2022-06-21 22:32:18 +0000 | |
commit | 73ba955e344c8ccedd43235495ef8b72b5a2b6fd (patch) | |
tree | 03766ab32fefe7e83026a14393527f1dcbaed849 /src/stores.types.ts | |
parent | docs: add cino as a contributor for infra [skip ci] (#330) (diff) | |
download | ferdium-app-73ba955e344c8ccedd43235495ef8b72b5a2b6fd.tar.gz ferdium-app-73ba955e344c8ccedd43235495ef8b72b5a2b6fd.tar.zst ferdium-app-73ba955e344c8ccedd43235495ef8b72b5a2b6fd.zip |
chore: Transform AppStore.js into Typescript (#329)
* turn actions into typescript
* correct tsconfig
* added TypedStore
Diffstat (limited to 'src/stores.types.ts')
-rw-r--r-- | src/stores.types.ts | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/stores.types.ts b/src/stores.types.ts index d09916653..14ae32133 100644 --- a/src/stores.types.ts +++ b/src/stores.types.ts | |||
@@ -1,3 +1,9 @@ | |||
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 { CachedRequest } from './stores/lib/CachedRequest'; | ||
6 | |||
1 | export interface FerdiumStores { | 7 | export interface FerdiumStores { |
2 | app: AppStore; | 8 | app: AppStore; |
3 | communityRecipes: CommunityRecipesStore; | 9 | communityRecipes: CommunityRecipesStore; |
@@ -15,7 +21,7 @@ export interface FerdiumStores { | |||
15 | workspaces: WorkspacesStore; | 21 | workspaces: WorkspacesStore; |
16 | } | 22 | } |
17 | 23 | ||
18 | interface Stores { | 24 | export interface Stores { |
19 | app: AppStore; | 25 | app: AppStore; |
20 | communityRecipes: CommunityRecipesStore; | 26 | communityRecipes: CommunityRecipesStore; |
21 | features: FeaturesStore; | 27 | features: FeaturesStore; |
@@ -62,9 +68,11 @@ interface AppStore { | |||
62 | api: Api; | 68 | api: Api; |
63 | authRequestFailed: () => void; | 69 | authRequestFailed: () => void; |
64 | autoLaunchOnStart: () => void; | 70 | autoLaunchOnStart: () => void; |
71 | automaticUpdates: boolean; | ||
65 | clearAppCacheRequest: () => void; | 72 | clearAppCacheRequest: () => void; |
66 | dictionaries: []; | 73 | dictionaries: []; |
67 | fetchDataInterval: 4; | 74 | fetchDataInterval: 4; |
75 | get(key: string): any; | ||
68 | getAppCacheSizeRequest: () => void; | 76 | getAppCacheSizeRequest: () => void; |
69 | healthCheckRequest: () => void; | 77 | healthCheckRequest: () => void; |
70 | isClearingAllCache: () => void; | 78 | isClearingAllCache: () => void; |
@@ -74,6 +82,8 @@ interface AppStore { | |||
74 | isSystemDarkModeEnabled: () => void; | 82 | isSystemDarkModeEnabled: () => void; |
75 | isSystemMuteOverridden: () => void; | 83 | isSystemMuteOverridden: () => void; |
76 | locale: () => void; | 84 | locale: () => void; |
85 | reloadAfterResume: boolean; | ||
86 | reloadAfterResumeTime: number; | ||
77 | stores: Stores; | 87 | stores: Stores; |
78 | timeOfflineStart: () => void; | 88 | timeOfflineStart: () => void; |
79 | timeSuspensionStart: () => void; | 89 | timeSuspensionStart: () => void; |
@@ -95,8 +105,8 @@ interface AppStore { | |||
95 | interface CommunityRecipesStore { | 105 | interface CommunityRecipesStore { |
96 | actions: Actions; | 106 | actions: Actions; |
97 | stores: Stores; | 107 | stores: Stores; |
98 | _actions: []; | 108 | _actions: any[]; |
99 | _reactions: []; | 109 | _reactions: any[]; |
100 | communityRecipes: () => void; | 110 | communityRecipes: () => void; |
101 | } | 111 | } |
102 | 112 | ||
@@ -105,7 +115,7 @@ interface FeaturesStore { | |||
105 | api: Api; | 115 | api: Api; |
106 | defaultFeaturesRequest: () => void; | 116 | defaultFeaturesRequest: () => void; |
107 | features: () => void; | 117 | features: () => void; |
108 | featuresRequest: () => void; | 118 | featuresRequest: CachedRequest; |
109 | stores: Stores; | 119 | stores: Stores; |
110 | _reactions: any[]; | 120 | _reactions: any[]; |
111 | _status: () => void; | 121 | _status: () => void; |
@@ -136,8 +146,8 @@ interface RecipePreviewsStore { | |||
136 | _reactions: []; | 146 | _reactions: []; |
137 | _status: () => void; | 147 | _status: () => void; |
138 | actionStatus: () => void; | 148 | actionStatus: () => void; |
139 | all: () => void; | 149 | all: Recipe[]; |
140 | dev: () => void; | 150 | dev: Recipe[]; |
141 | searchResults: () => void; | 151 | searchResults: () => void; |
142 | } | 152 | } |
143 | 153 | ||
@@ -152,7 +162,7 @@ interface RecipeStore { | |||
152 | _status: () => void; | 162 | _status: () => void; |
153 | actionStatus: () => void; | 163 | actionStatus: () => void; |
154 | active: () => void; | 164 | active: () => void; |
155 | all: () => void; | 165 | all: Recipe[]; |
156 | recipeIdForServices: () => void; | 166 | recipeIdForServices: () => void; |
157 | } | 167 | } |
158 | 168 | ||
@@ -179,7 +189,7 @@ interface RouterStore { | |||
179 | goForward: () => void; | 189 | goForward: () => void; |
180 | history: () => void; | 190 | history: () => void; |
181 | location: () => void; | 191 | location: () => void; |
182 | push: () => void; | 192 | push(path: string): void; |
183 | replace: () => void; | 193 | replace: () => void; |
184 | } | 194 | } |
185 | 195 | ||
@@ -200,7 +210,7 @@ export interface ServicesStore { | |||
200 | actionStatus: () => void; | 210 | actionStatus: () => void; |
201 | active: () => void; | 211 | active: () => void; |
202 | activeSettings: () => void; | 212 | activeSettings: () => void; |
203 | all: () => void; | 213 | all: Service[]; |
204 | allDisplayed: () => void; | 214 | allDisplayed: () => void; |
205 | allDisplayedUnordered: () => void; | 215 | allDisplayedUnordered: () => void; |
206 | enabled: () => void; | 216 | enabled: () => void; |
@@ -209,6 +219,11 @@ export interface ServicesStore { | |||
209 | isTodosServiceAdded: () => void; | 219 | isTodosServiceAdded: () => void; |
210 | } | 220 | } |
211 | 221 | ||
222 | // TODO: Create actual type based on the default config in config.ts | ||
223 | interface ISettings { | ||
224 | [key: string]: any; | ||
225 | } | ||
226 | |||
212 | interface SettingsStore { | 227 | interface SettingsStore { |
213 | actions: Actions; | 228 | actions: Actions; |
214 | api: Api; | 229 | api: Api; |
@@ -220,7 +235,7 @@ interface SettingsStore { | |||
220 | _reactions: []; | 235 | _reactions: []; |
221 | _status: () => void; | 236 | _status: () => void; |
222 | actionStatus: () => void; | 237 | actionStatus: () => void; |
223 | all: () => void; | 238 | all: ISettings; |
224 | app: AppStore; | 239 | app: AppStore; |
225 | migration: () => void; | 240 | migration: () => void; |
226 | proxy: () => void; | 241 | proxy: () => void; |
@@ -301,7 +316,7 @@ interface UserStore { | |||
301 | deleteAccountRequest: () => void; | 316 | deleteAccountRequest: () => void; |
302 | fetchUserInfoInterval: null; | 317 | fetchUserInfoInterval: null; |
303 | getLegacyServicesRequest: () => void; | 318 | getLegacyServicesRequest: () => void; |
304 | getUserInfoRequest: () => void; | 319 | getUserInfoRequest: CachedRequest; |
305 | hasCompletedSignup: () => void; | 320 | hasCompletedSignup: () => void; |
306 | id: () => void; | 321 | id: () => void; |
307 | inviteRequest: () => void; | 322 | inviteRequest: () => void; |
@@ -320,11 +335,11 @@ interface UserStore { | |||
320 | _requireAuthenticatedUser: () => void; | 335 | _requireAuthenticatedUser: () => void; |
321 | _status: () => void; | 336 | _status: () => void; |
322 | changeServerRoute: () => void; | 337 | changeServerRoute: () => void; |
323 | data: () => void; | 338 | data: User; |
324 | importRoute: () => void; | 339 | importRoute: () => void; |
325 | inviteRoute: () => void; | 340 | inviteRoute: () => void; |
326 | isLoggedIn: () => void; | 341 | isLoggedIn: boolean; |
327 | isTokenExpired: () => void; | 342 | isTokenExpired: () => boolean; |
328 | legacyServices: () => void; | 343 | legacyServices: () => void; |
329 | loginRoute: () => void; | 344 | loginRoute: () => void; |
330 | logoutRoute: () => void; | 345 | logoutRoute: () => void; |
@@ -348,6 +363,7 @@ export interface WorkspacesStore { | |||
348 | isWorkspaceDrawerOpen: () => void; | 363 | isWorkspaceDrawerOpen: () => void; |
349 | nextWorkspace: () => void; | 364 | nextWorkspace: () => void; |
350 | stores: Stores; | 365 | stores: Stores; |
366 | workspaces: Workspace[]; | ||
351 | workspaceBeingEdited: () => void; | 367 | workspaceBeingEdited: () => void; |
352 | _actions: any[]; | 368 | _actions: any[]; |
353 | _activateLastUsedWorkspaceReaction: () => void; | 369 | _activateLastUsedWorkspaceReaction: () => void; |