@openfin/core 33.76.31 → 33.76.38

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 (269) hide show
  1. package/OpenFin.d.ts +1 -1
  2. package/README.md +29 -4
  3. package/fin.d.ts +2 -2
  4. package/{src → out}/GlobalOpenFin.d.ts +1 -1
  5. package/out/mock-alpha.d.ts +16112 -0
  6. package/out/mock-beta.d.ts +16112 -0
  7. package/out/mock-public.d.ts +16112 -0
  8. package/out/mock.d.ts +16797 -0
  9. package/out/mock.js +17104 -0
  10. package/package.json +30 -23
  11. package/LICENSE +0 -13
  12. package/NOTICE +0 -16
  13. package/openfin-core-33.76.31.tgz +0 -0
  14. package/src/OpenFin.d.ts +0 -3080
  15. package/src/OpenFin.js +0 -2
  16. package/src/api/api-exposer/api-consumer.d.ts +0 -28
  17. package/src/api/api-exposer/api-consumer.js +0 -28
  18. package/src/api/api-exposer/api-exposer.d.ts +0 -35
  19. package/src/api/api-exposer/api-exposer.js +0 -38
  20. package/src/api/api-exposer/decorators.d.ts +0 -10
  21. package/src/api/api-exposer/decorators.js +0 -18
  22. package/src/api/api-exposer/index.d.ts +0 -4
  23. package/src/api/api-exposer/index.js +0 -20
  24. package/src/api/api-exposer/strategies/index.d.ts +0 -1
  25. package/src/api/api-exposer/strategies/index.js +0 -17
  26. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
  27. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
  28. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
  29. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
  30. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
  31. package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
  32. package/src/api/application/Factory.d.ts +0 -148
  33. package/src/api/application/Factory.js +0 -230
  34. package/src/api/application/Instance.d.ts +0 -321
  35. package/src/api/application/Instance.js +0 -453
  36. package/src/api/application/index.d.ts +0 -3
  37. package/src/api/application/index.js +0 -19
  38. package/src/api/base.d.ts +0 -48
  39. package/src/api/base.js +0 -177
  40. package/src/api/clipboard/index.d.ts +0 -92
  41. package/src/api/clipboard/index.js +0 -120
  42. package/src/api/events/application.d.ts +0 -146
  43. package/src/api/events/application.js +0 -2
  44. package/src/api/events/base.d.ts +0 -42
  45. package/src/api/events/base.js +0 -2
  46. package/src/api/events/channel.d.ts +0 -30
  47. package/src/api/events/channel.js +0 -2
  48. package/src/api/events/emitterMap.d.ts +0 -11
  49. package/src/api/events/emitterMap.js +0 -35
  50. package/src/api/events/eventAggregator.d.ts +0 -5
  51. package/src/api/events/eventAggregator.js +0 -35
  52. package/src/api/events/externalApplication.d.ts +0 -19
  53. package/src/api/events/externalApplication.js +0 -2
  54. package/src/api/events/frame.d.ts +0 -30
  55. package/src/api/events/frame.js +0 -2
  56. package/src/api/events/globalHotkey.d.ts +0 -20
  57. package/src/api/events/globalHotkey.js +0 -2
  58. package/src/api/events/platform.d.ts +0 -26
  59. package/src/api/events/platform.js +0 -2
  60. package/src/api/events/system.d.ts +0 -113
  61. package/src/api/events/system.js +0 -2
  62. package/src/api/events/typedEventEmitter.d.ts +0 -20
  63. package/src/api/events/typedEventEmitter.js +0 -2
  64. package/src/api/events/view.d.ts +0 -82
  65. package/src/api/events/view.js +0 -2
  66. package/src/api/events/webcontents.d.ts +0 -266
  67. package/src/api/events/webcontents.js +0 -2
  68. package/src/api/events/window.d.ts +0 -352
  69. package/src/api/events/window.js +0 -2
  70. package/src/api/external-application/Factory.d.ts +0 -27
  71. package/src/api/external-application/Factory.js +0 -40
  72. package/src/api/external-application/Instance.d.ts +0 -102
  73. package/src/api/external-application/Instance.js +0 -109
  74. package/src/api/external-application/index.d.ts +0 -3
  75. package/src/api/external-application/index.js +0 -19
  76. package/src/api/fin.d.ts +0 -51
  77. package/src/api/fin.js +0 -42
  78. package/src/api/frame/Factory.d.ts +0 -37
  79. package/src/api/frame/Factory.js +0 -69
  80. package/src/api/frame/Instance.d.ts +0 -123
  81. package/src/api/frame/Instance.js +0 -130
  82. package/src/api/frame/index.d.ts +0 -3
  83. package/src/api/frame/index.js +0 -19
  84. package/src/api/global-hotkey/index.d.ts +0 -38
  85. package/src/api/global-hotkey/index.js +0 -64
  86. package/src/api/interappbus/channel/channel.d.ts +0 -28
  87. package/src/api/interappbus/channel/channel.js +0 -77
  88. package/src/api/interappbus/channel/channels-docs.d.ts +0 -340
  89. package/src/api/interappbus/channel/channels-docs.js +0 -398
  90. package/src/api/interappbus/channel/client.d.ts +0 -24
  91. package/src/api/interappbus/channel/client.js +0 -89
  92. package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
  93. package/src/api/interappbus/channel/connection-manager.js +0 -246
  94. package/src/api/interappbus/channel/index.d.ts +0 -25
  95. package/src/api/interappbus/channel/index.js +0 -169
  96. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
  97. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
  98. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
  99. package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
  100. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
  101. package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
  102. package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
  103. package/src/api/interappbus/channel/protocols/index.js +0 -2
  104. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
  105. package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
  106. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
  107. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
  108. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
  109. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
  110. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
  111. package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
  112. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
  113. package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
  114. package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
  115. package/src/api/interappbus/channel/protocols/strategy.js +0 -2
  116. package/src/api/interappbus/channel/provider.d.ts +0 -34
  117. package/src/api/interappbus/channel/provider.js +0 -166
  118. package/src/api/interappbus/index.d.ts +0 -85
  119. package/src/api/interappbus/index.js +0 -175
  120. package/src/api/interop/Factory.d.ts +0 -37
  121. package/src/api/interop/Factory.js +0 -76
  122. package/src/api/interop/InteropBroker.d.ts +0 -437
  123. package/src/api/interop/InteropBroker.js +0 -1085
  124. package/src/api/interop/InteropClient.d.ts +0 -278
  125. package/src/api/interop/InteropClient.js +0 -459
  126. package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
  127. package/src/api/interop/SessionContextGroupBroker.js +0 -108
  128. package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
  129. package/src/api/interop/SessionContextGroupClient.js +0 -86
  130. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
  131. package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
  132. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
  133. package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
  134. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -208
  135. package/src/api/interop/fdc3/fdc3-1.2.js +0 -438
  136. package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -301
  137. package/src/api/interop/fdc3/fdc3-2.0.js +0 -482
  138. package/src/api/interop/fdc3/fdc3.d.ts +0 -12
  139. package/src/api/interop/fdc3/fdc3.js +0 -35
  140. package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
  141. package/src/api/interop/fdc3/overrideCheck.js +0 -32
  142. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
  143. package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
  144. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
  145. package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
  146. package/src/api/interop/fdc3/utils.d.ts +0 -45
  147. package/src/api/interop/fdc3/utils.js +0 -239
  148. package/src/api/interop/fdc3/versions.d.ts +0 -1
  149. package/src/api/interop/fdc3/versions.js +0 -2
  150. package/src/api/interop/index.d.ts +0 -4
  151. package/src/api/interop/index.js +0 -20
  152. package/src/api/interop/utils.d.ts +0 -18
  153. package/src/api/interop/utils.js +0 -61
  154. package/src/api/me.d.ts +0 -40
  155. package/src/api/me.js +0 -134
  156. package/src/api/platform/Factory.d.ts +0 -115
  157. package/src/api/platform/Factory.js +0 -184
  158. package/src/api/platform/Instance.d.ts +0 -150
  159. package/src/api/platform/Instance.js +0 -332
  160. package/src/api/platform/common-utils.d.ts +0 -7
  161. package/src/api/platform/common-utils.js +0 -16
  162. package/src/api/platform/index.d.ts +0 -3
  163. package/src/api/platform/index.js +0 -19
  164. package/src/api/platform/layout/Factory.d.ts +0 -114
  165. package/src/api/platform/layout/Factory.js +0 -174
  166. package/src/api/platform/layout/Instance.d.ts +0 -57
  167. package/src/api/platform/layout/Instance.js +0 -126
  168. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
  169. package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
  170. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
  171. package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
  172. package/src/api/platform/layout/entities/layout-entities.d.ts +0 -235
  173. package/src/api/platform/layout/entities/layout-entities.js +0 -312
  174. package/src/api/platform/layout/entities/shapes.d.ts +0 -6
  175. package/src/api/platform/layout/entities/shapes.js +0 -2
  176. package/src/api/platform/layout/index.d.ts +0 -2
  177. package/src/api/platform/layout/index.js +0 -18
  178. package/src/api/platform/layout/layout.constants.d.ts +0 -1
  179. package/src/api/platform/layout/layout.constants.js +0 -4
  180. package/src/api/platform/layout/shapes.d.ts +0 -16
  181. package/src/api/platform/layout/shapes.js +0 -2
  182. package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
  183. package/src/api/platform/layout/utils/layout-traversal.js +0 -65
  184. package/src/api/platform/provider.d.ts +0 -163
  185. package/src/api/platform/provider.js +0 -2
  186. package/src/api/snapshot-source/Factory.d.ts +0 -38
  187. package/src/api/snapshot-source/Factory.js +0 -66
  188. package/src/api/snapshot-source/Instance.d.ts +0 -31
  189. package/src/api/snapshot-source/Instance.js +0 -132
  190. package/src/api/snapshot-source/index.d.ts +0 -3
  191. package/src/api/snapshot-source/index.js +0 -19
  192. package/src/api/snapshot-source/utils.d.ts +0 -2
  193. package/src/api/snapshot-source/utils.js +0 -6
  194. package/src/api/system/index.d.ts +0 -517
  195. package/src/api/system/index.js +0 -895
  196. package/src/api/view/Factory.d.ts +0 -50
  197. package/src/api/view/Factory.js +0 -103
  198. package/src/api/view/Instance.d.ts +0 -487
  199. package/src/api/view/Instance.js +0 -557
  200. package/src/api/view/index.d.ts +0 -3
  201. package/src/api/view/index.js +0 -19
  202. package/src/api/webcontents/main.d.ts +0 -32
  203. package/src/api/webcontents/main.js +0 -156
  204. package/src/api/window/Factory.d.ts +0 -45
  205. package/src/api/window/Factory.js +0 -91
  206. package/src/api/window/Instance.d.ts +0 -1090
  207. package/src/api/window/Instance.js +0 -1349
  208. package/src/api/window/index.d.ts +0 -3
  209. package/src/api/window/index.js +0 -19
  210. package/src/browser.d.ts +0 -10
  211. package/src/browser.js +0 -36
  212. package/src/environment/browser.d.ts +0 -29
  213. package/src/environment/browser.js +0 -60
  214. package/src/environment/environment.d.ts +0 -33
  215. package/src/environment/environment.js +0 -4
  216. package/src/environment/mockEnvironment.d.ts +0 -27
  217. package/src/environment/mockEnvironment.js +0 -61
  218. package/src/environment/node-env.d.ts +0 -29
  219. package/src/environment/node-env.js +0 -72
  220. package/src/fdc3.d.ts +0 -3
  221. package/src/fdc3.js +0 -9
  222. package/src/mock.d.ts +0 -3
  223. package/src/mock.js +0 -18
  224. package/src/namespaces.d.ts +0 -21
  225. package/src/namespaces.js +0 -24
  226. package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
  227. package/src/shapes/ERROR_BOX_TYPES.js +0 -2
  228. package/src/shapes/WebOptions.d.ts +0 -13
  229. package/src/shapes/WebOptions.js +0 -2
  230. package/src/shapes/WindowOptions.d.ts +0 -43
  231. package/src/shapes/WindowOptions.js +0 -2
  232. package/src/shapes/protocol.d.ts +0 -200
  233. package/src/shapes/protocol.js +0 -2
  234. package/src/transport/mockWire.d.ts +0 -11
  235. package/src/transport/mockWire.js +0 -26
  236. package/src/transport/transport-errors.d.ts +0 -31
  237. package/src/transport/transport-errors.js +0 -79
  238. package/src/transport/transport.d.ts +0 -73
  239. package/src/transport/transport.js +0 -219
  240. package/src/transport/wire.d.ts +0 -77
  241. package/src/transport/wire.js +0 -36
  242. package/src/util/asyncFilter.d.ts +0 -1
  243. package/src/util/asyncFilter.js +0 -7
  244. package/src/util/channel-api-relay.d.ts +0 -13
  245. package/src/util/channel-api-relay.js +0 -47
  246. package/src/util/errors.d.ts +0 -10
  247. package/src/util/errors.js +0 -12
  248. package/src/util/exhaustive.d.ts +0 -1
  249. package/src/util/exhaustive.js +0 -7
  250. package/src/util/http.d.ts +0 -11
  251. package/src/util/http.js +0 -90
  252. package/src/util/inaccessibleObject.d.ts +0 -2
  253. package/src/util/inaccessibleObject.js +0 -49
  254. package/src/util/lazy.d.ts +0 -34
  255. package/src/util/lazy.js +0 -54
  256. package/src/util/normalize-config.d.ts +0 -3
  257. package/src/util/normalize-config.js +0 -52
  258. package/src/util/promises.d.ts +0 -5
  259. package/src/util/promises.js +0 -27
  260. package/src/util/ref-counter.d.ts +0 -7
  261. package/src/util/ref-counter.js +0 -52
  262. package/src/util/reversible-map.d.ts +0 -11
  263. package/src/util/reversible-map.js +0 -49
  264. package/src/util/runtimeVersioning.d.ts +0 -3
  265. package/src/util/runtimeVersioning.js +0 -25
  266. package/src/util/utilTypes.d.ts +0 -8
  267. package/src/util/utilTypes.js +0 -2
  268. package/src/util/validate.d.ts +0 -3
  269. package/src/util/validate.js +0 -11
