@openfin/core 25.68.30 → 25.70.2

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 (199) hide show
  1. package/OpenFin.d.ts +30 -826
  2. package/README.md +12 -2
  3. package/package.json +1 -1
  4. package/src/api/application/Factory.d.ts +145 -145
  5. package/src/api/application/Factory.js +229 -229
  6. package/src/api/application/Instance.d.ts +301 -302
  7. package/src/api/application/Instance.js +412 -412
  8. package/src/api/application/index.d.ts +3 -3
  9. package/src/api/application/index.js +15 -15
  10. package/src/api/base.d.ts +43 -43
  11. package/src/api/base.js +177 -177
  12. package/src/api/clipboard/index.d.ts +69 -69
  13. package/src/api/clipboard/index.js +88 -88
  14. package/src/api/events/application.d.ts +69 -0
  15. package/src/api/events/application.js +2 -0
  16. package/src/api/events/base.d.ts +17 -0
  17. package/src/api/events/base.js +2 -0
  18. package/src/api/events/channel.d.ts +10 -11
  19. package/src/api/events/channel.js +2 -2
  20. package/src/api/events/emitterMap.d.ts +11 -11
  21. package/src/api/events/emitterMap.js +35 -35
  22. package/src/api/events/eventAggregator.d.ts +5 -5
  23. package/src/api/events/eventAggregator.js +43 -43
  24. package/src/api/events/externalApplication.d.ts +5 -0
  25. package/src/api/events/externalApplication.js +2 -0
  26. package/src/api/events/frame.d.ts +9 -0
  27. package/src/api/events/frame.js +2 -0
  28. package/src/api/events/globalHotkey.d.ts +10 -0
  29. package/src/api/events/globalHotkey.js +2 -0
  30. package/src/api/events/platform.d.ts +18 -0
  31. package/src/api/events/platform.js +2 -0
  32. package/src/api/events/system.d.ts +22 -0
  33. package/src/api/events/system.js +2 -0
  34. package/src/api/events/view.d.ts +56 -0
  35. package/src/api/events/view.js +2 -0
  36. package/src/api/events/webcontents.d.ts +48 -0
  37. package/src/api/events/webcontents.js +2 -0
  38. package/src/api/events/window.d.ts +176 -0
  39. package/src/api/events/window.js +2 -0
  40. package/src/api/external-application/Factory.d.ts +26 -26
  41. package/src/api/external-application/Factory.js +40 -40
  42. package/src/api/external-application/Instance.d.ts +101 -102
  43. package/src/api/external-application/Instance.js +109 -109
  44. package/src/api/external-application/index.d.ts +3 -3
  45. package/src/api/external-application/index.js +15 -15
  46. package/src/api/fin.d.ts +49 -49
  47. package/src/api/fin.js +43 -43
  48. package/src/api/frame/Factory.d.ts +36 -36
  49. package/src/api/frame/Factory.js +69 -69
  50. package/src/api/frame/Instance.d.ts +121 -121
  51. package/src/api/frame/Instance.js +130 -130
  52. package/src/api/frame/index.d.ts +3 -3
  53. package/src/api/frame/index.js +15 -15
  54. package/src/api/global-hotkey/index.d.ts +38 -38
  55. package/src/api/global-hotkey/index.js +58 -58
  56. package/src/api/interappbus/channel/channel.d.ts +26 -26
  57. package/src/api/interappbus/channel/channel.js +77 -77
  58. package/src/api/interappbus/channel/channels-docs.d.ts +318 -318
  59. package/src/api/interappbus/channel/channels-docs.js +376 -376
  60. package/src/api/interappbus/channel/client.d.ts +22 -22
  61. package/src/api/interappbus/channel/client.js +84 -84
  62. package/src/api/interappbus/channel/connection-manager.d.ts +28 -28
  63. package/src/api/interappbus/channel/connection-manager.js +244 -244
  64. package/src/api/interappbus/channel/index.d.ts +22 -23
  65. package/src/api/interappbus/channel/index.js +121 -121
  66. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -13
  67. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -73
  68. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -22
  69. package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -84
  70. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -20
  71. package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -58
  72. package/src/api/interappbus/channel/protocols/index.d.ts +44 -44
  73. package/src/api/interappbus/channel/protocols/index.js +2 -2
  74. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -10
  75. package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -43
  76. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -23
  77. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -135
  78. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -30
  79. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -131
  80. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -22
  81. package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -87
  82. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -13
  83. package/src/api/interappbus/channel/protocols/strategy-types.js +2 -2
  84. package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -15
  85. package/src/api/interappbus/channel/protocols/strategy.js +2 -2
  86. package/src/api/interappbus/channel/provider.d.ts +31 -31
  87. package/src/api/interappbus/channel/provider.js +160 -160
  88. package/src/api/interappbus/index.d.ts +85 -86
  89. package/src/api/interappbus/index.js +175 -175
  90. package/src/api/interop/Factory.d.ts +37 -37
  91. package/src/api/interop/Factory.js +54 -54
  92. package/src/api/interop/InteropBroker.d.ts +363 -363
  93. package/src/api/interop/InteropBroker.js +914 -914
  94. package/src/api/interop/InteropClient.d.ts +268 -268
  95. package/src/api/interop/InteropClient.js +450 -450
  96. package/src/api/interop/SessionContextGroupBroker.d.ts +26 -26
  97. package/src/api/interop/SessionContextGroupBroker.js +107 -107
  98. package/src/api/interop/SessionContextGroupClient.d.ts +20 -20
  99. package/src/api/interop/SessionContextGroupClient.js +85 -85
  100. package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -187
  101. package/src/api/interop/fdc3/fdc3-1.2.js +385 -385
  102. package/src/api/interop/fdc3/fdc3.js +17 -17
  103. package/src/api/interop/fdc3/utils.d.ts +6 -6
  104. package/src/api/interop/fdc3/utils.js +17 -17
  105. package/src/api/interop/index.d.ts +4 -4
  106. package/src/api/interop/index.js +16 -16
  107. package/src/api/interop/utils.d.ts +11 -11
  108. package/src/api/interop/utils.js +36 -36
  109. package/src/api/me.d.ts +38 -35
  110. package/src/api/me.js +128 -60
  111. package/src/api/platform/Factory.d.ts +109 -109
  112. package/src/api/platform/Factory.js +188 -188
  113. package/src/api/platform/Instance.d.ts +122 -122
  114. package/src/api/platform/Instance.js +298 -298
  115. package/src/api/platform/common-utils.d.ts +6 -6
  116. package/src/api/platform/common-utils.js +16 -16
  117. package/src/api/platform/index.d.ts +3 -3
  118. package/src/api/platform/index.js +15 -15
  119. package/src/api/platform/layout/Factory.d.ts +108 -108
  120. package/src/api/platform/layout/Factory.js +189 -189
  121. package/src/api/platform/layout/Instance.d.ts +49 -49
  122. package/src/api/platform/layout/Instance.js +99 -99
  123. package/src/api/platform/layout/index.d.ts +2 -2
  124. package/src/api/platform/layout/index.js +14 -14
  125. package/src/api/platform/layout/shapes.d.ts +11 -0
  126. package/src/api/{window → platform/layout}/shapes.js +2 -2
  127. package/src/api/snapshot-source/Factory.d.ts +36 -36
  128. package/src/api/snapshot-source/Factory.js +65 -65
  129. package/src/api/snapshot-source/Instance.d.ts +30 -30
  130. package/src/api/snapshot-source/Instance.js +134 -134
  131. package/src/api/snapshot-source/index.d.ts +3 -3
  132. package/src/api/snapshot-source/index.js +15 -15
  133. package/src/api/snapshot-source/utils.d.ts +1 -1
  134. package/src/api/snapshot-source/utils.js +5 -5
  135. package/src/api/system/index.d.ts +960 -961
  136. package/src/api/system/index.js +1241 -1241
  137. package/src/api/view/Factory.d.ts +49 -49
  138. package/src/api/view/Factory.js +103 -103
  139. package/src/api/view/Instance.d.ts +387 -380
  140. package/src/api/view/Instance.js +422 -415
  141. package/src/api/view/index.d.ts +3 -3
  142. package/src/api/view/index.js +15 -15
  143. package/src/api/webcontents/main.d.ts +36 -36
  144. package/src/api/webcontents/main.js +82 -82
  145. package/src/api/window/Factory.d.ts +44 -44
  146. package/src/api/window/Factory.js +91 -91
  147. package/src/api/window/Instance.d.ts +972 -966
  148. package/src/api/window/Instance.js +1209 -1202
  149. package/src/api/window/index.d.ts +3 -5
  150. package/src/api/window/index.js +15 -17
  151. package/src/environment/environment.d.ts +28 -25
  152. package/src/environment/environment.js +4 -4
  153. package/src/environment/node-env.d.ts +25 -26
  154. package/src/environment/node-env.js +64 -64
  155. package/src/environment/openfin-env.d.ts +29 -30
  156. package/src/environment/openfin-env.js +107 -107
  157. package/src/mock.d.ts +3 -3
  158. package/src/mock.js +91 -90
  159. package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -0
  160. package/src/shapes/ERROR_BOX_TYPES.js +2 -0
  161. package/src/shapes/WebOptions.d.ts +12 -0
  162. package/src/shapes/WebOptions.js +2 -0
  163. package/src/shapes/WindowOptions.d.ts +42 -0
  164. package/src/shapes/WindowOptions.js +2 -0
  165. package/src/shapes/protocol.d.ts +178 -0
  166. package/src/shapes/protocol.js +2 -0
  167. package/src/transport/fin_store.d.ts +4 -4
  168. package/src/transport/fin_store.js +16 -16
  169. package/src/transport/transport-errors.d.ts +18 -18
  170. package/src/transport/transport-errors.js +37 -37
  171. package/src/transport/transport.d.ts +56 -43
  172. package/src/transport/transport.js +181 -181
  173. package/src/transport/wire.d.ts +71 -11
  174. package/src/transport/wire.js +32 -32
  175. package/src/util/asyncFilter.d.ts +1 -1
  176. package/src/util/asyncFilter.js +7 -7
  177. package/src/util/errors.d.ts +9 -5
  178. package/src/util/errors.js +11 -11
  179. package/src/util/exhaustive.d.ts +1 -1
  180. package/src/util/exhaustive.js +7 -7
  181. package/src/util/http.d.ts +11 -11
  182. package/src/util/http.js +83 -83
  183. package/src/util/normalize-config.d.ts +3 -5
  184. package/src/util/normalize-config.js +47 -47
  185. package/src/util/promises.d.ts +5 -5
  186. package/src/util/promises.js +27 -27
  187. package/src/util/ref-counter.d.ts +7 -7
  188. package/src/util/ref-counter.js +51 -51
  189. package/src/util/runtimeVersioning.d.ts +3 -3
  190. package/src/util/runtimeVersioning.js +25 -25
  191. package/src/util/utilTypes.d.ts +8 -8
  192. package/src/util/utilTypes.js +2 -2
  193. package/src/util/validate.d.ts +3 -3
  194. package/src/util/validate.js +11 -11
  195. package/docs.README(OLD).md +0 -82
  196. package/resources/win/OpenFinRVM.exe +0 -0
  197. package/src/api/window/bounds-changed.d.ts +0 -10
  198. package/src/api/window/bounds-changed.js +0 -6
  199. package/src/api/window/shapes.d.ts +0 -13
