@openfin/core 30.73.22 → 30.73.24

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 (115) hide show
  1. package/LICENSE.md +4 -0
  2. package/package.json +2 -2
  3. package/src/OpenFin.d.ts +1678 -188
  4. package/src/api/application/Factory.d.ts +2 -1
  5. package/src/api/application/Factory.js +1 -0
  6. package/src/api/application/Instance.d.ts +3 -2
  7. package/src/api/application/Instance.js +1 -0
  8. package/src/api/base.d.ts +19 -16
  9. package/src/api/base.js +2 -2
  10. package/src/api/clipboard/index.d.ts +2 -1
  11. package/src/api/clipboard/index.js +1 -0
  12. package/src/api/events/application.d.ts +66 -57
  13. package/src/api/events/base.d.ts +33 -15
  14. package/src/api/events/channel.d.ts +13 -8
  15. package/src/api/events/eventAggregator.js +1 -9
  16. package/src/api/events/externalApplication.d.ts +10 -5
  17. package/src/api/events/frame.d.ts +13 -7
  18. package/src/api/events/globalHotkey.d.ts +11 -11
  19. package/src/api/events/platform.d.ts +10 -16
  20. package/src/api/events/system.d.ts +42 -30
  21. package/src/api/events/typedEventEmitter.d.ts +15 -8
  22. package/src/api/events/view.d.ts +38 -55
  23. package/src/api/events/webcontents.d.ts +75 -29
  24. package/src/api/events/window.d.ts +148 -135
  25. package/src/api/external-application/Factory.d.ts +1 -1
  26. package/src/api/external-application/Instance.d.ts +2 -2
  27. package/src/api/fin.d.ts +3 -2
  28. package/src/api/frame/Factory.d.ts +1 -1
  29. package/src/api/frame/Instance.d.ts +2 -2
  30. package/src/api/global-hotkey/index.d.ts +2 -4
  31. package/src/api/global-hotkey/index.js +6 -0
  32. package/src/api/interappbus/channel/channel.d.ts +6 -5
  33. package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
  34. package/src/api/interappbus/channel/channels-docs.js +7 -0
  35. package/src/api/interappbus/channel/client.d.ts +4 -3
  36. package/src/api/interappbus/channel/client.js +12 -5
  37. package/src/api/interappbus/channel/connection-manager.d.ts +1 -1
  38. package/src/api/interappbus/channel/index.d.ts +6 -5
  39. package/src/api/interappbus/channel/index.js +7 -7
  40. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +3 -2
  41. package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
  42. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +3 -2
  43. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
  44. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +3 -2
  45. package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
  46. package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -2
  47. package/src/api/interappbus/channel/provider.d.ts +3 -3
  48. package/src/api/interop/Factory.d.ts +2 -3
  49. package/src/api/interop/Factory.js +20 -4
  50. package/src/api/interop/InteropBroker.d.ts +18 -49
  51. package/src/api/interop/InteropBroker.js +33 -47
  52. package/src/api/interop/InteropClient.d.ts +10 -9
  53. package/src/api/interop/InteropClient.js +9 -8
  54. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
  55. package/src/api/interop/SessionContextGroupClient.d.ts +1 -1
  56. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +1 -1
  57. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
  58. package/src/api/interop/fdc3/fdc3-1.2.d.ts +1 -1
  59. package/src/api/interop/fdc3/fdc3-1.2.js +8 -8
  60. package/src/api/interop/fdc3/fdc3-2.0.d.ts +3 -3
  61. package/src/api/interop/fdc3/fdc3-2.0.js +15 -7
  62. package/src/api/interop/fdc3/fdc3.d.ts +3 -4
  63. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  64. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  65. package/src/api/interop/fdc3/utils.d.ts +3 -3
  66. package/src/api/interop/fdc3/versions.d.ts +1 -0
  67. package/src/api/interop/fdc3/versions.js +2 -0
  68. package/src/api/interop/utils.d.ts +1 -1
  69. package/src/api/me.d.ts +3 -2
  70. package/src/api/platform/Factory.d.ts +6 -1
  71. package/src/api/platform/Factory.js +9 -0
  72. package/src/api/platform/Instance.d.ts +8 -7
  73. package/src/api/platform/Instance.js +6 -3
  74. package/src/api/platform/common-utils.d.ts +2 -2
  75. package/src/api/platform/layout/Factory.d.ts +7 -2
  76. package/src/api/platform/layout/Factory.js +4 -0
  77. package/src/api/platform/layout/Instance.d.ts +5 -4
  78. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -1
  79. package/src/api/platform/layout/shapes.d.ts +3 -2
  80. package/src/api/platform/layout/utils/view-overlay.d.ts +1 -1
  81. package/src/api/platform/provider.d.ts +162 -0
  82. package/src/api/platform/provider.js +2 -0
  83. package/src/api/snapshot-source/Factory.d.ts +2 -1
  84. package/src/api/snapshot-source/Factory.js +1 -0
  85. package/src/api/snapshot-source/Instance.d.ts +1 -1
  86. package/src/api/snapshot-source/utils.d.ts +1 -1
  87. package/src/api/system/index.d.ts +2 -3
  88. package/src/api/system/index.js +22 -6
  89. package/src/api/view/Factory.d.ts +1 -1
  90. package/src/api/view/Instance.d.ts +9 -5
  91. package/src/api/view/Instance.js +7 -4
  92. package/src/api/webcontents/main.d.ts +20 -6
  93. package/src/api/webcontents/main.js +10 -0
  94. package/src/api/window/Factory.d.ts +1 -1
  95. package/src/api/window/Instance.d.ts +22 -4
  96. package/src/api/window/Instance.js +22 -0
  97. package/src/browser.d.ts +1 -1
  98. package/src/environment/browser.d.ts +3 -2
  99. package/src/environment/environment.d.ts +3 -2
  100. package/src/environment/node-env.d.ts +3 -2
  101. package/src/environment/openfin-env.d.ts +3 -2
  102. package/src/fdc3.d.ts +1 -1
  103. package/src/mock.d.ts +1 -1
  104. package/src/mock.js +0 -1
  105. package/src/namespaces.d.ts +21 -0
  106. package/src/namespaces.js +24 -0
  107. package/src/shapes/WebOptions.d.ts +1 -1
  108. package/src/shapes/WindowOptions.d.ts +1 -1
  109. package/src/shapes/protocol.d.ts +1 -1
  110. package/src/transport/transport-errors.d.ts +6 -1
  111. package/src/transport/transport-errors.js +1 -2
  112. package/src/transport/transport.d.ts +12 -9
  113. package/src/transport/transport.js +9 -1
  114. package/src/util/inaccessibleObject.d.ts +2 -0
  115. package/src/util/inaccessibleObject.js +49 -0
