@openfin/core 25.68.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/LICENSE +13 -0
  2. package/NOTICE +16 -0
  3. package/OpenFin.d.ts +1340 -0
  4. package/README.md +41 -0
  5. package/docs.README(OLD).md +82 -0
  6. package/fin.d.ts +4 -0
  7. package/package.json +33 -0
  8. package/resources/win/OpenFinRVM.exe +0 -0
  9. package/src/api/application/Factory.d.ts +145 -0
  10. package/src/api/application/Factory.js +229 -0
  11. package/src/api/application/Instance.d.ts +302 -0
  12. package/src/api/application/Instance.js +412 -0
  13. package/src/api/application/index.d.ts +3 -0
  14. package/src/api/application/index.js +15 -0
  15. package/src/api/base.d.ts +43 -0
  16. package/src/api/base.js +177 -0
  17. package/src/api/clipboard/index.d.ts +69 -0
  18. package/src/api/clipboard/index.js +88 -0
  19. package/src/api/events/application.d.ts +69 -0
  20. package/src/api/events/application.js +2 -0
  21. package/src/api/events/base.d.ts +17 -0
  22. package/src/api/events/base.js +2 -0
  23. package/src/api/events/channel.d.ts +10 -0
  24. package/src/api/events/channel.js +2 -0
  25. package/src/api/events/emitterMap.d.ts +11 -0
  26. package/src/api/events/emitterMap.js +35 -0
  27. package/src/api/events/eventAggregator.d.ts +5 -0
  28. package/src/api/events/eventAggregator.js +43 -0
  29. package/src/api/events/externalApplication.d.ts +5 -0
  30. package/src/api/events/externalApplication.js +2 -0
  31. package/src/api/events/frame.d.ts +9 -0
  32. package/src/api/events/frame.js +2 -0
  33. package/src/api/events/globalHotkey.d.ts +10 -0
  34. package/src/api/events/globalHotkey.js +2 -0
  35. package/src/api/events/platform.d.ts +18 -0
  36. package/src/api/events/platform.js +2 -0
  37. package/src/api/events/system.d.ts +22 -0
  38. package/src/api/events/system.js +2 -0
  39. package/src/api/events/view.d.ts +56 -0
  40. package/src/api/events/view.js +2 -0
  41. package/src/api/events/webcontents.d.ts +48 -0
  42. package/src/api/events/webcontents.js +2 -0
  43. package/src/api/events/window.d.ts +169 -0
  44. package/src/api/events/window.js +2 -0
  45. package/src/api/external-application/Factory.d.ts +26 -0
  46. package/src/api/external-application/Factory.js +40 -0
  47. package/src/api/external-application/Instance.d.ts +102 -0
  48. package/src/api/external-application/Instance.js +109 -0
  49. package/src/api/external-application/index.d.ts +3 -0
  50. package/src/api/external-application/index.js +15 -0
  51. package/src/api/fin.d.ts +49 -0
  52. package/src/api/fin.js +43 -0
  53. package/src/api/frame/Factory.d.ts +36 -0
  54. package/src/api/frame/Factory.js +69 -0
  55. package/src/api/frame/Instance.d.ts +121 -0
  56. package/src/api/frame/Instance.js +130 -0
  57. package/src/api/frame/index.d.ts +3 -0
  58. package/src/api/frame/index.js +15 -0
  59. package/src/api/global-hotkey/index.d.ts +38 -0
  60. package/src/api/global-hotkey/index.js +58 -0
  61. package/src/api/interappbus/channel/channel.d.ts +26 -0
  62. package/src/api/interappbus/channel/channel.js +77 -0
  63. package/src/api/interappbus/channel/channels-docs.d.ts +318 -0
  64. package/src/api/interappbus/channel/channels-docs.js +376 -0
  65. package/src/api/interappbus/channel/client.d.ts +22 -0
  66. package/src/api/interappbus/channel/client.js +84 -0
  67. package/src/api/interappbus/channel/connection-manager.d.ts +28 -0
  68. package/src/api/interappbus/channel/connection-manager.js +244 -0
  69. package/src/api/interappbus/channel/index.d.ts +22 -0
  70. package/src/api/interappbus/channel/index.js +121 -0
  71. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -0
  72. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -0
  73. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -0
  74. package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -0
  75. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -0
  76. package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -0
  77. package/src/api/interappbus/channel/protocols/index.d.ts +44 -0
  78. package/src/api/interappbus/channel/protocols/index.js +2 -0
  79. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -0
  80. package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -0
  81. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -0
  82. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -0
  83. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -0
  84. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -0
  85. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -0
  86. package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -0
  87. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -0
  88. package/src/api/interappbus/channel/protocols/strategy-types.js +2 -0
  89. package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -0
  90. package/src/api/interappbus/channel/protocols/strategy.js +2 -0
  91. package/src/api/interappbus/channel/provider.d.ts +31 -0
  92. package/src/api/interappbus/channel/provider.js +165 -0
  93. package/src/api/interappbus/index.d.ts +85 -0
  94. package/src/api/interappbus/index.js +175 -0
  95. package/src/api/interop/Factory.d.ts +37 -0
  96. package/src/api/interop/Factory.js +54 -0
  97. package/src/api/interop/InteropBroker.d.ts +363 -0
  98. package/src/api/interop/InteropBroker.js +914 -0
  99. package/src/api/interop/InteropClient.d.ts +268 -0
  100. package/src/api/interop/InteropClient.js +450 -0
  101. package/src/api/interop/SessionContextGroupBroker.d.ts +26 -0
  102. package/src/api/interop/SessionContextGroupBroker.js +107 -0
  103. package/src/api/interop/SessionContextGroupClient.d.ts +20 -0
  104. package/src/api/interop/SessionContextGroupClient.js +85 -0
  105. package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -0
  106. package/src/api/interop/fdc3/fdc3-1.2.js +385 -0
  107. package/src/api/interop/fdc3/fdc3.js +17 -0
  108. package/src/api/interop/fdc3/utils.d.ts +6 -0
  109. package/src/api/interop/fdc3/utils.js +17 -0
  110. package/src/api/interop/index.d.ts +4 -0
  111. package/src/api/interop/index.js +16 -0
  112. package/src/api/interop/utils.d.ts +11 -0
  113. package/src/api/interop/utils.js +36 -0
  114. package/src/api/me.d.ts +35 -0
  115. package/src/api/me.js +60 -0
  116. package/src/api/platform/Factory.d.ts +109 -0
  117. package/src/api/platform/Factory.js +188 -0
  118. package/src/api/platform/Instance.d.ts +122 -0
  119. package/src/api/platform/Instance.js +299 -0
  120. package/src/api/platform/common-utils.d.ts +6 -0
  121. package/src/api/platform/common-utils.js +16 -0
  122. package/src/api/platform/index.d.ts +3 -0
  123. package/src/api/platform/index.js +15 -0
  124. package/src/api/platform/layout/Factory.d.ts +108 -0
  125. package/src/api/platform/layout/Factory.js +189 -0
  126. package/src/api/platform/layout/Instance.d.ts +48 -0
  127. package/src/api/platform/layout/Instance.js +99 -0
  128. package/src/api/platform/layout/index.d.ts +3 -0
  129. package/src/api/platform/layout/index.js +15 -0
  130. package/src/api/platform/layout/shapes.d.ts +11 -0
  131. package/src/api/platform/layout/shapes.js +2 -0
  132. package/src/api/snapshot-source/Factory.d.ts +36 -0
  133. package/src/api/snapshot-source/Factory.js +65 -0
  134. package/src/api/snapshot-source/Instance.d.ts +30 -0
  135. package/src/api/snapshot-source/Instance.js +134 -0
  136. package/src/api/snapshot-source/index.d.ts +3 -0
  137. package/src/api/snapshot-source/index.js +15 -0
  138. package/src/api/snapshot-source/utils.d.ts +1 -0
  139. package/src/api/snapshot-source/utils.js +5 -0
  140. package/src/api/system/application.d.ts +6 -0
  141. package/src/api/system/application.js +2 -0
  142. package/src/api/system/entity.d.ts +11 -0
  143. package/src/api/system/entity.js +2 -0
  144. package/src/api/system/index.d.ts +957 -0
  145. package/src/api/system/index.js +1241 -0
  146. package/src/api/system/installedApps.d.ts +6 -0
  147. package/src/api/system/installedApps.js +2 -0
  148. package/src/api/system/log.d.ts +11 -0
  149. package/src/api/system/log.js +2 -0
  150. package/src/api/system/process.d.ts +15 -0
  151. package/src/api/system/process.js +2 -0
  152. package/src/api/system/proxy.d.ts +15 -0
  153. package/src/api/system/proxy.js +2 -0
  154. package/src/api/system/queryPermissionTypes.d.ts +1 -0
  155. package/src/api/system/queryPermissionTypes.js +2 -0
  156. package/src/api/system/registry-info.d.ts +7 -0
  157. package/src/api/system/registry-info.js +2 -0
  158. package/src/api/system/window.d.ts +16 -0
  159. package/src/api/system/window.js +2 -0
  160. package/src/api/view/Factory.d.ts +49 -0
  161. package/src/api/view/Factory.js +103 -0
  162. package/src/api/view/Instance.d.ts +379 -0
  163. package/src/api/view/Instance.js +415 -0
  164. package/src/api/view/index.d.ts +3 -0
  165. package/src/api/view/index.js +15 -0
  166. package/src/api/webcontents/main.d.ts +36 -0
  167. package/src/api/webcontents/main.js +82 -0
  168. package/src/api/window/Factory.d.ts +44 -0
  169. package/src/api/window/Factory.js +91 -0
  170. package/src/api/window/Instance.d.ts +966 -0
  171. package/src/api/window/Instance.js +1202 -0
  172. package/src/api/window/bounds-changed.d.ts +10 -0
  173. package/src/api/window/bounds-changed.js +6 -0
  174. package/src/api/window/index.d.ts +5 -0
  175. package/src/api/window/index.js +17 -0
  176. package/src/api/window/shapes.d.ts +13 -0
  177. package/src/api/window/shapes.js +2 -0
  178. package/src/environment/environment.d.ts +28 -0
  179. package/src/environment/environment.js +4 -0
  180. package/src/environment/node-env.d.ts +25 -0
  181. package/src/environment/node-env.js +64 -0
  182. package/src/environment/openfin-env.d.ts +29 -0
  183. package/src/environment/openfin-env.js +105 -0
  184. package/src/mock.d.ts +4 -0
  185. package/src/mock.js +91 -0
  186. package/src/shapes/ERROR_BOX_TYPES.d.ts +6 -0
  187. package/src/shapes/ERROR_BOX_TYPES.js +10 -0
  188. package/src/shapes/EntityType.d.ts +1 -0
  189. package/src/shapes/EntityType.js +2 -0
  190. package/src/shapes/LayoutPresetType.d.ts +1 -0
  191. package/src/shapes/LayoutPresetType.js +2 -0
  192. package/src/shapes/Platform.d.ts +112 -0
  193. package/src/shapes/Platform.js +16 -0
  194. package/src/shapes/WebOptions.d.ts +12 -0
  195. package/src/shapes/WebOptions.js +2 -0
  196. package/src/shapes/WindowOptions.d.ts +42 -0
  197. package/src/shapes/WindowOptions.js +2 -0
  198. package/src/shapes/protocol.d.ts +178 -0
  199. package/src/shapes/protocol.js +2 -0
  200. package/src/transport/fin_store.d.ts +4 -0
  201. package/src/transport/fin_store.js +16 -0
  202. package/src/transport/transport-errors.d.ts +17 -0
  203. package/src/transport/transport-errors.js +39 -0
  204. package/src/transport/transport.d.ts +57 -0
  205. package/src/transport/transport.js +195 -0
  206. package/src/transport/wire.d.ts +76 -0
  207. package/src/transport/wire.js +39 -0
  208. package/src/util/asyncFilter.d.ts +1 -0
  209. package/src/util/asyncFilter.js +7 -0
  210. package/src/util/errors.d.ts +9 -0
  211. package/src/util/errors.js +14 -0
  212. package/src/util/exhaustive.d.ts +1 -0
  213. package/src/util/exhaustive.js +7 -0
  214. package/src/util/http.d.ts +11 -0
  215. package/src/util/http.js +83 -0
  216. package/src/util/normalize-config.d.ts +3 -0
  217. package/src/util/normalize-config.js +47 -0
  218. package/src/util/promises.d.ts +5 -0
  219. package/src/util/promises.js +27 -0
  220. package/src/util/ref-counter.d.ts +7 -0
  221. package/src/util/ref-counter.js +51 -0
  222. package/src/util/runtimeVersioning.d.ts +3 -0
  223. package/src/util/runtimeVersioning.js +25 -0
  224. package/src/util/utilTypes.d.ts +8 -0
  225. package/src/util/utilTypes.js +2 -0
  226. package/src/util/validate.d.ts +3 -0
  227. package/src/util/validate.js +11 -0
