forked from tutao/tutanota
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
150 lines (140 loc) · 3.54 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
* File for global declarations which are used *in the app* (not in packages).
*
* Hey you! Don't import anything in this file, or all these declarations will cease to be global!
*/
declare type NumberString = string
declare type Dict = {[key: string]: string}
/** Requests from main web thread to worker */
declare type WorkerRequestType =
| 'setup'
| 'reset'
| 'testEcho'
| 'testError'
| 'restRequest'
| 'entropy'
| 'tryReconnectEventBus'
| 'closeEventBus'
| 'getLog'
| 'urlify'
| 'generateSsePushIdentifer'
| 'facade'
/** Requests from worker web thread to main web thread */
declare type MainRequestType =
| 'facade'
| 'execNative'
| 'entityEvent'
| 'error'
| 'progress'
| 'updateIndexState'
| 'updateWebSocketState'
| 'counterUpdate'
| 'updateLeaderStatus'
| 'infoMessage'
| 'createProgressMonitor'
| 'progressWorkDone'
| 'writeIndexerDebugLog'
/** Requests from web to native */
declare type NativeRequestType = 'init'
| 'generateRsaKey'
| 'rsaEncrypt'
| 'rsaDecrypt'
| 'aesEncryptFile'
| 'aesDecryptFile'
| 'open'
| 'openFileChooser'
| 'deleteFile'
| 'getName'
| 'getMimeType'
| 'getSize'
| 'upload'
| 'download'
| 'clearFileData'
| 'findSuggestions'
| 'initPushNotifications'
| 'openLink'
| 'shareText'
| 'reload'
| 'getPushIdentifier'
| 'storePushIdentifierLocally'
| 'closePushNotifications'
| 'readDataFile'
| 'saveDataFile'
| 'putFileIntoDownloads'
| 'findInPage'
| 'stopFindInPage'
| 'registerMailto'
| 'unregisterMailto'
| 'openNewWindow'
| 'setConfigValue'
| 'enableAutoLaunch'
| 'disableAutoLaunch'
| 'sendSocketMessage'
| 'getDeviceLog' // for mobile apps
| 'getLog' // for desktop
| 'integrateDesktop'
| 'unIntegrateDesktop'
| 'setSearchOverlayState'
| 'changeLanguage'
| 'isUpdateAvailable' // check if update is ready to install
| 'manualUpdate' // progress update process (check, dl, install)
| 'startNativeDrag'
| 'mailToMsg'
| 'focusApplicationWindow'
| 'saveToExportDir'
| 'checkFileExistsInExportDirectory'
| 'scheduleAlarms'
| 'getConfigValue'
| 'getIntegrationInfo'
| 'getSpellcheckLanguages'
| 'getSelectedTheme'
| 'setSelectedTheme'
| 'getThemes'
| 'setThemes'
| 'encryptUsingKeychain'
| 'decryptUsingKeychain'
| 'getSupportedEncryptionModes'
| 'hashFile'
| 'facade' // only for desktop
| 'joinFiles'
| 'splitFile'
/** Requests from native to web */
declare type JsRequestType =
| 'facade' // only for desktop
| 'createMailEditor'
| 'handleBackPress'
| 'showAlertDialog'
| 'openMailbox'
| 'keyboardSizeChanged'
| 'print'
| 'openFindInPage'
| 'reportError'
| 'openCalendar'
| 'visibilityChange'
| 'invalidateAlarms'
| 'applySearchResultToOverlay'
| 'addShortcuts'
| 'appUpdateDownloaded'
| 'openCustomer' // only for admin clients
| 'updateTargetUrl'
| 'showSpellcheckDropdown'
// see https://bitwiseshiftleft.github.io/sjcl/doc/symbols/sjcl.bitArray.html
// type that is used by sjcl for any encryption/decryption operation
// TODO these should be exported by tutanota-crypto
declare type BitArray = number[]
declare type Aes128Key = BitArray
declare type Aes256Key = BitArray
declare type SignedBytes = number[]
declare type Base32 = string
declare type EnvMode = "Browser" | "App" | "Test" | "Playground" | "Desktop" | "Admin"
declare type PlatformId = "ios" | "android" | "darwin" | "linux" | "win32"
declare var env: {
staticUrl?: string, // if null the url from the browser is used
mode: EnvMode,
platformId: PlatformId | null,
dist: boolean,
versionNumber: string,
timeout: number,
systemConfig: any,
}
type EventRedraw<T extends Event> = T & {redraw?: boolean}