@@ -1,9 +1,9 @@
1
- import * as OpenFin from '../../../OpenFin';
1
+ import type * as OpenFin from '../../../OpenFin';
2
2
  import Transport from '../../../transport/transport';
3
- import ProviderIdentity = OpenFin.ProviderIdentity;
4
- import ChannelMiddleware = OpenFin.ChannelMiddleware;
5
- import ErrorMiddleware = OpenFin.ErrorMiddleware;
6
- import ChannelAction = OpenFin.ChannelAction;
3
+ declare type ProviderIdentity = OpenFin.ProviderIdentity;
4
+ declare type ChannelMiddleware = OpenFin.ChannelMiddleware;
5
+ declare type ErrorMiddleware = OpenFin.ErrorMiddleware;
6
+ declare type ChannelAction = OpenFin.ChannelAction;
7
7
  export declare class ProtectedItems {
8
8
  providerIdentity: ProviderIdentity;
9
9
  wire: Transport;
@@ -25,3 +25,4 @@ export declare class ChannelBase {
25
25
  setDefaultAction(func: ChannelMiddleware): void;
26
26
  register(topic: string, listener: ChannelAction): boolean;
27
27
  }
28
+ export {};
@@ -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,8 +1,8 @@
1
- import * as OpenFin from '../../../OpenFin';
1
+ import type * as OpenFin from '../../../OpenFin';
2
2
  import { ChannelBase } from './channel';
3
3
  import Transport from '../../../transport/transport';
4
4
  import { AnyStrategy } from './protocols/strategy-types';
5
- import ProviderIdentity = OpenFin.ProviderIdentity;
5
+ declare type ProviderIdentity = OpenFin.ProviderIdentity;
6
6
  declare type DisconnectionListener = (providerIdentity: ProviderIdentity) => any;
7
7
  interface RoutingInfo extends ProviderIdentity {
8
8
  endpointId: string;
@@ -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 {};
@@ -38,10 +38,14 @@ class ChannelClient extends channel_1.ChannelBase {
38
38
  __classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
39
39
  }
40
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);
41
+ // closes the corresponding channel and invokes the disconnect listener if an event payload is passed.
42
+ static handleProviderDisconnect(eventPayload) {
43
+ for (const channelClient of channelClientsByEndpointId.values()) {
44
+ if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
45
+ channelClient.disconnectListener(eventPayload);
46
+ __classPrivateFieldGet(channelClient, _ChannelClient_close, "f").call(channelClient);
47
+ }
48
+ }
45
49
  }
