@openfin/core 33.76.36 → 33.77.1

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 (271) 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 +17111 -0
  10. package/package.json +30 -23
  11. package/LICENSE +0 -13
  12. package/NOTICE +0 -16
  13. package/openfin-core-33.76.36.tgz +0 -0
  14. package/src/OpenFin.d.ts +0 -3091
  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 -196
  33. package/src/api/application/Factory.js +0 -278
  34. package/src/api/application/Instance.d.ts +0 -692
  35. package/src/api/application/Instance.js +0 -821
  36. package/src/api/application/index.d.ts +0 -12
  37. package/src/api/application/index.js +0 -28
  38. package/src/api/base.d.ts +0 -117
  39. package/src/api/base.js +0 -246
  40. package/src/api/clipboard/index.d.ts +0 -172
  41. package/src/api/clipboard/index.js +0 -200
  42. package/src/api/events/application.d.ts +0 -158
  43. package/src/api/events/application.js +0 -14
  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 -35
  47. package/src/api/events/channel.js +0 -7
  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 -24
  53. package/src/api/events/externalApplication.js +0 -7
  54. package/src/api/events/frame.d.ts +0 -35
  55. package/src/api/events/frame.js +0 -2
  56. package/src/api/events/globalHotkey.d.ts +0 -25
  57. package/src/api/events/globalHotkey.js +0 -2
  58. package/src/api/events/platform.d.ts +0 -34
  59. package/src/api/events/platform.js +0 -10
  60. package/src/api/events/system.d.ts +0 -126
  61. package/src/api/events/system.js +0 -15
  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 -92
  65. package/src/api/events/view.js +0 -12
  66. package/src/api/events/webcontents.d.ts +0 -277
  67. package/src/api/events/webcontents.js +0 -13
  68. package/src/api/events/window.d.ts +0 -421
  69. package/src/api/events/window.js +0 -12
  70. package/src/api/external-application/Factory.d.ts +0 -34
  71. package/src/api/external-application/Factory.js +0 -47
  72. package/src/api/external-application/Instance.d.ts +0 -110
  73. package/src/api/external-application/Instance.js +0 -117
  74. package/src/api/external-application/index.d.ts +0 -12
  75. package/src/api/external-application/index.js +0 -28
  76. package/src/api/fin.d.ts +0 -54
  77. package/src/api/fin.js +0 -45
  78. package/src/api/frame/Factory.d.ts +0 -54
  79. package/src/api/frame/Factory.js +0 -86
  80. package/src/api/frame/Instance.d.ts +0 -136
  81. package/src/api/frame/Instance.js +0 -143
  82. package/src/api/frame/index.d.ts +0 -14
  83. package/src/api/frame/index.js +0 -30
  84. package/src/api/global-hotkey/index.d.ts +0 -106
  85. package/src/api/global-hotkey/index.js +0 -132
  86. package/src/api/interappbus/channel/channel.d.ts +0 -285
  87. package/src/api/interappbus/channel/channel.js +0 -334
  88. package/src/api/interappbus/channel/channels-docs.d.ts +0 -342
  89. package/src/api/interappbus/channel/channels-docs.js +0 -401
  90. package/src/api/interappbus/channel/client.d.ts +0 -117
  91. package/src/api/interappbus/channel/client.js +0 -181
  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 -189
  95. package/src/api/interappbus/channel/index.js +0 -333
  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 -206
  117. package/src/api/interappbus/channel/provider.js +0 -338
  118. package/src/api/interappbus/index.d.ts +0 -120
  119. package/src/api/interappbus/index.js +0 -210
  120. package/src/api/interop/Factory.d.ts +0 -57
  121. package/src/api/interop/Factory.js +0 -96
  122. package/src/api/interop/InteropBroker.d.ts +0 -665
  123. package/src/api/interop/InteropBroker.js +0 -1313
  124. package/src/api/interop/InteropClient.d.ts +0 -502
  125. package/src/api/interop/InteropClient.js +0 -683
  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/documentationStub.d.ts +0 -14
  135. package/src/api/interop/fdc3/documentationStub.js +0 -17
  136. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -205
  137. package/src/api/interop/fdc3/fdc3-1.2.js +0 -435
  138. package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -298
  139. package/src/api/interop/fdc3/fdc3-2.0.js +0 -479
  140. package/src/api/interop/fdc3/fdc3.d.ts +0 -12
  141. package/src/api/interop/fdc3/fdc3.js +0 -35
  142. package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
  143. package/src/api/interop/fdc3/overrideCheck.js +0 -32
  144. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
  145. package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
  146. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
  147. package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
  148. package/src/api/interop/fdc3/utils.d.ts +0 -45
  149. package/src/api/interop/fdc3/utils.js +0 -239
  150. package/src/api/interop/fdc3/versions.d.ts +0 -1
  151. package/src/api/interop/fdc3/versions.js +0 -2
  152. package/src/api/interop/index.d.ts +0 -12
  153. package/src/api/interop/index.js +0 -28
  154. package/src/api/interop/utils.d.ts +0 -18
  155. package/src/api/interop/utils.js +0 -61
  156. package/src/api/me.d.ts +0 -40
  157. package/src/api/me.js +0 -134
  158. package/src/api/platform/Factory.d.ts +0 -171
  159. package/src/api/platform/Factory.js +0 -240
  160. package/src/api/platform/Instance.d.ts +0 -653
  161. package/src/api/platform/Instance.js +0 -834
  162. package/src/api/platform/common-utils.d.ts +0 -7
  163. package/src/api/platform/common-utils.js +0 -16
  164. package/src/api/platform/index.d.ts +0 -12
  165. package/src/api/platform/index.js +0 -28
  166. package/src/api/platform/layout/Factory.d.ts +0 -91
  167. package/src/api/platform/layout/Factory.js +0 -151
  168. package/src/api/platform/layout/Instance.d.ts +0 -192
  169. package/src/api/platform/layout/Instance.js +0 -224
  170. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
  171. package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
  172. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
  173. package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
  174. package/src/api/platform/layout/entities/layout-entities.d.ts +0 -427
  175. package/src/api/platform/layout/entities/layout-entities.js +0 -504
  176. package/src/api/platform/layout/entities/shapes.d.ts +0 -6
  177. package/src/api/platform/layout/entities/shapes.js +0 -2
  178. package/src/api/platform/layout/index.d.ts +0 -11
  179. package/src/api/platform/layout/index.js +0 -27
  180. package/src/api/platform/layout/layout.constants.d.ts +0 -1
  181. package/src/api/platform/layout/layout.constants.js +0 -4
  182. package/src/api/platform/layout/shapes.d.ts +0 -16
  183. package/src/api/platform/layout/shapes.js +0 -2
  184. package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
  185. package/src/api/platform/layout/utils/layout-traversal.js +0 -65
  186. package/src/api/platform/provider.d.ts +0 -510
  187. package/src/api/platform/provider.js +0 -2
  188. package/src/api/snapshot-source/Factory.d.ts +0 -53
  189. package/src/api/snapshot-source/Factory.js +0 -81
  190. package/src/api/snapshot-source/Instance.d.ts +0 -53
  191. package/src/api/snapshot-source/Instance.js +0 -154
  192. package/src/api/snapshot-source/index.d.ts +0 -12
  193. package/src/api/snapshot-source/index.js +0 -28
  194. package/src/api/snapshot-source/utils.d.ts +0 -2
  195. package/src/api/snapshot-source/utils.js +0 -6
  196. package/src/api/system/index.d.ts +0 -1468
  197. package/src/api/system/index.js +0 -1851
  198. package/src/api/view/Factory.d.ts +0 -88
  199. package/src/api/view/Factory.js +0 -141
  200. package/src/api/view/Instance.d.ts +0 -601
  201. package/src/api/view/Instance.js +0 -671
  202. package/src/api/view/index.d.ts +0 -12
  203. package/src/api/view/index.js +0 -28
  204. package/src/api/webcontents/main.d.ts +0 -922
  205. package/src/api/webcontents/main.js +0 -1046
  206. package/src/api/window/Factory.d.ts +0 -96
  207. package/src/api/window/Factory.js +0 -142
  208. package/src/api/window/Instance.d.ts +0 -1598
  209. package/src/api/window/Instance.js +0 -1851
  210. package/src/api/window/index.d.ts +0 -14
  211. package/src/api/window/index.js +0 -30
  212. package/src/browser.d.ts +0 -10
  213. package/src/browser.js +0 -36
  214. package/src/environment/browser.d.ts +0 -29
  215. package/src/environment/browser.js +0 -60
  216. package/src/environment/environment.d.ts +0 -33
  217. package/src/environment/environment.js +0 -4
  218. package/src/environment/mockEnvironment.d.ts +0 -27
  219. package/src/environment/mockEnvironment.js +0 -61
  220. package/src/environment/node-env.d.ts +0 -29
  221. package/src/environment/node-env.js +0 -72
  222. package/src/fdc3.d.ts +0 -3
  223. package/src/fdc3.js +0 -9
  224. package/src/mock.d.ts +0 -3
  225. package/src/mock.js +0 -18
  226. package/src/namespaces.d.ts +0 -22
  227. package/src/namespaces.js +0 -26
  228. package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
  229. package/src/shapes/ERROR_BOX_TYPES.js +0 -2
  230. package/src/shapes/WebOptions.d.ts +0 -13
  231. package/src/shapes/WebOptions.js +0 -2
  232. package/src/shapes/WindowOptions.d.ts +0 -43
  233. package/src/shapes/WindowOptions.js +0 -2
  234. package/src/shapes/protocol.d.ts +0 -204
  235. package/src/shapes/protocol.js +0 -2
  236. package/src/transport/mockWire.d.ts +0 -11
  237. package/src/transport/mockWire.js +0 -26
  238. package/src/transport/transport-errors.d.ts +0 -31
  239. package/src/transport/transport-errors.js +0 -79
  240. package/src/transport/transport.d.ts +0 -73
  241. package/src/transport/transport.js +0 -219
  242. package/src/transport/wire.d.ts +0 -77
  243. package/src/transport/wire.js +0 -36
  244. package/src/util/asyncFilter.d.ts +0 -1
  245. package/src/util/asyncFilter.js +0 -7
  246. package/src/util/channel-api-relay.d.ts +0 -13
  247. package/src/util/channel-api-relay.js +0 -47
  248. package/src/util/errors.d.ts +0 -10
  249. package/src/util/errors.js +0 -12
  250. package/src/util/exhaustive.d.ts +0 -1
  251. package/src/util/exhaustive.js +0 -7
  252. package/src/util/http.d.ts +0 -11
  253. package/src/util/http.js +0 -90
  254. package/src/util/inaccessibleObject.d.ts +0 -2
  255. package/src/util/inaccessibleObject.js +0 -49
  256. package/src/util/lazy.d.ts +0 -34
  257. package/src/util/lazy.js +0 -54
  258. package/src/util/normalize-config.d.ts +0 -3
  259. package/src/util/normalize-config.js +0 -52
  260. package/src/util/promises.d.ts +0 -5
  261. package/src/util/promises.js +0 -27
  262. package/src/util/ref-counter.d.ts +0 -7
  263. package/src/util/ref-counter.js +0 -52
  264. package/src/util/reversible-map.d.ts +0 -11
  265. package/src/util/reversible-map.js +0 -49
  266. package/src/util/runtimeVersioning.d.ts +0 -3
  267. package/src/util/runtimeVersioning.js +0 -25
  268. package/src/util/utilTypes.d.ts +0 -8
  269. package/src/util/utilTypes.js +0 -2
  270. package/src/util/validate.d.ts +0 -3
  271. package/src/util/validate.js +0 -11
