@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,412 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Application = void 0;
4
+ /* eslint-disable import/prefer-default-export */
5
+ const base_1 = require("../base");
6
+ const window_1 = require("../window");
7
+ const view_1 = require("../view");
8
+ /**
9
+ * @classdesc An object representing an application. Allows the developer to create,
10
+ * execute, show/close an application as well as listen to <a href="tutorial-Application.EventEmitter.html">application events</a>.
11
+ * @class
12
+ * @hideconstructor
13
+ */
14
+ class Application extends base_1.EmitterBase {
15
+ constructor(wire, identity) {
16
+ super(wire, 'application', identity.uuid);
17
+ this.identity = identity;
18
+ this.window = new window_1._Window(this.wire, {
19
+ uuid: this.identity.uuid,
20
+ name: this.identity.uuid
21
+ });
22
+ }
23
+ windowListFromIdentityList(identityList) {
24
+ const windowList = [];
25
+ identityList.forEach((identity) => {
26
+ windowList.push(new window_1._Window(this.wire, {
27
+ uuid: identity.uuid,
28
+ name: identity.name
29
+ }));
30
+ });
31
+ return windowList;
32
+ }
33
+ /**
34
+ * Adds a listener to the end of the listeners array for the specified event.
35
+ * @param { string | symbol } eventType - The type of the event.
36
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
37
+ * @param { SubOptions } [options] - Option to support event timestamps.
38
+ * @return {Promise.<this>}
39
+ * @function addListener
40
+ * @memberof Application
41
+ * @instance
42
+ * @tutorial Application.EventEmitter
43
+ */
44
+ /**
45
+ * Adds a listener to the end of the listeners array for the specified event.
46
+ * @param { string | symbol } eventType - The type of the event.
47
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
48
+ * @param { SubOptions } [options] - Option to support event timestamps.
49
+ * @return {Promise.<this>}
50
+ * @function on
51
+ * @memberof Application
52
+ * @instance
53
+ * @tutorial Application.EventEmitter
54
+ */
55
+ /**
56
+ * 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.
57
+ * @param { string | symbol } eventType - The type of the event.
58
+ * @param { Function } listener - The callback function.
59
+ * @param { SubOptions } [options] - Option to support event timestamps.
60
+ * @return {Promise.<this>}
61
+ * @function once
62
+ * @memberof Application
63
+ * @instance
64
+ * @tutorial Application.EventEmitter
65
+ */
66
+ /**
67
+ * Adds a listener to the beginning of the listeners array for the specified event.
68
+ * @param { string | symbol } eventType - The type of the event.
69
+ * @param { Function } listener - The callback function.
70
+ * @param { SubOptions } [options] - Option to support event timestamps.
71
+ * @return {Promise.<this>}
72
+ * @function prependListener
73
+ * @memberof Application
74
+ * @instance
75
+ * @tutorial Application.EventEmitter
76
+ */
77
+ /**
78
+ * 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.
79
+ * The listener is added to the beginning of the listeners array.
80
+ * @param { string | symbol } eventType - The type of the event.
81
+ * @param { Function } listener - The callback function.
82
+ * @param { SubOptions } [options] - Option to support event timestamps.
83
+ * @return {Promise.<this>}
84
+ * @function prependOnceListener
85
+ * @memberof Application
86
+ * @instance
87
+ * @tutorial Application.EventEmitter
88
+ */
89
+ /**
90
+ * Remove a listener from the listener array for the specified event.
91
+ * Caution: Calling this method changes the array indices in the listener array behind the listener.
92
+ * @param { string | symbol } eventType - The type of the event.
93
+ * @param { Function } listener - The callback function.
94
+ * @param { SubOptions } [options] - Option to support event timestamps.
95
+ * @return {Promise.<this>}
96
+ * @function removeListener
97
+ * @memberof Application
98
+ * @instance
99
+ * @tutorial Application.EventEmitter
100
+ */
101
+ /**
102
+ * Removes all listeners, or those of the specified event.
103
+ * @param { string | symbol } [eventType] - The type of the event.
104
+ * @return {Promise.<this>}
105
+ * @function removeAllListeners
106
+ * @memberof Application
107
+ * @instance
108
+ * @tutorial Application.EventEmitter
109
+ */
110
+ /**
111
+ * Determines if the application is currently running.
112
+ * @return {Promise.<boolean>}
113
+ * @tutorial Application.isRunning
114
+ */
115
+ /**
116
+ * JumpListCategory interface
117
+ * @typedef { object } JumpListCategory
118
+ * @property { string } name The display title for the category. If omitted, items in this category will be placed into the standard 'Tasks' category. There can be only one such category, and it will always be displayed at the bottom of the JumpList.
119
+ * @property { JumpListItem[] } items Array of JumpListItem objects
120
+ */
121
+ /**
122
+ * JumpListItem interface
123
+ * @typedef { object } JumpListItem
124
+ * @property { string } type One of the following: "task" or "separator". Defaults to task.
125
+ * @property { string } title The text to be displayed for the JumpList Item. Should only be set if type is "task".
126
+ * @property { string } description Description of the task (displayed in a tooltip). Should only be set if type is "task".
127
+ * @property { string } deepLink Deep link to a manifest, i.e: fins://path.to/manifest.json?$$param1=value1. See {@link https://developers.openfin.co/docs/deep-linking deep-linking} for more information.
128
+ * @property { string } iconPath The absolute path to an icon to be displayed for the item, which can be an arbitrary resource file that contains an icon (e.g. .ico, .exe, .dll).
129
+ * @property { number } iconIndex The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.
130
+ */
131
+ isRunning() {
132
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
133
+ }
134
+ /**
135
+ * Closes the application and any child windows created by the application.
136
+ * Cleans the application from state so it is no longer found in getAllApplications.
137
+ * @param { boolean } [force = false] Close will be prevented from closing when force is false and
138
+ * ‘close-requested’ has been subscribed to for application’s main window.
139
+ * @return {Promise.<boolean>}
140
+ * @tutorial Application.quit
141
+ */
142
+ async quit(force = false) {
143
+ await this._close(force);
144
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
145
+ }
146
+ _close(force = false) {
147
+ return this.wire.sendAction('close-application', { force, ...this.identity }).then(() => undefined);
148
+ }
149
+ close(force = false) {
150
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
151
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
152
+ // we do not want to expose this error, just continue if this analytics-only call fails
153
+ });
154
+ return this._close(force);
155
+ }
156
+ /**
157
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
158
+ * @return {Promise.Array.<_Window>}
159
+ * @tutorial Application.getChildWindows
160
+ */
161
+ getChildWindows() {
162
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
163
+ const identityList = [];
164
+ payload.data.forEach((winName) => {
165
+ identityList.push({ uuid: this.identity.uuid, name: winName });
166
+ });
167
+ return this.windowListFromIdentityList(identityList);
168
+ });
169
+ }
170
+ /**
171
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
172
+ * if the application was not created from a manifest.
173
+ * @return {Promise.<any>}
174
+ * @tutorial Application.getManifest
175
+ */
176
+ getManifest() {
177
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
178
+ }
179
+ /**
180
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
181
+ * if the application was created from a manifest.
182
+ * @return {Promise.<string>}
183
+ * @tutorial Application.getParentUuid
184
+ */
185
+ getParentUuid() {
186
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
187
+ }
188
+ /**
189
+ * Retrieves current application's shortcut configuration.
190
+ * @return {Promise.<ShortCutConfig>}
191
+ * @tutorial Application.getShortcuts
192
+ */
193
+ getShortcuts() {
194
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
195
+ }
196
+ /**
197
+ * Retrieves current application's views.
198
+ * @experimental
199
+ * @return {Promise.Array.<View>}
200
+ * @tutorial Application.getViews
201
+ */
202
+ async getViews() {
203
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
204
+ return payload.data.map((id) => new view_1.View(this.wire, id));
205
+ }
206
+ /**
207
+ * Returns the current zoom level of the application.
208
+ * @return {Promise.<number>}
209
+ * @tutorial Application.getZoomLevel
210
+ */
211
+ getZoomLevel() {
212
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
213
+ }
214
+ /**
215
+ * Returns an instance of the main Window of the application
216
+ * @return {Promise.<_Window>}
217
+ * @tutorial Application.getWindow
218
+ */
219
+ getWindow() {
220
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
221
+ // we do not want to expose this error, just continue if this analytics-only call fails
222
+ });
223
+ return Promise.resolve(this.window);
224
+ }
225
+ /**
226
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
227
+ * @param { string } userName - username to be passed to the RVM.
228
+ * @param { string } appName - app name to be passed to the RVM.
229
+ * @return {Promise.<void>}
230
+ * @tutorial Application.registerUser
231
+ */
232
+ registerUser(userName, appName) {
233
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
234
+ }
235
+ /**
236
+ * Removes the application’s icon from the tray.
237
+ * @return {Promise.<void>}
238
+ * @tutorial Application.removeTrayIcon
239
+ */
240
+ removeTrayIcon() {
241
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
242
+ }
243
+ /**
244
+ * Restarts the application.
245
+ * @return {Promise.<void>}
246
+ * @tutorial Application.restart
247
+ */
248
+ restart() {
249
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
250
+ }
251
+ /**
252
+ * DEPRECATED method to run the application.
253
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
254
+ * @return {Promise.<void>}
255
+ * @tutorial Application.run
256
+ * @ignore
257
+ */
258
+ run() {
259
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
260
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
261
+ // we do not want to expose this error, just continue if this analytics-only call fails
262
+ });
263
+ return this._run();
264
+ }
265
+ _run(opts = {}) {
266
+ return this.wire
267
+ .sendAction('run-application', {
268
+ manifestUrl: this._manifestUrl,
269
+ opts,
270
+ ...this.identity
271
+ })
272
+ .then(() => undefined);
273
+ }
274
+ /**
275
+ * Instructs the RVM to schedule one restart of the application.
276
+ * @return {Promise.<void>}
277
+ * @tutorial Application.scheduleRestart
278
+ */
279
+ scheduleRestart() {
280
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
281
+ }
282
+ /**
283
+ * Sends a message to the RVM to upload the application's logs. On success,
284
+ * an object containing logId is returned.
285
+ * @return {Promise.<LogInfo>}
286
+ * @tutorial Application.sendApplicationLog
287
+ */
288
+ async sendApplicationLog() {
289
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
290
+ return payload.data;
291
+ }
292
+ /**
293
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
294
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
295
+ * Note: If the "name" property is omitted it defaults to "tasks".
296
+ * @param { Array.<JumpListCategory> | null } jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
297
+ * @return { Promise.<void> }
298
+ * @tutorial Application.setJumpList
299
+ */
300
+ async setJumpList(jumpListCategories) {
301
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
302
+ }
303
+ /**
304
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
305
+ * @param { string } icon Image URL or base64 encoded string to be used as the icon
306
+ * @return {Promise.<void>}
307
+ * @tutorial Application.setTrayIcon
308
+ */
309
+ setTrayIcon(icon) {
310
+ return this.wire
311
+ .sendAction('set-tray-icon', {
312
+ enabledIcon: icon,
313
+ ...this.identity
314
+ })
315
+ .then(() => undefined);
316
+ }
317
+ /**
318
+ * Sets new application's shortcut configuration. Windows only.
319
+ * @param { ShortCutConfig } config New application's shortcut configuration.
320
+ * @param { boolean } [config.desktop] - Enable/disable desktop shortcut.
321
+ * @param { boolean } [config.startMenu] - Enable/disable start menu shortcut.
322
+ * @param { boolean } [config.systemStartup] - Enable/disable system startup shortcut.
323
+ * @return {Promise.<void>}
324
+ * @tutorial Application.setShortcuts
325
+ */
326
+ setShortcuts(config) {
327
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
328
+ }
329
+ /**
330
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
331
+ * @param { string } queryString The new query string for this app's shortcuts.
332
+ * @return {Promise.<void>}
333
+ * @tutorial Application.setShortcutQueryParams
334
+ */
335
+ async setShortcutQueryParams(queryString) {
336
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
337
+ }
338
+ /**
339
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
340
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
341
+ * @param { number } level The zoom level
342
+ * @return {Promise.<void>}
343
+ * @tutorial Application.setZoomLevel
344
+ */
345
+ setZoomLevel(level) {
346
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
347
+ }
348
+ /**
349
+ * Sets a username to correlate with App Log Management.
350
+ * @param { string } username Username to correlate with App's Log.
351
+ * @return {Promise.<void>}
352
+ * @tutorial Application.setAppLogUsername
353
+ */
354
+ async setAppLogUsername(username) {
355
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
356
+ }
357
+ /**
358
+ * @summary Retrieves information about the system tray.
359
+ * @desc The only information currently returned is the position and dimensions.
360
+ * @return {Promise.<TrayInfo>}
361
+ * @tutorial Application.getTrayIconInfo
362
+ */
363
+ getTrayIconInfo() {
364
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
365
+ }
366
+ /**
367
+ * Closes the application by terminating its process.
368
+ * @return {Promise.<void>}
369
+ * @tutorial Application.terminate
370
+ */
371
+ terminate() {
372
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
373
+ }
374
+ /**
375
+ * Waits for a hanging application. This method can be called in response to an application
376
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
377
+ * message after a certain period of time.
378
+ * @return {Promise.<void>}
379
+ * @ignore
380
+ */
381
+ wait() {
382
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
383
+ }
384
+ /**
385
+ * Retrieves information about the application.
386
+ * @return {Promise.<ApplicationInfo>}
387
+ * @tutorial Application.getInfo
388
+ */
389
+ getInfo() {
390
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
391
+ }
392
+ /**
393
+ * Retrieves all process information for entities (windows and views) associated with an application.
394
+ * @return {Promise.<AppProcessInfo>}
395
+ * @tutorial Application.getProcessInfo
396
+ * @experimental
397
+ */
398
+ async getProcessInfo() {
399
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
400
+ return data;
401
+ }
402
+ /**
403
+ * Sets file auto download location.
404
+ * @param { string } downloadLocation file auto download location
405
+ * @return {Promise.<void>}
406
+ * @tutorial Application.setFileDownloadLocation
407
+ */
408
+ async setFileDownloadLocation(downloadLocation) {
409
+ await this.wire.sendAction('set-file-download-location', { downloadLocation, ...this.identity });
410
+ }
411
+ }
412
+ exports.Application = Application;
@@ -0,0 +1,3 @@
1
+ import ApplicationModule from './Factory';
2
+ export * from './Instance';
3
+ export default ApplicationModule;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ }
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ const Factory_1 = require("./Factory");
14
+ __exportStar(require("./Instance"), exports);
15
+ exports.default = Factory_1.default;
@@ -0,0 +1,43 @@
1
+ import { EventEmitter } from 'events';
2
+ import Transport from '../transport/transport';
3
+ import { BaseEventMap } from './events/base';
4
+ import Fin from './fin';
5
+ import ApplicationIdentity = OpenFin.ApplicationIdentity;
6
+ import Identity = OpenFin.Identity;
7
+ export declare class Base {
8
+ wire: Transport;
9
+ constructor(wire: Transport);
10
+ protected get fin(): Fin;
11
+ get me(): Identity;
12
+ protected isNodeEnvironment: () => boolean;
13
+ protected isOpenFinEnvironment: () => boolean;
14
+ }
15
+ export declare class EmitterBase<EventTypes extends BaseEventMap> extends Base {
16
+ #private;
17
+ private topic;
18
+ protected identity: ApplicationIdentity;
19
+ constructor(wire: Transport, topic: string, ...additionalAccessors: string[]);
20
+ eventNames: () => (string | symbol)[];
21
+ emit: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventName: E, payload: E extends Extract<keyof EventTypes, string> ? EventTypes[E] : any, ...args: any[]) => boolean;
22
+ private hasEmitter;
23
+ private getOrCreateEmitter;
24
+ listeners: (type: string | symbol) => Function[];
25
+ listenerCount: (type: string | symbol) => number;
26
+ protected registerEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
27
+ protected deregisterEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
28
+ on: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
29
+ addListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
30
+ once: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
31
+ prependListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
32
+ prependOnceListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
33
+ removeListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
34
+ protected deregisterAllListeners: (eventType: Extract<keyof EventTypes, string> | string | symbol) => Promise<EventEmitter | void>;
35
+ removeAllListeners: (eventType?: Extract<keyof EventTypes, string> | string | symbol) => Promise<this>;
36
+ private deleteEmitterIfNothingRegistered;
37
+ }
38
+ export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
39
+ topic: TOPIC;
40
+ type: TYPE;
41
+ uuid: string;
42
+ name: string;
43
+ }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
+ if (!privateMap.has(receiver)) {
4
+ throw new TypeError("attempted to set private field on non-instance");
5
+ }
6
+ privateMap.set(receiver, value);
7
+ return value;
8
+ };
9
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
+ if (!privateMap.has(receiver)) {
11
+ throw new TypeError("attempted to get private field on non-instance");
12
+ }
13
+ return privateMap.get(receiver);
14
+ };
15
+ var _emitterAccessor;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Reply = exports.EmitterBase = exports.Base = void 0;
18
+ const promises_1 = require("../util/promises");
19
+ const fin_store_1 = require("../transport/fin_store");
20
+ class Base {
21
+ constructor(wire) {
22
+ this.isNodeEnvironment = () => {
23
+ return this.wire.environment.constructor.name === 'NodeEnvironment';
24
+ };
25
+ this.isOpenFinEnvironment = () => {
26
+ return this.wire.environment.constructor.name === 'OpenFinEnvironment';
27
+ };
28
+ this.wire = wire;
29
+ }
30
+ get fin() {
31
+ return fin_store_1.getFin(this.wire);
32
+ }
33
+ get me() {
34
+ return this.wire.me;
35
+ }
36
+ }
37
+ exports.Base = Base;
38
+ class EmitterBase extends Base {
39
+ constructor(wire, topic, ...additionalAccessors) {
40
+ super(wire);
41
+ this.topic = topic;
42
+ _emitterAccessor.set(this, void 0);
43
+ this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
44
+ this.emit = (eventName, payload, ...args) => {
45
+ return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventName, payload, ...args) : false;
46
+ };
47
+ this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this, _emitterAccessor));
48
+ this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this, _emitterAccessor));
49
+ this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
50
+ this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
51
+ this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
52
+ const runtimeEvent = {
53
+ ...this.identity,
54
+ timestamp: options.timestamp || Date.now(),
55
+ topic: this.topic,
56
+ type: eventType
57
+ };
58
+ const emitter = this.getOrCreateEmitter();
59
+ // We apply the subscription and then undo if the async call fails to avoid
60
+ // indeterminacy in subscription application order, which can break things elsewhere
61
+ applySubscription(emitter);
62
+ try {
63
+ await this.wire.sendAction('subscribe-to-desktop-event', runtimeEvent);
64
+ }
65
+ catch (e) {
66
+ undoSubscription(emitter);
67
+ this.deleteEmitterIfNothingRegistered(emitter);
68
+ throw e;
69
+ }
70
+ };
71
+ this.deregisterEventListener = async (eventType, options = {}) => {
72
+ if (this.hasEmitter()) {
73
+ const runtimeEvent = {
74
+ ...this.identity,
75
+ timestamp: options.timestamp || Date.now(),
76
+ topic: this.topic,
77
+ type: eventType
78
+ };
79
+ await this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null);
80
+ const emitter = this.getOrCreateEmitter();
81
+ return emitter;
82
+ }
83
+ // This will only be reached if unsubscribe from event that does not exist but do not want to error here
84
+ return Promise.resolve();
85
+ };
86
+ this.on = async (eventType, listener, options) => {
87
+ await this.registerEventListener(eventType, options, (emitter) => {
88
+ emitter.on(eventType, listener);
89
+ }, (emitter) => {
90
+ emitter.removeListener(eventType, listener);
91
+ });
92
+ return this;
93
+ };
94
+ this.addListener = this.on;
95
+ this.once = async (eventType, listener, options) => {
96
+ const deregister = () => this.deregisterEventListener(eventType);
97
+ await this.registerEventListener(eventType, options, (emitter) => {
98
+ emitter.once(eventType, deregister);
99
+ emitter.once(eventType, listener);
100
+ }, (emitter) => {
101
+ emitter.removeListener(eventType, deregister);
102
+ emitter.removeListener(eventType, listener);
103
+ });
104
+ return this;
105
+ };
106
+ this.prependListener = async (eventType, listener, options) => {
107
+ await this.registerEventListener(eventType, options, (emitter) => {
108
+ emitter.prependListener(eventType, listener);
109
+ }, (emitter) => {
110
+ emitter.removeListener(eventType, listener);
111
+ });
112
+ return this;
113
+ };
114
+ this.prependOnceListener = async (eventType, listener, options) => {
115
+ const deregister = () => this.deregisterEventListener(eventType);
116
+ await this.registerEventListener(eventType, options, (emitter) => {
117
+ emitter.prependOnceListener(eventType, listener);
118
+ emitter.once(eventType, deregister);
119
+ }, (emitter) => {
120
+ emitter.removeListener(eventType, listener);
121
+ emitter.removeListener(eventType, deregister);
122
+ });
123
+ return this;
124
+ };
125
+ this.removeListener = async (eventType, listener, options) => {
126
+ const emitter = await this.deregisterEventListener(eventType, options);
127
+ if (emitter) {
128
+ emitter.removeListener(eventType, listener);
129
+ this.deleteEmitterIfNothingRegistered(emitter);
130
+ }
131
+ return this;
132
+ };
133
+ this.deregisterAllListeners = async (eventType) => {
134
+ const runtimeEvent = { ...this.identity, type: eventType, topic: this.topic };
135
+ if (this.hasEmitter()) {
136
+ const emitter = this.getOrCreateEmitter();
137
+ const refCount = emitter.listenerCount(runtimeEvent.type);
138
+ const unsubscribePromises = [];
139
+ for (let i = 0; i < refCount; i++) {
140
+ unsubscribePromises.push(this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null));
141
+ }
142
+ await Promise.all(unsubscribePromises);
143
+ return emitter;
144
+ }
145
+ return undefined;
146
+ };
147
+ this.removeAllListeners = async (eventType) => {
148
+ const removeByEvent = async (event) => {
149
+ const emitter = await this.deregisterAllListeners(event);
150
+ if (emitter) {
151
+ emitter.removeAllListeners(event);
152
+ this.deleteEmitterIfNothingRegistered(emitter);
153
+ }
154
+ };
155
+ if (eventType) {
156
+ await removeByEvent(eventType);
157
+ }
158
+ else if (this.hasEmitter()) {
159
+ const events = this.getOrCreateEmitter().eventNames();
160
+ await promises_1.promiseMap(events, removeByEvent);
161
+ }
162
+ return this;
163
+ };
164
+ __classPrivateFieldSet(this, _emitterAccessor, [topic, ...additionalAccessors]);
165
+ this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
166
+ }
167
+ deleteEmitterIfNothingRegistered(emitter) {
168
+ if (emitter.eventNames().length === 0) {
169
+ this.wire.eventAggregator.delete(__classPrivateFieldGet(this, _emitterAccessor));
170
+ }
171
+ }
172
+ }
173
+ exports.EmitterBase = EmitterBase;
174
+ _emitterAccessor = new WeakMap();
175
+ class Reply {
176
+ }
177
+ exports.Reply = Reply;