@openfin/core 30.73.28 → 31.74.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/LICENSE.md +4 -0
  2. package/package.json +2 -2
  3. package/src/OpenFin.d.ts +1929 -407
  4. package/src/OpenFin.js +0 -2
  5. package/src/api/api-exposer/api-consumer.d.ts +28 -0
  6. package/src/api/api-exposer/api-consumer.js +28 -0
  7. package/src/api/api-exposer/api-exposer.d.ts +35 -0
  8. package/src/api/api-exposer/api-exposer.js +38 -0
  9. package/src/api/api-exposer/decorators.d.ts +10 -0
  10. package/src/api/api-exposer/decorators.js +18 -0
  11. package/src/api/api-exposer/index.d.ts +4 -0
  12. package/src/api/api-exposer/index.js +20 -0
  13. package/src/api/api-exposer/strategies/index.d.ts +1 -0
  14. package/src/api/api-exposer/strategies/index.js +17 -0
  15. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
  16. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
  17. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
  18. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
  19. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
  20. package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
  21. package/src/api/application/Factory.d.ts +1 -0
  22. package/src/api/application/Factory.js +2 -2
  23. package/src/api/application/Instance.d.ts +2 -1
  24. package/src/api/application/Instance.js +1 -0
  25. package/src/api/base.d.ts +4 -4
  26. package/src/api/clipboard/index.d.ts +1 -0
  27. package/src/api/clipboard/index.js +1 -0
  28. package/src/api/events/application.d.ts +22 -22
  29. package/src/api/events/base.d.ts +6 -9
  30. package/src/api/events/channel.d.ts +5 -5
  31. package/src/api/events/emitterMap.d.ts +1 -1
  32. package/src/api/events/externalApplication.d.ts +3 -3
  33. package/src/api/events/frame.d.ts +5 -5
  34. package/src/api/events/globalHotkey.d.ts +3 -3
  35. package/src/api/events/platform.d.ts +6 -7
  36. package/src/api/events/system.d.ts +20 -21
  37. package/src/api/events/typedEventEmitter.d.ts +1 -1
  38. package/src/api/events/view.d.ts +17 -14
  39. package/src/api/events/webcontents.d.ts +40 -18
  40. package/src/api/events/window.d.ts +65 -57
  41. package/src/api/external-application/Instance.d.ts +1 -1
  42. package/src/api/fin.d.ts +2 -2
  43. package/src/api/frame/Instance.d.ts +2 -2
  44. package/src/api/global-hotkey/index.d.ts +1 -1
  45. package/src/api/interappbus/channel/channel.d.ts +5 -5
  46. package/src/api/interappbus/channel/channel.js +3 -3
  47. package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
  48. package/src/api/interappbus/channel/channels-docs.js +7 -0
  49. package/src/api/interappbus/channel/client.d.ts +5 -4
  50. package/src/api/interappbus/channel/client.js +24 -17
  51. package/src/api/interappbus/channel/connection-manager.d.ts +2 -2
  52. package/src/api/interappbus/channel/connection-manager.js +12 -12
  53. package/src/api/interappbus/channel/index.d.ts +3 -3
  54. package/src/api/interappbus/channel/index.js +6 -8
  55. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +1 -1
  56. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +2 -2
  57. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +2 -2
  58. package/src/api/interappbus/channel/protocols/combined/strategy.js +5 -5
  59. package/src/api/interappbus/channel/protocols/index.d.ts +7 -4
  60. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +1 -1
  61. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
  62. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +1 -1
  63. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +1 -1
  64. package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
  65. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +4 -4
  66. package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -3
  67. package/src/api/interappbus/channel/provider.d.ts +6 -6
  68. package/src/api/interappbus/channel/provider.js +24 -24
  69. package/src/api/interappbus/index.d.ts +1 -1
  70. package/src/api/interop/Factory.d.ts +1 -2
  71. package/src/api/interop/Factory.js +20 -4
  72. package/src/api/interop/InteropBroker.d.ts +16 -48
  73. package/src/api/interop/InteropBroker.js +38 -48
  74. package/src/api/interop/InteropClient.d.ts +10 -9
  75. package/src/api/interop/InteropClient.js +9 -8
  76. package/src/api/interop/SessionContextGroupClient.d.ts +1 -1
  77. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +2 -1
  78. package/src/api/interop/fdc3/PrivateChannelClient.js +15 -7
  79. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +16 -2
  80. package/src/api/interop/fdc3/PrivateChannelProvider.js +80 -21
  81. package/src/api/interop/fdc3/fdc3-1.2.js +27 -12
  82. package/src/api/interop/fdc3/fdc3-2.0.d.ts +13 -12
  83. package/src/api/interop/fdc3/fdc3-2.0.js +33 -26
  84. package/src/api/interop/fdc3/fdc3.d.ts +4 -5
  85. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  86. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  87. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +3 -3
  88. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +5 -5
  89. package/src/api/interop/fdc3/utils.d.ts +17 -0
  90. package/src/api/interop/fdc3/utils.js +52 -18
  91. package/src/api/interop/fdc3/versions.d.ts +1 -0
  92. package/src/api/interop/fdc3/versions.js +2 -0
  93. package/src/api/interop/utils.d.ts +0 -1
  94. package/src/api/interop/utils.js +1 -9
  95. package/src/api/me.d.ts +4 -4
  96. package/src/api/platform/Factory.d.ts +6 -1
  97. package/src/api/platform/Factory.js +10 -9
  98. package/src/api/platform/Instance.d.ts +5 -3
  99. package/src/api/platform/Instance.js +5 -3
  100. package/src/api/platform/common-utils.d.ts +1 -1
  101. package/src/api/platform/layout/Factory.d.ts +5 -1
  102. package/src/api/platform/layout/Factory.js +15 -3
  103. package/src/api/platform/layout/Instance.d.ts +10 -4
  104. package/src/api/platform/layout/Instance.js +26 -1
  105. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
  106. package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
  107. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +117 -0
  108. package/src/api/platform/layout/controllers/layout-entities-controller.js +270 -0
  109. package/src/api/platform/layout/controllers/splitter-controller.d.ts +1 -1
  110. package/src/api/platform/layout/entities/layout-entities.d.ts +144 -0
  111. package/src/api/platform/layout/entities/layout-entities.js +216 -0
  112. package/src/api/platform/layout/entities/shapes.d.ts +6 -0
  113. package/src/api/platform/layout/entities/shapes.js +2 -0
  114. package/src/api/platform/layout/layout.constants.d.ts +1 -0
  115. package/src/api/platform/layout/layout.constants.js +4 -0
  116. package/src/api/platform/layout/shapes.d.ts +4 -1
  117. package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
  118. package/src/api/platform/layout/utils/layout-traversal.js +65 -0
  119. package/src/api/platform/layout/utils/view-overlay.d.ts +1 -1
  120. package/src/api/platform/provider.d.ts +162 -0
  121. package/src/api/platform/provider.js +2 -0
  122. package/src/api/snapshot-source/Factory.d.ts +1 -0
  123. package/src/api/snapshot-source/Factory.js +1 -0
  124. package/src/api/snapshot-source/Instance.d.ts +1 -1
  125. package/src/api/system/index.d.ts +14 -484
  126. package/src/api/system/index.js +6 -476
  127. package/src/api/view/Instance.d.ts +20 -6
  128. package/src/api/view/Instance.js +48 -8
  129. package/src/api/webcontents/main.d.ts +18 -4
  130. package/src/api/window/Instance.d.ts +21 -1
  131. package/src/api/window/Instance.js +20 -0
  132. package/src/browser.js +1 -1
  133. package/src/environment/browser.d.ts +1 -1
  134. package/src/environment/environment.d.ts +1 -1
  135. package/src/environment/node-env.d.ts +1 -1
  136. package/src/environment/openfin-env.d.ts +1 -1
  137. package/src/mock.d.ts +1 -1
  138. package/src/mock.js +6 -3
  139. package/src/namespaces.d.ts +21 -0
  140. package/src/namespaces.js +24 -0
  141. package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -1
  142. package/src/shapes/protocol.d.ts +3 -3
  143. package/src/transport/fin_store.d.ts +1 -1
  144. package/src/transport/transport-errors.d.ts +7 -2
  145. package/src/transport/transport-errors.js +1 -2
  146. package/src/transport/transport.d.ts +11 -8
  147. package/src/transport/transport.js +12 -6
  148. package/src/transport/wire.d.ts +14 -13
  149. package/src/util/channel-api-relay.d.ts +13 -0
  150. package/src/util/channel-api-relay.js +37 -0
  151. package/src/util/errors.d.ts +2 -2
  152. package/src/util/http.js +4 -2
  153. package/src/util/inaccessibleObject.d.ts +2 -0
  154. package/src/util/inaccessibleObject.js +49 -0
  155. package/src/util/lazy.d.ts +16 -0
  156. package/src/util/lazy.js +26 -0
  157. package/src/util/promises.d.ts +1 -1
  158. package/src/util/reversible-map.d.ts +11 -0
  159. package/src/util/reversible-map.js +49 -0
  160. package/src/util/utilTypes.d.ts +1 -1