@@ -1,276 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PrivateChannelProvider = void 0;
4
- const InteropBroker_1 = require("../InteropBroker");
5
- class PrivateChannelProvider {
6
- constructor(provider, id) {
7
- this.provider = provider;
8
- this.id = id;
9
- this.clients = new Map();
10
- this.registerListeners();
11
- this.contextByContextType = new Map();
12
- this.lastContext = undefined;
13
- this.provider.onConnection((clientIdentity) => this.registerNewClient(clientIdentity));
14
- this.provider.onDisconnection(async (clientIdentity) => {
15
- const { endpointId } = clientIdentity;
16
- if (this.clients.has(endpointId)) {
17
- await this.handleClientDisconnecting(clientIdentity);
18
- }
19
- if ((await this.provider.getAllClientInfo()).length === 0) {
20
- this.provider.destroy();
21
- }
22
- });
23
- }
24
- getClientState(id) {
25
- return this.clients.get(id.endpointId);
26
- }
27
- registerListeners() {
28
- this.provider.register('broadcast', this.broadcast.bind(this));
29
- this.provider.register('getCurrentContext', this.getCurrentContext.bind(this));
30
- this.provider.register('contextHandlerAdded', this.contextHandlerAdded.bind(this));
31
- this.provider.register('contextHandlerRemoved', this.contextHandlerRemoved.bind(this));
32
- this.provider.register('nonStandardHandlerRemoved', this.nonStandardHandlerRemoved.bind(this));
33
- this.provider.register('onAddContextHandlerAdded', this.onAddContextHandlerAdded.bind(this));
34
- this.provider.register('onDisconnectHandlerAdded', this.onDisconnectHandlerAdded.bind(this));
35
- this.provider.register('onUnsubscribeHandlerAdded', this.onUnsubscribeHandlerAdded.bind(this));
36
- this.provider.register('clientDisconnecting', (payload, clientIdentity) => {
37
- this.handleClientDisconnecting(clientIdentity);
38
- });
39
- }
40
- broadcast(payload, broadcasterClientIdentity) {
41
- const { context } = payload;
42
- const broadcasterClientState = this.getClientState(broadcasterClientIdentity);
43
- if (!broadcasterClientState) {
44
- throw new Error(`Client with Identity: ${broadcasterClientIdentity.uuid} ${broadcasterClientIdentity.name}, tried to call broadcast, is not connected to this Private Channel`);
45
- }
46
- const contextIntegrityCheckResult = InteropBroker_1.InteropBroker.checkContextIntegrity(context);
47
- if (contextIntegrityCheckResult.isValid === false) {
48
- throw new Error(`Failed to broadcast - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
49
- }
50
- this.contextByContextType.set(context.type, context);
51
- this.lastContext = context;
52
- Array.from(this.clients.values()).forEach((currClientState) => {
53
- const handlerIdsForContextType = currClientState.handlerIdsByContextTypes.get(context.type);
54
- if (handlerIdsForContextType) {
55
- handlerIdsForContextType.forEach((handlerId) => {
56
- this.provider.dispatch(currClientState.clientIdentity, handlerId, context);
57
- });
58
- }
59
- if (currClientState.globalHandler) {
60
- this.provider.dispatch(currClientState.clientIdentity, currClientState.globalHandler, context);
61
- }
62
- });
63
- }
64
- getCurrentContext(payload, senderClientIdentity) {
65
- const { contextType } = payload;
66
- const clientState = this.getClientState(senderClientIdentity);
67
- if (!clientState) {
68
- throw new Error(`Client with Identity: ${senderClientIdentity.uuid} ${senderClientIdentity.name}, tried to call getCurrentContext, is not connected to this Private Channel`);
69
- }
70
- if (contextType !== undefined) {
71
- const currentContext = this.contextByContextType.get(contextType);
72
- if (currentContext)
73
- return currentContext;
74
- return null;
75
- }
76
- return this.lastContext ? this.lastContext : null;
77
- }
78
- contextHandlerAdded(payload, senderClientIdentity) {
79
- const { handlerId, contextType } = payload;
80
- const senderClientState = this.getClientState(senderClientIdentity);
81
- if (!senderClientState) {
82
- throw new Error(`Client with Identity: ${senderClientIdentity.uuid} ${senderClientIdentity.name}, tried to call addContextListener, is not connected to this Private Channel`);
83
- }
84
- if (contextType) {
85
- const currentHandlersList = senderClientState.handlerIdsByContextTypes.get(contextType) || [];
86
- senderClientState.handlerIdsByContextTypes.set(contextType, [...currentHandlersList, handlerId]);
87
- }
88
- else {
89
- senderClientState.globalHandler = handlerId;
90
- }
91
- Array.from(this.clients.values()).forEach((currClientState) => {
92
- if (currClientState.clientIdentity.endpointId !== senderClientIdentity.endpointId &&
93
- currClientState.onAddContextListenerHandlerId) {
94
- this.provider.dispatch(currClientState.clientIdentity, currClientState.onAddContextListenerHandlerId, contextType);
95
- }
96
- });
97
- }
98
- async contextHandlerRemoved(payload, removingClientIdentity) {
99
- // MC: Made this removal async to ensure that onUnsubscribe handlers are hit before anything else happens.
100
- const { handlerId } = payload;
101
- const removingClientState = this.getClientState(removingClientIdentity);
102
- if (removingClientState) {
103
- let contextType;
104
- if (removingClientState.globalHandler === handlerId) {
105
- removingClientState.globalHandler = undefined;
106
- }
107
- else {
108
- for (const [currContextType, handlersIds] of removingClientState.handlerIdsByContextTypes) {
109
- const index = handlersIds.indexOf(handlerId);
110
- if (index > -1) {
111
- handlersIds.splice(index, 1);
112
- contextType = currContextType;
113
- }
114
- }
115
- }
116
- // getting only valid client connections here, it is possible we haven't removed a disconnected client from the map yet
117
- // so we need to ensure we don't dispatch to any disconnected client
118
- // TODO: Take a look at our client disconnection logic and see if we can handle client disconnection cleanly
119
- const clientsToDispatchTo = await this.getConnectedClients();
120
- const dispatchPromises = clientsToDispatchTo.map(async (otherClientState) => {
121
- const { clientIdentity, clientIdentity: { endpointId }, onUnsubscribeHandlerId } = otherClientState;
122
- if (endpointId !== removingClientIdentity.endpointId && onUnsubscribeHandlerId) {
123
- await this.provider.dispatch(clientIdentity, onUnsubscribeHandlerId, contextType);
124
- }
125
- });
126
- try {
127
- await Promise.all(dispatchPromises);
128
- }
129
- catch (error) {
130
- console.error(`Problem when attempting to dispatch to onUnsubscribeHandlers. Error: ${error} Removing Client: ${handlerId}. uuid: ${removingClientIdentity.uuid}. name: ${removingClientIdentity.name}. endpointId: ${removingClientIdentity.endpointId}`);
131
- throw new Error(error);
132
- }
133
- }
134
- else {
135
- console.warn(`Trying to remove a handler from a client that isn't mapped. handlerId: ${handlerId}. uuid: ${removingClientIdentity.uuid}. name: ${removingClientIdentity.name}. endpointId: ${removingClientIdentity.endpointId}.`);
136
- }
137
- }
138
- nonStandardHandlerRemoved(payload, id) {
139
- const { handlerId } = payload;
140
- const clientState = this.getClientState(id);
141
- if (clientState) {
142
- if (clientState.onDisconnectHandlerId === handlerId) {
143
- clientState.onDisconnectHandlerId = undefined;
144
- }
145
- else if (clientState.onAddContextListenerHandlerId === handlerId) {
146
- clientState.onAddContextListenerHandlerId = undefined;
147
- }
148
- else if (clientState.onUnsubscribeHandlerId === handlerId) {
149
- clientState.onUnsubscribeHandlerId = undefined;
150
- }
151
- }
152
- else {
153
- console.warn(`Trying to remove a handler from a client that isn't mapped. handlerId: ${handlerId}. clientIdentity: ${id}`);
154
- }
155
- }
156
- onAddContextHandlerAdded(payload, senderClientIdentity) {
157
- const clientState = this.getClientState(senderClientIdentity);
158
- const { handlerId } = payload;
159
- if (!clientState) {
160
- throw new Error(`Client with Identity: ${senderClientIdentity.uuid} ${senderClientIdentity.name}, tried to call onAddContextListener, is not connected to this Private Channel`);
161
- }
162
- clientState.onAddContextListenerHandlerId = handlerId;
163
- // FDC3 Spec says that the added listener should fire for all previously-registered addContextListeners from the other client
164
- Array.from(this.clients.values()).forEach((otherClientState) => {
165
- if (otherClientState.clientIdentity.endpointId !== senderClientIdentity.endpointId) {
166
- Array.from(otherClientState.handlerIdsByContextTypes.keys()).forEach((subscribedContextType) => {
167
- this.provider.dispatch(senderClientIdentity, handlerId, subscribedContextType);
168
- });
169
- }
170
- });
171
- }
172
- onDisconnectHandlerAdded(payload, id) {
173
- const clientState = this.getClientState(id);
174
- const { handlerId } = payload;
175
- if (!clientState) {
176
- throw new Error(`Client with Identity: ${id.uuid} ${id.name}, tried to call onDisconnect, is not connected to this Private Channel`);
177
- }
178
- clientState.onDisconnectHandlerId = handlerId;
179
- }
180
- onUnsubscribeHandlerAdded(payload, id) {
181
- const clientState = this.getClientState(id);
182
- const { handlerId } = payload;
183
- if (!clientState) {
184
- throw new Error(`Client with Identity: ${id.uuid} ${id.name}, tried to call onUnsubscribe, is not connected to this Private Channel`);
185
- }
186
- clientState.onUnsubscribeHandlerId = handlerId;
187
- }
188
- removeClient(disconnectingClientIdentity) {
189
- const disconnectingClientState = this.getClientState(disconnectingClientIdentity);
190
- if (!disconnectingClientState) {
191
- throw new Error(`Client with Identity: ${disconnectingClientIdentity.uuid} ${disconnectingClientIdentity.name}, tried to call disconnect, is not connected to this Private Channel`);
192
- }
193
- disconnectingClientState.handlerIdsByContextTypes.clear();
194
- this.clients.delete(disconnectingClientIdentity.endpointId);
195
- }
196
- async fireOnDisconnectForOtherClients(disconnectingClientIdentity) {
197
- // TODO: call onDisconnect Handler of the other client only.
198
- // CURRENTLY, just calling the onDisconnect handler for all the other clients. Once we limit it to just one other client, we can eliminate all the iteration code.
199
- const { endpointId } = disconnectingClientIdentity;
200
- // getting only valid client connections here, it is possible we haven't removed a disconnected client from the map yet
201
- // so we need to ensure we don't dispatch to any disconnected client
202
- // TODO: Take a look at our client disconnection logic and see if we can handle client disconnection cleanly
203
- const clientsToDispatchTo = await this.getConnectedClients();
204
- const dispatchPromises = clientsToDispatchTo.map(async (otherClientState) => {
205
- const { clientIdentity: { endpointId: otherClientEndpointId }, onDisconnectHandlerId } = otherClientState;
206
- if (otherClientEndpointId !== endpointId && onDisconnectHandlerId) {
207
- await this.provider.dispatch(otherClientState.clientIdentity, onDisconnectHandlerId);
208
- }
209
- });
210
- try {
211
- await Promise.all(dispatchPromises);
212
- }
213
- catch (error) {
214
- console.error(`Problem when attempting to dispatch to onDisconnectHandlers. Error: ${error} Disconnecting Client: uuid: ${disconnectingClientIdentity.uuid}. name: ${disconnectingClientIdentity.name}. endpointId: ${disconnectingClientIdentity.endpointId}`);
215
- throw new Error(error);
216
- }
217
- }
218
- async unsubscribeAll(clientIdentity) {
219
- const { endpointId } = clientIdentity;
220
- const state = this.clients.get(endpointId);
221
- if (state) {
222
- const contextTypeHandlerIds = Array.from(state.handlerIdsByContextTypes.values()).flat();
223
- const globalHandlerId = state.globalHandler;
224
- if (contextTypeHandlerIds.length > 0) {
225
- const unsubPromises = contextTypeHandlerIds.map(async (handlerId) => {
226
- return this.contextHandlerRemoved({ handlerId }, clientIdentity);
227
- });
228
- try {
229
- await Promise.all(unsubPromises);
230
- }
231
- catch (error) {
232
- console.error(error.message);
233
- }
234
- }
235
- if (globalHandlerId) {
236
- try {
237
- await this.contextHandlerRemoved({ handlerId: globalHandlerId }, clientIdentity);
238
- }
239
- catch (error) {
240
- console.error(error.message);
241
- }
242
- }
243
- }
244
- }
245
- async handleClientDisconnecting(disconnectingClientIdentity) {
246
- await this.unsubscribeAll(disconnectingClientIdentity);
247
- this.removeClient(disconnectingClientIdentity);
248
- await this.fireOnDisconnectForOtherClients(disconnectingClientIdentity);
249
- }
250
- registerNewClient(clientIdentity) {
251
- if (!this.clients.has(clientIdentity.endpointId)) {
252
- const clientSubscriptionState = {
253
- clientIdentity,
254
- handlerIdsByContextTypes: new Map(),
255
- globalHandler: undefined,
256
- onAddContextListenerHandlerId: undefined,
257
- onUnsubscribeHandlerId: undefined,
258
- onDisconnectHandlerId: undefined
259
- };
260
- this.clients.set(clientIdentity.endpointId, clientSubscriptionState);
261
- }
262
- }
263
- async getConnectedClients() {
264
- const allClientInfo = await this.provider.getAllClientInfo();
265
- return Array.from(this.clients.values()).filter((clientState) => {
266
- const { uuid, name } = clientState.clientIdentity;
267
- return allClientInfo.some((clientInfo) => {
268
- return name === clientInfo.name && uuid === clientInfo.uuid;
269
- });
270
- });
271
- }
272
- static init(channelProvider, id) {
273
- return new PrivateChannelProvider(channelProvider, id);
274
- }
275
- }
276
- exports.PrivateChannelProvider = PrivateChannelProvider;
@@ -1,14 +0,0 @@
1
- /**
2
- * Prior to the move to TypeDoc, OpenFin maintained a copy of the FDC3 documentation under this namespace. To avoid
3
- * duplication, these types have been removed from the OpenFin documentation.
4
- *
5
- * These types can be found in the official FDC3 documentation at https://fdc3.finos.org/docs/api/ref/Types.
6
- *
7
- * @packageDocumentation
8
- */
9
- /**
10
- * @hidden
11
- *
12
- * Export required to allow import into typedoc entry point.
13
- */
14
- export declare const placeholder = "placeholder";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /**
3
- * Prior to the move to TypeDoc, OpenFin maintained a copy of the FDC3 documentation under this namespace. To avoid
4
- * duplication, these types have been removed from the OpenFin documentation.
5
- *
6
- * These types can be found in the official FDC3 documentation at https://fdc3.finos.org/docs/api/ref/Types.
7
- *
8
- * @packageDocumentation
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.placeholder = void 0;
12
- /**
13
- * @hidden
14
- *
15
- * Export required to allow import into typedoc entry point.
16
- */
17
- exports.placeholder = 'placeholder';
@@ -1,205 +0,0 @@
1
- import type * as FDC3v1 from './shapes/fdc3v1';
2
- import { Base } from '../../base';
3
- /**
4
- * @typedef { object } Listener
5
- * @summary Listener object returned by addContextListener and addIntentListener
6
- * @property {function} unsubscribe function for addContextListener and addIntentListener.
7
- */
8
- /**
9
- * @typedef { object } Channel
10
- * @summary Information for a Context Group. Contains metadata for displaying the group properly.
11
- * @property {string} id Name of the context group
12
- * @property {DisplayMetadata} displayMetadata Metadata for the Context Group. Contains the group's human-readable name, color, and an image, as defined by the Interop Broker.
13
- * @property {string} type Defaults to system.
14
- * @property {function} broadcast Broadcasts a context for the channel.
15
- * @property {function} addContextListener Add a context handler for incoming context.
16
- * @property {function} getCurrentContext Gets the current context for the channel.
17
- */
18
- /**
19
- * @typedef { object } AppMetadata
20
- * @summary App metadata is provided by the FDC3 App Directory.
21
- * @property {string} name
22
- * @property {string} [appId]
23
- * @property {string} [version]
24
- * @property {string} [title]
25
- * @property {string} [tooltip]
26
- * @property {string} [description]
27
- * @property {Array<string>} [icons]
28
- * @property {Array<string>} [images]
29
- */
30
- /**
31
- * @typedef { string | AppMetadata } TargetApp
32
- * @summary Some operations can identify an app just by its name, or pass full app metadata.
33
- */
34
- /**
35
- * @typedef { object } IntentResolution
36
- * @summary IntentResolution provides a standard format for data returned upon resolving an Intent.
37
- * @property { TargetApp } source identifier for the Application resolving the Intent (null if the Intent could not be resolved)
38
- * @property { string } [data] Return data structure - if one is provided for the given Intent.
39
- * @property { string } version The version number of the Intents schema being used
40
- */
41
- /**
42
- * @typedef { object } AppIntent
43
- * @summary An interface that represents the binding of an intent to apps.
44
- * @property { Intent } intent
45
- * @property { Array<AppMetadata> } apps
46
- */
47
- /**
48
- * @typedef { object } ImplementationMetadata
49
- * @summary An interface that represents FDC3 implementation meta data.
50
- * @property { string } fdc3Version The FDC3 version
51
- * @property { string } provider The provider uuid with prepend 'openfin'
52
- * @property { string } [providerVersion] The provider runtime version
53
- */
54
- /**
55
- * @version 1.2
56
- * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
57
- * while using our Interop API under the hood. In order to use this set of APIs
58
- * you will need to set up your own {@link InteropBroker InteropBroker} or use a Platform application, which does the setup for you. Refer to our documentation on
59
- * our {@link https://developers.openfin.co/of-docs/docs/enable-color-linking Interop API}.
60
- *
61
- * To enable the FDC3 APIs in a {@link Window Window} or {@link View View}, add the fdc3InteropApi
62
- * property to its options:
63
- *
64
- * ```js
65
- * {
66
- * autoShow: false,
67
- * saveWindowState: true,
68
- * url: 'https://openfin.co',
69
- * fdc3InteropApi: '1.2'
70
- * }
71
- * ```
72
- *
73
- * If using a {@link Platform Platform } application, you can set this property in defaultWindowOptions and defaultViewOptions.
74
- *
75
- * In order to ensure that the FDC3 Api is ready before use, you can use the 'fdc3Ready' event fired on the DOM Window object:
76
- *
77
- * ```js
78
- * function fdc3Action() {
79
- * // Make some fdc3 API calls here
80
- * }
81
- *
82
- * if (window.fdc3) {
83
- * fdc3Action();
84
- * } else {
85
- * window.addEventListener('fdc3Ready', fdc3Action);
86
- * }
87
- * ```
88
- */
89
- export default class Fdc3Module extends Base implements FDC3v1.DesktopAgent {
90
- /**
91
- * Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass `null` for the contextType argument.
92
- * @param contextType - The type of context you wish to handle.
93
- * @param handler - Handler for incoming context.
94
- *
95
- * @tutorial fdc3.addContextListener
96
- * @static
97
- */
98
- addContextListener(contextType: string | null, handler: FDC3v1.ContextHandler): FDC3v1.Listener & Promise<FDC3v1.Listener>;
99
- /**
100
- * Broadcasts a context for the channel of the current entity.
101
- * @param context - New context to set.
102
- *
103
- * @tutorial fdc3.broadcast
104
- * @static
105
- */
106
- broadcast(context: FDC3v1.Context): Promise<void>;
107
- /**
108
- * Returns the Interop-Broker-defined context groups available for an entity to join.
109
- *
110
- * @tutorial fdc3.getSystemChannels
111
- * @static
112
- */
113
- getSystemChannels(): Promise<FDC3v1.SystemChannel[]>;
114
- /**
115
- * Join all Interop Clients at the given identity to context group `contextGroupId`.
116
- * If no target is specified, it adds the sender to the context group.
117
- * Because multiple Channel connections/Interop Clients can potentially exist at a `uuid`/`name` combo, we currently join all Channel connections/Interop Clients at the given identity to the context group.
118
- * If an `endpointId` is provided (which is unlikely, unless the call is coming from an external adapter), then we only join that single connection to the context group.
119
- * For all intents and purposes, there will only be 1 connection present in Platform and Browser implementations, so this point is more-or-less moot.
120
- * @param channelId - Id of the context group.
121
- *
122
- * @tutorial fdc3.joinChannel
123
- * @static
124
- */
125
- joinChannel(channelId: string): Promise<void>;
126
- /**
127
- * Removes the specified target from a context group.
128
- * If no target is specified, it removes the sender from their context group.
129
- *
130
- * @tutorial fdc3.leaveCurrentChannel
131
- * @static
132
- */
133
- leaveCurrentChannel(): Promise<void>;
134
- /**
135
- * Adds a listener for incoming Intents.
136
- * @param intent - Name of the Intent
137
- * @param handler - Handler for incoming Intent
138
- *
139
- * @tutorial fdc3.addIntentListener
140
- * @static
141
- */
142
- addIntentListener(intent: string, handler: FDC3v1.ContextHandler): FDC3v1.Listener & Promise<FDC3v1.Listener>;
143
- /**
144
- * Raises a specific intent.
145
- * @param intent Name of the Intent.
146
- * @param context Context associated with the Intent.
147
- * @param app App that will resolve the Intent. This is added as metadata to the Intent. Can be accessed by the app provider in {@link InteropBroker#handleFiredIntent InteropBroker.handleFiredIntent}.
148
- *
149
- * @tutorial fdc3.raiseIntent
150
- * @static
151
- */
152
- raiseIntent(intent: string, context: FDC3v1.Context, app?: FDC3v1.TargetApp): Promise<FDC3v1.IntentResolution>;
153
- /**
154
- * Returns the Channel that the entity is subscribed to. Returns null if not joined to a channel.
155
- *
156
- * @tutorial fdc3.getCurrentChannel
157
- */
158
- getCurrentChannel(): Promise<FDC3v1.Channel | null>;
159
- /**
160
- * Find out more information about a particular intent by passing its name, and optionally its context.
161
- * @param intent Name of the Intent
162
- * @param context
163
- *
164
- * @tutorial fdc3.findIntent
165
- */
166
- findIntent(intent: string, context?: FDC3v1.Context): Promise<FDC3v1.AppIntent>;
167
- /**
168
- * Find all the available intents for a particular context.
169
- * @param context
170
- *
171
- * @tutorial fdc3.findIntentsByContext
172
- */
173
- findIntentsByContext(context: FDC3v1.Context): Promise<Array<FDC3v1.AppIntent>>;
174
- /**
175
- * Finds and raises an intent against a target app based purely on context data.
176
- * @param context
177
- * @param app
178
- *
179
- * @tutorial fdc3.raiseIntentForContext
180
- */
181
- raiseIntentForContext(context: FDC3v1.Context, app?: FDC3v1.TargetApp): Promise<FDC3v1.IntentResolution>;
182
- /**
183
- * Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
184
- * @param channelId
185
- *
186
- * @tutorial fdc3.getOrCreateChannel
187
- */
188
- getOrCreateChannel(channelId: string): Promise<FDC3v1.Channel>;
189
- /**
190
- * Returns metadata relating to the FDC3 object and its provider, including the supported version of the FDC3 specification and the name of the provider of the implementation.
191
- *
192
- * @tutorial fdc3.getInfo
193
- */
194
- getInfo(): FDC3v1.ImplementationMetadata;
195
- /**
196
- * Launches an app with target information, which can either be a string or an AppMetadata object.
197
- * @param app
198
- * @param context
199
- *
200
- * @tutorial fdc3.open
201
- */
202
- open(app: FDC3v1.TargetApp, context?: FDC3v1.Context): Promise<void>;
203
- private getCurrentContextGroupInfo;
204
- private buildChannelObject;
205
- }