@@ -1,895 +0,0 @@
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
- const events_1 = require("events");
7
- /**
8
- * An object representing the core of OpenFin Runtime. Allows the developer
9
- * to perform system-level actions, such as accessing logs, viewing processes,
10
- * clearing the cache and exiting the runtime as well as listen to <a href="tutorial-System.EventEmitter.html">system events</a>.
11
- * @namespace
12
- */
13
- class System extends base_1.EmitterBase {
14
- constructor(wire) {
15
- super(wire, 'system');
16
- }
17
- sendExternalProcessRequest(action, options) {
18
- return new Promise((resolve, reject) => {
19
- const exitEventKey = 'external-process-exited';
20
- let processUuid;
21
- let exitPayload;
22
- let externalProcessExitHandler;
23
- let ofWindow;
24
- if (typeof options.listener === 'function') {
25
- externalProcessExitHandler = (payload) => {
26
- const data = payload || {};
27
- exitPayload = {
28
- topic: 'exited',
29
- uuid: data.processUuid || '',
30
- exitCode: data.exitCode || 0
31
- };
32
- if (processUuid === payload.processUuid) {
33
- options.listener(exitPayload);
34
- ofWindow.removeListener(exitEventKey, externalProcessExitHandler);
35
- }
36
- };
37
- // window constructor expects the name is not undefined
38
- if (!this.wire.me.name) {
39
- this.wire.me.name = this.wire.me.uuid;
40
- }
41
- ofWindow = new window_1._Window(this.wire, this.wire.me);
42
- ofWindow.on(exitEventKey, externalProcessExitHandler);
43
- }
44
- this.wire
45
- .sendAction(action, options)
46
- .then(({ payload }) => {
47
- processUuid = payload.data.uuid;
48
- resolve(payload.data);
49
- if (exitPayload && processUuid === exitPayload.uuid) {
50
- options.listener(exitPayload);
51
- ofWindow.removeListener(exitEventKey, externalProcessExitHandler);
52
- }
53
- })
54
- .catch((err) => {
55
- if (ofWindow) {
56
- ofWindow.removeListener(exitEventKey, externalProcessExitHandler);
57
- }
58
- reject(err);
59
- });
60
- });
61
- }
62
- /**
63
- * Adds a listener to the end of the listeners array for the specified event.
64
- * @param { string | symbol } eventType - The type of the event.
65
- * @param { Function } listener - Called whenever an event of the specified type occurs.
66
- * @param { SubOptions } [options] - Option to support event timestamps.
67
- * @return {Promise.<this>}
68
- * @function addListener
69
- * @memberof System
70
- * @instance
71
- * @tutorial System.EventEmitter
72
- */
73
- /**
74
- * Adds a listener to the end of the listeners array for the specified event.
75
- * @param { string | symbol } eventType - The type of the event.
76
- * @param { Function } listener - Called whenever an event of the specified type occurs.
77
- * @param { SubOptions } [options] - Option to support event timestamps.
78
- * @return {Promise.<this>}
79
- * @function on
80
- * @memberof System
81
- * @instance
82
- * @tutorial System.EventEmitter
83
- */
84
- /**
85
- * 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.
86
- * @param { string | symbol } eventType - The type of the event.
87
- * @param { Function } listener - The callback function.
88
- * @param { SubOptions } [options] - Option to support event timestamps.
89
- * @return {Promise.<this>}
90
- * @function once
91
- * @memberof System
92
- * @instance
93
- * @tutorial System.EventEmitter
94
- */
95
- /**
96
- * Adds a listener to the beginning of the listeners array for the specified event.
97
- * @param { string | symbol } eventType - The type of the event.
98
- * @param { Function } listener - The callback function.
99
- * @param { SubOptions } [options] - Option to support event timestamps.
100
- * @return {Promise.<this>}
101
- * @function prependListener
102
- * @memberof System
103
- * @instance
104
- * @tutorial System.EventEmitter
105
- */
106
- /**
107
- * 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.
108
- * The listener is added to the beginning of the listeners array.
109
- * @param { string | symbol } eventType - The type of the event.
110
- * @param { Function } listener - The callback function.
111
- * @param { SubOptions } [options] - Option to support event timestamps.
112
- * @return {Promise.<this>}
113
- * @function prependOnceListener
114
- * @memberof System
115
- * @instance
116
- * @tutorial System.EventEmitter
117
- */
118
- /**
119
- * Remove a listener from the listener array for the specified event.
120
- * Caution: Calling this method changes the array indices in the listener array behind the listener.
121
- * @param { string | symbol } eventType - The type of the event.
122
- * @param { Function } listener - The callback function.
123
- * @param { SubOptions } [options] - Option to support event timestamps.
124
- * @return {Promise.<this>}
125
- * @function removeListener
126
- * @memberof System
127
- * @instance
128
- * @tutorial System.EventEmitter
129
- */
130
- /**
131
- * Removes all listeners, or those of the specified event.
132
- * @param { string | symbol } [eventType] - The type of the event.
133
- * @return {Promise.<this>}
134
- * @function removeAllListeners
135
- * @memberof System
136
- * @instance
137
- * @tutorial System.EventEmitter
138
- */
139
- /**
140
- * Returns the version of the runtime. The version contains the major, minor,
141
- * build and revision numbers.
142
- * @return {Promise.<string>}
143
- * @tutorial System.getVersion
144
- */
145
- getVersion() {
146
- return this.wire.sendAction('get-version').then(({ payload }) => payload.data);
147
- }
148
- /**
149
- * Clears cached data containing application resource
150
- * files (images, HTML, JavaScript files), cookies, and items stored in the
151
- * Local Storage.
152
- * @param { ClearCacheOption } options - See tutorial for more details.
153
- * @return {Promise.<void>}
154
- * @tutorial System.clearCache
155
- */
156
- clearCache(options) {
157
- return this.wire.sendAction('clear-cache', options).then(() => undefined);
158
- }
159
- /**
160
- * Clears all cached data when OpenFin Runtime exits.
161
- * @return {Promise.<void>}
162
- * @tutorial System.deleteCacheOnExit
163
- */
164
- deleteCacheOnExit() {
165
- return this.wire.sendAction('delete-cache-request').then(() => undefined);
166
- }
167
- /**
168
- * Exits the Runtime.
169
- * @return {Promise.<void>}
170
- * @tutorial System.exit
171
- */
172
- exit() {
173
- return this.wire.sendAction('exit-desktop').then(() => undefined);
174
- }
175
- /**
176
- * Fetches a JSON manifest using the browser process and returns a Javascript object.
177
- * @param { string } manifestUrl The URL of the manifest to fetch.
178
- * @return {Promise.<any>}
179
- * @tutorial System.fetchManifest
180
- */
181
- async fetchManifest(manifestUrl) {
182
- const { payload: { data } } = await this.wire.sendAction('fetch-manifest', { manifestUrl });
183
- return data;
184
- }
185
- /**
186
- * Writes any unwritten cookies data to disk.
187
- * @return {Promise.<void>}
188
- * @tutorial System.flushCookieStore
189
- */
190
- flushCookieStore() {
191
- return this.wire.sendAction('flush-cookie-store').then(() => undefined);
192
- }
193
- /**
194
- * Retrieves an array of data (name, ids, bounds) for all application windows.
195
- * @return {Promise.Array.<ApplicationWindowInfo>}
196
- * @tutorial System.getAllWindows
197
- */
198
- getAllWindows() {
199
- return this.wire.sendAction('get-all-windows').then(({ payload }) => payload.data);
200
- }
201
- /**
202
- * Retrieves an array of data for all applications.
203
- * @return {Promise.Array.<ApplicationState>}
204
- * @tutorial System.getAllApplications
205
- */
206
- getAllApplications() {
207
- return this.wire.sendAction('get-all-applications').then(({ payload }) => payload.data);
208
- }
209
- /**
210
- * Retrieves the command line argument string that started OpenFin Runtime.
211
- * @return {Promise.<string>}
212
- * @tutorial System.getCommandLineArguments
213
- */
214
- getCommandLineArguments() {
215
- return this.wire.sendAction('get-command-line-arguments').then(({ payload }) => payload.data);
216
- }
217
- /**
218
- * Get the current state of the crash reporter.
219
- * @return {Promise.<CrashReporterState>}
220
- * @tutorial System.getCrashReporterState
221
- */
222
- async getCrashReporterState() {
223
- const { payload: { data: { diagnosticMode, isRunning } } } = await this.wire.sendAction('get-crash-reporter-state');
224
- console.warn('diagnosticMode property is deprecated. It will be removed in a future version');
225
- return {
226
- // diagnosticMode will be removed in a future version
227
- diagnosticMode,
228
- diagnosticsMode: diagnosticMode,
229
- isRunning
230
- };
231
- }
232
- /**
233
- * Start the crash reporter if not already running.
234
- * @param { CrashReporterOptions } options - configure crash reporter
235
- * @return {Promise.<CrashReporterState>}
236
- * @tutorial System.startCrashReporter
237
- */
238
- async startCrashReporter(options) {
239
- const opts = options;
240
- const newOpts = { ...opts, diagnosticMode: opts.diagnosticsMode || opts.diagnosticMode };
241
- const { payload: { data: { diagnosticMode, isRunning } } } = await this.wire.sendAction('start-crash-reporter', newOpts);
242
- return {
243
- // diagnosticMode will be removed in a future version
244
- diagnosticMode,
245
- diagnosticsMode: diagnosticMode,
246
- isRunning
247
- };
248
- }
249
- /**
250
- * Returns a hex encoded hash of the machine id and the currently logged in user name.
251
- * This is the recommended way to uniquely identify a user / machine combination.
252
- * @return {Promise.<string>}
253
- * @tutorial System.getUniqueUserId
254
- * @static
255
- */
256
- getUniqueUserId() {
257
- return this.wire.sendAction('get-unique-user-id').then(({ payload }) => payload.data);
258
- }
259
- /**
260
- * Retrieves a frame info object for the uuid and name passed in
261
- * @param { string } uuid - The UUID of the target.
262
- * @param { string } name - The name of the target.
263
- * @return {Promise.<EntityInfo>}
264
- * @tutorial System.getEntityInfo
265
- */
266
- getEntityInfo(uuid, name) {
267
- return this.wire.sendAction('get-entity-info', { uuid, name }).then(({ payload }) => payload.data);
268
- }
269
- /**
270
- * Gets the value of a given environment variable on the computer on which the runtime is installed
271
- * @return {Promise.<string>}
272
- * @tutorial System.getEnvironmentVariable
273
- */
274
- getEnvironmentVariable(envName) {
275
- return this.wire
276
- .sendAction('get-environment-variable', {
277
- environmentVariables: envName
278
- })
279
- .then(({ payload }) => payload.data);
280
- }
281
- /**
282
- * Get current focused window.
283
- * @return {Promise.<Identity | null>}
284
- * @tutorial System.getFocusedWindow
285
- */
286
- getFocusedWindow() {
287
- return this.wire.sendAction('get-focused-window').then(({ payload }) => payload.data);
288
- }
289
- /**
290
- * Returns information about the given app's certification status
291
- * @return {Promise.<CertifiedAppInfo>}
292
- * @tutorial System.isAppCertified
293
- */
294
- async isAppCertified(manifestUrl) {
295
- const { payload: { data: { certifiedInfo } } } = await this.wire.sendAction('is-app-certified', { manifestUrl });
296
- return certifiedInfo;
297
- }
298
- /**
299
- * Returns an array of all the installed runtime versions in an object.
300
- * @return {Promise.<string[]>}
301
- * @tutorial System.getInstalledRuntimes
302
- */
303
- // incompatible with standalone node process.
304
- getInstalledRuntimes() {
305
- return this.wire.sendAction('get-installed-runtimes').then(({ payload }) => payload.data.runtimes);
306
- }
307
- // incompatible with standalone node process.
308
- async getInstalledApps() {
309
- const { payload: { data: { installedApps } } } = await this.wire.sendAction('get-installed-apps');
310
- return installedApps;
311
- }
312
- /**
313
- * Retrieves the contents of the log with the specified filename.
314
- * @param { GetLogRequestType } options A object that id defined by the GetLogRequestType interface
315
- * @return {Promise.<string>}
316
- * @tutorial System.getLog
317
- */
318
- getLog(options) {
319
- return this.wire.sendAction('view-log', options).then(({ payload }) => payload.data);
320
- }
321
- /**
322
- * Returns a unique identifier (UUID) provided by the machine.
323
- * @return {Promise.<string>}
324
- * @tutorial System.getMachineId
325
- */
326
- getMachineId() {
327
- return this.wire.sendAction('get-machine-id').then(({ payload }) => payload.data);
328
- }
329
- /**
330
- * Returns the minimum (inclusive) logging level that is currently being written to the log.
331
- * @return {Promise.<LogLevel>}
332
- * @tutorial System.getMinLogLevel
333
- */
334
- getMinLogLevel() {
335
- return this.wire.sendAction('get-min-log-level').then(({ payload }) => payload.data);
336
- }
337
- /**
338
- * Retrieves an array containing information for each log file.
339
- * @return {Promise.Array<LogInfo>}
340
- * @tutorial System.getLogList
341
- */
342
- getLogList() {
343
- return this.wire.sendAction('list-logs').then(({ payload }) => payload.data);
344
- }
345
- /**
346
- * Retrieves an object that contains data about the monitor setup of the
347
- * computer that the runtime is running on.
348
- * @return {Promise.<MonitorInfo>}
349
- * @tutorial System.getMonitorInfo
350
- */
351
- getMonitorInfo() {
352
- return this.wire.sendAction('get-monitor-info').then(({ payload }) => payload.data);
353
- }
354
- /**
355
- * Returns the mouse in virtual screen coordinates (left, top).
356
- * @return {Promise.<PointTopLeft>}
357
- * @tutorial System.getMousePosition
358
- */
359
- getMousePosition() {
360
- return this.wire.sendAction('get-mouse-position').then(({ payload }) => payload.data);
361
- }
362
- /**
363
- * Retrieves an array of all of the runtime processes that are currently
364
- * running. Each element in the array is an object containing the uuid
365
- * and the name of the application to which the process belongs.
366
- * @deprecated Please use our new set of process APIs:
367
- * [Window.getProcessInfo]{@link Window#getProcessInfo}
368
- * [View.getProcessInfo]{@link View#getProcessInfo}
369
- * [Application.getProcessInfo]{@link Application#getProcessInfo}
370
- * [System.getAllProcessInfo]{@link System#getAllProcessInfo}
371
- * @return {Promise.Array.<ProcessInfo>}
372
- * @tutorial System.getProcessList
373
- */
374
- getProcessList() {
375
- // eslint-disable-next-line no-console
376
- console.warn('System.getProcessList has been deprecated. Please consider using our new process APIs: Window.getProcessInfo, View.getProcessInfo, Application.getProcessInfo, System.getAllProcessInfo');
377
- return this.wire.sendAction('process-snapshot').then(({ payload }) => payload.data);
378
- }
379
- /**
380
- * Retrieves all process information. This includes the browser process and every process associated to all entities (windows and views).
381
- * @return {Promise.<SystemProcessInfo>}
382
- * @tutorial System.getAllProcessInfo
383
- * @experimental
384
- */
385
- async getAllProcessInfo() {
386
- const { payload: { data } } = await this.wire.sendAction('get-all-process-info', this.identity);
387
- return data;
388
- }
389
- /**
390
- * Retrieves the Proxy settings.
391
- * @return {Promise.<ProxyInfo>}
392
- * @tutorial System.getProxySettings
393
- */
394
- getProxySettings() {
395
- return this.wire.sendAction('get-proxy-settings').then(({ payload }) => payload.data);
396
- }
397
- /**
398
- * Returns information about the running Runtime in an object.
399
- * @return {Promise.<RuntimeInfo>}
400
- * @tutorial System.getRuntimeInfo
401
- */
402
- getRuntimeInfo() {
403
- return this.wire.sendAction('get-runtime-info').then(({ payload }) => payload.data);
404
- }
405
- /**
406
- * Returns information about the running RVM in an object.
407
- * @return {Promise.<RVMInfo>}
408
- * @tutorial System.getRvmInfo
409
- */
410
- // incompatible with standalone node process.
411
- getRvmInfo() {
412
- return this.wire.sendAction('get-rvm-info').then(({ payload }) => payload.data);
413
- }
414
- /**
415
- * Retrieves system information.
416
- * @return {Promise.<HostSpecs>}
417
- * @tutorial System.getHostSpecs
418
- */
419
- getHostSpecs() {
420
- return this.wire.sendAction('get-host-specs').then(({ payload }) => payload.data);
421
- }
422
- /**
423
- * Runs an executable or batch file. A path to the file must be included in options.
424
- * <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
425
- * <br> Note: This method is restricted by default and must be enabled via
426
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>. Also, this api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the assets owned by the application, the enabled downloaded files or the restricted executables.
427
- * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
428
- * @return {Promise.<Identity>}
429
- * @tutorial System.launchExternalProcess
430
- */
431
- launchExternalProcess(options) {
432
- return this.sendExternalProcessRequest('launch-external-process', options);
433
- }
434
- /**
435
- * Monitors a running process. A pid for the process must be included in options.
436
- * <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
437
- * @param { ExternalProcessInfo } options See tutorial for more details
438
- * @return {Promise.<Identity>}
439
- * @tutorial System.monitorExternalProcess
440
- */
441
- monitorExternalProcess(options) {
442
- return this.sendExternalProcessRequest('monitor-external-process', options);
443
- }
444
- /**
445
- * Writes the passed message into both the log file and the console.
446
- * @param { string } level The log level for the entry. Can be either "info", "warning" or "error"
447
- * @param { string } message The log message text
448
- * @return {Promise.<void>}
449
- * @tutorial System.log
450
- */
451
- log(level, message) {
452
- return this.wire.sendAction('write-to-log', { level, message }).then(() => undefined);
453
- }
454
- /**
455
- * Opens the passed URL in the default web browser. It only supports http(s) and fin(s) protocols by default.
456
- * In order to use other custom protocols, they have to be enabled via
457
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
458
- * File protocol and file path are not supported.
459
- * @param { string } url The URL to open
460
- * @return {Promise.<void>}
461
- * @tutorial System.openUrlWithBrowser
462
- */
463
- openUrlWithBrowser(url) {
464
- return this.wire.sendAction('open-url-with-browser', { url }).then(() => undefined);
465
- }
466
- /**
467
- * Removes the process entry for the passed UUID obtained from a prior call
468
- * of fin.System.launchExternalProcess().
469
- * @param { string } uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess()
470
- * @return {Promise.<void>}
471
- * @tutorial System.releaseExternalProcess
472
- */
473
- releaseExternalProcess(uuid) {
474
- return this.wire.sendAction('release-external-process', { uuid }).then(() => undefined);
475
- }
476
- /**
477
- * Shows the Chromium Developer Tools for the specified window
478
- * @param { Identity } identity This is a object that is defined by the Identity interface
479
- * @return {Promise.<void>}
480
- * @tutorial System.showDeveloperTools
481
- */
482
- showDeveloperTools(identity) {
483
- return this.wire.sendAction('show-developer-tools', identity).then(() => undefined);
484
- }
485
- /**
486
- * Attempt to close an external process. The process will be terminated if it
487
- * has not closed after the elapsed timeout in milliseconds.<br>
488
- * Note: This method is restricted by default and must be enabled via
489
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
490
- * @param { TerminateExternalRequestType } options A object defined in the TerminateExternalRequestType interface
491
- * @return {Promise.<void>}
492
- * @tutorial System.terminateExternalProcess
493
- */
494
- terminateExternalProcess(options) {
495
- return this.wire.sendAction('terminate-external-process', options).then(() => undefined);
496
- }
497
- /**
498
- * Update the OpenFin Runtime Proxy settings.
499
- * @param { ProxyConfig } options A config object defined in the ProxyConfig interface
500
- * @return {Promise.<void>}
501
- * @tutorial System.updateProxySettings
502
- */
503
- updateProxySettings(options) {
504
- return this.wire.sendAction('update-proxy', options).then(() => undefined);
505
- }
506
- /**
507
- * Downloads the given application asset<br>
508
- * Note: This method is restricted by default and must be enabled via
509
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
510
- * @param { AppAssetInfo } appAsset App asset object
511
- * @return {Promise.<void>}
512
- * @tutorial System.downloadAsset
513
- */
514
- // incompatible with standalone node process.
515
- async downloadAsset(appAsset, progressListener) {
516
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-empty-function
517
- const noop = () => { };
518
- let resolve = noop;
519
- let reject = noop;
520
- const downloadCompletePromise = new Promise((y, n) => {
521
- resolve = y;
522
- reject = n;
523
- });
524
- // node.js environment not supported
525
- if (this.wire.environment.constructor.name === 'NodeEnvironment') {
526
- throw new transport_errors_1.NotSupportedError('downloadAsset only supported in an OpenFin Render process');
527
- }
528
- const callSite = transport_errors_1.RuntimeError.getCallSite();
529
- const downloadId = this.wire.environment.getNextMessageId().toString();
530
- const dlProgressKey = `asset-download-progress-${downloadId}`;
531
- const dlErrorKey = `asset-download-error-${downloadId}`;
532
- const dlCompleteKey = `asset-download-complete-${downloadId}`;
533
- const dlProgress = (progress) => {
534
- const p = {
535
- downloadedBytes: progress.downloadedBytes,
536
- totalBytes: progress.totalBytes
537
- };
538
- progressListener(p);
539
- };
540
- const cleanListeners = () => {
541
- // TODO: fix internal types
542
- // @ts-expect-error
543
- this.removeListener(dlProgressKey, dlProgress);
544
- };
545
- const dlError = (payload) => {
546
- cleanListeners();
547
- const { reason, err: error } = payload;
548
- reject(new transport_errors_1.RuntimeError({ reason, error }, callSite));
549
- };
550
- const dlComplete = () => {
551
- cleanListeners();
552
- resolve();
553
- };
554
- await Promise.all([
555
- // TODO: fix internal types
556
- // @ts-expect-error
557
- this.on(dlProgressKey, dlProgress),
558
- // TODO: fix internal types
559
- // @ts-expect-error
560
- this.once(dlErrorKey, dlError),
561
- // TODO: fix internal types
562
- // @ts-expect-error
563
- this.once(dlCompleteKey, dlComplete)
564
- ]);
565
- const downloadOptions = Object.assign(appAsset, { downloadId });
566
- await this.wire.sendAction('download-asset', downloadOptions).catch((err) => {
567
- cleanListeners();
568
- throw err;
569
- });
570
- return downloadCompletePromise;
571
- }
572
- /**
573
- * Downloads a version of the runtime.
574
- * @param { RuntimeDownloadOptions } options - Download options.
575
- * @param {Function} [progressListener] - called as the runtime is downloaded with progress information.
576
- * @return {Promise.<void>}
577
- * @tutorial System.downloadRuntime
578
- */
579
- downloadRuntime(options, progressListener) {
580
- const callsites = transport_errors_1.RuntimeError.getCallSite();
581
- return new Promise((resolve, reject) => {
582
- // node.js environment not supported
583
- if (this.wire.environment.constructor.name === 'NodeEnvironment') {
584
- reject(new transport_errors_1.NotSupportedError('downloadRuntime only supported in an OpenFin Render process'));
585
- return;
586
- }
587
- const downloadId = this.wire.environment.getNextMessageId().toString();
588
- const dlProgressKey = `runtime-download-progress-${downloadId}`;
589
- const dlErrorKey = `runtime-download-error-${downloadId}`;
590
- const dlCompleteKey = `runtime-download-complete-${downloadId}`;
591
- const dlProgress = (progress) => {
592
- const p = {
593
- downloadedBytes: progress.downloadedBytes,
594
- totalBytes: progress.totalBytes
595
- };
596
- progressListener(p);
597
- };
598
- const cleanListeners = () => {
599
- // TODO: fix internal types
600
- // @ts-expect-error
601
- this.removeListener(dlProgressKey, dlProgress);
602
- };
603
- const dlError = (payload) => {
604
- cleanListeners();
605
- const { reason, err: error } = payload;
606
- reject(new transport_errors_1.RuntimeError({ reason, error }, callsites));
607
- };
608
- const dlComplete = () => {
609
- cleanListeners();
610
- resolve();
611
- };
612
- // TODO: fix internal types
613
- // @ts-expect-error
614
- this.on(dlProgressKey, dlProgress);
615
- // TODO: fix internal types
616
- // @ts-expect-error
617
- this.once(dlErrorKey, dlError);
618
- // TODO: fix internal types
619
- // @ts-expect-error
620
- this.once(dlCompleteKey, dlComplete);
621
- const downloadOptions = Object.assign(options, { downloadId });
622
- this.wire.sendAction('download-runtime', downloadOptions).catch((err) => {
623
- cleanListeners();
624
- reject(err);
625
- });
626
- });
627
- }
628
- /**
629
- * Download preload scripts from given URLs
630
- * @param {DownloadPreloadOption[]} scripts - URLs of preload scripts. See tutorial for more details.
631
- * @return {Promise.Array<DownloadPreloadInfo>}
632
- * @tutorial System.downloadPreloadScripts
633
- */
634
- downloadPreloadScripts(scripts) {
635
- return this.wire.sendAction('download-preload-scripts', { scripts }).then(({ payload }) => payload.data);
636
- }
637
- /**
638
- * Retrieves an array of data (name, ids, bounds) for all application windows.
639
- * @return {Promise.Array.<Identity>}
640
- * @tutorial System.getAllExternalApplications
641
- */
642
- getAllExternalApplications() {
643
- return this.wire.sendAction('get-all-external-applications').then(({ payload }) => payload.data);
644
- }
645
- /**
646
- * Retrieves app asset information.
647
- * @param { AppAssetRequest } options
648
- * @return {Promise.<AppAssetInfo>}
649
- * @tutorial System.getAppAssetInfo
650
- */
651
- getAppAssetInfo(options) {
652
- return this.wire.sendAction('get-app-asset-info', options).then(({ payload }) => payload.data);
653
- }
654
- /**
655
- * Get additional info of cookies.
656
- * @param { CookieOption } options - See tutorial for more details.
657
- * @return {Promise.Array.<CookieInfo>}
658
- * @tutorial System.getCookies
659
- */
660
- getCookies(options) {
661
- const url = this.wire.environment.getUrl();
662
- const newOptions = Object.assign(options, { url });
663
- return this.wire.sendAction('get-cookies', newOptions).then(({ payload }) => payload.data);
664
- }
665
- /**
666
- * Set the minimum log level above which logs will be written to the OpenFin log
667
- * @param { LogLevel } The minimum level (inclusive) above which all calls to log will be written
668
- * @return {Promise.<void>}
669
- * @tutorial System.setMinLogLevel
670
- */
671
- setMinLogLevel(level) {
672
- return this.wire.sendAction('set-min-log-level', { level }).then(() => undefined);
673
- }
674
- /**
675
- * Retrieves the UUID of the computer on which the runtime is installed
676
- * @param { string } uuid The uuid of the running application
677
- * @return {Promise.<ApplicationType>}
678
- * @tutorial System.resolveUuid
679
- */
680
- resolveUuid(uuid) {
681
- return this.wire
682
- .sendAction('resolve-uuid', {
683
- entityKey: uuid
684
- })
685
- .then(({ payload }) => payload.data);
686
- }
687
- /**
688
- * Retrieves an array of data for all external applications
689
- * @param { Identity } requestingIdentity This object is described in the Identity typedef
690
- * @param { any } data Any data type to pass to the method
691
- * @return {Promise.<any>}
692
- * @ignore
693
- */
694
- executeOnRemote(requestingIdentity, data) {
695
- data.requestingIdentity = requestingIdentity;
696
- return this.wire.ferryAction(data);
697
- }
698
- /**
699
- * Reads the specifed value from the registry.<br>
700
- * Note: This method is restricted by default and must be enabled via
701
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
702
- * @param { string } rootKey - The registry root key.
703
- * @param { string } subkey - The registry key.
704
- * @param { string } value - The registry value name.
705
- * @return {Promise.<RegistryInfo>}
706
- * @tutorial System.readRegistryValue
707
- */
708
- readRegistryValue(rootKey, subkey, value) {
709
- return this.wire
710
- .sendAction('read-registry-value', {
711
- rootKey,
712
- subkey,
713
- value
714
- })
715
- .then(({ payload }) => payload.data);
716
- }
717
- /**
718
- * This function call will register a unique id and produce a token.
719
- * The token can be used to broker an external connection.
720
- * @param { string } uuid - A UUID for the remote connection.
721
- * @return {Promise.<ExternalConnection>}
722
- * @tutorial System.registerExternalConnection
723
- */
724
- registerExternalConnection(uuid) {
725
- return this.wire.sendAction('register-external-connection', { uuid }).then(({ payload }) => payload.data);
726
- }
727
- /**
728
- * Returns the json blob found in the [desktop owner settings](https://openfin.co/documentation/desktop-owner-settings/)
729
- * for the specified service.
730
- * More information about desktop services can be found [here](https://developers.openfin.co/docs/desktop-services).
731
- * @param { ServiceIdentifier } serviceIdentifier An object containing a name key that identifies the service.
732
- * @return {Promise.<ServiceConfiguration>}
733
- * @tutorial System.getServiceConfiguration
734
- */
735
- async getServiceConfiguration(serviceIdentifier) {
736
- if (typeof serviceIdentifier.name !== 'string') {
737
- throw new Error('Must provide an object with a `name` property having a string value');
738
- }
739
- const { name } = serviceIdentifier;
740
- return this.wire.sendAction('get-service-configuration', { name }).then(({ payload }) => payload.data);
741
- }
742
- async getSystemAppConfig(name) {
743
- if (typeof name !== 'string') {
744
- throw new Error('Must provide a string value for name of system app');
745
- }
746
- return this.wire.sendAction('get-system-app-configuration', { name }).then(({ payload }) => payload.data);
747
- }
748
- /**
749
- * Registers a system shutdown handler so user can do some cleanup before system is shutting down.
750
- * Note: Once system shutdown starts, you are unable to cancel it.
751
- * @param { SystemShutdownHandler } handler system shutdown handler
752
- * @return {Promise.<void>}
753
- * @tutorial System.registerShutdownHandler
754
- * @experimental
755
- */
756
- async registerShutdownHandler(handler) {
757
- this.wire.sendAction('system-register-shutdown-handler').catch((e) => {
758
- // don't expose, analytics-only call
759
- });
760
- const SystemShutdownEventName = 'system-shutdown';
761
- const SystemShutdownHandledEventName = 'system-shutdown-handled';
762
- const { uuid, name } = this.wire.me;
763
- const shutdownHandler = (payload) => {
764
- const proceed = () => {
765
- // notify core that the app is ready for shutdown
766
- this.wire.environment.raiseEvent(`application/${SystemShutdownHandledEventName}`, {
767
- uuid,
768
- name,
769
- topic: 'application'
770
- });
771
- };
772
- handler({ proceed });
773
- };
774
- this.on(SystemShutdownEventName, shutdownHandler);
775
- }
776
- /**
777
- * Signals the RVM to perform a health check and returns the results as json.
778
- * @return {Promise.<string[]>}
779
- * @tutorial System.runRvmHealthCheck
780
- */
781
- runRvmHealthCheck() {
782
- return this.wire.sendAction('run-rvm-health-check').then(({ payload }) => payload.data);
783
- }
784
- /**
785
- * Launch application using a manifest URL/path. It differs from Application.startFromManifest in that this API can accept a manifest using the fin protocol.
786
- * @param {string} manifestUrl - The manifest's URL or path.
787
- * @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
788
- * @return {Promise.<Manifest>}
789
- * @experimental
790
- * @tutorial System.launchManifest
791
- * @static
792
- */
793
- async launchManifest(manifestUrl, opts = {}) {
794
- const { subscribe, ..._sendOpts } = opts;
795
- const sendOpts = _sendOpts;
796
- if (subscribe) {
797
- const launchEmitter = new events_1.EventEmitter();
798
- subscribe(launchEmitter);
799
- const AppVersionProgressEventName = 'app-version-progress';
800
- const RuntimeStatusEventName = 'runtime-status';
801
- const AppVersionCompleteEventName = 'app-version-complete';
802
- const AppVersionErrorEventName = 'app-version-error';
803
- // add id to avoid multiple api calls getting duplicated events
804
- const id = this.wire.environment.getNextMessageId().toString();
805
- sendOpts.appVersionId = id;
806
- const supportedEvents = [
807
- AppVersionCompleteEventName,
808
- AppVersionProgressEventName,
809
- RuntimeStatusEventName,
810
- AppVersionErrorEventName
811
- ];
812
- const cleanEventPayload = (payload) => {
813
- // We need to do type castings below to make sure the return type is correct.
814
- const { appVersionId, topic, type: typeWithId, ...rest } = payload;
815
- const type = supportedEvents.find((x) => typeWithId.includes(x));
816
- return {
817
- ...rest,
818
- type
819
- };
820
- };
821
- const appVersionListener = (payload) => {
822
- const cleanPayload = cleanEventPayload(payload);
823
- launchEmitter.emit(cleanPayload.type, cleanPayload);
824
- };
825
- const removeAllListeners = () => {
826
- this.removeListener(`${AppVersionProgressEventName}.${id}`, appVersionListener);
827
- this.removeListener(`${RuntimeStatusEventName}.${id}`, appVersionListener);
828
- this.removeListener(`${AppVersionCompleteEventName}.${id}`, appVersionListener);
829
- this.removeListener(`${AppVersionErrorEventName}.${id}`, appVersionListener);
830
- this.removeListener(`${AppVersionCompleteEventName}.${id}`, removeAllListeners);
831
- this.removeListener(`${AppVersionErrorEventName}.${id}`, removeAllListeners);
832
- };
833
- await Promise.all([
834
- this.on(`${AppVersionProgressEventName}.${id}`, appVersionListener),
835
- this.on(`${RuntimeStatusEventName}.${id}`, appVersionListener),
836
- this.once(`${AppVersionCompleteEventName}.${id}`, appVersionListener),
837
- this.once(`${AppVersionErrorEventName}.${id}`, appVersionListener),
838
- this.once(`${AppVersionCompleteEventName}.${id}`, removeAllListeners),
839
- this.once(`${AppVersionErrorEventName}.${id}`, removeAllListeners)
840
- ]);
841
- }
842
- const response = await this.wire.sendAction('launch-manifest', {
843
- manifestUrl,
844
- opts: sendOpts
845
- });
846
- return response.payload.data.manifest;
847
- }
848
- /**
849
- * Query permission of a secured api in current context.
850
- * @param {string} apiName - The full name of a secured API.
851
- * @return {Promise.<QueryPermissionResult>}
852
- * @tutorial System.queryPermissionForCurrentContext
853
- */
854
- async queryPermissionForCurrentContext(apiName) {
855
- const identity = { uuid: this.wire.me.uuid, name: this.wire.me.name };
856
- const response = await this.wire.sendAction('query-permission-for-current-context', {
857
- apiName,
858
- identity
859
- });
860
- return response.payload.data;
861
- }
862
- // Not documenting, internal use only.
863
- async enableNativeWindowIntegrationProvider(permissions) {
864
- const { payload } = await this.wire.sendAction('enable-native-window-integration-provider', { permissions });
865
- return payload.data;
866
- }
867
- /**
868
- * (Internal) Register the usage of a component with a platform
869
- * @param {OpenFin.RegisterUsageData} options - Object with data and type
870
- * @return {Promise.<void>}
871
- * @tutorial System.registerUsage
872
- */
873
- async registerUsage({ data, type }) {
874
- await this.wire.sendAction('register-usage', { data, type });
875
- }
876
- /**
877
- * Returns an array with all printers of the caller and not all the printers on the desktop.
878
- * @return { Promise.Array.<PrinterInfo> }
879
- * @tutorial System.getPrinters
880
- */
881
- async getPrinters() {
882
- const { payload } = await this.wire.sendAction('system-get-printers');
883
- return payload.data;
884
- }
885
- /**
886
- * Updates Process Logging values: periodic interval and outlier detection entries and interval.
887
- * @param {ProcessLoggingOptions} options Process Logging updatable options.
888
- * @return { Promise<void> }
889
- * @tutorial System.updateProcessLoggingOptions
890
- */
891
- async updateProcessLoggingOptions(options) {
892
- await this.wire.sendAction('system-update-process-logging-options', { options });
893
- }
894
- }
895
- exports.default = System;