@@ -0,0 +1,1241 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const base_1 = require("../base");
4
+ const transport_errors_1 = require("../../transport/transport-errors");
5
+ const window_1 = require("../window");
6
+ /**
7
+ * AppAssetInfo interface
8
+ * @typedef { object } AppAssetInfo
9
+ * @property { string } src The URL to a zip file containing the package files (executables, dlls, etc…)
10
+ * @property { string } alias The name of the asset
11
+ * @property { string } version The version of the package
12
+ * @property { string } target Specify default executable to launch. This option can be overridden in launchExternalProcess
13
+ * @property { string } args The default command line arguments for the aforementioned target.
14
+ * @property { boolean } mandatory When set to true, the app will fail to load if the asset cannot be downloaded.
15
+ * When set to false, the app will continue to load if the asset cannot be downloaded. (Default: true)
16
+ */
17
+ /**
18
+ * AppAssetRequest interface
19
+ * @typedef { object } AppAssetRequest
20
+ * @property { string } alias The name of the asset
21
+ */
22
+ /**
23
+ * ApplicationInfo interface
24
+ * @typedef { object } ApplicationInfo
25
+ * @property { boolean } isPlatform true when the application is a Platform controller
26
+ * @property { boolean } isRunning true when the application is running
27
+ * @property { string } uuid uuid of the application
28
+ * @property { string } parentUuid uuid of the application that launches this application
29
+ */
30
+ /**
31
+ * @typedef { object } ClearCacheOption
32
+ * @summary Clear cache options.
33
+ * @desc These are the options required by the clearCache function.
34
+ *
35
+ * @property {boolean} appcache html5 application cache
36
+ * @property {boolean} cache browser data cache for html files and images
37
+ * @property {boolean} cookies browser cookies
38
+ * @property {boolean} localStorage browser data that can be used across sessions
39
+ */
40
+ /**
41
+ * CookieInfo interface
42
+ * @typedef { object } CookieInfo
43
+ * @property { string } name The name of the cookie
44
+ * @property { string } domain The domain of the cookie
45
+ * @property { string } path The path of the cookie
46
+ */
47
+ /**
48
+ * CookieOption interface
49
+ * @typedef { object } CookieOption
50
+ * @property { string } name The name of the cookie
51
+ */
52
+ /**
53
+ * CpuInfo interface
54
+ * @typedef { object } CpuInfo
55
+ * @property { string } model The model of the cpu
56
+ * @property { number } speed The number in MHz
57
+ * @property { Time } times The numbers of milliseconds the CPU has spent in different modes.
58
+ */
59
+ /**
60
+ * CrashReporterState interface
61
+ * @typedef { object } CrashReporterState
62
+ * @property { boolean } diagnosticsMode In diagnostics mode the crash reporter will send diagnostic logs to
63
+ * the OpenFin reporting service on runtime shutdown
64
+ * @property { boolean } isRunning check if it's running
65
+ */
66
+ /**
67
+ * CrashReporterOptions interface
68
+ * @typedef { object } CrashReporterOptions
69
+ * @property { boolean } diagnosticsMode In diagnostics mode the crash reporter will send diagnostic logs to
70
+ * the OpenFin reporting service on runtime shutdown
71
+ */
72
+ /**
73
+ * DipRect interface
74
+ * @typedef { object } DipRect
75
+ * @property { Rect } dipRect The DIP coordinates
76
+ * @property { Rect } scaledRect The scale coordinates
77
+ */
78
+ /**
79
+ * DipScaleRects interface
80
+ * @typedef { object } DipScaleRects
81
+ * @property { Rect } dipRect The DIP coordinates
82
+ * @property { Rect } scaledRect The scale coordinates
83
+ */
84
+ /**
85
+ * DownloadPreloadInfo interface
86
+ * @typedef { object } DownloadPreloadInfo
87
+ * @desc downloadPreloadScripts function return value
88
+ * @property { string } url url to the preload script
89
+ * @property { string } error error during preload script acquisition
90
+ * @property { boolean } succeess download operation success
91
+ */
92
+ /**
93
+ * DownloadPreloadOption interface
94
+ * @typedef { object } DownloadPreloadOption
95
+ * @desc These are the options object required by the downloadPreloadScripts function
96
+ * @property { string } url url to the preload script
97
+ */
98
+ /**
99
+ * Entity interface
100
+ * @typedef { object } Entity
101
+ * @property { string } type The type of the entity
102
+ * @property { string } uuid The uuid of the entity
103
+ */
104
+ /**
105
+ * EntityInfo interface
106
+ * @typedef { object } EntityInfo
107
+ * @property { string } name The name of the entity
108
+ * @property { string } uuid The uuid of the entity
109
+ * @property { Identity } parent The parent of the entity
110
+ * @property { string } entityType The type of the entity
111
+ */
112
+ /**
113
+ * ExternalApplicationInfo interface
114
+ * @typedef { object } ExternalApplicationInfo
115
+ * @property { Identity } parent The parent identity
116
+ */
117
+ /**
118
+ * ExternalConnection interface
119
+ * @typedef { object } ExternalConnection
120
+ * @property { string } token The token to broker an external connection
121
+ * @property { string } uuid The uuid of the external connection
122
+ */
123
+ /**
124
+ * ExternalProcessRequestType interface
125
+ * @typedef { object } ExternalProcessRequestType
126
+ * @property { string } path The file path to where the running application resides
127
+ * @property { string } arguments The argument passed to the running application
128
+ * @property { LaunchExternalProcessListener } listener This is described in the {LaunchExternalProcessListner} type definition
129
+ * @property { string } initialWindowState Initial window state after launching: 'normal' (default), 'minimized', 'maximized'
130
+ * @property { string } cwd current working directory
131
+ */
132
+ /**
133
+ * FrameInfo interface
134
+ * @typedef { object } FrameInfo
135
+ * @property { string } name The name of the frame
136
+ * @property { string } uuid The uuid of the frame
137
+ * @property { EntityType } entityType The entity type, could be 'window', 'iframe', 'external connection' or 'unknown'
138
+ * @property { Identity } parent The parent identity
139
+ */
140
+ /**
141
+ * GetLogRequestType interface
142
+ * @typedef { object } GetLogRequestType
143
+ * @property { string } name The name of the running application
144
+ * @property { number } endFile The file length of the log file
145
+ * @property { number } sizeLimit The set size limit of the log file
146
+ */
147
+ /**
148
+ * GpuInfo interface
149
+ * @typedef { object } GpuInfo
150
+ * @property { string } name The graphics card name
151
+ */
152
+ /**
153
+ * HostSpecs interface
154
+ * @typedef { object } HostSpecs
155
+ * @property { boolean } aeroGlassEnabled Value to check if Aero Glass theme is supported on Windows platforms
156
+ * @property { string } arch "x86" for 32-bit or "x86_64" for 64-bit
157
+ * @property { Array<CpuInfo> } cpus The same payload as Node's os.cpus()
158
+ * @property { GpuInfo } gpu The graphics card name
159
+ * @property { number } memory The same payload as Node's os.totalmem()
160
+ * @property { string } name The OS name and version/edition
161
+ * @property { boolean } screenSaver Value to check if screensaver is running. Supported on Windows only
162
+ */
163
+ /**
164
+ * Identity interface
165
+ * @typedef { object } Identity
166
+ * @property { string } name Optional - the name of the component
167
+ * @property { string } uuid Universally unique identifier of the application
168
+ */
169
+ /**
170
+ * LogInfo interface
171
+ * @typedef { object } LogInfo
172
+ * @property { string } name The filename of the log
173
+ * @property { number } size The size of the log in bytes
174
+ * @property { string } date The unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)"
175
+ */
176
+ /**
177
+ * ManifestInfo interface
178
+ * @typedef { object } ManifestInfo
179
+ * @property { string } uuid The uuid of the application
180
+ * @property { string } manifestUrl The runtime manifest URL
181
+ */
182
+ /**
183
+ * MonitorDetails interface
184
+ * @typedef { object } MonitorDetails
185
+ * @property { DipScaleRects } available The available DIP scale coordinates
186
+ * @property { Rect } availableRect The available monitor coordinates
187
+ * @property { string } deviceId The device id of the display
188
+ * @property { boolean } displayDeviceActive true if the display is active
189
+ * @property { number } deviceScaleFactor The device scale factor
190
+ * @property { Rect } monitorRect The monitor coordinates
191
+ * @property { string } name The name of the display
192
+ * @property { Point } dpi The dots per inch
193
+ * @property { DipScaleRects } monitor The monitor coordinates
194
+ */
195
+ /**
196
+ * MonitorInfo interface
197
+ * @typedef { object } MonitorInfo
198
+ * @property { number } deviceScaleFactor The device scale factor
199
+ * @property { Point } dpi The dots per inch
200
+ * @property { Array<MonitorDetails> } nonPrimaryMonitors The array of monitor details
201
+ * @property { MonitorDetails } primaryMonitor The monitor details
202
+ * @property { string } reason always "api-query"
203
+ * @property { TaskBar } taskBar The taskbar on monitor
204
+ * @property { DipRect } virtualScreen The virtual display screen coordinates
205
+ */
206
+ /**
207
+ * @typedef { verbose | info | warning | error | fatal } LogLevel
208
+ * @summary Log verbosity levels.
209
+ * @desc Describes the minimum level (inclusive) above which logs will be written
210
+ *
211
+ * @property { string } verbose all logs written
212
+ * @property { string } info info and above
213
+ * @property { string } warning warning and above
214
+ * @property { string } error error and above
215
+ * @property { string } fatal fatal only, indicates a crash is imminent
216
+ */
217
+ /**
218
+ * PointTopLeft interface
219
+ * @typedef { object } PointTopLeft
220
+ * @property { number } top The mouse top position in virtual screen coordinates
221
+ * @property { number } left The mouse left position in virtual screen coordinates
222
+ */
223
+ /**
224
+ * Point interface
225
+ * @typedef { object } Point
226
+ * @property { number } x The mouse x position
227
+ * @property { number } y The mouse y position
228
+ */
229
+ /**
230
+ * ProcessInfo interface
231
+ * @typedef { object } ProcessInfo
232
+ * @property { number } cpuUsage The percentage of total CPU usage
233
+ * @property { string } name The application name
234
+ * @property { number } nonPagedPoolUsage The current nonpaged pool usage in bytes
235
+ * @property { number } pageFaultCount The number of page faults
236
+ * @property { number } pagedPoolUsage The current paged pool usage in bytes
237
+ * @property { number } pagefileUsage The total amount of memory in bytes that the memory manager has committed
238
+ * @property { number } peakNonPagedPoolUsage The peak nonpaged pool usage in bytes
239
+ * @property { number } peakPagedPoolUsage The peak paged pool usage in bytes
240
+ * @property { number } peakPagefileUsage The peak value in bytes of pagefileUsage during the lifetime of this process
241
+ * @property { number } peakWorkingSetSize The peak working set size in bytes
242
+ * @property { number } processId The native process identifier
243
+ * @property { string } uuid The application UUID
244
+ * @property { number } workingSetSize The current working set size (both shared and private data) in bytes
245
+ */
246
+ /**
247
+ * SystemProcessInfo interface
248
+ * @typedef { object } SystemProcessInfo
249
+ * @property { ProcessDetails } browserProcess Info on browser process
250
+ * @property { Array<AppProcessInfo> } apps Array of apps and their process info
251
+ */
252
+ /**
253
+ * AppProcessInfo interface
254
+ * @typedef { object } AppProcessInfo
255
+ * @property { string } uuid The uuid of the application
256
+ * @property { Array<EntityProcessDetails> } entities Array of process info for each window and view for the application
257
+ */
258
+ /**
259
+ * EntityProcessDetails interface
260
+ * @typedef { object } EntityProcessDetails
261
+ * @property { string } uuid The uuid for the entity
262
+ * @property { string } name The name for the entity
263
+ * @property { string } url URL associated with the entity
264
+ * @property { string } entityType Type for the entity: window or view
265
+ * @property { number } cpuUsage The percentage of total CPU usage
266
+ * @property { number } nonPagedPoolUsage The current nonpaged pool usage in bytes
267
+ * @property { number } pageFaultCount The number of page faults
268
+ * @property { number } pagedPoolUsage The current paged pool usage in bytes
269
+ * @property { number } pagefileUsage The total amount of memory in bytes that the memory manager has committed
270
+ * @property { number } peakNonPagedPoolUsage The peak nonpaged pool usage in bytes
271
+ * @property { number } peakPagedPoolUsage The peak paged pool usage in bytes
272
+ * @property { number } peakPagefileUsage The peak value in bytes of pagefileUsage during the lifetime of this process
273
+ * @property { number } peakWorkingSetSize The peak working set size in bytes
274
+ * @property { number } privateSetSize The current working set size (not shared)
275
+ * @property { number } workingSetSize The current working set size (both shared and private data) in bytes
276
+ * @property { number } pid The native process identifier
277
+ * @property { Array<FrameProcessDetails> } frames Array of process info for each iframe corresponeding to the entity
278
+ */
279
+ /**
280
+ * FrameProcessDetails interface
281
+ * @typedef { object } FrameProcessDetails
282
+ * @property { string } url Current URL associated with the process
283
+ * @property { string } entityType Type for the frame
284
+ * @property { number } cpuUsage The percentage of total CPU usage
285
+ * @property { number } nonPagedPoolUsage The current nonpaged pool usage in bytes
286
+ * @property { number } pageFaultCount The number of page faults
287
+ * @property { number } pagedPoolUsage The current paged pool usage in bytes
288
+ * @property { number } pagefileUsage The total amount of memory in bytes that the memory manager has committed
289
+ * @property { number } peakNonPagedPoolUsage The peak nonpaged pool usage in bytes
290
+ * @property { number } peakPagedPoolUsage The peak paged pool usage in bytes
291
+ * @property { number } peakPagefileUsage The peak value in bytes of pagefileUsage during the lifetime of this process
292
+ * @property { number } peakWorkingSetSize The peak working set size in bytes
293
+ * @property { number } workingSetSize The current working set size (both shared and private data) in bytes
294
+ * @property { number } pid The native process identifier
295
+ */
296
+ /**
297
+ * ProcessDetails interface
298
+ * @typedef { object } ProcessDetails
299
+ * @property { number } cpuUsage The percentage of total CPU usage
300
+ * @property { number } nonPagedPoolUsage The current nonpaged pool usage in bytes
301
+ * @property { number } pageFaultCount The number of page faults
302
+ * @property { number } pagedPoolUsage The current paged pool usage in bytes
303
+ * @property { number } pagefileUsage The total amount of memory in bytes that the memory manager has committed
304
+ * @property { number } peakNonPagedPoolUsage The peak nonpaged pool usage in bytes
305
+ * @property { number } peakPagedPoolUsage The peak paged pool usage in bytes
306
+ * @property { number } peakPagefileUsage The peak value in bytes of pagefileUsage during the lifetime of this process
307
+ * @property { number } peakWorkingSetSize The peak working set size in bytes
308
+ * @property { number } workingSetSize The current working set size (both shared and private data) in bytes
309
+ * @property { number } pid The native process identifier
310
+ */
311
+ /**
312
+ * ProxyConfig interface
313
+ * @typedef { object } ProxyConfig
314
+ * @property { string } proxyAddress The configured proxy address
315
+ * @property { number } proxyPort The configured proxy port
316
+ * @property { string } type The proxy Type
317
+ */
318
+ /**
319
+ * ProxyInfo interface
320
+ * @typedef { object } ProxyInfo
321
+ * @property { ProxyConfig } config The proxy config
322
+ * @property { ProxySystemInfo } system The proxy system info
323
+ */
324
+ /**
325
+ * QueryPermissionResult interface
326
+ * @typedef { object } QueryPermissionResult
327
+ * @property { string } permission The full name of a secured API
328
+ * @property { string } state 'granted' | 'denied' | 'unavailable'
329
+ * @property { boolean } granted true if permission is granted
330
+ * @property { object } [rawValue] The value of permission
331
+ */
332
+ /**
333
+ * ProxySystemInfo interface
334
+ * @typedef { object } ProxySystemInfo
335
+ * @property { string } autoConfigUrl The auto configuration url
336
+ * @property { string } bypass The proxy bypass info
337
+ * @property { boolean } enabled Value to check if a proxy is enabled
338
+ * @property { string } proxy The proxy info
339
+ */
340
+ /**
341
+ * Rect interface
342
+ * @typedef { object } Rect
343
+ * @property { number } bottom The bottom-most coordinate
344
+ * @property { number } left The left-most coordinate
345
+ * @property { number } right The right-most coordinate
346
+ * @property { number } top The top-most coordinate
347
+ */
348
+ /**
349
+ * RegistryInfo interface
350
+ * @typedef { object } RegistryInfo
351
+ * @property { any } data The registry data
352
+ * @property { string } rootKey The registry root key
353
+ * @property { string } subkey The registry key
354
+ * @property { string } type The registry type
355
+ * @property { string } value The registry value name
356
+ */
357
+ /**
358
+ * RuntimeDownloadOptions interface
359
+ * @typedef { object } RuntimeDownloadOptions
360
+ * @desc These are the options object required by the downloadRuntime function.
361
+ * @property { string } version The given version to download
362
+ */
363
+ /**
364
+ * RuntimeInfo interface
365
+ * @typedef { object } RuntimeInfo
366
+ * @property { string } architecture The runtime build architecture
367
+ * @property { string } manifestUrl The runtime manifest URL
368
+ * @property { number } port The runtime websocket port
369
+ * @property { string } securityRealm The runtime security realm
370
+ * @property { string } version The runtime version
371
+ * @property { object } args the command line argument used to start the Runtime
372
+ * @property { string } chromeVersion The chrome version
373
+ * @property { string } electronVersion The electron version
374
+ */
375
+ /**
376
+ * RVMInfo interface
377
+ * @typedef { object } RVMInfo
378
+ * @property { string } action The name of action: "get-rvm-info"
379
+ * @property { string } appLogDirectory The app log directory
380
+ * @property { string } path The path of OpenfinRVM.exe
381
+ * @property { string } 'start-time' The start time of RVM
382
+ * @property { string } version The version of RVM
383
+ * @property { string } 'working-dir' The working directory
384
+ */
385
+ /**
386
+ * RvmLaunchOptions interface
387
+ * @typedef { object } RvmLaunchOptions
388
+ * @property { boolean } [noUi] true if no UI when launching
389
+ * @property { object } [userAppConfigArgs] The user app configuration args
390
+ */
391
+ /**
392
+ * ServiceIdentifier interface
393
+ * @typedef { object } ServiceIdentifier
394
+ * @property { string } name The name of the service
395
+ */
396
+ /**
397
+ * ServiceConfiguration interface
398
+ * @typedef { object } ServiceConfiguration
399
+ * @property { object } config The service configuration
400
+ * @property { string } name The name of the service
401
+ */
402
+ /**
403
+ * ShortCutConfig interface
404
+ * @typedef { object } ShortCutConfig
405
+ * @property { boolean } desktop true if application has a shortcut on the desktop
406
+ * @property { boolean } startMenu true if application has shortcut in the start menu
407
+ * @property { boolean } systemStartup true if application will be launched on system startup
408
+ */
409
+ /**
410
+ * SubOptions interface
411
+ * @typedef { Object } SubOptions
412
+ * @property { number } timestamp The event timestamp
413
+ */
414
+ /**
415
+ * TaskBar interface
416
+ * @typedef { object } TaskBar
417
+ * @property { string } edge which edge of a monitor the taskbar is on
418
+ * @property { Rect } rect The taskbar coordinates
419
+ */
420
+ /**
421
+ * TerminateExternalRequestType interface
422
+ * @typedef { object } TerminateExternalRequestType
423
+ * @property { string } uuid The uuid of the running application
424
+ * @property { number } timeout Time out period before the running application terminates
425
+ * @property { boolean } killtree Value to terminate the running application
426
+ */
427
+ /**
428
+ * Time interface
429
+ * @typedef { object } Time
430
+ * @property { number } user The number of milliseconds the CPU has spent in user mode
431
+ * @property { number } nice The number of milliseconds the CPU has spent in nice mode
432
+ * @property { number } sys The number of milliseconds the CPU has spent in sys mode
433
+ * @property { number } idle The number of milliseconds the CPU has spent in idle mode
434
+ * @property { number } irq The number of milliseconds the CPU has spent in irq mode
435
+ */
436
+ /**
437
+ * TrayInfo interface
438
+ * @typedef { object } TrayInfo
439
+ * @property { Bounds } bounds The bound of tray icon in virtual screen pixels
440
+ * @property { MonitorInfo } monitorInfo Please see fin.System.getMonitorInfo for more information
441
+ * @property { number } x copy of bounds.x
442
+ * @property { number } y copy of bounds.y
443
+ */
444
+ /**
445
+ * WindowDetail interface
446
+ * @typedef { object } WindowDetail
447
+ * @property { number } bottom The bottom-most coordinate of the window
448
+ * @property { number } height The height of the window
449
+ * @property { boolean } isShowing Value to check if the window is showing
450
+ * @property { number } left The left-most coordinate of the window
451
+ * @property { string } name The name of the window
452
+ * @property { number } right The right-most coordinate of the window
453
+ * @property { string } state The window state
454
+ * @property { number } top The top-most coordinate of the window
455
+ * @property { number } width The width of the window
456
+ */
457
+ /**
458
+ * WindowInfo interface
459
+ * @typedef { object } WindowInfo
460
+ * @property { Array<WindowDetail> } childWindows The array of child windows details
461
+ * @property { WindowDetail } mainWindow The main window detail
462
+ * @property { string } uuid The uuid of the application
463
+ */
464
+ /**
465
+ * CertifiedAppInfo interface
466
+ * @typedef { object } CertifiedAppInfo
467
+ * @property { boolean } isRunning true if the app is running
468
+ * @property { boolean } [isOptedIntoCertfiedApp] true if the app has opted into certification
469
+ * @property { boolean } [isCertified] true if the app is certified
470
+ * @property { boolean } [isSSLCertified] true if the app manifest's SSL certificate is valid
471
+ * @property { boolean } [isPresentInAppDirectory] true if the app is present in the OpenFin app directory
472
+ */
473
+ /**
474
+ * An object representing the core of OpenFin Runtime. Allows the developer
475
+ * to perform system-level actions, such as accessing logs, viewing processes,
476
+ * clearing the cache and exiting the runtime as well as listen to <a href="tutorial-System.EventEmitter.html">system events</a>.
477
+ * @namespace
478
+ */
479
+ class System extends base_1.EmitterBase {
480
+ constructor(wire) {
481
+ super(wire, 'system');
482
+ }
483
+ sendExternalProcessRequest(action, options) {
484
+ return new Promise((resolve, reject) => {
485
+ const exitEventKey = 'external-process-exited';
486
+ let processUuid;
487
+ let exitPayload;
488
+ let externalProcessExitHandler;
489
+ let ofWindow;
490
+ if (typeof options.listener === 'function') {
491
+ externalProcessExitHandler = (payload) => {
492
+ const data = payload || {};
493
+ exitPayload = {
494
+ topic: 'exited',
495
+ uuid: data.processUuid || '',
496
+ exitCode: data.exitCode || 0
497
+ };
498
+ if (processUuid === payload.processUuid) {
499
+ options.listener(exitPayload);
500
+ ofWindow.removeListener(exitEventKey, externalProcessExitHandler);
501
+ }
502
+ };
503
+ // window constructor expects the name is not undefined
504
+ if (!this.wire.me.name) {
505
+ this.wire.me.name = this.wire.me.uuid;
506
+ }
507
+ ofWindow = new window_1._Window(this.wire, this.wire.me);
508
+ ofWindow.on(exitEventKey, externalProcessExitHandler);
509
+ }
510
+ this.wire
511
+ .sendAction(action, options)
512
+ .then(({ payload }) => {
513
+ processUuid = payload.data.uuid;
514
+ resolve(payload.data);
515
+ if (exitPayload && processUuid === exitPayload.uuid) {
516
+ options.listener(exitPayload);
517
+ ofWindow.removeListener(exitEventKey, externalProcessExitHandler);
518
+ }
519
+ })
520
+ .catch((err) => {
521
+ if (ofWindow) {
522
+ ofWindow.removeListener(exitEventKey, externalProcessExitHandler);
523
+ }
524
+ reject(err);
525
+ });
526
+ });
527
+ }
528
+ /**
529
+ * Adds a listener to the end of the listeners array for the specified event.
530
+ * @param { string | symbol } eventType - The type of the event.
531
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
532
+ * @param { SubOptions } [options] - Option to support event timestamps.
533
+ * @return {Promise.<this>}
534
+ * @function addListener
535
+ * @memberof System
536
+ * @instance
537
+ * @tutorial System.EventEmitter
538
+ */
539
+ /**
540
+ * Adds a listener to the end of the listeners array for the specified event.
541
+ * @param { string | symbol } eventType - The type of the event.
542
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
543
+ * @param { SubOptions } [options] - Option to support event timestamps.
544
+ * @return {Promise.<this>}
545
+ * @function on
546
+ * @memberof System
547
+ * @instance
548
+ * @tutorial System.EventEmitter
549
+ */
550
+ /**
551
+ * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
552
+ * @param { string | symbol } eventType - The type of the event.
553
+ * @param { Function } listener - The callback function.
554
+ * @param { SubOptions } [options] - Option to support event timestamps.
555
+ * @return {Promise.<this>}
556
+ * @function once
557
+ * @memberof System
558
+ * @instance
559
+ * @tutorial System.EventEmitter
560
+ */
561
+ /**
562
+ * Adds a listener to the beginning of the listeners array for the specified event.
563
+ * @param { string | symbol } eventType - The type of the event.
564
+ * @param { Function } listener - The callback function.
565
+ * @param { SubOptions } [options] - Option to support event timestamps.
566
+ * @return {Promise.<this>}
567
+ * @function prependListener
568
+ * @memberof System
569
+ * @instance
570
+ * @tutorial System.EventEmitter
571
+ */
572
+ /**
573
+ * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
574
+ * The listener is added to the beginning of the listeners array.
575
+ * @param { string | symbol } eventType - The type of the event.
576
+ * @param { Function } listener - The callback function.
577
+ * @param { SubOptions } [options] - Option to support event timestamps.
578
+ * @return {Promise.<this>}
579
+ * @function prependOnceListener
580
+ * @memberof System
581
+ * @instance
582
+ * @tutorial System.EventEmitter
583
+ */
584
+ /**
585
+ * Remove a listener from the listener array for the specified event.
586
+ * Caution: Calling this method changes the array indices in the listener array behind the listener.
587
+ * @param { string | symbol } eventType - The type of the event.
588
+ * @param { Function } listener - The callback function.
589
+ * @param { SubOptions } [options] - Option to support event timestamps.
590
+ * @return {Promise.<this>}
591
+ * @function removeListener
592
+ * @memberof System
593
+ * @instance
594
+ * @tutorial System.EventEmitter
595
+ */
596
+ /**
597
+ * Removes all listeners, or those of the specified event.
598
+ * @param { string | symbol } [eventType] - The type of the event.
599
+ * @return {Promise.<this>}
600
+ * @function removeAllListeners
601
+ * @memberof System
602
+ * @instance
603
+ * @tutorial System.EventEmitter
604
+ */
605
+ /**
606
+ * Returns the version of the runtime. The version contains the major, minor,
607
+ * build and revision numbers.
608
+ * @return {Promise.<string>}
609
+ * @tutorial System.getVersion
610
+ */
611
+ getVersion() {
612
+ return this.wire.sendAction('get-version').then(({ payload }) => payload.data);
613
+ }
614
+ /**
615
+ * Clears cached data containing application resource
616
+ * files (images, HTML, JavaScript files), cookies, and items stored in the
617
+ * Local Storage.
618
+ * @param { ClearCacheOption } options - See tutorial for more details.
619
+ * @return {Promise.<void>}
620
+ * @tutorial System.clearCache
621
+ */
622
+ clearCache(options) {
623
+ return this.wire.sendAction('clear-cache', options).then(() => undefined);
624
+ }
625
+ /**
626
+ * Clears all cached data when OpenFin Runtime exits.
627
+ * @return {Promise.<void>}
628
+ * @tutorial System.deleteCacheOnExit
629
+ */
630
+ deleteCacheOnExit() {
631
+ return this.wire.sendAction('delete-cache-request').then(() => undefined);
632
+ }
633
+ /**
634
+ * Exits the Runtime.
635
+ * @return {Promise.<void>}
636
+ * @tutorial System.exit
637
+ */
638
+ exit() {
639
+ return this.wire.sendAction('exit-desktop').then(() => undefined);
640
+ }
641
+ /**
642
+ * Fetches a JSON manifest using the browser process and returns a Javascript object.
643
+ * @param { string } manifestUrl The URL of the manifest to fetch.
644
+ * @return {Promise.<any>}
645
+ * @tutorial System.fetchManifest
646
+ */
647
+ async fetchManifest(manifestUrl) {
648
+ const { payload: { data } } = await this.wire.sendAction('fetch-manifest', { manifestUrl });
649
+ return data;
650
+ }
651
+ /**
652
+ * Writes any unwritten cookies data to disk.
653
+ * @return {Promise.<void>}
654
+ * @tutorial System.flushCookieStore
655
+ */
656
+ flushCookieStore() {
657
+ return this.wire.sendAction('flush-cookie-store').then(() => undefined);
658
+ }
659
+ /**
660
+ * Retrieves an array of data (name, ids, bounds) for all application windows.
661
+ * @return {Promise.Array.<WindowInfo>}
662
+ * @tutorial System.getAllWindows
663
+ */
664
+ getAllWindows() {
665
+ return this.wire.sendAction('get-all-windows').then(({ payload }) => payload.data);
666
+ }
667
+ /**
668
+ * Retrieves an array of data for all applications.
669
+ * @return {Promise.Array.<ApplicationInfo>}
670
+ * @tutorial System.getAllApplications
671
+ */
672
+ getAllApplications() {
673
+ return this.wire.sendAction('get-all-applications').then(({ payload }) => payload.data);
674
+ }
675
+ /**
676
+ * Retrieves the command line argument string that started OpenFin Runtime.
677
+ * @return {Promise.<string>}
678
+ * @tutorial System.getCommandLineArguments
679
+ */
680
+ getCommandLineArguments() {
681
+ return this.wire.sendAction('get-command-line-arguments').then(({ payload }) => payload.data);
682
+ }
683
+ /**
684
+ * Get the current state of the crash reporter.
685
+ * @return {Promise.<CrashReporterState>}
686
+ * @tutorial System.getCrashReporterState
687
+ */
688
+ async getCrashReporterState() {
689
+ const { payload: { data: { diagnosticMode, isRunning } } } = await this.wire.sendAction('get-crash-reporter-state');
690
+ console.warn('diagnosticMode property is deprecated. It will be removed in a future version');
691
+ return {
692
+ // diagnosticMode will be removed in a future version
693
+ diagnosticMode,
694
+ diagnosticsMode: diagnosticMode,
695
+ isRunning
696
+ };
697
+ }
698
+ /**
699
+ * Start the crash reporter if not already running.
700
+ * @param { CrashReporterOptions } options - configure crash reporter
701
+ * @return {Promise.<CrashReporterState>}
702
+ * @tutorial System.startCrashReporter
703
+ */
704
+ async startCrashReporter(options) {
705
+ const opts = options;
706
+ const newOpts = { ...opts, diagnosticMode: opts.diagnosticsMode || opts.diagnosticMode };
707
+ const { payload: { data: { diagnosticMode, isRunning } } } = await this.wire.sendAction('start-crash-reporter', newOpts);
708
+ return {
709
+ // diagnosticMode will be removed in a future version
710
+ diagnosticMode,
711
+ diagnosticsMode: diagnosticMode,
712
+ isRunning
713
+ };
714
+ }
715
+ /**
716
+ * Returns a hex encoded hash of the machine id and the currently logged in user name.
717
+ * This is the recommended way to uniquely identify a user / machine combination.
718
+ * @return {Promise.<string>}
719
+ * @tutorial System.getUniqueUserId
720
+ * @static
721
+ */
722
+ getUniqueUserId() {
723
+ return this.wire.sendAction('get-unique-user-id').then(({ payload }) => payload.data);
724
+ }
725
+ /**
726
+ * Retrieves a frame info object for the uuid and name passed in
727
+ * @param { string } uuid - The UUID of the target.
728
+ * @param { string } name - The name of the target.
729
+ * @return {Promise.<EntityInfo>}
730
+ * @tutorial System.getEntityInfo
731
+ */
732
+ getEntityInfo(uuid, name) {
733
+ return this.wire.sendAction('get-entity-info', { uuid, name }).then(({ payload }) => payload.data);
734
+ }
735
+ /**
736
+ * Gets the value of a given environment variable on the computer on which the runtime is installed
737
+ * @return {Promise.<string>}
738
+ * @tutorial System.getEnvironmentVariable
739
+ */
740
+ getEnvironmentVariable(envName) {
741
+ return this.wire
742
+ .sendAction('get-environment-variable', {
743
+ environmentVariables: envName
744
+ })
745
+ .then(({ payload }) => payload.data);
746
+ }
747
+ /**
748
+ * Get current focused window.
749
+ * @return {Promise.<WindowInfo>}
750
+ * @tutorial System.getFocusedWindow
751
+ */
752
+ getFocusedWindow() {
753
+ return this.wire.sendAction('get-focused-window').then(({ payload }) => payload.data);
754
+ }
755
+ /**
756
+ * Returns information about the given app's certification status
757
+ * @return {Promise.<CertifiedAppInfo>}
758
+ * @tutorial System.isAppCertified
759
+ */
760
+ async isAppCertified(manifestUrl) {
761
+ const { payload: { data: { certifiedInfo } } } = await this.wire.sendAction('is-app-certified', { manifestUrl });
762
+ return certifiedInfo;
763
+ }
764
+ /**
765
+ * Returns an array of all the installed runtime versions in an object.
766
+ * @return {Promise.<string[]>}
767
+ * @tutorial System.getInstalledRuntimes
768
+ */
769
+ // incompatible with standalone node process.
770
+ getInstalledRuntimes() {
771
+ return this.wire.sendAction('get-installed-runtimes').then(({ payload }) => payload.data.runtimes);
772
+ }
773
+ // incompatible with standalone node process.
774
+ async getInstalledApps() {
775
+ const { payload: { data: { installedApps } } } = await this.wire.sendAction('get-installed-apps');
776
+ return installedApps;
777
+ }
778
+ /**
779
+ * Retrieves the contents of the log with the specified filename.
780
+ * @param { GetLogRequestType } options A object that id defined by the GetLogRequestType interface
781
+ * @return {Promise.<string>}
782
+ * @tutorial System.getLog
783
+ */
784
+ getLog(options) {
785
+ return this.wire.sendAction('view-log', options).then(({ payload }) => payload.data);
786
+ }
787
+ /**
788
+ * Returns a unique identifier (UUID) provided by the machine.
789
+ * @return {Promise.<string>}
790
+ * @tutorial System.getMachineId
791
+ */
792
+ getMachineId() {
793
+ return this.wire.sendAction('get-machine-id').then(({ payload }) => payload.data);
794
+ }
795
+ /**
796
+ * Returns the minimum (inclusive) logging level that is currently being written to the log.
797
+ * @return {Promise.<LogLevel>}
798
+ * @tutorial System.getMinLogLevel
799
+ */
800
+ getMinLogLevel() {
801
+ return this.wire.sendAction('get-min-log-level').then(({ payload }) => payload.data);
802
+ }
803
+ /**
804
+ * Retrieves an array containing information for each log file.
805
+ * @return {Promise.Array<LogInfo>}
806
+ * @tutorial System.getLogList
807
+ */
808
+ getLogList() {
809
+ return this.wire.sendAction('list-logs').then(({ payload }) => payload.data);
810
+ }
811
+ /**
812
+ * Retrieves an object that contains data about the monitor setup of the
813
+ * computer that the runtime is running on.
814
+ * @return {Promise.<MonitorInfo>}
815
+ * @tutorial System.getMonitorInfo
816
+ */
817
+ getMonitorInfo() {
818
+ return this.wire.sendAction('get-monitor-info').then(({ payload }) => payload.data);
819
+ }
820
+ /**
821
+ * Returns the mouse in virtual screen coordinates (left, top).
822
+ * @return {Promise.<PointTopLeft>}
823
+ * @tutorial System.getMousePosition
824
+ */
825
+ getMousePosition() {
826
+ return this.wire.sendAction('get-mouse-position').then(({ payload }) => payload.data);
827
+ }
828
+ /**
829
+ * Retrieves an array of all of the runtime processes that are currently
830
+ * running. Each element in the array is an object containing the uuid
831
+ * and the name of the application to which the process belongs.
832
+ * @deprecated Please use our new set of process APIs:
833
+ * [Window.getProcessInfo]{@link Window#getProcessInfo}
834
+ * [View.getProcessInfo]{@link View#getProcessInfo}
835
+ * [Application.getProcessInfo]{@link Application#getProcessInfo}
836
+ * [System.getAllProcessInfo]{@link System#getAllProcessInfo}
837
+ * @return {Promise.Array.<ProcessInfo>}
838
+ * @tutorial System.getProcessList
839
+ */
840
+ getProcessList() {
841
+ // eslint-disable-next-line no-console
842
+ console.warn('System.getProcessList has been deprecated. Please consider using our new process APIs: Window.getProcessInfo, View.getProcessInfo, Application.getProcessInfo, System.getAllProcessInfo');
843
+ return this.wire.sendAction('process-snapshot').then(({ payload }) => payload.data);
844
+ }
845
+ /**
846
+ * Retrieves all process information. This includes the browser process and every process associated to all entities (windows and views).
847
+ * @return {Promise.<SystemProcessInfo>}
848
+ * @tutorial System.getAllProcessInfo
849
+ * @experimental
850
+ */
851
+ async getAllProcessInfo() {
852
+ const { payload: { data } } = await this.wire.sendAction('get-all-process-info', this.identity);
853
+ return data;
854
+ }
855
+ /**
856
+ * Retrieves the Proxy settings.
857
+ * @return {Promise.<ProxyInfo>}
858
+ * @tutorial System.getProxySettings
859
+ */
860
+ getProxySettings() {
861
+ return this.wire.sendAction('get-proxy-settings').then(({ payload }) => payload.data);
862
+ }
863
+ /**
864
+ * Returns information about the running Runtime in an object.
865
+ * @return {Promise.<RuntimeInfo>}
866
+ * @tutorial System.getRuntimeInfo
867
+ */
868
+ getRuntimeInfo() {
869
+ return this.wire.sendAction('get-runtime-info').then(({ payload }) => payload.data);
870
+ }
871
+ /**
872
+ * Returns information about the running RVM in an object.
873
+ * @return {Promise.<RVMInfo>}
874
+ * @tutorial System.getRvmInfo
875
+ */
876
+ // incompatible with standalone node process.
877
+ getRvmInfo() {
878
+ return this.wire.sendAction('get-rvm-info').then(({ payload }) => payload.data);
879
+ }
880
+ /**
881
+ * Retrieves system information.
882
+ * @return {Promise.<HostSpecs>}
883
+ * @tutorial System.getHostSpecs
884
+ */
885
+ getHostSpecs() {
886
+ return this.wire.sendAction('get-host-specs').then(({ payload }) => payload.data);
887
+ }
888
+ /**
889
+ * Runs an executable or batch file. A path to the file must be included in options.
890
+ * <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
891
+ * <br> Note: This method is restricted by default and must be enabled via
892
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
893
+ * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
894
+ * @return {Promise.<Identity>}
895
+ * @tutorial System.launchExternalProcess
896
+ */
897
+ launchExternalProcess(options) {
898
+ return this.sendExternalProcessRequest('launch-external-process', options);
899
+ }
900
+ /**
901
+ * Monitors a running process. A pid for the process must be included in options.
902
+ * <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
903
+ * @param { ExternalProcessInfo } options See tutorial for more details
904
+ * @return {Promise.<Identity>}
905
+ * @tutorial System.monitorExternalProcess
906
+ */
907
+ monitorExternalProcess(options) {
908
+ return this.sendExternalProcessRequest('monitor-external-process', options);
909
+ }
910
+ /**
911
+ * Writes the passed message into both the log file and the console.
912
+ * @param { string } level The log level for the entry. Can be either "info", "warning" or "error"
913
+ * @param { string } message The log message text
914
+ * @return {Promise.<void>}
915
+ * @tutorial System.log
916
+ */
917
+ log(level, message) {
918
+ return this.wire.sendAction('write-to-log', { level, message }).then(() => undefined);
919
+ }
920
+ /**
921
+ * Opens the passed URL in the default web browser. It only supports http(s) and fin(s) protocols by default.
922
+ * In order to use other custom protocols, they have to be enabled via
923
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
924
+ * File protocol and file path are not supported.
925
+ * @param { string } url The URL to open
926
+ * @return {Promise.<void>}
927
+ * @tutorial System.openUrlWithBrowser
928
+ */
929
+ openUrlWithBrowser(url) {
930
+ return this.wire.sendAction('open-url-with-browser', { url }).then(() => undefined);
931
+ }
932
+ /**
933
+ * Removes the process entry for the passed UUID obtained from a prior call
934
+ * of fin.System.launchExternalProcess().
935
+ * @param { string } uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess()
936
+ * @return {Promise.<void>}
937
+ * @tutorial System.releaseExternalProcess
938
+ */
939
+ releaseExternalProcess(uuid) {
940
+ return this.wire.sendAction('release-external-process', { uuid }).then(() => undefined);
941
+ }
942
+ /**
943
+ * Shows the Chromium Developer Tools for the specified window
944
+ * @param { Identity } identity This is a object that is defined by the Identity interface
945
+ * @return {Promise.<void>}
946
+ * @tutorial System.showDeveloperTools
947
+ */
948
+ showDeveloperTools(identity) {
949
+ return this.wire.sendAction('show-developer-tools', identity).then(() => undefined);
950
+ }
951
+ /**
952
+ * Attempt to close an external process. The process will be terminated if it
953
+ * has not closed after the elapsed timeout in milliseconds.<br>
954
+ * Note: This method is restricted by default and must be enabled via
955
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
956
+ * @param { TerminateExternalRequestType } options A object defined in the TerminateExternalRequestType interface
957
+ * @return {Promise.<void>}
958
+ * @tutorial System.terminateExternalProcess
959
+ */
960
+ terminateExternalProcess(options) {
961
+ return this.wire.sendAction('terminate-external-process', options).then(() => undefined);
962
+ }
963
+ /**
964
+ * Update the OpenFin Runtime Proxy settings.
965
+ * @param { ProxyConfig } options A config object defined in the ProxyConfig interface
966
+ * @return {Promise.<void>}
967
+ * @tutorial System.updateProxySettings
968
+ */
969
+ updateProxySettings(options) {
970
+ return this.wire.sendAction('update-proxy', options).then(() => undefined);
971
+ }
972
+ /**
973
+ * Downloads the given application asset<br>
974
+ * Note: This method is restricted by default and must be enabled via
975
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
976
+ * @param { AppAssetInfo } appAsset App asset object
977
+ * @return {Promise.<void>}
978
+ * @tutorial System.downloadAsset
979
+ */
980
+ // incompatible with standalone node process.
981
+ downloadAsset(appAsset, progressListener) {
982
+ return new Promise((resolve, reject) => {
983
+ // node.js environment not supported
984
+ if (this.wire.environment.constructor.name === 'NodeEnvironment') {
985
+ reject(new transport_errors_1.NotSupportedError('downloadAsset only supported in an OpenFin Render process'));
986
+ return;
987
+ }
988
+ const downloadId = this.wire.environment.getNextMessageId().toString();
989
+ const dlProgressKey = `asset-download-progress-${downloadId}`;
990
+ const dlErrorKey = `asset-download-error-${downloadId}`;
991
+ const dlCompleteKey = `asset-download-complete-${downloadId}`;
992
+ const dlProgress = (progress) => {
993
+ const p = {
994
+ downloadedBytes: progress.downloadedBytes,
995
+ totalBytes: progress.totalBytes
996
+ };
997
+ progressListener(p);
998
+ };
999
+ const cleanListeners = () => {
1000
+ this.removeListener(dlProgressKey, dlProgress);
1001
+ };
1002
+ const dlError = (r, err) => {
1003
+ const error = err || r;
1004
+ cleanListeners();
1005
+ reject(new transport_errors_1.RuntimeError(error));
1006
+ };
1007
+ const dlComplete = () => {
1008
+ cleanListeners();
1009
+ resolve();
1010
+ };
1011
+ this.on(dlProgressKey, dlProgress);
1012
+ this.once(dlErrorKey, dlError);
1013
+ this.once(dlCompleteKey, dlComplete);
1014
+ const downloadOptions = Object.assign(appAsset, { downloadId });
1015
+ this.wire.sendAction('download-asset', downloadOptions).catch((err) => {
1016
+ cleanListeners();
1017
+ reject(err);
1018
+ });
1019
+ });
1020
+ }
1021
+ /**
1022
+ * Downloads a version of the runtime.
1023
+ * @param { RuntimeDownloadOptions } options - Download options.
1024
+ * @param {Function} [progressListener] - called as the runtime is downloaded with progress information.
1025
+ * @return {Promise.<void>}
1026
+ * @tutorial System.downloadRuntime
1027
+ */
1028
+ downloadRuntime(options, progressListener) {
1029
+ return new Promise((resolve, reject) => {
1030
+ // node.js environment not supported
1031
+ if (this.wire.environment.constructor.name === 'NodeEnvironment') {
1032
+ reject(new transport_errors_1.NotSupportedError('downloadRuntime only supported in an OpenFin Render process'));
1033
+ return;
1034
+ }
1035
+ const downloadId = this.wire.environment.getNextMessageId().toString();
1036
+ const dlProgressKey = `runtime-download-progress-${downloadId}`;
1037
+ const dlErrorKey = `runtime-download-error-${downloadId}`;
1038
+ const dlCompleteKey = `runtime-download-complete-${downloadId}`;
1039
+ const dlProgress = (progress) => {
1040
+ const p = {
1041
+ downloadedBytes: progress.downloadedBytes,
1042
+ totalBytes: progress.totalBytes
1043
+ };
1044
+ progressListener(p);
1045
+ };
1046
+ const cleanListeners = () => {
1047
+ this.removeListener(dlProgressKey, dlProgress);
1048
+ };
1049
+ const dlError = (r, err) => {
1050
+ const error = err || r;
1051
+ cleanListeners();
1052
+ reject(new transport_errors_1.RuntimeError(error));
1053
+ };
1054
+ const dlComplete = () => {
1055
+ cleanListeners();
1056
+ resolve();
1057
+ };
1058
+ this.on(dlProgressKey, dlProgress);
1059
+ this.once(dlErrorKey, dlError);
1060
+ this.once(dlCompleteKey, dlComplete);
1061
+ const downloadOptions = Object.assign(options, { downloadId });
1062
+ this.wire.sendAction('download-runtime', downloadOptions).catch((err) => {
1063
+ cleanListeners();
1064
+ reject(err);
1065
+ });
1066
+ });
1067
+ }
1068
+ /**
1069
+ * Download preload scripts from given URLs
1070
+ * @param {DownloadPreloadOption[]} scripts - URLs of preload scripts. See tutorial for more details.
1071
+ * @return {Promise.Array<DownloadPreloadInfo>}
1072
+ * @tutorial System.downloadPreloadScripts
1073
+ */
1074
+ downloadPreloadScripts(scripts) {
1075
+ return this.wire.sendAction('download-preload-scripts', { scripts }).then(({ payload }) => payload.data);
1076
+ }
1077
+ /**
1078
+ * Retrieves an array of data (name, ids, bounds) for all application windows.
1079
+ * @return {Promise.Array.<Identity>}
1080
+ * @tutorial System.getAllExternalApplications
1081
+ */
1082
+ getAllExternalApplications() {
1083
+ return this.wire.sendAction('get-all-external-applications').then(({ payload }) => payload.data);
1084
+ }
1085
+ /**
1086
+ * Retrieves app asset information.
1087
+ * @param { AppAssetRequest } options
1088
+ * @return {Promise.<AppAssetInfo>}
1089
+ * @tutorial System.getAppAssetInfo
1090
+ */
1091
+ getAppAssetInfo(options) {
1092
+ return this.wire.sendAction('get-app-asset-info', options).then(({ payload }) => payload.data);
1093
+ }
1094
+ /**
1095
+ * Get additional info of cookies.
1096
+ * @param { CookieOption } options - See tutorial for more details.
1097
+ * @return {Promise.Array.<CookieInfo>}
1098
+ * @tutorial System.getCookies
1099
+ */
1100
+ getCookies(options) {
1101
+ const url = this.wire.environment.getUrl();
1102
+ const newOptions = Object.assign(options, { url });
1103
+ return this.wire.sendAction('get-cookies', newOptions).then(({ payload }) => payload.data);
1104
+ }
1105
+ /**
1106
+ * Set the minimum log level above which logs will be written to the OpenFin log
1107
+ * @param { LogLevel } The minimum level (inclusive) above which all calls to log will be written
1108
+ * @return {Promise.<void>}
1109
+ * @tutorial System.setMinLogLevel
1110
+ */
1111
+ setMinLogLevel(level) {
1112
+ return this.wire.sendAction('set-min-log-level', { level }).then(() => undefined);
1113
+ }
1114
+ /**
1115
+ * Retrieves the UUID of the computer on which the runtime is installed
1116
+ * @param { string } uuid The uuid of the running application
1117
+ * @return {Promise.<Entity>}
1118
+ * @tutorial System.resolveUuid
1119
+ */
1120
+ resolveUuid(uuid) {
1121
+ return this.wire
1122
+ .sendAction('resolve-uuid', {
1123
+ entityKey: uuid
1124
+ })
1125
+ .then(({ payload }) => payload.data);
1126
+ }
1127
+ /**
1128
+ * Retrieves an array of data for all external applications
1129
+ * @param { Identity } requestingIdentity This object is described in the Identity typedef
1130
+ * @param { any } data Any data type to pass to the method
1131
+ * @return {Promise.<any>}
1132
+ * @ignore
1133
+ */
1134
+ executeOnRemote(requestingIdentity, data) {
1135
+ data.requestingIdentity = requestingIdentity;
1136
+ return this.wire.ferryAction(data);
1137
+ }
1138
+ /**
1139
+ * Reads the specifed value from the registry.<br>
1140
+ * Note: This method is restricted by default and must be enabled via
1141
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
1142
+ * @param { string } rootKey - The registry root key.
1143
+ * @param { string } subkey - The registry key.
1144
+ * @param { string } value - The registry value name.
1145
+ * @return {Promise.<RegistryInfo>}
1146
+ * @tutorial System.readRegistryValue
1147
+ */
1148
+ readRegistryValue(rootKey, subkey, value) {
1149
+ return this.wire
1150
+ .sendAction('read-registry-value', {
1151
+ rootKey,
1152
+ subkey,
1153
+ value
1154
+ })
1155
+ .then(({ payload }) => payload.data);
1156
+ }
1157
+ /**
1158
+ * This function call will register a unique id and produce a token.
1159
+ * The token can be used to broker an external connection.
1160
+ * @param { string } uuid - A UUID for the remote connection.
1161
+ * @return {Promise.<ExternalConnection>}
1162
+ * @tutorial System.registerExternalConnection
1163
+ */
1164
+ registerExternalConnection(uuid) {
1165
+ return this.wire.sendAction('register-external-connection', { uuid }).then(({ payload }) => payload.data);
1166
+ }
1167
+ /**
1168
+ * Returns the json blob found in the [desktop owner settings](https://openfin.co/documentation/desktop-owner-settings/)
1169
+ * for the specified service.
1170
+ * More information about desktop services can be found [here](https://developers.openfin.co/docs/desktop-services).
1171
+ * @param { ServiceIdentifier } serviceIdentifier An object containing a name key that identifies the service.
1172
+ * @return {Promise.<ServiceConfiguration>}
1173
+ * @tutorial System.getServiceConfiguration
1174
+ */
1175
+ async getServiceConfiguration(serviceIdentifier) {
1176
+ if (typeof serviceIdentifier.name !== 'string') {
1177
+ throw new Error('Must provide an object with a `name` property having a string value');
1178
+ }
1179
+ const { name } = serviceIdentifier;
1180
+ return this.wire.sendAction('get-service-configuration', { name }).then(({ payload }) => payload.data);
1181
+ }
1182
+ async getSystemAppConfig(name) {
1183
+ if (typeof name !== 'string') {
1184
+ throw new Error('Must provide a string value for name of system app');
1185
+ }
1186
+ return this.wire.sendAction('get-system-app-configuration', { name }).then(({ payload }) => payload.data);
1187
+ }
1188
+ /**
1189
+ * Signals the RVM to perform a health check and returns the results as json.
1190
+ * @return {Promise.<string[]>}
1191
+ * @tutorial System.runRvmHealthCheck
1192
+ */
1193
+ runRvmHealthCheck() {
1194
+ return this.wire.sendAction('run-rvm-health-check').then(({ payload }) => payload.data);
1195
+ }
1196
+ /**
1197
+ * Launch application using a manifest URL/path. It differs from Application.startFromManifest in that this API can accept a manifest using the fin protocol.
1198
+ * @param {string} manifestUrl - The manifest's URL or path.
1199
+ * @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
1200
+ * @return {Promise.<Manifest>}
1201
+ * @experimental
1202
+ * @tutorial System.launchManifest
1203
+ * @static
1204
+ */
1205
+ async launchManifest(manifestUrl, opts) {
1206
+ const response = await this.wire.sendAction('launch-manifest', {
1207
+ manifestUrl,
1208
+ opts
1209
+ });
1210
+ return response.payload.data.manifest;
1211
+ }
1212
+ /**
1213
+ * Query permission of a secured api in current context.
1214
+ * @param {string} apiName - The full name of a secured API.
1215
+ * @return {Promise.<QueryPermissionResult>}
1216
+ * @tutorial System.queryPermissionForCurrentContext
1217
+ */
1218
+ async queryPermissionForCurrentContext(apiName) {
1219
+ const identity = { uuid: this.wire.me.uuid, name: this.wire.me.name };
1220
+ const response = await this.wire.sendAction('query-permission-for-current-context', {
1221
+ apiName,
1222
+ identity
1223
+ });
1224
+ return response.payload.data;
1225
+ }
1226
+ // Not documenting, internal use only.
1227
+ async enableNativeWindowIntegrationProvider(permissions) {
1228
+ const { payload } = await this.wire.sendAction('enable-native-window-integration-provider', { permissions });
1229
+ return payload.data;
1230
+ }
1231
+ /**
1232
+ * Register the usage of a component with a platform
1233
+ * @param {OpenFin.RegisterUsageData} options - Object with data and type
1234
+ * @return {Promise.<void>}
1235
+ * @tutorial System.registerUsage
1236
+ */
1237
+ async registerUsage({ data, type }) {
1238
+ await this.wire.sendAction('register-usage', { data, type });
1239
+ }
1240
+ }
1241
+ exports.default = System;