@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,401 +0,0 @@
1
- /* eslint-disable class-methods-use-this, @typescript-eslint/no-empty-function, @typescript-eslint/explicit-function-return-type */
2
- /* todo IMPORTANT PLEASE READ!
3
- * Make sure any edits to the Table of Contents in the following jsdoc comment are also made to both:
4
- * 1. docs home page (/docs.README.md)
5
- * 2. App config web page (https://openfin.co/documentation/application-config/)
6
- */
7
- const InterApplicationBus = {};
8
- /**
9
- * @PORTED
10
- *
11
- * @desc The Channel namespace allows an OpenFin application to create a channel as a {@link Channel#ChannelProvider ChannelProvider},
12
- * or connect to a channel as a {@link Channel#ChannelClient ChannelClient}. The "handshake" between the communication partners is
13
- * simplified when using a channel. A request to connect to a channel as a client will return a promise that resolves if/when the channel has been created. Both the
14
- * provider and client can dispatch actions that have been registered on their opposites, and dispatch returns a promise that resolves with a payload from the other
15
- * communication participant. There can be only one provider per channel, but many clients. Version `9.61.35.*` or later is required for both communication partners.
16
- *
17
- * ##### Asynchronous Methods
18
- * * {@link InterApplicationBus.Channel.create create(channelName, options)}
19
- * * {@link InterApplicationBus.Channel.connect connect(channelName, options)}
20
- * * {@link InterApplicationBus.Channel.onChannelConnect onChannelConnect(listener)}
21
- * * {@link InterApplicationBus.Channel.onChannelDisconnect onChannelDisconnect(listener)}
22
- */
23
- InterApplicationBus.Channel = function () { };
24
- /**
25
- *
26
- * Create a new channel. Returns a promise that resolves with a {@link Channel#ChannelProvider ChannelProvider} instance for your channel.
27
- * You must provide a unique channelName. If a channelName is not provided, or it is not unique, the creation will fail. EXPERIMENTAL: pass { protocols: ['rtc'] } as options to opt-in to High Throughput Channels.
28
- * @param channelName - Name of the channel to be created.
29
- * @param options - Creation options.
30
- *
31
- * @tutorial Channel.create
32
- */
33
- InterApplicationBus.Channel.create = function () { };
34
- /**
35
- *
36
- * Connect to a channel. Returns a promise for a {@link Channel#ChannelClient ChannelClient} instance for that channel.
37
- * If you wish to send a payload to the provider, add a payload property to the options argument. EXPERIMENTAL: pass { protocols: ['rtc'] } as options to opt-in to High Throughput Channels.
38
- * @param channelName - Name of the target channel.
39
- * @param options - Connection options.
40
- *
41
- * @tutorial Channel.connect
42
- *
43
- */
44
- InterApplicationBus.Channel.connect = function (options) { };
45
- /**
46
- *
47
- * Listens for channel connections.
48
- * @param listener - callback to execute.
49
- *
50
- * @tutorial Channel.onChannelConnect
51
- */
52
- InterApplicationBus.Channel.onChannelConnect = function () { };
53
- /**
54
- *
55
- * Listen for channel disconnections.
56
- * @param listener - callback to execute.
57
- *
58
- * @tutorial Channel.onChannelDisconnect
59
- */
60
- InterApplicationBus.Channel.onChannelDisconnect = function () { };
61
- /**
62
- * @PORTED
63
- * Instance created to enable use of a channel as a provider. Allows for communication with the {@link Channel#ChannelClient ChannelClients} by invoking an action on
64
- * a single client via {@link Channel#ChannelProvider#dispatch dispatch} or all clients via {@link Channel#ChannelProvider#publish publish}
65
- * and to listen for communication from clients by registering an action via {@link Channel#ChannelProvider#register register}.
66
- *
67
- * ##### Constructor
68
- *
69
- * Returned by {@link InterApplicationBus.Channel.create Channel.create}.
70
- *
71
- * ##### Synchronous Methods
72
- * * {@link Channel#ChannelProvider#onConnection onConnection(listener)}
73
- * * {@link Channel#ChannelProvider#onDisconnection onDisconnection(listener)}
74
- * * {@link Channel#ChannelProvider#publish publish(action, payload)}
75
- * * {@link Channel#ChannelProvider#register register(action, listener)}
76
- * * {@link Channel#ChannelProvider#remove remove(action)}
77
- *
78
- * ##### Asynchronous Methods
79
- * * {@link Channel#ChannelProvider#destroy destroy()}
80
- * * {@link Channel#ChannelProvider#dispatch dispatch(to, action, payload)}
81
- * * {@link Channel#ChannelProvider#getAllClientInfo getAllClientInfo()}
82
- *
83
- * ##### Middleware
84
- * Middleware functions receive the following arguments: (action, payload, senderId).
85
- * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
86
- * unless it is undefined, in which case the most recently defined payload is used. Middleware can be used for side effects.
87
- * * {@link Channel#ChannelProvider#setDefaultAction setDefaultAction(middleware)}
88
- * * {@link Channel#ChannelProvider#onError onError(middleware)}
89
- * * {@link Channel#ChannelProvider#beforeAction beforeAction(middleware)}
90
- * * {@link Channel#ChannelProvider#afterAction afterAction(middleware)}
91
- *
92
- * @memberof! Channel#
93
- * @hideconstructor
94
- * @property {InterApplicationBus.Channel~ClientIdentity[]} connections a read-only array containing all the identities of connecting clients.
95
- *
96
- */
97
- class ChannelProvider {
98
- /**
99
- *
100
- * Destroy the channel.
101
- *
102
- * @tutorial ChannelProvider.destroy
103
- */
104
- destroy() { }
105
- /**
106
- *
107
- * Dispatch an action to a specified client. Returns a promise for the result of executing that action on the client side.
108
- * @param to - Identity of the target client.
109
- * @param action - Name of the action to be invoked by the client.
110
- * @param payload - Payload to be sent along with the action.
111
- *
112
- * @tutorial Channel.dispatch
113
- */
114
- dispatch() { }
115
- /**
116
- *
117
- * Register an action to be called
118
- * @param action - Name of the action to be registered for channel clients to later invoke.
119
- * @param listener - Function representing the action to be taken on a client dispatch.
120
- * @returns - Boolean representing the successful registration of the action.
121
- * @tutorial Channel.register
122
- */
123
- register() { }
124
- /**
125
- *
126
- * Publish an action and payload to every connected client.
127
- * Synchronously returns an array of promises for each action (see dispatch).
128
- * @param action
129
- * @param payload
130
- *
131
- * @tutorial ChannelProvider.publish
132
- */
133
- publish() { }
134
- /**
135
- *
136
- * Register a listener that is called on every new client connection.
137
- * It is passed the identity of the connecting client and a payload if it was provided to {@link Channel.connect}.
138
- * If you wish to reject the connection, throw an error. Be sure to synchronously provide an onConnection upon receipt of the channelProvider
139
- * to ensure all potential client connections are caught by the listener.
140
- * @param listener
141
- *
142
- * @tutorial ChannelProvider.onConnection
143
- */
144
- onConnection() { }
145
- /**
146
- *
147
- * Register a listener that is called on every new client disconnection.
148
- * It is passed the disconnection event of the disconnecting client.
149
- * @param listener
150
- *
151
- * @tutorial Channel.onDisconnection
152
- */
153
- onDisconnection() { }
154
- /**
155
- *
156
- * Register middleware that fires before the action.
157
- * @param middleware - Function to be executed before invoking the action.
158
- *
159
- * @tutorial ChannelMiddleware.beforeAction
160
- */
161
- beforeAction() { }
162
- /**
163
- *
164
- * Register an error handler. This is called before responding on any error.
165
- * @param middleware - Function to be executed in case of an error.
166
- *
167
- * @tutorial ChannelMiddleware.onError
168
- */
169
- onError() { }
170
- /**
171
- *
172
- * Register middleware that fires after the action. This is passed the return value of the action.
173
- * @param middleware - Function to be executed after invoking the action.
174
- *
175
- * @tutorial ChannelMiddleware.afterAction
176
- */
177
- afterAction() { }
178
- /**
179
- *
180
- * Remove an action by action name.
181
- * @param action - Name of the action to be removed.
182
- *
183
- * @tutorial Channel.remove
184
- */
185
- remove() { }
186
- /**
187
- *
188
- * Sets a default action. This is used any time an action that has not been registered is invoked.
189
- * Default behavior if not set is to throw an error.
190
- * @param middleware - Function to be executed when a client invokes an action name that has not been registered.
191
- *
192
- * @tutorial ChannelMiddleware.setDefaultAction
193
- */
194
- setDefaultAction() { }
195
- /** Returns an array with info on every Client connected to the Provider
196
- *
197
- * @tutorial Channel.getAllClientInfo
198
- */
199
- getAllClientInfo() { }
200
- }
201
- /**
202
- * @PORTED
203
- * Instance created to enable use of a channel as a client. Allows for communication with the
204
- * {@link Channel#ChannelProvider ChannelProvider} by invoking an action on the
205
- * provider via {@link Channel#ChannelClient#dispatch dispatch} and to listen for communication
206
- * from the provider by registering an action via {@link Channel#ChannelClient#register register}.
207
- *
208
- * ##### Constructor
209
- * Returned by {@link InterApplicationBus.Channel.connect Channel.connect}.
210
- *
211
- * ##### Synchronous Methods
212
- * * {@link Channel#ChannelClient#onDisconnection onDisconnection(listener)}
213
- * * {@link Channel#ChannelClient#register register(action, listener)}
214
- * * {@link Channel#ChannelClient#remove remove(action)}
215
- *
216
- * ##### Asynchronous Methods
217
- * * {@link Channel#ChannelClient#disconnect disconnect()}
218
- * * {@link Channel#ChannelClient#dispatch dispatch(action, payload)}
219
- *
220
- * ##### Middleware
221
- * Middleware functions receive the following arguments: (action, payload, senderId).
222
- * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
223
- * unless it is undefined, in which case the original payload is used. Middleware can be used for side effects.
224
- * * {@link Channel#ChannelClient#setDefaultAction setDefaultAction(middleware)}
225
- * * {@link Channel#ChannelClient#onError onError(middleware)}
226
- * * {@link Channel#ChannelClient#beforeAction beforeAction(middleware)}
227
- * * {@link Channel#ChannelClient#afterAction afterAction(middleware)}
228
- *
229
- * @hideconstructor
230
- * @memberof! Channel#
231
- * @property {InterApplicationBus.Channel~ProviderIdentity} providerIdentity a read-only provider identity
232
- */
233
- class ChannelClient {
234
- /**
235
- *
236
- * Disconnect from the channel.
237
- * @tutorial Channel.disconnect
238
- *
239
- */
240
- disconnect() { }
241
- /**
242
- *
243
- * Dispatch the given action to the channel provider. Returns a promise that resolves with the response from the provider for that action.
244
- * @param action - Name of the action to be invoked by the channel provider.
245
- * @param payload - Payload to be sent along with the action.
246
- * @tutorial Channel.dispatch
247
- *
248
- */
249
- dispatch() { }
250
- /**
251
- *
252
- * Register an action to be called by the provider of the channel.
253
- * @param action - Name of the action to be registered for the channel provider to later invoke.
254
- * @param listener - Function representing the action to be taken on a provider dispatch.
255
- *
256
- * @tutorial Channel.register
257
- */
258
- register() { }
259
- /**
260
- *
261
- * Register middleware that fires before the action.
262
- * @param middleware - Function to be executed before invoking the action.
263
- *
264
- * @tutorial ChannelMiddleware.beforeAction
265
- */
266
- beforeAction() { }
267
- /**
268
- *
269
- * Register a listener that is called on channel disconnection.
270
- * It is passed the disconnection event of the disconnecting channel.
271
- * @param listener
272
- *
273
- * @tutorial Channel.onDisconnection
274
- */
275
- onDisconnection() { }
276
- /**
277
- * Register an error handler. This is called before responding on any error.
278
- * @param middleware - Function to be executed in case of an error.
279
- *
280
- * @tutorial ChannelMiddleware.onError
281
- */
282
- onError() { }
283
- /**
284
- *
285
- * Register middleware that fires after the action. This is passed the return value of the action.
286
- * @param middleware - Function to be executed after invoking the action.
287
- *
288
- * @tutorial ChannelMiddleware.afterAction
289
- */
290
- afterAction() { }
291
- /**
292
- *
293
- * Remove an action by action name.
294
- * @param action - Name of the action to be removed.
295
- *
296
- * @tutorial Channel.remove
297
- */
298
- remove() { }
299
- /**
300
- *
301
- * Sets a default action. This is used any time an action that has not been registered is invoked.
302
- * Default behavior if not set is to throw an error.
303
- * @param middleware - Function to be executed when a client invokes an action name that has not been registered.
304
- *
305
- * @tutorial ChannelMiddleware.setDefaultAction
306
- */
307
- setDefaultAction() { }
308
- }
309
- /**
310
- * Channel action callback signature
311
- * @callback Channel#ChannelProvider~Action
312
- * @param payload - Payload sent along with the message.
313
- * @param identity - Identity of the sender.
314
- */
315
- /**
316
- * Channel action callback signature
317
- * @callback Channel#ChannelClient~Action
318
- * @param payload - Payload sent along with the message.
319
- * @param identity - Identity of the sender.
320
- */
321
- /**
322
- * Middleware function signature
323
- * @callback Channel#ChannelProvider~Middleware
324
- * @param action - Action to be invoked.
325
- * @param payload - Payload sent along with the message (or error for error middleware).
326
- * @param identity - Identity of the sender.
327
- */
328
- /**
329
- * Middleware function signature
330
- * @callback Channel#ChannelClient~Middleware
331
- * @param action - Action to be invoked.
332
- * @param payload - Payload sent along with the message (or error for error middleware).
333
- * @param identity - Identity of the sender.
334
- */
335
- /**
336
- * Callback for the channel onConnection or onDisconnection. If it errors connection will be rejected.
337
- * @callback Channel#ChannelProvider~ConnectionListener
338
- * @param identity - Identity of the client attempting to connect to the channel.
339
- * @param payload - Payload sent with connection request.
340
- */
341
- /**
342
- * @REMOVED
343
- * Callback for onChannelConnect or onChannelDisconnect.
344
- * @typedef {object} InterApplicationBus.Channel~ConnectionEvent
345
- * @property {string} channelId - Identifier of the channel.
346
- * @property {string} uuid - Channel provider uuid.
347
- * @property {string} [name] - Channel provider name.
348
- * @property {string} channelName - Name of the channel.
349
- */
350
- /**
351
- * @PORTED
352
- * Protocol values for determining channel messaging strategy.
353
- * @typedef {('classic' | 'rtc')} InterApplicationBus.Channel~MessagingProtocols - EXPERIMENTAL
354
- *
355
- */
356
- /**
357
- * @PORTED
358
- * Channel provider creation options.
359
- * @typedef {object} InterApplicationBus.Channel~ChannelCreateOptions
360
- * @property {InterApplicationBus.Channel~MessagingProtocols[]} [protocols=['classic']] - EXPERIMENTAL: Messaging protocols supported by the channel provider.
361
- *
362
- */
363
- /**
364
- * @PORTED
365
- * Options provided on a client connection to a channel.
366
- * @typedef {object} InterApplicationBus.Channel~ChannelConnectOptions
367
- * @property {InterApplicationBus.Channel~MessagingProtocols[]} [protocols=['classic']] - EXPERIMENTAL: Messaging protocols requested by the client, connection will fail if the provider protocols are not compatible.
368
- * @property {any} [payload] - Payload to pass to ChannelProvider onConnection action.
369
- * @property {boolean} [wait=true] - If true will wait for ChannelProvider to connect. If false will fail if ChannelProvider is not found.
370
- *
371
- */
372
- /**
373
- * @PORTED
374
- * Provider Identity.
375
- * @typedef {object} InterApplicationBus.Channel~ProviderIdentity
376
- * @property {string} uuid - Channel provider uuid.
377
- * @property {string} [name] - Channel provider name.
378
- * @property {string} channelId - Identifier of the channel.
379
- * @property {boolean} [isExternal] - true if it's external connection.
380
- * @property {string} channelName - Name of the channel.
381
- *
382
- */
383
- /**
384
- * @PORTED
385
- * Client Identity.
386
- * @typedef {object} InterApplicationBus.Channel~ClientIdentity
387
- * @property {string} uuid - Channel client uuid.
388
- * @property {string} name - Channel client name.
389
- * @property {string} endpointId - Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
390
- *
391
- */
392
- /**
393
- * @PORTED
394
- * Extended Client Information
395
- * @typedef {object} InterApplicationBus.Channel~ClientInfo
396
- * @property {string} uuid - Channel client uuid
397
- * @property {string} name - Channel client name
398
- * @property {string} endpointId - Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
399
- * @property {string} entityType - Indicates if the client belongs to a Window or View
400
- * @property {string} connectionUrl - URL of the View or Window at the time of connection to the Channel Provider.
401
- */
@@ -1,117 +0,0 @@
1
- import type * as OpenFin from '../../../OpenFin';
2
- import { ChannelBase } from './channel';
3
- import { Transport } from '../../../transport/transport';
4
- import { AnyStrategy } from './protocols/strategy-types';
5
- type ProviderIdentity = OpenFin.ProviderIdentity;
6
- type DisconnectionListener = (providerIdentity: ProviderIdentity) => any;
7
- export type RoutingInfo = ProviderIdentity & {
8
- endpointId: string;
9
- };
10
- /**
11
- * Instance created to enable use of a channel as a client. Allows for communication with the
12
- * {@link ChannelProvider ChannelProvider} by invoking an action on the
13
- * provider via {@link ChannelClient#dispatch dispatch} and to listen for communication
14
- * from the provider by registering an action via {@link ChannelClient#register register}.
15
- *
16
- * Synchronous Methods:
17
- * * {@link ChannelClient#onDisconnection onDisconnection(listener)}
18
- * * {@link ChannelClient#register register(action, listener)}
19
- * * {@link ChannelClient#remove remove(action)}
20
- *
21
- * Asynchronous Methods:
22
- * * {@link ChannelClient#disconnect disconnect()}
23
- * * {@link ChannelClient#dispatch dispatch(action, payload)}
24
- *
25
- * Middleware:
26
- * <br>Middleware functions receive the following arguments: (action, payload, senderId).
27
- * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
28
- * unless it is undefined, in which case the original payload is used. Middleware can be used for side effects.
29
- * * {@link ChannelClient#setDefaultAction setDefaultAction(middleware)}
30
- * * {@link ChannelClient#onError onError(middleware)}
31
- * * {@link ChannelClient#beforeAction beforeAction(middleware)}
32
- * * {@link ChannelClient#afterAction afterAction(middleware)}
33
- */
34
- export default class ChannelClient extends ChannelBase {
35
- #private;
36
- private disconnectListener;
37
- private endpointId;
38
- /**
39
- * @internal
40
- */
41
- static closeChannelByEndpointId(id: string): void;
42
- /**
43
- * @internal
44
- * closes the corresponding channel and invokes the disconnect listener if an event payload is passed.
45
- */
46
- static handleProviderDisconnect(eventPayload: ProviderIdentity): void;
47
- /**
48
- * @internal
49
- */
50
- constructor(routingInfo: RoutingInfo, wire: Transport, strategy: AnyStrategy);
51
- protected processAction: (action: string, payload: any, senderIdentity: ProviderIdentity | OpenFin.ClientIdentity) => Promise<any>;
52
- /**
53
- * a read-only provider identity
54
- */
55
- get providerIdentity(): ProviderIdentity;
56
- /**
57
- * Dispatch the given action to the channel provider. Returns a promise that resolves with the response from
58
- * the provider for that action.
59
- *
60
- * @param action
61
- * @param payload
62
- *
63
- * @example
64
- *
65
- * ```js
66
- * (async ()=> {
67
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
68
- *
69
- * await client.register('client-action', (payload, identity) => {
70
- * console.log(payload, identity);
71
- * return {
72
- * echo: payload
73
- * };
74
- * });
75
- *
76
- * const providerResponse = await client.dispatch('provider-action', { message: 'Hello From the client'});
77
- * console.log(providerResponse);
78
- * })();
79
- * ```
80
- */
81
- dispatch(action: string, payload?: any): Promise<any>;
82
- /**
83
- * Register a listener that is called on provider disconnection. It is passed the disconnection event of the
84
- * disconnecting provider.
85
- *
86
- * @param listener
87
- *
88
- * @example
89
- *
90
- * ```js
91
- * (async ()=> {
92
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
93
- *
94
- * await client.onDisconnection(evt => {
95
- * console.log('Provider disconnected', `uuid: ${evt.uuid}, name: ${evt.name}`);
96
- * });
97
- * })();
98
- * ```
99
- */
100
- onDisconnection(listener: DisconnectionListener): void;
101
- /**
102
- * Disconnects the client from the channel.
103
- *
104
- * @example
105
- *
106
- * ```js
107
- * (async ()=> {
108
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
109
- *
110
- * await client.disconnect();
111
- * })();
112
- * ```
113
- */
114
- disconnect(): Promise<void>;
115
- sendDisconnectAction(): Promise<void>;
116
- }
117
- export {};
@@ -1,181 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
- if (kind === "m") throw new TypeError("Private method is not writable");
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
- };
13
- var _ChannelClient_protectedObj, _ChannelClient_strategy, _ChannelClient_close;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const channel_1 = require("./channel");
16
- const channelClientsByEndpointId = new Map();
17
- /**
18
- * Instance created to enable use of a channel as a client. Allows for communication with the
19
- * {@link ChannelProvider ChannelProvider} by invoking an action on the
20
- * provider via {@link ChannelClient#dispatch dispatch} and to listen for communication
21
- * from the provider by registering an action via {@link ChannelClient#register register}.
22
- *
23
- * Synchronous Methods:
24
- * * {@link ChannelClient#onDisconnection onDisconnection(listener)}
25
- * * {@link ChannelClient#register register(action, listener)}
26
- * * {@link ChannelClient#remove remove(action)}
27
- *
28
- * Asynchronous Methods:
29
- * * {@link ChannelClient#disconnect disconnect()}
30
- * * {@link ChannelClient#dispatch dispatch(action, payload)}
31
- *
32
- * Middleware:
33
- * <br>Middleware functions receive the following arguments: (action, payload, senderId).
34
- * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
35
- * unless it is undefined, in which case the original payload is used. Middleware can be used for side effects.
36
- * * {@link ChannelClient#setDefaultAction setDefaultAction(middleware)}
37
- * * {@link ChannelClient#onError onError(middleware)}
38
- * * {@link ChannelClient#beforeAction beforeAction(middleware)}
39
- * * {@link ChannelClient#afterAction afterAction(middleware)}
40
- */
41
- class ChannelClient extends channel_1.ChannelBase {
42
- /**
43
- * @internal
44
- */
45
- static closeChannelByEndpointId(id) {
46
- const channel = channelClientsByEndpointId.get(id);
47
- if (channel) {
48
- __classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
49
- }
50
- }
51
- /**
52
- * @internal
53
- * closes the corresponding channel and invokes the disconnect listener if an event payload is passed.
54
- */
55
- static handleProviderDisconnect(eventPayload) {
56
- for (const channelClient of channelClientsByEndpointId.values()) {
57
- if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
58
- channelClient.disconnectListener(eventPayload);
59
- __classPrivateFieldGet(channelClient, _ChannelClient_close, "f").call(channelClient);
60
- }
61
- }
62
- }
63
- /**
64
- * @internal
65
- */
66
- constructor(routingInfo, wire, strategy) {
67
- super();
68
- _ChannelClient_protectedObj.set(this, void 0);
69
- _ChannelClient_strategy.set(this, void 0);
70
- // needs to be bound;
71
- this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
72
- _ChannelClient_close.set(this, () => {
73
- channelClientsByEndpointId.delete(this.endpointId);
74
- __classPrivateFieldGet(this, _ChannelClient_strategy, "f").close();
75
- });
76
- __classPrivateFieldSet(this, _ChannelClient_protectedObj, new channel_1.ProtectedItems(routingInfo, wire), "f");
77
- this.disconnectListener = () => undefined;
78
- this.endpointId = routingInfo.endpointId;
79
- __classPrivateFieldSet(this, _ChannelClient_strategy, strategy, "f");
80
- channelClientsByEndpointId.set(this.endpointId, this);
81
- strategy.receive(this.processAction);
82
- }
83
- /**
84
- * a read-only provider identity
85
- */
86
- get providerIdentity() {
87
- const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
88
- return protectedObj.providerIdentity;
89
- }
90
- /**
91
- * Dispatch the given action to the channel provider. Returns a promise that resolves with the response from
92
- * the provider for that action.
93
- *
94
- * @param action
95
- * @param payload
96
- *
97
- * @example
98
- *
99
- * ```js
100
- * (async ()=> {
101
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
102
- *
103
- * await client.register('client-action', (payload, identity) => {
104
- * console.log(payload, identity);
105
- * return {
106
- * echo: payload
107
- * };
108
- * });
109
- *
110
- * const providerResponse = await client.dispatch('provider-action', { message: 'Hello From the client'});
111
- * console.log(providerResponse);
112
- * })();
113
- * ```
114
- */
115
- async dispatch(action, payload) {
116
- if (__classPrivateFieldGet(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
117
- return __classPrivateFieldGet(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
118
- }
119
- throw new Error('The client you are trying to dispatch from is disconnected from the target provider.');
120
- }
121
- /**
122
- * Register a listener that is called on provider disconnection. It is passed the disconnection event of the
123
- * disconnecting provider.
124
- *
125
- * @param listener
126
- *
127
- * @example
128
- *
129
- * ```js
130
- * (async ()=> {
131
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
132
- *
133
- * await client.onDisconnection(evt => {
134
- * console.log('Provider disconnected', `uuid: ${evt.uuid}, name: ${evt.name}`);
135
- * });
136
- * })();
137
- * ```
138
- */
139
- onDisconnection(listener) {
140
- this.disconnectListener = (payload) => {
141
- try {
142
- listener(payload);
143
- }
144
- catch (err) {
145
- throw new Error(`Error while calling the onDisconnection callback: ${err.message}`);
146
- }
147
- finally {
148
- this.disconnectListener = () => undefined;
149
- }
150
- };
151
- }
152
- /**
153
- * Disconnects the client from the channel.
154
- *
155
- * @example
156
- *
157
- * ```js
158
- * (async ()=> {
159
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
160
- *
161
- * await client.disconnect();
162
- * })();
163
- * ```
164
- */
165
- async disconnect() {
166
- await this.sendDisconnectAction();
167
- __classPrivateFieldGet(this, _ChannelClient_close, "f").call(this);
168
- }
169
- async sendDisconnectAction() {
170
- const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
171
- const { channelName, uuid, name } = protectedObj.providerIdentity;
172
- await protectedObj.wire.sendAction('disconnect-from-channel', {
173
- channelName,
174
- uuid,
175
- name,
176
- endpointId: this.endpointId
177
- });
178
- }
179
- }
180
- exports.default = ChannelClient;
181
- _ChannelClient_protectedObj = new WeakMap(), _ChannelClient_strategy = new WeakMap(), _ChannelClient_close = new WeakMap();