@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,334 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChannelBase = exports.ProtectedItems = void 0;
4
- const resultOrPayload = (func) => async (topic, payload, senderIdentity) => {
5
- const res = await func(topic, payload, senderIdentity);
6
- return res === undefined ? payload : res;
7
- };
8
- class ProtectedItems {
9
- /**
10
- * @internal
11
- */
12
- constructor(providerIdentity, wire) {
13
- this.providerIdentity = providerIdentity;
14
- this.wire = wire;
15
- }
16
- }
17
- exports.ProtectedItems = ProtectedItems;
18
- class ChannelBase {
19
- static defaultAction(topic) {
20
- throw new Error(`No action registered at target for ${topic}`);
21
- }
22
- constructor() {
23
- this.subscriptions = new Map();
24
- }
25
- async processAction(topic, payload, senderIdentity) {
26
- try {
27
- const mainAction = this.subscriptions.has(topic)
28
- ? this.subscriptions.get(topic)
29
- : (currentPayload, id) => { var _a; return ((_a = this.defaultAction) !== null && _a !== void 0 ? _a : ChannelBase.defaultAction)(topic, currentPayload, id); };
30
- const preActionProcessed = this.preAction ? await this.preAction(topic, payload, senderIdentity) : payload;
31
- const actionProcessed = await mainAction(preActionProcessed, senderIdentity);
32
- return this.postAction ? await this.postAction(topic, actionProcessed, senderIdentity) : actionProcessed;
33
- }
34
- catch (e) {
35
- if (this.errorMiddleware) {
36
- return this.errorMiddleware(topic, e, senderIdentity);
37
- }
38
- throw e;
39
- }
40
- }
41
- /**
42
- * Register middleware that fires before the action.
43
- *
44
- * @param func
45
- *
46
- * @example
47
- *
48
- * Channel Provider:
49
- * ```js
50
- * (async ()=> {
51
- * const provider = await fin.InterApplicationBus.Channel.create('channelName');
52
- *
53
- * provider.register('provider-action', (payload, identity) => {
54
- * console.log(payload, identity);
55
- * return {
56
- * echo: payload
57
- * };
58
- * });
59
- *
60
- * provider.beforeAction((action, payload, identity) => {
61
- * //The payload can be altered here before handling the action.
62
- * payload.received = Date.now();
63
- * return payload;
64
- * });
65
- *
66
- * })();
67
- * ```
68
- *
69
- * Channel Client:
70
- * ```js
71
- * (async ()=> {
72
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
73
- *
74
- * client.register('client-action', (payload, identity) => {
75
- * console.log(payload, identity);
76
- * return {
77
- * echo: payload
78
- * };
79
- * });
80
- *
81
- * client.beforeAction((action, payload, identity) => {
82
- * //The payload can be altered here before handling the action.
83
- * payload.received = Date.now();
84
- * return payload;
85
- * });
86
- *
87
- * const providerResponse = await client.dispatch('provider-action', { message: 'Hello From the client' });
88
- * console.log(providerResponse);
89
- * })();
90
- * ```
91
- */
92
- beforeAction(func) {
93
- if (this.preAction) {
94
- throw new Error('Already registered beforeAction middleware');
95
- }
96
- this.preAction = resultOrPayload(func);
97
- }
98
- /**
99
- * Register an error handler. This is called before responding on any error.
100
- *
101
- * @param func
102
- *
103
- * Channel Provider:
104
- * ```js
105
- * (async ()=> {
106
- * const provider = await fin.InterApplicationBus.Channel.create('channelName');
107
- *
108
- * provider.register('provider-action', (payload, identity) => {
109
- * console.log(payload);
110
- * throw new Error('Action error');
111
- * return {
112
- * echo: payload
113
- * };
114
- * });
115
- *
116
- * provider.onError((action, error, identity) => {
117
- * console.log('uncaught Exception in action:', action);
118
- * console.error(error);
119
- * });
120
- *
121
- * })();
122
- * ```
123
- *
124
- * Channel Client:
125
- * ```js
126
- * (async ()=> {
127
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
128
- *
129
- * client.register('client-action', (payload, identity) => {
130
- * console.log(payload);
131
- * throw new Error('Action error');
132
- * return {
133
- * echo: payload
134
- * };
135
- * });
136
- *
137
- * client.onError((action, error, identity) => {
138
- * console.log('uncaught Exception in action:', action);
139
- * console.error(error);
140
- * });
141
- * })();
142
- * ```
143
- */
144
- onError(func) {
145
- if (this.errorMiddleware) {
146
- throw new Error('Already registered error middleware');
147
- }
148
- this.errorMiddleware = func;
149
- }
150
- /**
151
- * Register middleware that fires after the action.
152
- *
153
- * @param func
154
- *
155
- * @remarks If the action does not return the payload, then the afterAction will not have access to the payload object.
156
- *
157
- * @example
158
- *
159
- * Channel Provider:
160
- * ```js
161
- * (async ()=> {
162
- * const provider = await fin.InterApplicationBus.Channel.create('channelName');
163
- *
164
- * await provider.register('provider-action', (payload, identity) => {
165
- * return {
166
- * echo: payload
167
- * };
168
- * });
169
- *
170
- * await provider.afterAction((action, payload, identity) => {
171
- * //the payload can be altered here after handling the action but before sending an acknowledgement.
172
- * payload.sent = date.now();
173
- * return payload;
174
- * });
175
- *
176
- * })();
177
- * ```
178
- *
179
- * Channel Client:
180
- * ```js
181
- * (async ()=> {
182
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
183
- *
184
- * await client.register('client-action', (payload, identity) => {
185
- * return {
186
- * echo: payload
187
- * };
188
- * });
189
- *
190
- * await client.afterAction((action, payload, identity) => {
191
- * //the payload can be altered here after handling the action but before sending an acknowledgement.
192
- * payload.sent = date.now();
193
- * return payload;
194
- * });
195
- *
196
- * })();
197
- * ```
198
- */
199
- afterAction(func) {
200
- if (this.postAction) {
201
- throw new Error('Already registered afterAction middleware');
202
- }
203
- this.postAction = resultOrPayload(func);
204
- }
205
- /**
206
- * Remove an action by action name.
207
- *
208
- * @param action
209
- *
210
- * @example
211
- *
212
- * ```js
213
- * (async ()=> {
214
- * const provider = await fin.InterApplicationBus.Channel.create('channelName');
215
- *
216
- * await provider.register('provider-action', (payload, identity) => {
217
- * console.log(payload);
218
- * return {
219
- * echo: payload
220
- * };
221
- * });
222
- *
223
- * await provider.remove('provider-action');
224
- *
225
- * })();
226
- * ```
227
- */
228
- remove(action) {
229
- this.subscriptions.delete(action);
230
- }
231
- /**
232
- * Registers a default action. This is used any time an action that has not been registered is invoked.
233
- *
234
- * @example
235
- *
236
- * Channel Provider:
237
- * ```js
238
- * (async ()=> {
239
- * const provider = await fin.InterApplicationBus.Channel.create('channelName');
240
- *
241
- * await provider.setDefaultAction((action, payload, identity) => {
242
- * console.log(`Client with identity ${JSON.stringify(identity)} has attempted to dispatch unregistered action: ${action}.`);
243
- *
244
- * return {
245
- * echo: payload
246
- * };
247
- * });
248
- *
249
- * })();
250
- * ```
251
- *
252
- * Channel Client:
253
- * ```js
254
- * (async ()=> {
255
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
256
- *
257
- * await client.setDefaultAction((action, payload, identity) => {
258
- * console.log(`Provider with identity ${JSON.stringify(identity)} has attempted to dispatch unregistered action: ${action}.`);
259
- *
260
- * return {
261
- * echo: payload
262
- * };
263
- * });
264
- *
265
- * })();
266
- * ```
267
- * @param func
268
- */
269
- setDefaultAction(func) {
270
- if (this.defaultAction) {
271
- throw new Error('default action can only be set once');
272
- }
273
- else {
274
- this.defaultAction = func;
275
- }
276
- }
277
- /**
278
- * Register an action to be called by dispatching from any channelClient or channelProvider.
279
- *
280
- * @param topic
281
- * @param listener
282
- *
283
- * @remarks The return value will be sent back as an acknowledgement to the original caller. You can throw an
284
- * error to send a negative-acknowledgement and the error will reject the promise returned to the sender by the
285
- * dispatch call. Once a listener is registered for a particular action, it stays in place receiving and responding
286
- * to incoming messages until it is removed. This messaging mechanism works exactly the same when messages are
287
- * dispatched from the provider to a client. However, the provider has an additional publish method that sends messages
288
- * to all connected clients.
289
- *
290
- * Because multiple clients can share the same `name` and `uuid`, in order to distinguish between individual clients,
291
- * the `identity` argument in a provider's registered action callback contains an `endpointId` property. When dispatching
292
- * from a provider to a client, the `endpointId` property must be provided in order to send an action to a specific client.
293
- *
294
- * @example
295
- *
296
- * Channel Provider:
297
- * ```js
298
- * (async ()=> {
299
- * const provider = await fin.InterApplicationBus.Channel.create('channelName');
300
- *
301
- * await provider.register('provider-action', (payload, identity) => {
302
- * console.log('Action dispatched by client: ', identity);
303
- * console.log('Payload sent in dispatch: ', payload);
304
- *
305
- * return { echo: payload };
306
- * });
307
- * })();
308
- * ```
309
- *
310
- * Channel Client:
311
- * ```js
312
- * (async ()=> {
313
- * const client = await fin.InterApplicationBus.Channel.connect('channelName');
314
- *
315
- * await client.register('client-action', (payload, identity) => {
316
- * console.log('Action dispatched by client: ', identity);
317
- * console.log('Payload sent in dispatch: ', payload);
318
- *
319
- * return { echo: payload };
320
- * });
321
- * })();
322
- * ```
323
- */
324
- register(topic, listener) {
325
- if (this.subscriptions.has(topic)) {
326
- throw new Error(`Subscription already registered for action: ${topic}. Unsubscribe before adding new subscription`);
327
- }
328
- else {
329
- this.subscriptions.set(topic, listener);
330
- return true;
331
- }
332
- }
333
- }
334
- exports.ChannelBase = ChannelBase;
@@ -1,342 +0,0 @@
1
- declare const InterApplicationBus: any;
2
- /**
3
- * @PORTED
4
- * 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
5
- * a single client via {@link Channel#ChannelProvider#dispatch dispatch} or all clients via {@link Channel#ChannelProvider#publish publish}
6
- * and to listen for communication from clients by registering an action via {@link Channel#ChannelProvider#register register}.
7
- *
8
- * ##### Constructor
9
- *
10
- * Returned by {@link InterApplicationBus.Channel.create Channel.create}.
11
- *
12
- * ##### Synchronous Methods
13
- * * {@link Channel#ChannelProvider#onConnection onConnection(listener)}
14
- * * {@link Channel#ChannelProvider#onDisconnection onDisconnection(listener)}
15
- * * {@link Channel#ChannelProvider#publish publish(action, payload)}
16
- * * {@link Channel#ChannelProvider#register register(action, listener)}
17
- * * {@link Channel#ChannelProvider#remove remove(action)}
18
- *
19
- * ##### Asynchronous Methods
20
- * * {@link Channel#ChannelProvider#destroy destroy()}
21
- * * {@link Channel#ChannelProvider#dispatch dispatch(to, action, payload)}
22
- * * {@link Channel#ChannelProvider#getAllClientInfo getAllClientInfo()}
23
- *
24
- * ##### Middleware
25
- * Middleware functions receive the following arguments: (action, payload, senderId).
26
- * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
27
- * unless it is undefined, in which case the most recently defined payload is used. Middleware can be used for side effects.
28
- * * {@link Channel#ChannelProvider#setDefaultAction setDefaultAction(middleware)}
29
- * * {@link Channel#ChannelProvider#onError onError(middleware)}
30
- * * {@link Channel#ChannelProvider#beforeAction beforeAction(middleware)}
31
- * * {@link Channel#ChannelProvider#afterAction afterAction(middleware)}
32
- *
33
- * @memberof! Channel#
34
- * @hideconstructor
35
- * @property {InterApplicationBus.Channel~ClientIdentity[]} connections a read-only array containing all the identities of connecting clients.
36
- *
37
- */
38
- declare class ChannelProvider {
39
- /**
40
- *
41
- * Destroy the channel.
42
- *
43
- * @tutorial ChannelProvider.destroy
44
- */
45
- destroy(): void;
46
- /**
47
- *
48
- * Dispatch an action to a specified client. Returns a promise for the result of executing that action on the client side.
49
- * @param to - Identity of the target client.
50
- * @param action - Name of the action to be invoked by the client.
51
- * @param payload - Payload to be sent along with the action.
52
- *
53
- * @tutorial Channel.dispatch
54
- */
55
- dispatch(): void;
56
- /**
57
- *
58
- * Register an action to be called
59
- * @param action - Name of the action to be registered for channel clients to later invoke.
60
- * @param listener - Function representing the action to be taken on a client dispatch.
61
- * @returns - Boolean representing the successful registration of the action.
62
- * @tutorial Channel.register
63
- */
64
- register(): void;
65
- /**
66
- *
67
- * Publish an action and payload to every connected client.
68
- * Synchronously returns an array of promises for each action (see dispatch).
69
- * @param action
70
- * @param payload
71
- *
72
- * @tutorial ChannelProvider.publish
73
- */
74
- publish(): void;
75
- /**
76
- *
77
- * Register a listener that is called on every new client connection.
78
- * It is passed the identity of the connecting client and a payload if it was provided to {@link Channel.connect}.
79
- * If you wish to reject the connection, throw an error. Be sure to synchronously provide an onConnection upon receipt of the channelProvider
80
- * to ensure all potential client connections are caught by the listener.
81
- * @param listener
82
- *
83
- * @tutorial ChannelProvider.onConnection
84
- */
85
- onConnection(): void;
86
- /**
87
- *
88
- * Register a listener that is called on every new client disconnection.
89
- * It is passed the disconnection event of the disconnecting client.
90
- * @param listener
91
- *
92
- * @tutorial Channel.onDisconnection
93
- */
94
- onDisconnection(): void;
95
- /**
96
- *
97
- * Register middleware that fires before the action.
98
- * @param middleware - Function to be executed before invoking the action.
99
- *
100
- * @tutorial ChannelMiddleware.beforeAction
101
- */
102
- beforeAction(): void;
103
- /**
104
- *
105
- * Register an error handler. This is called before responding on any error.
106
- * @param middleware - Function to be executed in case of an error.
107
- *
108
- * @tutorial ChannelMiddleware.onError
109
- */
110
- onError(): void;
111
- /**
112
- *
113
- * Register middleware that fires after the action. This is passed the return value of the action.
114
- * @param middleware - Function to be executed after invoking the action.
115
- *
116
- * @tutorial ChannelMiddleware.afterAction
117
- */
118
- afterAction(): void;
119
- /**
120
- *
121
- * Remove an action by action name.
122
- * @param action - Name of the action to be removed.
123
- *
124
- * @tutorial Channel.remove
125
- */
126
- remove(): void;
127
- /**
128
- *
129
- * Sets a default action. This is used any time an action that has not been registered is invoked.
130
- * Default behavior if not set is to throw an error.
131
- * @param middleware - Function to be executed when a client invokes an action name that has not been registered.
132
- *
133
- * @tutorial ChannelMiddleware.setDefaultAction
134
- */
135
- setDefaultAction(): void;
136
- /** Returns an array with info on every Client connected to the Provider
137
- *
138
- * @tutorial Channel.getAllClientInfo
139
- */
140
- getAllClientInfo(): void;
141
- }
142
- /**
143
- * @PORTED
144
- * Instance created to enable use of a channel as a client. Allows for communication with the
145
- * {@link Channel#ChannelProvider ChannelProvider} by invoking an action on the
146
- * provider via {@link Channel#ChannelClient#dispatch dispatch} and to listen for communication
147
- * from the provider by registering an action via {@link Channel#ChannelClient#register register}.
148
- *
149
- * ##### Constructor
150
- * Returned by {@link InterApplicationBus.Channel.connect Channel.connect}.
151
- *
152
- * ##### Synchronous Methods
153
- * * {@link Channel#ChannelClient#onDisconnection onDisconnection(listener)}
154
- * * {@link Channel#ChannelClient#register register(action, listener)}
155
- * * {@link Channel#ChannelClient#remove remove(action)}
156
- *
157
- * ##### Asynchronous Methods
158
- * * {@link Channel#ChannelClient#disconnect disconnect()}
159
- * * {@link Channel#ChannelClient#dispatch dispatch(action, payload)}
160
- *
161
- * ##### Middleware
162
- * Middleware functions receive the following arguments: (action, payload, senderId).
163
- * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
164
- * unless it is undefined, in which case the original payload is used. Middleware can be used for side effects.
165
- * * {@link Channel#ChannelClient#setDefaultAction setDefaultAction(middleware)}
166
- * * {@link Channel#ChannelClient#onError onError(middleware)}
167
- * * {@link Channel#ChannelClient#beforeAction beforeAction(middleware)}
168
- * * {@link Channel#ChannelClient#afterAction afterAction(middleware)}
169
- *
170
- * @hideconstructor
171
- * @memberof! Channel#
172
- * @property {InterApplicationBus.Channel~ProviderIdentity} providerIdentity a read-only provider identity
173
- */
174
- declare class ChannelClient {
175
- /**
176
- *
177
- * Disconnect from the channel.
178
- * @tutorial Channel.disconnect
179
- *
180
- */
181
- disconnect(): void;
182
- /**
183
- *
184
- * Dispatch the given action to the channel provider. Returns a promise that resolves with the response from the provider for that action.
185
- * @param action - Name of the action to be invoked by the channel provider.
186
- * @param payload - Payload to be sent along with the action.
187
- * @tutorial Channel.dispatch
188
- *
189
- */
190
- dispatch(): void;
191
- /**
192
- *
193
- * Register an action to be called by the provider of the channel.
194
- * @param action - Name of the action to be registered for the channel provider to later invoke.
195
- * @param listener - Function representing the action to be taken on a provider dispatch.
196
- *
197
- * @tutorial Channel.register
198
- */
199
- register(): void;
200
- /**
201
- *
202
- * Register middleware that fires before the action.
203
- * @param middleware - Function to be executed before invoking the action.
204
- *
205
- * @tutorial ChannelMiddleware.beforeAction
206
- */
207
- beforeAction(): void;
208
- /**
209
- *
210
- * Register a listener that is called on channel disconnection.
211
- * It is passed the disconnection event of the disconnecting channel.
212
- * @param listener
213
- *
214
- * @tutorial Channel.onDisconnection
215
- */
216
- onDisconnection(): void;
217
- /**
218
- * Register an error handler. This is called before responding on any error.
219
- * @param middleware - Function to be executed in case of an error.
220
- *
221
- * @tutorial ChannelMiddleware.onError
222
- */
223
- onError(): void;
224
- /**
225
- *
226
- * Register middleware that fires after the action. This is passed the return value of the action.
227
- * @param middleware - Function to be executed after invoking the action.
228
- *
229
- * @tutorial ChannelMiddleware.afterAction
230
- */
231
- afterAction(): void;
232
- /**
233
- *
234
- * Remove an action by action name.
235
- * @param action - Name of the action to be removed.
236
- *
237
- * @tutorial Channel.remove
238
- */
239
- remove(): void;
240
- /**
241
- *
242
- * Sets a default action. This is used any time an action that has not been registered is invoked.
243
- * Default behavior if not set is to throw an error.
244
- * @param middleware - Function to be executed when a client invokes an action name that has not been registered.
245
- *
246
- * @tutorial ChannelMiddleware.setDefaultAction
247
- */
248
- setDefaultAction(): void;
249
- }
250
- /**
251
- * Channel action callback signature
252
- * @callback Channel#ChannelProvider~Action
253
- * @param payload - Payload sent along with the message.
254
- * @param identity - Identity of the sender.
255
- */
256
- /**
257
- * Channel action callback signature
258
- * @callback Channel#ChannelClient~Action
259
- * @param payload - Payload sent along with the message.
260
- * @param identity - Identity of the sender.
261
- */
262
- /**
263
- * Middleware function signature
264
- * @callback Channel#ChannelProvider~Middleware
265
- * @param action - Action to be invoked.
266
- * @param payload - Payload sent along with the message (or error for error middleware).
267
- * @param identity - Identity of the sender.
268
- */
269
- /**
270
- * Middleware function signature
271
- * @callback Channel#ChannelClient~Middleware
272
- * @param action - Action to be invoked.
273
- * @param payload - Payload sent along with the message (or error for error middleware).
274
- * @param identity - Identity of the sender.
275
- */
276
- /**
277
- * Callback for the channel onConnection or onDisconnection. If it errors connection will be rejected.
278
- * @callback Channel#ChannelProvider~ConnectionListener
279
- * @param identity - Identity of the client attempting to connect to the channel.
280
- * @param payload - Payload sent with connection request.
281
- */
282
- /**
283
- * @REMOVED
284
- * Callback for onChannelConnect or onChannelDisconnect.
285
- * @typedef {object} InterApplicationBus.Channel~ConnectionEvent
286
- * @property {string} channelId - Identifier of the channel.
287
- * @property {string} uuid - Channel provider uuid.
288
- * @property {string} [name] - Channel provider name.
289
- * @property {string} channelName - Name of the channel.
290
- */
291
- /**
292
- * @PORTED
293
- * Protocol values for determining channel messaging strategy.
294
- * @typedef {('classic' | 'rtc')} InterApplicationBus.Channel~MessagingProtocols - EXPERIMENTAL
295
- *
296
- */
297
- /**
298
- * @PORTED
299
- * Channel provider creation options.
300
- * @typedef {object} InterApplicationBus.Channel~ChannelCreateOptions
301
- * @property {InterApplicationBus.Channel~MessagingProtocols[]} [protocols=['classic']] - EXPERIMENTAL: Messaging protocols supported by the channel provider.
302
- *
303
- */
304
- /**
305
- * @PORTED
306
- * Options provided on a client connection to a channel.
307
- * @typedef {object} InterApplicationBus.Channel~ChannelConnectOptions
308
- * @property {InterApplicationBus.Channel~MessagingProtocols[]} [protocols=['classic']] - EXPERIMENTAL: Messaging protocols requested by the client, connection will fail if the provider protocols are not compatible.
309
- * @property {any} [payload] - Payload to pass to ChannelProvider onConnection action.
310
- * @property {boolean} [wait=true] - If true will wait for ChannelProvider to connect. If false will fail if ChannelProvider is not found.
311
- *
312
- */
313
- /**
314
- * @PORTED
315
- * Provider Identity.
316
- * @typedef {object} InterApplicationBus.Channel~ProviderIdentity
317
- * @property {string} uuid - Channel provider uuid.
318
- * @property {string} [name] - Channel provider name.
319
- * @property {string} channelId - Identifier of the channel.
320
- * @property {boolean} [isExternal] - true if it's external connection.
321
- * @property {string} channelName - Name of the channel.
322
- *
323
- */
324
- /**
325
- * @PORTED
326
- * Client Identity.
327
- * @typedef {object} InterApplicationBus.Channel~ClientIdentity
328
- * @property {string} uuid - Channel client uuid.
329
- * @property {string} name - Channel client name.
330
- * @property {string} endpointId - Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
331
- *
332
- */
333
- /**
334
- * @PORTED
335
- * Extended Client Information
336
- * @typedef {object} InterApplicationBus.Channel~ClientInfo
337
- * @property {string} uuid - Channel client uuid
338
- * @property {string} name - Channel client name
339
- * @property {string} endpointId - Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
340
- * @property {string} entityType - Indicates if the client belongs to a Window or View
341
- * @property {string} connectionUrl - URL of the View or Window at the time of connection to the Channel Provider.
342
- */