@openfin/core 33.76.36 → 33.76.38

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 +17104 -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,27 +0,0 @@
1
- import type * as OpenFin from '../../OpenFin';
2
- import type { ChannelProvider } from '../interappbus/channel/provider';
3
- export default class SessionContextGroupBroker {
4
- id: string;
5
- private contextGroupMap;
6
- private provider;
7
- private clients;
8
- private lastContext;
9
- constructor(provider: ChannelProvider, id: string);
10
- registerListeners(): void;
11
- getCurrentContext(payload: {
12
- type?: string;
13
- }): OpenFin.Context | undefined;
14
- setContext(payload: {
15
- context: OpenFin.Context;
16
- }, clientIdentity: OpenFin.ClientIdentity): void;
17
- private getClientState;
18
- handlerAdded(payload: {
19
- handlerId: string;
20
- contextType?: string;
21
- }, clientIdentity: OpenFin.ClientIdentity): Promise<void>;
22
- handlerRemoved(payload: {
23
- handlerId: string;
24
- }, clientIdentity: OpenFin.ClientIdentity): void;
25
- registerNewClient(clientIdentity: OpenFin.ClientIdentity): void;
26
- onDisconnection(clientIdentity: OpenFin.ClientIdentity): void;
27
- }
@@ -1,108 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _1 = require(".");
4
- class SessionContextGroupBroker {
5
- constructor(provider, id) {
6
- this.provider = provider;
7
- this.id = id;
8
- this.lastContext = undefined;
9
- this.contextGroupMap = new Map();
10
- this.clients = new Map();
11
- this.registerListeners();
12
- }
13
- registerListeners() {
14
- this.provider.register(`sessionContextGroup:getContext-${this.id}`, this.getCurrentContext.bind(this));
15
- this.provider.register(`sessionContextGroup:setContext-${this.id}`, this.setContext.bind(this));
16
- this.provider.register(`sessionContextGroup:handlerAdded-${this.id}`, this.handlerAdded.bind(this));
17
- this.provider.register(`sessionContextGroup:handlerRemoved-${this.id}`, this.handlerRemoved.bind(this));
18
- }
19
- getCurrentContext(payload) {
20
- return payload.type ? this.contextGroupMap.get(payload.type) : this.lastContext;
21
- }
22
- setContext(payload, clientIdentity) {
23
- const { context } = payload;
24
- const contextIntegrityCheckResult = _1.InteropBroker.checkContextIntegrity(context);
25
- if (contextIntegrityCheckResult.isValid === false) {
26
- throw new Error(`Failed to set Context - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
27
- }
28
- const clientState = this.getClientState(clientIdentity);
29
- if (!clientState) {
30
- // This shouldn't get hit.
31
- throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Session Client State Map`);
32
- }
33
- // set the context
34
- this.contextGroupMap.set(context.type, context);
35
- this.lastContext = context;
36
- const clientSubscriptionStates = Array.from(this.clients.values());
37
- clientSubscriptionStates.forEach((client) => {
38
- var _a;
39
- // eslint-disable-next-line no-unused-expressions
40
- (_a = client.contextHandlers.get(context.type)) === null || _a === void 0 ? void 0 : _a.forEach((handlerId) => {
41
- this.provider.dispatch(client.clientIdentity, handlerId, context);
42
- });
43
- if (client.globalHandler) {
44
- this.provider.dispatch(client.clientIdentity, client.globalHandler, context);
45
- }
46
- });
47
- }
48
- getClientState(id) {
49
- return this.clients.get(id.endpointId);
50
- }
51
- async handlerAdded(payload, clientIdentity) {
52
- const { handlerId, contextType } = payload;
53
- const clientSubscriptionState = this.getClientState(clientIdentity);
54
- if (!clientSubscriptionState) {
55
- throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
56
- }
57
- if (contextType) {
58
- const currentHandlerList = clientSubscriptionState.contextHandlers.get(contextType) || [];
59
- clientSubscriptionState.contextHandlers.set(contextType, [...currentHandlerList, handlerId]);
60
- const currentContext = this.contextGroupMap.get(contextType);
61
- if (currentContext) {
62
- await this.provider.dispatch(clientIdentity, handlerId, currentContext);
63
- }
64
- }
65
- else {
66
- clientSubscriptionState.globalHandler = handlerId;
67
- const globalDispatchPromises = [...this.contextGroupMap.keys()].map(async (currentContextType) => {
68
- const currentContext = this.contextGroupMap.get(currentContextType);
69
- if (currentContext) {
70
- await this.provider.dispatch(clientIdentity, handlerId, currentContext);
71
- }
72
- });
73
- await Promise.all(globalDispatchPromises);
74
- }
75
- }
76
- handlerRemoved(payload, clientIdentity) {
77
- const { handlerId } = payload;
78
- const client = this.clients.get(clientIdentity.endpointId);
79
- if (client) {
80
- Array.from(client.contextHandlers).forEach(([, handlers]) => {
81
- const index = handlers.indexOf(handlerId);
82
- if (index > -1) {
83
- handlers.splice(index, 1);
84
- }
85
- });
86
- if (client.globalHandler === handlerId) {
87
- client.globalHandler = undefined;
88
- }
89
- }
90
- else {
91
- console.warn(`Trying to remove a handler from a client that isn't mapped. handlerId: ${handlerId}. clientIdentity: ${clientIdentity}`);
92
- }
93
- }
94
- registerNewClient(clientIdentity) {
95
- if (!this.clients.has(clientIdentity.endpointId)) {
96
- const clientSubscriptionState = {
97
- contextHandlers: new Map(),
98
- clientIdentity,
99
- globalHandler: undefined
100
- };
101
- this.clients.set(clientIdentity.endpointId, clientSubscriptionState);
102
- }
103
- }
104
- onDisconnection(clientIdentity) {
105
- this.clients.delete(clientIdentity.endpointId);
106
- }
107
- }
108
- exports.default = SessionContextGroupBroker;
@@ -1,21 +0,0 @@
1
- import type * as OpenFin from '../../OpenFin';
2
- import { Transport } from '../../transport/transport';
3
- import { Base } from '../base';
4
- export default class SessionContextGroupClient extends Base {
5
- #private;
6
- id: string;
7
- constructor(wire: Transport, client: Promise<OpenFin.ChannelClient>, id: string);
8
- /**
9
- * Sets a context for the session context group.
10
- * @param context - New context to set.
11
- *
12
- * @tutorial interop.setContext
13
- */
14
- setContext(context: OpenFin.Context): Promise<void>;
15
- getCurrentContext(type?: string): Promise<OpenFin.Context>;
16
- addContextHandler(contextHandler: OpenFin.ContextHandler, contextType?: string): Promise<{
17
- unsubscribe: () => void;
18
- }>;
19
- private createUnsubscribeCb;
20
- getUserInstance(): OpenFin.SessionContextGroup;
21
- }
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- 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");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- 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");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _SessionContextGroupClient_clientPromise;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const base_1 = require("../base");
16
- const utils_1 = require("./utils");
17
- class SessionContextGroupClient extends base_1.Base {
18
- constructor(wire, client, id) {
19
- super(wire);
20
- _SessionContextGroupClient_clientPromise.set(this, void 0);
21
- this.id = id;
22
- __classPrivateFieldSet(this, _SessionContextGroupClient_clientPromise, client, "f");
23
- }
24
- /**
25
- * Sets a context for the session context group.
26
- * @param context - New context to set.
27
- *
28
- * @tutorial interop.setContext
29
- */
30
- async setContext(context) {
31
- this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
32
- // don't expose, analytics-only call
33
- });
34
- const client = await __classPrivateFieldGet(this, _SessionContextGroupClient_clientPromise, "f");
35
- return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
36
- sessionContextGroupId: this.id,
37
- context
38
- });
39
- }
40
- async getCurrentContext(type) {
41
- this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
42
- // don't expose, analytics-only call
43
- });
44
- const client = await __classPrivateFieldGet(this, _SessionContextGroupClient_clientPromise, "f");
45
- return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
46
- sessionContextGroupId: this.id,
47
- type
48
- });
49
- }
50
- async addContextHandler(contextHandler, contextType) {
51
- this.wire.sendAction('interop-session-context-group-add-handler').catch((e) => {
52
- // don't expose, analytics-only call
53
- });
54
- if (typeof contextHandler !== 'function') {
55
- throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
56
- }
57
- const client = await __classPrivateFieldGet(this, _SessionContextGroupClient_clientPromise, "f");
58
- let handlerId;
59
- if (contextType) {
60
- handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1.generateId)()}`;
61
- }
62
- else {
63
- handlerId = `sessionContextHandler:invoke-${this.id}`;
64
- }
65
- client.register(handlerId, (0, utils_1.wrapContextHandler)(contextHandler, handlerId));
66
- await client.dispatch(`sessionContextGroup:handlerAdded-${this.id}`, { handlerId, contextType });
67
- return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
68
- }
69
- async createUnsubscribeCb(handlerId) {
70
- const client = await __classPrivateFieldGet(this, _SessionContextGroupClient_clientPromise, "f");
71
- return async () => {
72
- client.remove(handlerId);
73
- await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
74
- };
75
- }
76
- getUserInstance() {
77
- return {
78
- id: this.id,
79
- setContext: (0, utils_1.wrapInTryCatch)(this.setContext.bind(this), 'Failed to set context: '),
80
- getCurrentContext: (0, utils_1.wrapInTryCatch)(this.getCurrentContext.bind(this), 'Failed to get context: '),
81
- addContextHandler: (0, utils_1.wrapInTryCatch)(this.addContextHandler.bind(this), 'Failed to add context handler: ')
82
- };
83
- }
84
- }
85
- exports.default = SessionContextGroupClient;
86
- _SessionContextGroupClient_clientPromise = new WeakMap();
@@ -1,20 +0,0 @@
1
- import type * as OpenFin from '../../../OpenFin';
2
- import type { Listener, Context, ContextHandler } from './shapes/fdc3v2';
3
- type HandlerId = string;
4
- export declare class PrivateChannelClient {
5
- id: string;
6
- client: OpenFin.ChannelClient;
7
- listeners: Map<HandlerId, Listener>;
8
- constructor(client: OpenFin.ChannelClient, id: string);
9
- broadcast(context: Context): Promise<void>;
10
- getCurrentContext(contextType?: string): Promise<Context | null>;
11
- addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>;
12
- private createNonStandardUnsubscribeCb;
13
- private createContextUnsubscribeCb;
14
- onAddContextListener(handler: (contextType?: string) => void): Listener;
15
- onDisconnect(handler: () => void): Listener;
16
- onUnsubscribe(handler: (contextType?: string) => void): Listener;
17
- cleanUpAllSubs(): Promise<void>;
18
- disconnect(): Promise<void>;
19
- }
20
- export {};
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PrivateChannelClient = void 0;
4
- const utils_1 = require("../utils");
5
- class PrivateChannelClient {
6
- constructor(client, id) {
7
- this.id = id;
8
- this.client = client;
9
- this.listeners = new Map();
10
- }
11
- async broadcast(context) {
12
- return this.client.dispatch('broadcast', { context });
13
- }
14
- async getCurrentContext(contextType) {
15
- return this.client.dispatch('getCurrentContext', { contextType });
16
- }
17
- async addContextListener(contextType, handler) {
18
- if (typeof handler !== 'function') {
19
- throw new Error("Non-function argument passed to the second parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
20
- }
21
- let handlerId;
22
- if (contextType) {
23
- handlerId = `contextHandler:invoke-${this.id}-${contextType}-${(0, utils_1.generateId)()}`;
24
- }
25
- else {
26
- handlerId = `contextHandler:invoke-${this.id}-${(0, utils_1.generateId)()}`;
27
- }
28
- this.client.register(handlerId, (0, utils_1.wrapContextHandler)(handler, handlerId));
29
- const listener = { unsubscribe: await this.createContextUnsubscribeCb(handlerId) };
30
- this.listeners.set(handlerId, listener);
31
- await this.client.dispatch(`contextHandlerAdded`, { handlerId, contextType });
32
- return listener;
33
- }
34
- createNonStandardUnsubscribeCb(handlerId) {
35
- return async () => {
36
- this.client.remove(handlerId);
37
- this.listeners.delete(handlerId);
38
- await this.client.dispatch('nonStandardHandlerRemoved', { handlerId });
39
- };
40
- }
41
- createContextUnsubscribeCb(handlerId) {
42
- return async () => {
43
- this.client.remove(handlerId);
44
- this.listeners.delete(handlerId);
45
- await this.client.dispatch('contextHandlerRemoved', { handlerId });
46
- };
47
- }
48
- onAddContextListener(handler) {
49
- const handlerId = `onContextHandlerAdded:invoke-${this.id}-${(0, utils_1.generateId)()}`;
50
- this.client.register(handlerId, handler);
51
- const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
52
- this.listeners.set(handlerId, listener);
53
- this.client.dispatch(`onAddContextHandlerAdded`, { handlerId });
54
- return listener;
55
- }
56
- onDisconnect(handler) {
57
- const handlerId = `onDisconnect:invoke-${this.id}-${(0, utils_1.generateId)()}`;
58
- this.client.register(handlerId, handler);
59
- const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
60
- this.listeners.set(handlerId, listener);
61
- this.client.dispatch(`onDisconnectHandlerAdded`, { handlerId });
62
- return listener;
63
- }
64
- onUnsubscribe(handler) {
65
- const handlerId = `onUnsubscribe:invoke-${this.id}-${(0, utils_1.generateId)()}`;
66
- this.client.register(handlerId, handler);
67
- const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
68
- this.listeners.set(handlerId, listener);
69
- this.client.dispatch(`onUnsubscribeHandlerAdded`, { handlerId });
70
- return listener;
71
- }
72
- async cleanUpAllSubs() {
73
- const listenerUnsubscribers = Array.from(this.listeners.keys());
74
- listenerUnsubscribers.forEach((handlerId) => {
75
- this.client.remove(handlerId);
76
- this.listeners.delete(handlerId);
77
- });
78
- }
79
- async disconnect() {
80
- try {
81
- await this.client.dispatch('clientDisconnecting');
82
- await this.cleanUpAllSubs();
83
- await this.client.disconnect();
84
- }
85
- catch (error) {
86
- throw new Error(error.message);
87
- }
88
- }
89
- }
90
- exports.PrivateChannelClient = PrivateChannelClient;
@@ -1,55 +0,0 @@
1
- import type * as OpenFin from '../../../OpenFin';
2
- type ChannelProvider = OpenFin.ChannelProvider;
3
- type HandlerId = string;
4
- type ContextType = string;
5
- interface PrivateChannelClientState {
6
- clientIdentity: OpenFin.ClientIdentity;
7
- handlerIdsByContextTypes: Map<ContextType, HandlerId[]>;
8
- globalHandler: HandlerId | undefined;
9
- onAddContextListenerHandlerId: HandlerId | undefined;
10
- onUnsubscribeHandlerId: HandlerId | undefined;
11
- onDisconnectHandlerId: HandlerId | undefined;
12
- }
13
- export declare class PrivateChannelProvider {
14
- id: string;
15
- private provider;
16
- private clients;
17
- private contextByContextType;
18
- private lastContext;
19
- constructor(provider: ChannelProvider, id: string);
20
- private getClientState;
21
- registerListeners(): void;
22
- broadcast(payload: {
23
- context: OpenFin.Context;
24
- }, broadcasterClientIdentity: OpenFin.ClientIdentity): void;
25
- getCurrentContext(payload: {
26
- contextType?: string;
27
- }, senderClientIdentity: OpenFin.ClientIdentity): OpenFin.Context | null;
28
- contextHandlerAdded(payload: {
29
- handlerId: HandlerId;
30
- contextType?: string;
31
- }, senderClientIdentity: OpenFin.ClientIdentity): void;
32
- contextHandlerRemoved(payload: {
33
- handlerId: HandlerId;
34
- }, removingClientIdentity: OpenFin.ClientIdentity): Promise<void>;
35
- nonStandardHandlerRemoved(payload: {
36
- handlerId: HandlerId;
37
- }, id: OpenFin.ClientIdentity): void;
38
- onAddContextHandlerAdded(payload: {
39
- handlerId: HandlerId;
40
- }, senderClientIdentity: OpenFin.ClientIdentity): void;
41
- onDisconnectHandlerAdded(payload: {
42
- handlerId: HandlerId;
43
- }, id: OpenFin.ClientIdentity): void;
44
- onUnsubscribeHandlerAdded(payload: {
45
- handlerId: HandlerId;
46
- }, id: OpenFin.ClientIdentity): void;
47
- removeClient(disconnectingClientIdentity: OpenFin.ClientIdentity): void;
48
- fireOnDisconnectForOtherClients(disconnectingClientIdentity: OpenFin.ClientIdentity): Promise<void>;
49
- unsubscribeAll(clientIdentity: OpenFin.ClientIdentity): Promise<void>;
50
- handleClientDisconnecting(disconnectingClientIdentity: OpenFin.ClientIdentity): Promise<void>;
51
- registerNewClient(clientIdentity: OpenFin.ClientIdentity): void;
52
- getConnectedClients(): Promise<PrivateChannelClientState[]>;
53
- static init(channelProvider: OpenFin.ChannelProvider, id: string): PrivateChannelProvider;
54
- }
55
- export {};