@@ -1,363 +1,363 @@
1
- import { Base } from '../base';
2
- import type Transport from '../../transport/transport';
3
- import Identity = OpenFin.Identity;
4
- /**
5
- * {@link https://developers.openfin.co/of-docs/docs/enable-color-linking **THE INTEROP API IS EXPERIMENTAL. IF YOU WOULD LIKE TO USE IT, PLEASE USE OUR DEFAULT IMPLEMENTATION IN BROWSER**}
6
- *
7
- * The Interop Broker is responsible for keeping track of the Interop state of the Platform, and for directing messages to the proper locations.
8
- *
9
- * ---
10
- *
11
- * There are 2 ways to inject custom functionality into the Interop Broker:
12
- *
13
- * **1. Configuration**
14
- *
15
- * At the moment, you can configure the default context groups for the Interop Broker without having to override it. To do so, include the `interopBrokerConfiguration` `contextGroups` option in your `platform` options in your manifest. This is the preferred method.
16
- * ```js
17
- * {
18
- * "runtime": {
19
- * "arguments": "--v=1 --inspect",
20
- * "version": "alpha-v19"
21
- * },
22
- * "platform": {
23
- * "uuid": "platform_customization_local",
24
- * "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
25
- * "autoShow": false,
26
- * "providerUrl": "http://localhost:5555/provider.html",
27
- * "interopBrokerConfiguration": {
28
- * "contextGroups": [
29
- * {
30
- * "id": "green",
31
- * "displayMetadata": {
32
- * "color": "#00CC88",
33
- * "name": "green"
34
- * }
35
- * },
36
- * {
37
- * "id": "purple",
38
- * "displayMetadata": {
39
- * "color": "#8C61FF",
40
- * "name": "purple"
41
- * }
42
- * },
43
- * ]
44
- * }
45
- * }
46
- * }
47
- * ```
48
- *
49
- * ---
50
- * **2. Overriding**
51
- *
52
- * Similarly to how [Platform Overriding]{@link https://developers.openfin.co/docs/platform-customization#section-customizing-platform-behavior} works, you can override functions in the Interop Broker in `fin.Platform.init`. An example of that is shown below. Overriding `isConnectionAuthorized` and `isActionAuthorized` will allow you to control allowed connections and allowed actions.
53
- *
54
- * However, if there is custom functionality you wish to include in the Interop Broker, please let us know. We would like to provide better configuration options so that you don't have to continually maintain your own override code.
55
- *
56
- * ```js
57
- * fin.Platform.init({
58
- * overrideCallback: async (Provider) => {
59
- * class Override extends Provider {
60
- * async getSnapshot() {
61
- * console.log('before getSnapshot')
62
- * const snapshot = await super.getSnapshot();
63
- * console.log('after getSnapshot')
64
- * return snapshot;
65
- * }
66
- *
67
- * async applySnapshot({ snapshot, options }) {
68
- * console.log('before applySnapshot')
69
- * const originalPromise = super.applySnapshot({ snapshot, options });
70
- * console.log('after applySnapshot')
71
- *
72
- * return originalPromise;
73
- * }
74
- * };
75
- * return new Override();
76
- * },
77
- * interopOverride: async (InteropBroker, provider, options, ...args) => {
78
- * class Override extends InteropBroker {
79
- * async joinContextGroup(channelName = 'default', target) {
80
- * console.log('before super joinContextGroup')
81
- * super.joinContextGroup(channelName, target);
82
- * console.log('after super joinContextGroup')
83
- * }
84
- * }
85
- *
86
- * options.contextGroups = [
87
- * {
88
- * id: 'green',
89
- * displayMetadata: {
90
- * color: '#00CC88',
91
- * name: 'green'
92
- * }
93
- * },
94
- * {
95
- * id: 'purple',
96
- * displayMetadata: {
97
- * color: '#8C61FF',
98
- * name: 'purple'
99
- * }
100
- * },
101
- * {
102
- * id: 'orange',
103
- * displayMetadata: {
104
- * color: '#FF8C4C',
105
- * name: 'orange'
106
- * }
107
- * },
108
- * {
109
- * id: 'red',
110
- * displayMetadata: {
111
- * color: '#FF5E60',
112
- * name: 'red'
113
- * }
114
- * }
115
- * ];
116
- * return new Override(provider, options, ...args);
117
- * }
118
- * });
119
- * ```
120
- *
121
- * ---
122
- *
123
- * @hideconstructor
124
- * @class
125
- */
126
- export declare class InteropBroker extends Base {
127
- private channel;
128
- private interopClients;
129
- private contextGroupsById;
130
- private intentClientMap;
131
- private lastContextMap;
132
- private sessionContextGroupMap;
133
- constructor(wire: Transport, channel: OpenFin.ChannelProvider, options?: any);
134
- /**
135
- * SetContextOptions interface
136
- * @typedef { object } SetContextOptions
137
- * @property { Context } {context} - New context to set.
138
- */
139
- /**
140
- * GetContextOptions interface
141
- * @typedef { object } GetContextOptions
142
- * @property { string } [contextType] - Context Type
143
- */
144
- /**
145
- * JoinContextGroupOptions interface
146
- * @typedef { object } JoinContextGroupOptions
147
- * @property { string } contextGroupId - Id of the context group.
148
- * @property { Identity | ClientIdentity } [target] - Identity of the entity you wish to join to a context group.
149
- */
150
- /**
151
- * AddClientToContextGroupOptions interface
152
- * @typedef { object } AddClientToContextGroupOptions
153
- * @property { string } contextGroupId - Name of the context group.
154
- */
155
- /**
156
- * RemoveFromContextGroupOptions interface
157
- * @typedef { object } RemoveFromContextGroupOptions
158
- * @property { Identity | ClientIdentity } target - Identity of the entity you wish to join to a context group.
159
- */
160
- /**
161
- * GetInfoForContextGroupOptions interface
162
- * @typedef { object } GetInfoForContextGroupOptions
163
- * @property { string } contextGroupId - Name of the context group to get info for.
164
- */
165
- /**
166
- * GetAllClientsInContextGroupOptions interface
167
- * @typedef { object } GetAllClientsInContextGroupOptions
168
- * @property { string } contextGroupId - Name of the context group to get info for.
169
- */
170
- /**
171
- * InfoForIntentOptions interface
172
- * @typedef { object } InfoForIntentOptions
173
- * @property { string } name Name of the intent to get info for.
174
- * @property { Context } [context] Optional context.
175
- */
176
- /**
177
- * Sets a context for the context group of the incoming current entity.
178
- * @param { SetContextOptions } setContextOptions - New context to set.
179
- * @param { ClientIdentity } clientIdentity - Identity of the client sender.
180
- * @return { void }
181
- * @experimental
182
- */
183
- setContext({ context }: {
184
- context: OpenFin.Context;
185
- }, clientIdentity: OpenFin.ClientIdentity): void;
186
- /**
187
- * Get current context for a client subscribed to a Context Group.
188
- * @param { GetContextOptions } getContextOptions - Options for getting context
189
- * @param { ClientIdentity } clientIdentity - Identity of the client sender.
190
- * @return { Context }
191
- */
192
- getCurrentContext(getCurrentContextOptions: {
193
- contextType: string;
194
- }, clientIdentity: OpenFin.ClientIdentity): OpenFin.Context | undefined;
195
- /**
196
- * Join all connections at the given identity (or just one if endpointId provided) to context group `contextGroupId`.
197
- * If no target is specified, it adds the sender to the context group.
198
- * joinContextGroup is responsible for checking connections at the incoming identity. It calls {@link InteropBroker#addClientToContextGroup InteropBroker.addClientToContextGroup} to actually group the client.
199
- * Used by Platform Windows.
200
- * @return { Promise<void> }
201
- * @param { JoinContextGroupOptions } joinContextGroupOptions - Id of the Context Group and identity of the entity to join to the group.
202
- * @param { ClientIdentity } senderIdentity - Identity of the client sender.
203
- * @experimental
204
- */
205
- joinContextGroup({ contextGroupId, target }: {
206
- contextGroupId: string;
207
- target?: OpenFin.ClientIdentity | OpenFin.Identity;
208
- }, senderIdentity: OpenFin.ClientIdentity): Promise<void>;
209
- /**
210
- * Helper function for {@link InteropBroker#joinContextGroup InteropBroker.joinContextGroup}. Does the work of actually adding the client to the Context Group.
211
- * Used by Platform Windows.
212
- * @return { Promise<void> }
213
- * @param { AddClientToContextGroupOptions } addClientToContextGroupOptions - Contains the contextGroupId
214
- * @param { ClientIdentity } clientIdentity - Identity of the client sender.
215
- * @experimental
216
- */
217
- addClientToContextGroup({ contextGroupId }: {
218
- contextGroupId: string;
219
- }, clientIdentity: OpenFin.ClientIdentity): Promise<void>;
220
- /**
221
- * Removes the specified target from a context group.
222
- * If no target is specified, it removes the sender from their context group.
223
- * removeFromContextGroup is responsible for checking connections at the incoming identity. It calls {@link InteropBroker#removeClientFromContextGroup InteropBroker.removeClientFromContextGroup} to actually ungroup the client.
224
- * Used by Platform Windows.
225
- * @return { Promise<void> }
226
- * @param { RemoveFromContextGroupOptions } removeFromContextGroupOptions - Contains the target identity to remove.
227
- * @param { ClientIdentity } senderIdentity - Identity of the client sender.
228
- * @experimental
229
- */
230
- removeFromContextGroup({ target }: {
231
- target: OpenFin.Identity;
232
- }, senderIdentity: OpenFin.ClientIdentity): Promise<void>;
233
- /**
234
- * Helper function for {@link InteropBroker#removeFromContextGroup InteropBroker.removeFromContextGroup}. Does the work of actually removing the client from the Context Group.
235
- * Used by Platform Windows.
236
- * @return { Promise<void> }
237
- * @property { ClientIdentity } clientIdentity - Identity of the client sender.
238
- * @experimental
239
- */
240
- removeClientFromContextGroup(clientIdentity: OpenFin.ClientIdentity): Promise<void>;
241
- /**
242
- * Returns the Interop-Broker-defined context groups available for an entity to join. Because this function is used in the rest of the Interop Broker to fetch the Context Groups, overriding this allows you to customize the Context Groups for the Interop Broker. However, we recommend customizing the context groups through configuration instead.
243
- * Used by Platform Windows.
244
- * @return { Promise<ContextGroupInfo[]>}
245
- * @experimental
246
- */
247
- getContextGroups(): Readonly<OpenFin.ContextGroupInfo[]>;
248
- /**
249
- * Gets display info for a context group
250
- * Used by Platform Windows.
251
- * @param { GetInfoForContextGroupOptions } getInfoForContextGroupOptions - Contains contextGroupId, the context group you wish to get display info for.
252
- * @return { Promise<ContextGroupInfo>}
253
- * @experimental
254
- */
255
- getInfoForContextGroup({ contextGroupId }: {
256
- contextGroupId: string;
257
- }): OpenFin.ContextGroupInfo | undefined;
258
- /**
259
- * Gets all clients for a context group.
260
- * Used by Platform Windows.
261
- * @param { GetAllClientsInContextGroupOptions } getAllClientsInContextGroupOptions - Contains contextGroupId, the context group you wish to get clients for.
262
- * @return { Promise<ClientIdentity[]>}
263
- * @experimental
264
- */
265
- getAllClientsInContextGroup({ contextGroupId }: {
266
- contextGroupId: string;
267
- }): OpenFin.ClientIdentity[];
268
- /**
269
- * Responsible for launching of applications that can handle a given intent, and delegation of intents to those applications.
270
- * Must be overridden.
271
- * @param { Intent } intent The combination of an action and a context that is passed to an application for resolution.
272
- * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
273
- * @return { Promise<unknown> }
274
- * @tutorial interop.handleFiredIntent
275
- * @experimental
276
- */
277
- handleFiredIntent(intent: OpenFin.Intent, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
278
- /**
279
- * Should be called in {@link InteropBroker#handleFiredIntent InteropBroker.handleFiredIntent}.
280
- * While handleFiredIntent is responsible for launching applications, setIntentTarget is used to tell the InteropBroker which application should receive the intent when it is ready.
281
- * @param { Intent } intent The combination of an action and a context that is passed to an application for resolution.
282
- * @param { Identity } target - Identity of the target that will handle the intent.
283
- * @return { Promise<void> }
284
- * @experimental
285
- */
286
- setIntentTarget(intent: OpenFin.Intent, target: OpenFin.Identity): Promise<void>;
287
- /**
288
- * Responsible for returning information on a particular Intent.
289
- * Must be overridden.
290
- * @param { InfoForIntentOptions } options
291
- * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
292
- * @return { Promise<unknown> }
293
- * @tutorial interop.handleInfoForIntent
294
- * @experimental
295
- */
296
- handleInfoForIntent(options: OpenFin.InfoForIntentOptions, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
297
- /**
298
- * Responsible for returning information on which Intents are meant to handle a specific Context.
299
- * Must be overridden.
300
- * @param { Context } context Data passed between entities and applications.
301
- * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
302
- * @return { Promise<unknown> }
303
- * @tutorial interop.handleInfoForIntentsByContext
304
- * @experimental
305
- */
306
- handleInfoForIntentsByContext(context: OpenFin.Context, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
307
- /**
308
- * Responsible for resolving an Intent based on a specific Context.
309
- * Must be overridden.
310
- * @param { ContextForIntent } contextForIntent Data passed between entities and applications.
311
- * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
312
- * @return { Promise<unknown> }
313
- * @tutorial interop.handleFiredIntentForContext
314
- * @experimental
315
- */
316
- handleFiredIntentForContext(contextForIntent: OpenFin.ContextForIntent, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
317
- decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
318
- applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
319
- updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
320
- getContextGroupStates(): OpenFin.ContextGroupStates;
321
- rehydrateContextGroupStates(incomingContextGroupStates: OpenFin.ContextGroupStates): void;
322
- contextHandlerRegistered({ contextType, handlerId }: {
323
- contextType: string | undefined;
324
- handlerId: string;
325
- }, clientIdentity: OpenFin.ClientIdentity): void;
326
- intentHandlerRegistered(payload: any, clientIdentity: OpenFin.ClientIdentity): Promise<void>;
327
- protected invokeContextHandler(clientIdentity: OpenFin.ClientIdentity, handlerId: string, context: OpenFin.Context): void;
328
- removeContextHandler({ handlerId }: {
329
- handlerId: string;
330
- }, clientIdentity: OpenFin.ClientIdentity): void;
331
- handleJoinSessionContextGroup({ sessionContextGroupId }: {
332
- sessionContextGroupId: string;
333
- }, clientIdentity: OpenFin.ClientIdentity): {
334
- hasConflict: boolean;
335
- };
336
- private getClientState;
337
- private static toObject;
338
- static checkContextIntegrity(context: OpenFin.Context): {
339
- isValid: true;
340
- } | {
341
- isValid: false;
342
- reason: string;
343
- };
344
- private static hasEndpointId;
345
- static isContextTypeCompatible(contextType: string, registeredContextType: string | undefined): boolean;
346
- private setContextGroupMap;
347
- private static setCurrentContextGroupInClientOptions;
348
- private wireChannel;
349
- /**
350
- * Can be used to completely prevent a connection. Return false to prevent connections. Allows all connections by default.
351
- * @param _id the identity tryinc to connect
352
- * @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
353
- */
354
- isConnectionAuthorized(_id: Identity, _connectionPayload?: any): Promise<boolean>;
355
- /**
356
- * Called before every action to check if this entity should be allowed to take the action.
357
- * Return false to prevent the action
358
- * @param _action the string action to authorize in camel case
359
- * @param _payload the data being sent for this action
360
- * @param _identity the connection attempting to dispatch this action
361
- */
362
- isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean>;
363
- }
1
+ import { Base } from '../base';
2
+ import type Transport from '../../transport/transport';
3
+ import Identity = OpenFin.Identity;
4
+ /**
5
+ * {@link https://developers.openfin.co/of-docs/docs/enable-color-linking **THE INTEROP API IS EXPERIMENTAL. IF YOU WOULD LIKE TO USE IT, PLEASE USE OUR DEFAULT IMPLEMENTATION IN BROWSER**}
6
+ *
7
+ * The Interop Broker is responsible for keeping track of the Interop state of the Platform, and for directing messages to the proper locations.
8
+ *
9
+ * ---
10
+ *
11
+ * There are 2 ways to inject custom functionality into the Interop Broker:
12
+ *
13
+ * **1. Configuration**
14
+ *
15
+ * At the moment, you can configure the default context groups for the Interop Broker without having to override it. To do so, include the `interopBrokerConfiguration` `contextGroups` option in your `platform` options in your manifest. This is the preferred method.
16
+ * ```js
17
+ * {
18
+ * "runtime": {
19
+ * "arguments": "--v=1 --inspect",
20
+ * "version": "alpha-v19"
21
+ * },
22
+ * "platform": {
23
+ * "uuid": "platform_customization_local",
24
+ * "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
25
+ * "autoShow": false,
26
+ * "providerUrl": "http://localhost:5555/provider.html",
27
+ * "interopBrokerConfiguration": {
28
+ * "contextGroups": [
29
+ * {
30
+ * "id": "green",
31
+ * "displayMetadata": {
32
+ * "color": "#00CC88",
33
+ * "name": "green"
34
+ * }
35
+ * },
36
+ * {
37
+ * "id": "purple",
38
+ * "displayMetadata": {
39
+ * "color": "#8C61FF",
40
+ * "name": "purple"
41
+ * }
42
+ * },
43
+ * ]
44
+ * }
45
+ * }
46
+ * }
47
+ * ```
48
+ *
49
+ * ---
50
+ * **2. Overriding**
51
+ *
52
+ * Similarly to how [Platform Overriding]{@link https://developers.openfin.co/docs/platform-customization#section-customizing-platform-behavior} works, you can override functions in the Interop Broker in `fin.Platform.init`. An example of that is shown below. Overriding `isConnectionAuthorized` and `isActionAuthorized` will allow you to control allowed connections and allowed actions.
53
+ *
54
+ * However, if there is custom functionality you wish to include in the Interop Broker, please let us know. We would like to provide better configuration options so that you don't have to continually maintain your own override code.
55
+ *
56
+ * ```js
57
+ * fin.Platform.init({
58
+ * overrideCallback: async (Provider) => {
59
+ * class Override extends Provider {
60
+ * async getSnapshot() {
61
+ * console.log('before getSnapshot')
62
+ * const snapshot = await super.getSnapshot();
63
+ * console.log('after getSnapshot')
64
+ * return snapshot;
65
+ * }
66
+ *
67
+ * async applySnapshot({ snapshot, options }) {
68
+ * console.log('before applySnapshot')
69
+ * const originalPromise = super.applySnapshot({ snapshot, options });
70
+ * console.log('after applySnapshot')
71
+ *
72
+ * return originalPromise;
73
+ * }
74
+ * };
75
+ * return new Override();
76
+ * },
77
+ * interopOverride: async (InteropBroker, provider, options, ...args) => {
78
+ * class Override extends InteropBroker {
79
+ * async joinContextGroup(channelName = 'default', target) {
80
+ * console.log('before super joinContextGroup')
81
+ * super.joinContextGroup(channelName, target);
82
+ * console.log('after super joinContextGroup')
83
+ * }
84
+ * }
85
+ *
86
+ * options.contextGroups = [
87
+ * {
88
+ * id: 'green',
89
+ * displayMetadata: {
90
+ * color: '#00CC88',
91
+ * name: 'green'
92
+ * }
93
+ * },
94
+ * {
95
+ * id: 'purple',
96
+ * displayMetadata: {
97
+ * color: '#8C61FF',
98
+ * name: 'purple'
99
+ * }
100
+ * },
101
+ * {
102
+ * id: 'orange',
103
+ * displayMetadata: {
104
+ * color: '#FF8C4C',
105
+ * name: 'orange'
106
+ * }
107
+ * },
108
+ * {
109
+ * id: 'red',
110
+ * displayMetadata: {
111
+ * color: '#FF5E60',
112
+ * name: 'red'
113
+ * }
114
+ * }
115
+ * ];
116
+ * return new Override(provider, options, ...args);
117
+ * }
118
+ * });
119
+ * ```
120
+ *
121
+ * ---
122
+ *
123
+ * @hideconstructor
124
+ * @class
125
+ */
126
+ export declare class InteropBroker extends Base {
127
+ private channel;
128
+ private interopClients;
129
+ private contextGroupsById;
130
+ private intentClientMap;
131
+ private lastContextMap;
132
+ private sessionContextGroupMap;
133
+ constructor(wire: Transport, channel: OpenFin.ChannelProvider, options?: any);
134
+ /**
135
+ * SetContextOptions interface
136
+ * @typedef { object } SetContextOptions
137
+ * @property { Context } {context} - New context to set.
138
+ */
139
+ /**
140
+ * GetContextOptions interface
141
+ * @typedef { object } GetContextOptions
142
+ * @property { string } [contextType] - Context Type
143
+ */
144
+ /**
145
+ * JoinContextGroupOptions interface
146
+ * @typedef { object } JoinContextGroupOptions
147
+ * @property { string } contextGroupId - Id of the context group.
148
+ * @property { Identity | ClientIdentity } [target] - Identity of the entity you wish to join to a context group.
149
+ */
150
+ /**
151
+ * AddClientToContextGroupOptions interface
152
+ * @typedef { object } AddClientToContextGroupOptions
153
+ * @property { string } contextGroupId - Name of the context group.
154
+ */
155
+ /**
156
+ * RemoveFromContextGroupOptions interface
157
+ * @typedef { object } RemoveFromContextGroupOptions
158
+ * @property { Identity | ClientIdentity } target - Identity of the entity you wish to join to a context group.
159
+ */
160
+ /**
161
+ * GetInfoForContextGroupOptions interface
162
+ * @typedef { object } GetInfoForContextGroupOptions
163
+ * @property { string } contextGroupId - Name of the context group to get info for.
164
+ */
165
+ /**
166
+ * GetAllClientsInContextGroupOptions interface
167
+ * @typedef { object } GetAllClientsInContextGroupOptions
168
+ * @property { string } contextGroupId - Name of the context group to get info for.
169
+ */
170
+ /**
171
+ * InfoForIntentOptions interface
172
+ * @typedef { object } InfoForIntentOptions
173
+ * @property { string } name Name of the intent to get info for.
174
+ * @property { Context } [context] Optional context.
175
+ */
176
+ /**
177
+ * Sets a context for the context group of the incoming current entity.
178
+ * @param { SetContextOptions } setContextOptions - New context to set.
179
+ * @param { ClientIdentity } clientIdentity - Identity of the client sender.
180
+ * @return { void }
181
+ * @experimental
182
+ */
183
+ setContext({ context }: {
184
+ context: OpenFin.Context;
185
+ }, clientIdentity: OpenFin.ClientIdentity): void;
186
+ /**
187
+ * Get current context for a client subscribed to a Context Group.
188
+ * @param { GetContextOptions } getContextOptions - Options for getting context
189
+ * @param { ClientIdentity } clientIdentity - Identity of the client sender.
190
+ * @return { Context }
191
+ */
192
+ getCurrentContext(getCurrentContextOptions: {
193
+ contextType: string;
194
+ }, clientIdentity: OpenFin.ClientIdentity): OpenFin.Context | undefined;
195
+ /**
196
+ * Join all connections at the given identity (or just one if endpointId provided) to context group `contextGroupId`.
197
+ * If no target is specified, it adds the sender to the context group.
198
+ * joinContextGroup is responsible for checking connections at the incoming identity. It calls {@link InteropBroker#addClientToContextGroup InteropBroker.addClientToContextGroup} to actually group the client.
199
+ * Used by Platform Windows.
200
+ * @return { Promise<void> }
201
+ * @param { JoinContextGroupOptions } joinContextGroupOptions - Id of the Context Group and identity of the entity to join to the group.
202
+ * @param { ClientIdentity } senderIdentity - Identity of the client sender.
203
+ * @experimental
204
+ */
205
+ joinContextGroup({ contextGroupId, target }: {
206
+ contextGroupId: string;
207
+ target?: OpenFin.ClientIdentity | OpenFin.Identity;
208
+ }, senderIdentity: OpenFin.ClientIdentity): Promise<void>;
209
+ /**
210
+ * Helper function for {@link InteropBroker#joinContextGroup InteropBroker.joinContextGroup}. Does the work of actually adding the client to the Context Group.
211
+ * Used by Platform Windows.
212
+ * @return { Promise<void> }
213
+ * @param { AddClientToContextGroupOptions } addClientToContextGroupOptions - Contains the contextGroupId
214
+ * @param { ClientIdentity } clientIdentity - Identity of the client sender.
215
+ * @experimental
216
+ */
217
+ addClientToContextGroup({ contextGroupId }: {
218
+ contextGroupId: string;
219
+ }, clientIdentity: OpenFin.ClientIdentity): Promise<void>;
220
+ /**
221
+ * Removes the specified target from a context group.
222
+ * If no target is specified, it removes the sender from their context group.
223
+ * removeFromContextGroup is responsible for checking connections at the incoming identity. It calls {@link InteropBroker#removeClientFromContextGroup InteropBroker.removeClientFromContextGroup} to actually ungroup the client.
224
+ * Used by Platform Windows.
225
+ * @return { Promise<void> }
226
+ * @param { RemoveFromContextGroupOptions } removeFromContextGroupOptions - Contains the target identity to remove.
227
+ * @param { ClientIdentity } senderIdentity - Identity of the client sender.
228
+ * @experimental
229
+ */
230
+ removeFromContextGroup({ target }: {
231
+ target: OpenFin.Identity;
232
+ }, senderIdentity: OpenFin.ClientIdentity): Promise<void>;
233
+ /**
234
+ * Helper function for {@link InteropBroker#removeFromContextGroup InteropBroker.removeFromContextGroup}. Does the work of actually removing the client from the Context Group.
235
+ * Used by Platform Windows.
236
+ * @return { Promise<void> }
237
+ * @property { ClientIdentity } clientIdentity - Identity of the client sender.
238
+ * @experimental
239
+ */
240
+ removeClientFromContextGroup(clientIdentity: OpenFin.ClientIdentity): Promise<void>;
241
+ /**
242
+ * Returns the Interop-Broker-defined context groups available for an entity to join. Because this function is used in the rest of the Interop Broker to fetch the Context Groups, overriding this allows you to customize the Context Groups for the Interop Broker. However, we recommend customizing the context groups through configuration instead.
243
+ * Used by Platform Windows.
244
+ * @return { Promise<ContextGroupInfo[]>}
245
+ * @experimental
246
+ */
247
+ getContextGroups(): Readonly<OpenFin.ContextGroupInfo[]>;
248
+ /**
249
+ * Gets display info for a context group
250
+ * Used by Platform Windows.
251
+ * @param { GetInfoForContextGroupOptions } getInfoForContextGroupOptions - Contains contextGroupId, the context group you wish to get display info for.
252
+ * @return { Promise<ContextGroupInfo>}
253
+ * @experimental
254
+ */
255
+ getInfoForContextGroup({ contextGroupId }: {
256
+ contextGroupId: string;
257
+ }): OpenFin.ContextGroupInfo | undefined;
258
+ /**
259
+ * Gets all clients for a context group.
260
+ * Used by Platform Windows.
261
+ * @param { GetAllClientsInContextGroupOptions } getAllClientsInContextGroupOptions - Contains contextGroupId, the context group you wish to get clients for.
262
+ * @return { Promise<ClientIdentity[]>}
263
+ * @experimental
264
+ */
265
+ getAllClientsInContextGroup({ contextGroupId }: {
266
+ contextGroupId: string;
267
+ }): OpenFin.ClientIdentity[];
268
+ /**
269
+ * Responsible for launching of applications that can handle a given intent, and delegation of intents to those applications.
270
+ * Must be overridden.
271
+ * @param { Intent } intent The combination of an action and a context that is passed to an application for resolution.
272
+ * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
273
+ * @return { Promise<unknown> }
274
+ * @tutorial interop.handleFiredIntent
275
+ * @experimental
276
+ */
277
+ handleFiredIntent(intent: OpenFin.Intent, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
278
+ /**
279
+ * Should be called in {@link InteropBroker#handleFiredIntent InteropBroker.handleFiredIntent}.
280
+ * While handleFiredIntent is responsible for launching applications, setIntentTarget is used to tell the InteropBroker which application should receive the intent when it is ready.
281
+ * @param { Intent } intent The combination of an action and a context that is passed to an application for resolution.
282
+ * @param { Identity } target - Identity of the target that will handle the intent.
283
+ * @return { Promise<void> }
284
+ * @experimental
285
+ */
286
+ setIntentTarget(intent: OpenFin.Intent, target: OpenFin.Identity): Promise<void>;
287
+ /**
288
+ * Responsible for returning information on a particular Intent.
289
+ * Must be overridden.
290
+ * @param { InfoForIntentOptions } options
291
+ * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
292
+ * @return { Promise<unknown> }
293
+ * @tutorial interop.handleInfoForIntent
294
+ * @experimental
295
+ */
296
+ handleInfoForIntent(options: OpenFin.InfoForIntentOptions, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
297
+ /**
298
+ * Responsible for returning information on which Intents are meant to handle a specific Context.
299
+ * Must be overridden.
300
+ * @param { Context } context Data passed between entities and applications.
301
+ * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
302
+ * @return { Promise<unknown> }
303
+ * @tutorial interop.handleInfoForIntentsByContext
304
+ * @experimental
305
+ */
306
+ handleInfoForIntentsByContext(context: OpenFin.Context, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
307
+ /**
308
+ * Responsible for resolving an Intent based on a specific Context.
309
+ * Must be overridden.
310
+ * @param { ContextForIntent } contextForIntent Data passed between entities and applications.
311
+ * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
312
+ * @return { Promise<unknown> }
313
+ * @tutorial interop.handleFiredIntentForContext
314
+ * @experimental
315
+ */
316
+ handleFiredIntentForContext(contextForIntent: OpenFin.ContextForIntent, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
317
+ decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
318
+ applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
319
+ updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
320
+ getContextGroupStates(): OpenFin.ContextGroupStates;
321
+ rehydrateContextGroupStates(incomingContextGroupStates: OpenFin.ContextGroupStates): void;
322
+ contextHandlerRegistered({ contextType, handlerId }: {
323
+ contextType: string | undefined;
324
+ handlerId: string;
325
+ }, clientIdentity: OpenFin.ClientIdentity): void;
326
+ intentHandlerRegistered(payload: any, clientIdentity: OpenFin.ClientIdentity): Promise<void>;
327
+ protected invokeContextHandler(clientIdentity: OpenFin.ClientIdentity, handlerId: string, context: OpenFin.Context): void;
328
+ removeContextHandler({ handlerId }: {
329
+ handlerId: string;
330
+ }, clientIdentity: OpenFin.ClientIdentity): void;
331
+ handleJoinSessionContextGroup({ sessionContextGroupId }: {
332
+ sessionContextGroupId: string;
333
+ }, clientIdentity: OpenFin.ClientIdentity): {
334
+ hasConflict: boolean;
335
+ };
336
+ private getClientState;
337
+ private static toObject;
338
+ static checkContextIntegrity(context: OpenFin.Context): {
339
+ isValid: true;
340
+ } | {
341
+ isValid: false;
342
+ reason: string;
343
+ };
344
+ private static hasEndpointId;
345
+ static isContextTypeCompatible(contextType: string, registeredContextType: string | undefined): boolean;
346
+ private setContextGroupMap;
347
+ private static setCurrentContextGroupInClientOptions;
348
+ private wireChannel;
349
+ /**
350
+ * Can be used to completely prevent a connection. Return false to prevent connections. Allows all connections by default.
351
+ * @param _id the identity tryinc to connect
352
+ * @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
353
+ */
354
+ isConnectionAuthorized(_id: Identity, _connectionPayload?: any): Promise<boolean>;
355
+ /**
356
+ * Called before every action to check if this entity should be allowed to take the action.
357
+ * Return false to prevent the action
358
+ * @param _action the string action to authorize in camel case
359
+ * @param _payload the data being sent for this action
360
+ * @param _identity the connection attempting to dispatch this action
361
+ */
362
+ isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean>;
363
+ }