46
50
  get providerIdentity() {
47
51
  const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
@@ -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,4 +1,4 @@
1
- import * as OpenFin from '../../../OpenFin';
1
+ import type * as OpenFin from '../../../OpenFin';
2
2
  import { ChannelMessage } from '.';
3
3
  import Transport from '../../../transport/transport';
4
4
  import { Base } from '../../base';
@@ -1,18 +1,18 @@
1
- import * as OpenFin from '../../../OpenFin';
1
+ 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
5
  import Transport, { Message } from '../../../transport/transport';
6
- import { ChannelEvents } from '../../events/channel';
7
- import ProviderIdentity = OpenFin.ProviderIdentity;
8
- import Identity = OpenFin.Identity;
6
+ import { ChannelEvent } from '../../events/channel';
7
+ declare type ProviderIdentity = OpenFin.ProviderIdentity;
8
+ declare type Identity = OpenFin.Identity;
9
9
  export interface ChannelMessage extends Message<any> {
10
10
  senderIdentity: Identity;
11
11
  ackToSender: any;
12
12
  providerIdentity: ProviderIdentity;
13
13
  connectAction: boolean;
14
14
  }
15
- export declare class Channel extends EmitterBase<ChannelEvents> {
15
+ export declare class Channel extends EmitterBase<ChannelEvent> {
16
16
  #private;
17
17
  constructor(wire: Transport);
18
18
  getAllChannels(): Promise<ProviderIdentity[]>;
@@ -21,3 +21,4 @@ export declare class Channel extends EmitterBase<ChannelEvents> {
21
21
  connect(channelName: string, options?: OpenFin.ChannelConnectOptions): Promise<ChannelClient>;
22
22
  create(channelName: string, options?: OpenFin.ChannelCreateOptions): Promise<ChannelProvider>;
23
23
  }
24
+ export {};
@@ -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);
@@ -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;
@@ -120,6 +118,8 @@ class Channel extends base_1.EmitterBase {
120
118
  }
121
119
  const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
122
120
  const channel = __classPrivateFieldGet(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
121
+ // TODO: fix typing (internal)
122
+ // @ts-expect-error
123
123
  this.on('client-disconnected', (eventPayload) => {
124
124
  if (eventPayload.channelName === channelName) {
125
125
  provider_1.ChannelProvider.handleClientDisconnection(channel, eventPayload);
@@ -1,9 +1,9 @@
1
- import * as OpenFin from '../../../../../OpenFin';
1
+ import type * as OpenFin from '../../../../../OpenFin';
2
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
- import ProviderIdentity = OpenFin.ProviderIdentity;
6
+ declare type ProviderIdentity = OpenFin.ProviderIdentity;
7
7
  export declare class ClassicStrategy implements ChannelStrategy<EndpointPayload> {
8
8
  #private;
9
9
  private messageReceiver;
@@ -21,3 +21,4 @@ export declare class ClassicStrategy implements ChannelStrategy<EndpointPayload>
21
21
  isValidEndpointPayload(payload: any): payload is EndpointPayload;
22
22
  }
23
23
  export declare const ClassicInfo: LocalSupportedProtocol;
24
+ export {};
@@ -15,6 +15,9 @@ export interface RTCProtocolOffer extends ProtocolPacketBase {
15
15
  };
16
16
  }
17
17
  export declare type ProtocolOffer = ClassicProtocolOffer | RTCProtocolOffer;
18
+ /**
19
+ * Protocol values for determining channel messaging strategy.
20
+ */
18
21
  export declare type MessagingProtocols = ProtocolOffer['type'];
19
22
  export declare type LocalSupportedProtocol = {
20
23
  type: MessagingProtocols;
@@ -1,5 +1,5 @@
1
- import * as OpenFin from '../../../../../OpenFin';
2
- import ProviderIdentity = OpenFin.ProviderIdentity;
1
+ import type * as OpenFin from '../../../../../OpenFin';
2
+ declare type ProviderIdentity = OpenFin.ProviderIdentity;
3
3
  export interface RTCEndpointChannels {
4
4
  request: RTCDataChannel;
5
5
  response: RTCDataChannel;
@@ -22,3 +22,4 @@ export declare class RTCEndpoint {
22
22
  close: () => void;
23
23
  get connected(): boolean;
24
24
  }
25
+ export {};
@@ -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,8 +1,8 @@
1
- import * as OpenFin from '../../../../../OpenFin';
1
+ import type * as OpenFin from '../../../../../OpenFin';
2
2
  import { ChannelStrategy } from '../strategy';
3
3
  import { RTCPacket } from './endpoint';
4
4
  import { LocalSupportedProtocol } from '..';
5
- import ProviderIdentity = OpenFin.ProviderIdentity;
5
+ declare type ProviderIdentity = OpenFin.ProviderIdentity;
6
6
  export interface RTCStrategyEndpointPayload {
7
7
  endpointIdentity: OpenFin.ClientIdentity | ProviderIdentity;
8
8
  rtc: RTCPacket;
@@ -21,3 +21,4 @@ export declare class RTCStrategy implements ChannelStrategy<RTCStrategyEndpointP
21
21
  isValidEndpointPayload(payload: any): payload is RTCStrategyEndpointPayload;
22
22
  }
23
23
  export declare const RTCInfo: LocalSupportedProtocol;
24
+ export {};
@@ -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' };
@@ -1,5 +1,5 @@
1
- import * as OpenFin from '../../../../OpenFin';
2
- import ProviderIdentity = OpenFin.ProviderIdentity;
1
+ import type * as OpenFin from '../../../../OpenFin';
2
+ declare 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;
@@ -14,3 +14,4 @@ export declare type EndpointIdentity = OpenFin.ClientIdentity | ProviderIdentity
14
14
  export declare type EndpointPayload = {
15
15
  endpointIdentity: EndpointIdentity;
16
16
  };
17
+ export {};
@@ -1,9 +1,9 @@
1
- import * as OpenFin from '../../../OpenFin';
1
+ import type * as OpenFin from '../../../OpenFin';
2
2
  import { ChannelBase } from './channel';
3
3
  import Transport from '../../../transport/transport';
4
4
  import { AnyStrategy } from './protocols/strategy-types';
5
- import ProviderIdentity = OpenFin.ProviderIdentity;
6
- import ClientIdentity = OpenFin.ClientIdentity;
5
+ declare type ProviderIdentity = OpenFin.ProviderIdentity;
6
+ declare type ClientIdentity = OpenFin.ClientIdentity;
7
7
  export declare type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => Promise<any> | any;
8
8
  export declare type DisconnectionListener = (identity: ClientIdentity) => any;
9
9
  declare type ClientConnectionPayload = OpenFin.ClientIdentity & OpenFin.ClientInfo;
@@ -1,8 +1,9 @@
1
- import * as OpenFin from '../../OpenFin';
1
+ import type * as OpenFin from '../../OpenFin';
2
2
  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;
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lodash_1 = require("lodash");
4
+ const inaccessibleObject_1 = require("../../util/inaccessibleObject");
3
5
  const base_1 = require("../base");
4
6
  const InteropBroker_1 = require("./InteropBroker");
5
7
  const InteropClient_1 = require("./InteropClient");
6
- const defaultOverride = (Class, ...args) => new Class(...args);
8
+ const overrideCheck_1 = require("./fdc3/overrideCheck");
9
+ const defaultOverride = (Class) => new Class();
10
+ const BrokerParamAccessError = 'You have attempted to use or modify InteropBroker parameters, which is not allowed. You are likely using an older InteropBroker override scheme. Please consult our Interop docs for guidance on migrating to the new override scheme.';
7
11
  /**
12
+ * @PORTED
8
13
  * @typedef { object } InteropConfig
9
14
  * @summary Information relevant to the Interop Broker.
10
15
  * @property {string} [currentContextGroup] Context Group for the client. (green, yellow, red, etc.)
@@ -22,15 +27,18 @@ class InteropModule extends base_1.Base {
22
27
  * @param { OverrideCallback<InteropBroker> } [override] - A callback function that can be used to extend or replace default Interop Broker behavior.
23
28
  * @return {Promise.<InteropBroker>}
24
29
  * @tutorial Interop.init
25
- * @experimental
26
30
  * @static
27
31
  */
28
32
  async init(name, override = defaultOverride) {
33
+ var _a;
29
34
  this.wire.sendAction('interop-init').catch((e) => {
30
35
  // don't expose, analytics-only call
31
36
  });
32
37
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
33
38
  const options = await this.fin.Application.getCurrentSync().getInfo();
39
+ const opts = (_a = options.initialOptions.interopBrokerConfiguration) !== null && _a !== void 0 ? _a : {};
40
+ const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
41
+ const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(opts));
34
42
  let provider;
35
43
  const getProvider = () => {
36
44
  if (!provider) {
@@ -38,7 +46,16 @@ class InteropModule extends base_1.Base {
38
46
  }
39
47
  return provider;
40
48
  };
41
- return override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration);
49
+ const throwingGetProvider = async () => {
50
+ // eslint-disable-next-line no-console
51
+ throw new Error(BrokerParamAccessError);
52
+ };
53
+ const OverrideableBroker = InteropBroker_1.InteropBroker.createClosedConstructor(this.wire, getProvider, opts);
54
+ // We need to use these objects because removing them entirely would be a breaking change and we want an informative error
55
+ // @ts-expect-error
56
+ const broker = await override(OverrideableBroker, objectThatThrows, throwingGetProvider, warningOptsClone);
57
+ (0, overrideCheck_1.overrideCheck)(broker, (0, overrideCheck_1.getDefaultViewFdc3VersionFromAppInfo)(options));
58
+ return broker;
42
59
  }
43
60
  /**
44
61
  * Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
@@ -47,7 +64,6 @@ class InteropModule extends base_1.Base {
47
64
  * what context(s) the entity wants to subscribe to, and the current Context Group of the entity.
48
65
  * @return {InteropClient}
49
66
  * @tutorial Interop.connectSync
50
- * @experimental
51
67
  * @static
52
68
  */
53
69
  connectSync(name, interopConfig) {