@@ -278,6 +278,7 @@ declare class ChannelClient {
278
278
  * @param {any} payload - Payload sent with connection request.
279
279
  */
280
280
  /**
281
+ * @REMOVED
281
282
  * Callback for onChannelConnect or onChannelDisconnect.
282
283
  * @typedef {object} InterApplicationBus.Channel~ConnectionEvent
283
284
  * @property {string} channelId - Identifier of the channel.
@@ -286,17 +287,20 @@ declare class ChannelClient {
286
287
  * @property {string} channelName - Name of the channel.
287
288
  */
288
289
  /**
290
+ * @PORTED
289
291
  * Protocol values for determining channel messaging strategy.
290
292
  * @typedef {('classic' | 'rtc')} InterApplicationBus.Channel~MessagingProtocols - EXPERIMENTAL
291
293
  *
292
294
  */
293
295
  /**
296
+ * @PORTED
294
297
  * Channel provider creation options.
295
298
  * @typedef {object} InterApplicationBus.Channel~ChannelCreateOptions
296
299
  * @property {InterApplicationBus.Channel~MessagingProtocols[]} [protocols=['classic']] - EXPERIMENTAL: Messaging protocols supported by the channel provider.
297
300
  *
298
301
  */
299
302
  /**
303
+ * @PORTED
300
304
  * Options provided on a client connection to a channel.
301
305
  * @typedef {object} InterApplicationBus.Channel~ChannelConnectOptions
302
306
  * @property {InterApplicationBus.Channel~MessagingProtocols[]} [protocols=['classic']] - EXPERIMENTAL: Messaging protocols requested by the client, connection will fail if the provider protocols are not compatible.
@@ -305,6 +309,7 @@ declare class ChannelClient {
305
309
  *
306
310
  */
307
311
  /**
312
+ * @PORTED
308
313
  * Provider Identity.
309
314
  * @typedef {object} InterApplicationBus.Channel~ProviderIdentity
310
315
  * @property {string} uuid - Channel provider uuid.
@@ -315,6 +320,7 @@ declare class ChannelClient {
315
320
  *
316
321
  */
317
322
  /**
323
+ * @PORTED
318
324
  * Client Identity.
319
325
  * @typedef {object} InterApplicationBus.Channel~ClientIdentity
320
326
  * @property {string} uuid - Channel client uuid.
@@ -323,6 +329,7 @@ declare class ChannelClient {
323
329
  *
324
330
  */
325
331
  /**
332
+ * @PORTED
326
333
  * Extended Client Information
327
334
  * @typedef {object} InterApplicationBus.Channel~ClientInfo
328
335
  * @property {string} uuid - Channel client uuid
@@ -336,6 +336,7 @@ class ChannelClient {
336
336
  * @param {any} payload - Payload sent with connection request.
337
337
  */
338
338
  /**
339
+ * @REMOVED
339
340
  * Callback for onChannelConnect or onChannelDisconnect.
340
341
  * @typedef {object} InterApplicationBus.Channel~ConnectionEvent
341
342
  * @property {string} channelId - Identifier of the channel.
@@ -344,17 +345,20 @@ class ChannelClient {
344
345
  * @property {string} channelName - Name of the channel.
345
346
  */
346
347
  /**
348
+ * @PORTED
347
349
  * Protocol values for determining channel messaging strategy.
348
350
  * @typedef {('classic' | 'rtc')} InterApplicationBus.Channel~MessagingProtocols - EXPERIMENTAL
349
351
  *
350
352
  */
351
353
  /**
354
+ * @PORTED
352
355
  * Channel provider creation options.
353
356
  * @typedef {object} InterApplicationBus.Channel~ChannelCreateOptions
354
357
  * @property {InterApplicationBus.Channel~MessagingProtocols[]} [protocols=['classic']] - EXPERIMENTAL: Messaging protocols supported by the channel provider.
355
358
  *
356
359
  */
357
360
  /**
361
+ * @PORTED
358
362
  * Options provided on a client connection to a channel.
359
363
  * @typedef {object} InterApplicationBus.Channel~ChannelConnectOptions
360
364
  * @property {InterApplicationBus.Channel~MessagingProtocols[]} [protocols=['classic']] - EXPERIMENTAL: Messaging protocols requested by the client, connection will fail if the provider protocols are not compatible.
@@ -363,6 +367,7 @@ class ChannelClient {
363
367
  *
364
368
  */
365
369
  /**
370
+ * @PORTED
366
371
  * Provider Identity.
367
372
  * @typedef {object} InterApplicationBus.Channel~ProviderIdentity
368
373
  * @property {string} uuid - Channel provider uuid.
@@ -373,6 +378,7 @@ class ChannelClient {
373
378
  *
374
379
  */
375
380
  /**
381
+ * @PORTED
376
382
  * Client Identity.
377
383
  * @typedef {object} InterApplicationBus.Channel~ClientIdentity
378
384
  * @property {string} uuid - Channel client uuid.
@@ -381,6 +387,7 @@ class ChannelClient {
381
387
  *
382
388
  */
383
389
  /**
390
+ * @PORTED
384
391
  * Extended Client Information
385
392
  * @typedef {object} InterApplicationBus.Channel~ClientInfo
386
393
  * @property {string} uuid - Channel client uuid
@@ -1,9 +1,9 @@
1
1
  import type * as OpenFin from '../../../OpenFin';
2
2
  import { ChannelBase } from './channel';
3
- import Transport from '../../../transport/transport';
3
+ import { Transport } from '../../../transport/transport';
4
4
  import { AnyStrategy } from './protocols/strategy-types';
5
- declare type ProviderIdentity = OpenFin.ProviderIdentity;
6
- declare type DisconnectionListener = (providerIdentity: ProviderIdentity) => any;
5
+ type ProviderIdentity = OpenFin.ProviderIdentity;
6
+ type DisconnectionListener = (providerIdentity: ProviderIdentity) => any;
7
7
  interface RoutingInfo extends ProviderIdentity {
8
8
  endpointId: string;
9
9
  }
@@ -12,12 +12,13 @@ export default class ChannelClient extends ChannelBase {
12
12
  private disconnectListener;
13
13
  private endpointId;
14
14
  static closeChannelByEndpointId(id: string): void;
15
- static handleProviderDisconnect(channel: ChannelClient, eventPayload: ProviderIdentity): void;
15
+ static handleProviderDisconnect(eventPayload: ProviderIdentity): void;
16
16
  constructor(routingInfo: RoutingInfo, wire: Transport, strategy: AnyStrategy);
17
17
  protected processAction: (action: string, payload: any, senderIdentity: ProviderIdentity | OpenFin.ClientIdentity) => Promise<any>;
18
18
  get providerIdentity(): ProviderIdentity;
19
19
  dispatch(action: string, payload?: any): Promise<any>;
20
20
  onDisconnection(listener: DisconnectionListener): void;
21
21
  disconnect(): Promise<void>;
22
+ sendDisconnectAction(): Promise<void>;
22
23
  }
23
24
  export {};
@@ -1,20 +1,35 @@
1
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
+ };
2
7
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
8
  if (kind === "m") throw new TypeError("Private method is not writable");
4
9
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
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");
6
11
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
12
  };
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
13
  var _ChannelClient_protectedObj, _ChannelClient_strategy, _ChannelClient_close;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const channel_1 = require("./channel");
16
16
  const channelClientsByEndpointId = new Map();
17
17
  class ChannelClient extends channel_1.ChannelBase {
18
+ static closeChannelByEndpointId(id) {
19
+ const channel = channelClientsByEndpointId.get(id);
20
+ if (channel) {
21
+ __classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
22
+ }
23
+ }
24
+ // closes the corresponding channel and invokes the disconnect listener if an event payload is passed.
25
+ static handleProviderDisconnect(eventPayload) {
26
+ for (const channelClient of channelClientsByEndpointId.values()) {
27
+ if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
28
+ channelClient.disconnectListener(eventPayload);
29
+ __classPrivateFieldGet(channelClient, _ChannelClient_close, "f").call(channelClient);
30
+ }
31
+ }
32
+ }
18
33
  constructor(routingInfo, wire, strategy) {
19
34
  super();
20
35
  _ChannelClient_protectedObj.set(this, void 0);
@@ -32,17 +47,6 @@ class ChannelClient extends channel_1.ChannelBase {
32
47
  channelClientsByEndpointId.set(this.endpointId, this);
33
48
  strategy.receive(this.processAction);
34
49
  }
35
- static closeChannelByEndpointId(id) {
36
- const channel = channelClientsByEndpointId.get(id);
37
- if (channel) {
38
- __classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
39
- }
40
- }
41
- // closes the channel and invokes the disconnect listener if an event payload is passed.
42
- static handleProviderDisconnect(channel, eventPayload) {
43
- channel.disconnectListener(eventPayload);
44
- __classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
45
- }
46
50
  get providerIdentity() {
47
51
  const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
48
52
  return protectedObj.providerIdentity;
@@ -67,6 +71,10 @@ class ChannelClient extends channel_1.ChannelBase {
67
71
  };
68
72
  }
69
73
  async disconnect() {
74
+ await this.sendDisconnectAction();
75
+ __classPrivateFieldGet(this, _ChannelClient_close, "f").call(this);
76
+ }
77
+ async sendDisconnectAction() {
70
78
  const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
71
79
  const { channelName, uuid, name } = protectedObj.providerIdentity;
72
80
  await protectedObj.wire.sendAction('disconnect-from-channel', {
@@ -75,7 +83,6 @@ class ChannelClient extends channel_1.ChannelBase {
75
83
  name,
76
84
  endpointId: this.endpointId
77
85
  });
78
- __classPrivateFieldGet(this, _ChannelClient_close, "f").call(this);
79
86
  }
80
87
  }
81
88
  exports.default = ChannelClient;
@@ -1,12 +1,12 @@
1
1
  import type * as OpenFin from '../../../OpenFin';
2
2
  import { ChannelMessage } from '.';
3
- import Transport from '../../../transport/transport';
3
+ import { Transport } from '../../../transport/transport';
4
4
  import { Base } from '../../base';
5
5
  import { ClientOffer, LocalSupportedProtocol } from './protocols/index';
6
6
  import { RTCPacket } from './protocols/rtc/endpoint';
7
7
  import { ChannelProvider } from './provider';
8
8
  import { AnyStrategy } from './protocols/strategy-types';
9
- export declare type ProviderEntry = {
9
+ export type ProviderEntry = {
10
10
  provider: ChannelProvider;
11
11
  strategy: AnyStrategy;
12
12
  supportedProtocols: LocalSupportedProtocol[];
@@ -23,6 +23,18 @@ const message_receiver_1 = require("./protocols/classic/message-receiver");
23
23
  const protocol_manager_1 = require("./protocols/protocol-manager");
24
24
  const strategy_3 = require("./protocols/combined/strategy");
25
25
  class ConnectionManager extends base_1.Base {
26
+ static getProtocolOptionsFromStrings(protocols) {
27
+ return protocols.map((protocol) => {
28
+ switch (protocol) {
29
+ case 'rtc':
30
+ return strategy_2.RTCInfo;
31
+ case 'classic':
32
+ return strategy_1.ClassicInfo;
33
+ default:
34
+ return (0, exhaustive_1.exhaustiveCheck)(protocol, ['rtc', 'classic']);
35
+ }
36
+ });
37
+ }
26
38
  constructor(wire) {
27
39
  super(wire);
28
40
  _ConnectionManager_messageReceiver.set(this, void 0);
@@ -43,18 +55,6 @@ class ConnectionManager extends base_1.Base {
43
55
  __classPrivateFieldSet(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
44
56
  wire.registerMessageHandler(this.onmessage.bind(this));
45
57
  }
46
- static getProtocolOptionsFromStrings(protocols) {
47
- return protocols.map((protocol) => {
48
- switch (protocol) {
49
- case 'rtc':
50
- return strategy_2.RTCInfo;
51
- case 'classic':
52
- return strategy_1.ClassicInfo;
53
- default:
54
- return (0, exhaustive_1.exhaustiveCheck)(protocol, ['rtc', 'classic']);
55
- }
56
- });
57
- }
58
58
  createProvider(options, providerIdentity) {
59
59
  const opts = Object.assign(this.wire.environment.getDefaultChannelOptions().create, options || {});
60
60
  const protocols = this.protocolManager.getProviderProtocols(opts === null || opts === void 0 ? void 0 : opts.protocols);
@@ -2,10 +2,10 @@ import type * as OpenFin from '../../../OpenFin';
2
2
  import ChannelClient from './client';
3
3
  import { ChannelProvider } from './provider';
4
4
  import { EmitterBase } from '../../base';
5
- import Transport, { Message } from '../../../transport/transport';
5
+ import { Transport, Message } from '../../../transport/transport';
6
6
  import { ChannelEvent } from '../../events/channel';
7
- declare type ProviderIdentity = OpenFin.ProviderIdentity;
8
- declare type Identity = OpenFin.Identity;
7
+ type ProviderIdentity = OpenFin.ProviderIdentity;
8
+ type Identity = OpenFin.Identity;
9
9
  export interface ChannelMessage extends Message<any> {
10
10
  senderIdentity: Identity;
11
11
  ackToSender: any;
@@ -25,6 +25,9 @@ class Channel extends base_1.EmitterBase {
25
25
  super(wire, 'channel');
26
26
  _Channel_connectionManager.set(this, void 0);
27
27
  __classPrivateFieldSet(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
28
+ this.on('disconnected', (eventPayload) => {
29
+ client_1.default.handleProviderDisconnect(eventPayload);
30
+ }).catch((e) => console.error('Error setting up a disconnected listener:', e));
28
31
  }
29
32
  async getAllChannels() {
30
33
  return this.wire.sendAction('get-all-channels').then(({ payload }) => payload.data);
@@ -59,7 +62,7 @@ class Channel extends base_1.EmitterBase {
59
62
  if (entityType === 'iframe') {
60
63
  // @ts-expect-error
61
64
  // TODO: type this correctly (frame types are broken)
62
- const frame = (await this.fin.me.getInfo()).url;
65
+ connectionUrl = (await this.fin.me.getInfo()).url;
63
66
  }
64
67
  else if (entityType === 'window' || entityType === 'view') {
65
68
  connectionUrl = (await this.fin.me.getInfo()).url;
@@ -83,18 +86,13 @@ class Channel extends base_1.EmitterBase {
83
86
  // The provider does not care about endpoint disconnection.
84
87
  strategy.onEndpointDisconnect(routingInfo.channelId, async () => {
85
88
  try {
86
- await channel.disconnect();
89
+ await channel.sendDisconnectAction();
87
90
  }
88
91
  catch (error) {
89
92
  console.warn(`Something went wrong during disconnect for client with uuid: ${routingInfo.uuid} / name: ${routingInfo.name} / endpointId: ${routingInfo.endpointId}.`);
90
93
  }
91
94
  finally {
92
- client_1.default.handleProviderDisconnect(channel, routingInfo);
93
- }
94
- });
95
- this.on('disconnected', (eventPayload) => {
96
- if (eventPayload.channelName === channelName) {
97
- client_1.default.handleProviderDisconnect(channel, eventPayload);
95
+ client_1.default.handleProviderDisconnect(routingInfo);
98
96
  }
99
97
  });
100
98
  return channel;
@@ -1,4 +1,4 @@
1
- import Transport from '../../../../../transport/transport';
1
+ import { Transport } from '../../../../../transport/transport';
2
2
  import { Base } from '../../../../base';
3
3
  import { ChannelBase } from '../../channel';
4
4
  export declare class MessageReceiver extends Base {
@@ -1,9 +1,9 @@
1
1
  import type * as OpenFin from '../../../../../OpenFin';
2
- import Transport from '../../../../../transport/transport';
2
+ import { Transport } from '../../../../../transport/transport';
3
3
  import { MessageReceiver } from './message-receiver';
4
4
  import { ChannelStrategy, EndpointPayload } from '../strategy';
5
5
  import { LocalSupportedProtocol } from '..';
6
- declare type ProviderIdentity = OpenFin.ProviderIdentity;
6
+ type ProviderIdentity = OpenFin.ProviderIdentity;
7
7
  export declare class ClassicStrategy implements ChannelStrategy<EndpointPayload> {
8
8
  #private;
9
9
  private messageReceiver;
@@ -1,8 +1,8 @@
1
1
  import { ChannelStrategy } from '../strategy';
2
- declare type OverlapsOnlyIfMatching<T, U> = {
2
+ type OverlapsOnlyIfMatching<T, U> = {
3
3
  [K in Extract<keyof T, keyof U>]: U[K] extends T[K] ? U[K] : T[K] extends U[K] ? T[K] : never;
4
4
  };
5
- declare type OnlyIfCompatible<A, B, D = OverlapsOnlyIfMatching<A, B>> = D extends Record<any, never> ? keyof D extends never ? A | B : never : A | B;
5
+ type OnlyIfCompatible<A, B, D = OverlapsOnlyIfMatching<A, B>> = D extends Record<any, never> ? keyof D extends never ? A | B : never : A | B;
6
6
  export default class CombinedStrategy<A, B> implements ChannelStrategy<OnlyIfCompatible<A, B>> {
7
7
  private primary;
8
8
  private secondary;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class CombinedStrategy {
4
- // eslint-disable-next-line no-useless-constructor
5
- constructor(primary, secondary) {
6
- this.primary = primary;
7
- this.secondary = secondary;
8
- }
9
4
  // Making this a static method because the constructor can't be typed.
10
5
  // Otherwise it will error when calling addEndpoint but I'd rather the whole instance be typed as never.
11
6
  static combine(a, b) {
12
7
  return new CombinedStrategy(a, b);
13
8
  }
9
+ // eslint-disable-next-line no-useless-constructor
10
+ constructor(primary, secondary) {
11
+ this.primary = primary;
12
+ this.secondary = secondary;
13
+ }
14
14
  onEndpointDisconnect(endpointId, listener) {
15
15
  this.primary.onEndpointDisconnect(endpointId, () => {
16
16
  if (!this.secondary.isEndpointConnected(endpointId)) {
@@ -14,9 +14,12 @@ export interface RTCProtocolOffer extends ProtocolPacketBase {
14
14
  rtcConnectionId: string;
15
15
  };
16
16
  }
17
- export declare type ProtocolOffer = ClassicProtocolOffer | RTCProtocolOffer;
18
- export declare type MessagingProtocols = ProtocolOffer['type'];
19
- export declare type LocalSupportedProtocol = {
17
+ export type ProtocolOffer = ClassicProtocolOffer | RTCProtocolOffer;
18
+ /**
19
+ * Protocol values for determining channel messaging strategy.
20
+ */
21
+ export type MessagingProtocols = ProtocolOffer['type'];
22
+ export type LocalSupportedProtocol = {
20
23
  type: MessagingProtocols;
21
24
  minimumVersion: number;
22
25
  version: number;
@@ -38,7 +41,7 @@ export interface RTCProtocolAnswer extends ProtocolPacketBase {
38
41
  answer: RTCSessionDescriptionInit;
39
42
  };
40
43
  }
41
- export declare type ProtocolAnswer = ClassicProtocolAnswer | RTCProtocolAnswer;
44
+ export type ProtocolAnswer = ClassicProtocolAnswer | RTCProtocolAnswer;
42
45
  export interface ClientAnswer {
43
46
  supportedProtocols: ProtocolAnswer[];
44
47
  }
@@ -1,5 +1,5 @@
1
1
  import type * as OpenFin from '../../../../../OpenFin';
2
- declare type ProviderIdentity = OpenFin.ProviderIdentity;
2
+ type ProviderIdentity = OpenFin.ProviderIdentity;
3
3
  export interface RTCEndpointChannels {
4
4
  request: RTCDataChannel;
5
5
  response: RTCDataChannel;
@@ -51,7 +51,11 @@ class RTCEndpoint {
51
51
  };
52
52
  this.rtc.channels.response.addEventListener('message', (e) => {
53
53
  var _a;
54
- const { messageId, payload, success, error } = JSON.parse(e.data);
54
+ let { data } = e;
55
+ if (e.data instanceof ArrayBuffer) {
56
+ data = new TextDecoder().decode(e.data);
57
+ }
58
+ const { messageId, payload, success, error } = JSON.parse(data);
55
59
  const { resolve, reject } = (_a = this.responseMap.get(messageId)) !== null && _a !== void 0 ? _a : {};
56
60
  if (resolve && reject) {
57
61
  this.responseMap.delete(messageId);
@@ -68,7 +72,11 @@ class RTCEndpoint {
68
72
  }
69
73
  });
70
74
  this.rtc.channels.request.addEventListener('message', async (e) => {
71
- const { messageId, action, payload } = JSON.parse(e.data);
75
+ let { data } = e;
76
+ if (e.data instanceof ArrayBuffer) {
77
+ data = new TextDecoder().decode(e.data);
78
+ }
79
+ const { messageId, action, payload } = JSON.parse(data);
72
80
  if (__classPrivateFieldGet(this, _RTCEndpoint_processAction, "f")) {
73
81
  try {
74
82
  const res = await __classPrivateFieldGet(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
@@ -1,4 +1,4 @@
1
- import Transport from '../../../../../transport/transport';
1
+ import { Transport } from '../../../../../transport/transport';
2
2
  import { EmitterBase } from '../../../../base';
3
3
  import { RTCEndpointChannels } from './endpoint';
4
4
  export declare class RTCICEManager extends EmitterBase<any> {
@@ -2,7 +2,7 @@ import type * as OpenFin from '../../../../../OpenFin';
2
2
  import { ChannelStrategy } from '../strategy';
3
3
  import { RTCPacket } from './endpoint';
4
4
  import { LocalSupportedProtocol } from '..';
5
- declare type ProviderIdentity = OpenFin.ProviderIdentity;
5
+ type ProviderIdentity = OpenFin.ProviderIdentity;
6
6
  export interface RTCStrategyEndpointPayload {
7
7
  endpointIdentity: OpenFin.ClientIdentity | ProviderIdentity;
8
8
  rtc: RTCPacket;
@@ -82,4 +82,4 @@ class RTCStrategy {
82
82
  }
83
83
  exports.RTCStrategy = RTCStrategy;
84
84
  _RTCStrategy_processAction = new WeakMap(), _RTCStrategy_rtcEndpointMap = new WeakMap(), _RTCStrategy_connected = new WeakMap();
85
- exports.RTCInfo = { version: 1, minimumVersion: 0, type: 'rtc' };
85
+ exports.RTCInfo = { version: 2, minimumVersion: 0, type: 'rtc' };
@@ -3,11 +3,11 @@ import { ClassicStrategy } from './classic/strategy';
3
3
  import CombinedStrategy from './combined/strategy';
4
4
  import { RTCStrategy } from './rtc/strategy';
5
5
  import { ChannelStrategy } from './strategy';
6
- declare type StrategyMap = {
6
+ type StrategyMap = {
7
7
  rtc: RTCStrategy;
8
8
  classic: ClassicStrategy;
9
9
  };
10
- export declare type StrategyByProtocol<T extends MessagingProtocols> = StrategyMap[T];
11
- export declare type PayloadTypeByStrategy<T extends ChannelStrategy<unknown>> = T extends ChannelStrategy<infer U> ? U : never;
12
- export declare type AnyStrategy = ClassicStrategy | RTCStrategy | CombinedStrategy<PayloadTypeByStrategy<RTCStrategy>, PayloadTypeByStrategy<ClassicStrategy>>;
10
+ export type StrategyByProtocol<T extends MessagingProtocols> = StrategyMap[T];
11
+ export type PayloadTypeByStrategy<T extends ChannelStrategy<unknown>> = T extends ChannelStrategy<infer U> ? U : never;
12
+ export type AnyStrategy = ClassicStrategy | RTCStrategy | CombinedStrategy<PayloadTypeByStrategy<RTCStrategy>, PayloadTypeByStrategy<ClassicStrategy>>;
13
13
  export {};
@@ -1,5 +1,5 @@
1
1
  import type * as OpenFin from '../../../../OpenFin';
2
- declare type ProviderIdentity = OpenFin.ProviderIdentity;
2
+ type ProviderIdentity = OpenFin.ProviderIdentity;
3
3
  export interface ChannelStrategy<T extends unknown> {
4
4
  onEndpointDisconnect(endpointId: string, listener: () => void): void;
5
5
  receive(listener: (action: string, payload: any, identity: any) => Promise<any>): void;
@@ -10,8 +10,8 @@ export interface ChannelStrategy<T extends unknown> {
10
10
  addEndpoint(endpointId: string, payload: T): void;
11
11
  isValidEndpointPayload(payload: unknown): payload is T;
12
12
  }
13
- export declare type EndpointIdentity = OpenFin.ClientIdentity | ProviderIdentity;
14
- export declare type EndpointPayload = {
13
+ export type EndpointIdentity = OpenFin.ClientIdentity | ProviderIdentity;
14
+ export type EndpointPayload = {
15
15
  endpointIdentity: EndpointIdentity;
16
16
  };
17
17
  export {};
@@ -1,12 +1,12 @@
1
1
  import type * as OpenFin from '../../../OpenFin';
2
2
  import { ChannelBase } from './channel';
3
- import Transport from '../../../transport/transport';
3
+ import { Transport } from '../../../transport/transport';
4
4
  import { AnyStrategy } from './protocols/strategy-types';
5
- declare type ProviderIdentity = OpenFin.ProviderIdentity;
6
- declare type ClientIdentity = OpenFin.ClientIdentity;
7
- export declare type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => Promise<any> | any;
8
- export declare type DisconnectionListener = (identity: ClientIdentity) => any;
9
- declare type ClientConnectionPayload = OpenFin.ClientIdentity & OpenFin.ClientInfo;
5
+ type ProviderIdentity = OpenFin.ProviderIdentity;
6
+ type ClientIdentity = OpenFin.ClientIdentity;
7
+ export type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => Promise<any> | any;
8
+ export type DisconnectionListener = (identity: ClientIdentity) => any;
9
+ type ClientConnectionPayload = OpenFin.ClientIdentity & OpenFin.ClientInfo;
10
10
  export declare class ChannelProvider extends ChannelBase {
11
11
  #private;
12
12
  private static removalMap;
@@ -1,21 +1,40 @@
1
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
+ };
2
7
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
8
  if (kind === "m") throw new TypeError("Private method is not writable");
4
9
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
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");
6
11
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
12
  };
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
13
  var _ChannelProvider_connections, _ChannelProvider_protectedObj, _ChannelProvider_strategy, _ChannelProvider_removeEndpoint, _ChannelProvider_close;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ChannelProvider = void 0;
16
16
  const channel_1 = require("./channel");
17
17
  const runtimeVersioning_1 = require("../../../util/runtimeVersioning");
18
18
  class ChannelProvider extends channel_1.ChannelBase {
19
+ get connections() {
20
+ return [...__classPrivateFieldGet(this, _ChannelProvider_connections, "f")];
21
+ }
22
+ static handleClientDisconnection(channel, payload) {
23
+ const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
24
+ if (removeById) {
25
+ __classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
26
+ }
27
+ else {
28
+ const multipleRemoves = channel.connections.filter((identity) => {
29
+ return identity.uuid === payload.uuid && identity.name === payload.name;
30
+ });
31
+ multipleRemoves.forEach(__classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f"));
32
+ }
33
+ channel.disconnectListener(payload);
34
+ }
35
+ static setProviderRemoval(provider, remove) {
36
+ ChannelProvider.removalMap.set(provider, remove);
37
+ }
19
38
  constructor(providerIdentity, wire, strategy) {
20
39
  super();
21
40
  _ChannelProvider_connections.set(this, void 0);
@@ -51,25 +70,6 @@ class ChannelProvider extends channel_1.ChannelBase {
51
70
  __classPrivateFieldSet(this, _ChannelProvider_strategy, strategy, "f");
52
71
  strategy.receive(this.processAction);
53
72
  }
54
- get connections() {
55
- return [...__classPrivateFieldGet(this, _ChannelProvider_connections, "f")];
56
- }
57
- static handleClientDisconnection(channel, payload) {
58
- const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
59
- if (removeById) {
60
- __classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
61
- }
62
- else {
63
- const multipleRemoves = channel.connections.filter((identity) => {
64
- return identity.uuid === payload.uuid && identity.name === payload.name;
65
- });
66
- multipleRemoves.forEach(__classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f"));
67
- }
68
- channel.disconnectListener(payload);
69
- }
70
- static setProviderRemoval(provider, remove) {
71
- ChannelProvider.removalMap.set(provider, remove);
72
- }
73
73
  dispatch(to, action, payload) {
74
74
  var _a;
75
75
  const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
3
  import { Base } from '../base';
4
- import Transport, { Message } from '../../transport/transport';
4
+ import { Transport, Message } from '../../transport/transport';
5
5
  import { Channel } from './channel/index';
6
6
  /**
7
7
  * A messaging bus that allows for pub/sub messaging between different applications.
@@ -3,6 +3,7 @@ import { Base } from '../base';
3
3
  import { InteropBroker } from './InteropBroker';
4
4
  import { InteropClient } from './InteropClient';
5
5
  /**
6
+ * @PORTED
6
7
  * @typedef { object } InteropConfig
7
8
  * @summary Information relevant to the Interop Broker.
8
9
  * @property {string} [currentContextGroup] Context Group for the client. (green, yellow, red, etc.)
@@ -20,7 +21,6 @@ export default class InteropModule extends Base {
20
21
  * @param { OverrideCallback<InteropBroker> } [override] - A callback function that can be used to extend or replace default Interop Broker behavior.
21
22
  * @return {Promise.<InteropBroker>}
22
23
  * @tutorial Interop.init
23
- * @experimental
24
24
  * @static
25
25
  */
26
26
  init(name: string, override?: OpenFin.OverrideCallback<InteropBroker>): Promise<InteropBroker>;
@@ -31,7 +31,6 @@ export default class InteropModule extends Base {
31
31
  * what context(s) the entity wants to subscribe to, and the current Context Group of the entity.
32
32
  * @return {InteropClient}
33
33
  * @tutorial Interop.connectSync
34
- * @experimental
35
34
  * @static
36
35
  */
37
36
  connectSync(name: string, interopConfig?: OpenFin.InteropConfig): InteropClient;