@openfin/core 30.73.6 → 30.73.7

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 (158) hide show
  1. package/OpenFin.d.ts +1 -1729
  2. package/fin.d.ts +3 -4
  3. package/package.json +1 -1
  4. package/src/GlobalOpenFin.d.ts +4 -0
  5. package/src/OpenFin.d.ts +2938 -0
  6. package/src/OpenFin.js +4 -0
  7. package/src/api/application/Factory.d.ts +2 -0
  8. package/src/api/application/Factory.js +4 -3
  9. package/src/api/application/Instance.d.ts +3 -1
  10. package/src/api/application/Instance.js +1 -0
  11. package/src/api/application/index.js +7 -3
  12. package/src/api/base.d.ts +19 -15
  13. package/src/api/base.js +20 -22
  14. package/src/api/clipboard/index.d.ts +2 -0
  15. package/src/api/clipboard/index.js +1 -0
  16. package/src/api/events/application.d.ts +66 -56
  17. package/src/api/events/base.d.ts +33 -15
  18. package/src/api/events/channel.d.ts +13 -8
  19. package/src/api/events/eventAggregator.js +1 -9
  20. package/src/api/events/externalApplication.d.ts +10 -5
  21. package/src/api/events/frame.d.ts +13 -7
  22. package/src/api/events/globalHotkey.d.ts +11 -10
  23. package/src/api/events/platform.d.ts +10 -16
  24. package/src/api/events/system.d.ts +48 -18
  25. package/src/api/events/typedEventEmitter.d.ts +20 -0
  26. package/src/api/events/typedEventEmitter.js +2 -0
  27. package/src/api/events/view.d.ts +38 -54
  28. package/src/api/events/webcontents.d.ts +55 -28
  29. package/src/api/events/window.d.ts +148 -134
  30. package/src/api/external-application/Factory.d.ts +1 -0
  31. package/src/api/external-application/Instance.d.ts +2 -1
  32. package/src/api/external-application/index.js +7 -3
  33. package/src/api/fin.d.ts +3 -1
  34. package/src/api/fin.js +2 -2
  35. package/src/api/frame/Factory.d.ts +1 -0
  36. package/src/api/frame/Factory.js +2 -2
  37. package/src/api/frame/Instance.d.ts +3 -1
  38. package/src/api/frame/index.js +7 -3
  39. package/src/api/global-hotkey/index.d.ts +2 -2
  40. package/src/api/global-hotkey/index.js +6 -0
  41. package/src/api/interappbus/channel/channel.d.ts +6 -4
  42. package/src/api/interappbus/channel/channels-docs.d.ts +22 -0
  43. package/src/api/interappbus/channel/channels-docs.js +22 -0
  44. package/src/api/interappbus/channel/client.d.ts +2 -1
  45. package/src/api/interappbus/channel/client.js +24 -26
  46. package/src/api/interappbus/channel/connection-manager.d.ts +1 -0
  47. package/src/api/interappbus/channel/connection-manager.js +30 -28
  48. package/src/api/interappbus/channel/index.d.ts +6 -4
  49. package/src/api/interappbus/channel/index.js +34 -19
  50. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +3 -1
  51. package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
  52. package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
  53. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +1 -1
  54. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +3 -1
  55. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +25 -27
  56. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -1
  57. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +3 -1
  58. package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
  59. package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -1
  60. package/src/api/interappbus/channel/provider.d.ts +8 -4
  61. package/src/api/interappbus/channel/provider.js +140 -139
  62. package/src/api/interappbus/index.js +1 -1
  63. package/src/api/interop/Factory.d.ts +2 -0
  64. package/src/api/interop/Factory.js +20 -2
  65. package/src/api/interop/InteropBroker.d.ts +62 -39
  66. package/src/api/interop/InteropBroker.js +114 -55
  67. package/src/api/interop/InteropClient.d.ts +9 -0
  68. package/src/api/interop/InteropClient.js +46 -40
  69. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -0
  70. package/src/api/interop/SessionContextGroupClient.d.ts +1 -0
  71. package/src/api/interop/SessionContextGroupClient.js +22 -24
  72. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +9 -7
  73. package/src/api/interop/fdc3/PrivateChannelClient.js +6 -6
  74. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -0
  75. package/src/api/interop/fdc3/fdc3-1.2.d.ts +14 -13
  76. package/src/api/interop/fdc3/fdc3-1.2.js +3 -14
  77. package/src/api/interop/fdc3/fdc3-2.0.d.ts +24 -21
  78. package/src/api/interop/fdc3/fdc3-2.0.js +27 -27
  79. package/src/api/interop/fdc3/fdc3.d.ts +12 -0
  80. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  81. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  82. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +53 -0
  83. package/src/api/interop/fdc3/shapes/fdc3v1.js +4 -0
  84. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +75 -0
  85. package/src/api/interop/fdc3/shapes/fdc3v2.js +2 -0
  86. package/src/api/interop/fdc3/utils.d.ts +15 -5
  87. package/src/api/interop/fdc3/utils.js +29 -11
  88. package/src/api/interop/fdc3/versions.d.ts +1 -0
  89. package/src/api/interop/fdc3/versions.js +2 -0
  90. package/src/api/interop/index.js +7 -3
  91. package/src/api/interop/utils.d.ts +2 -0
  92. package/src/api/interop/utils.js +29 -15
  93. package/src/api/me.d.ts +3 -1
  94. package/src/api/platform/Factory.d.ts +6 -0
  95. package/src/api/platform/Factory.js +14 -5
  96. package/src/api/platform/Instance.d.ts +18 -3
  97. package/src/api/platform/Instance.js +30 -13
  98. package/src/api/platform/common-utils.d.ts +2 -1
  99. package/src/api/platform/index.js +7 -3
  100. package/src/api/platform/layout/Factory.d.ts +7 -1
  101. package/src/api/platform/layout/Factory.js +22 -20
  102. package/src/api/platform/layout/Instance.d.ts +6 -4
  103. package/src/api/platform/layout/Instance.js +2 -3
  104. package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
  105. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -0
  106. package/src/api/platform/layout/controllers/tab-drag-controller.js +1 -1
  107. package/src/api/platform/layout/index.js +7 -3
  108. package/src/api/platform/layout/shapes.d.ts +3 -1
  109. package/src/api/platform/layout/utils/bounds-observer.d.ts +1 -1
  110. package/src/api/platform/layout/utils/bounds-observer.js +7 -5
  111. package/src/api/platform/layout/utils/view-overlay.d.ts +1 -0
  112. package/src/api/platform/provider.d.ts +162 -0
  113. package/src/api/platform/provider.js +2 -0
  114. package/src/api/snapshot-source/Factory.d.ts +2 -0
  115. package/src/api/snapshot-source/Factory.js +2 -1
  116. package/src/api/snapshot-source/Instance.d.ts +1 -0
  117. package/src/api/snapshot-source/Instance.js +33 -35
  118. package/src/api/snapshot-source/index.js +7 -3
  119. package/src/api/snapshot-source/utils.d.ts +1 -0
  120. package/src/api/snapshot-source/utils.js +2 -1
  121. package/src/api/system/index.d.ts +76 -16
  122. package/src/api/system/index.js +127 -3
  123. package/src/api/view/Factory.d.ts +1 -0
  124. package/src/api/view/Factory.js +2 -2
  125. package/src/api/view/Instance.d.ts +17 -3
  126. package/src/api/view/Instance.js +20 -0
  127. package/src/api/view/index.js +7 -3
  128. package/src/api/webcontents/main.d.ts +20 -5
  129. package/src/api/webcontents/main.js +10 -0
  130. package/src/api/window/Factory.d.ts +1 -0
  131. package/src/api/window/Factory.js +2 -2
  132. package/src/api/window/Instance.d.ts +26 -3
  133. package/src/api/window/Instance.js +26 -1
  134. package/src/api/window/index.js +7 -3
  135. package/src/browser.d.ts +4 -4
  136. package/src/environment/browser.d.ts +3 -1
  137. package/src/environment/environment.d.ts +3 -1
  138. package/src/environment/node-env.d.ts +3 -1
  139. package/src/environment/node-env.js +2 -2
  140. package/src/environment/openfin-env.d.ts +3 -1
  141. package/src/environment/openfin-env.js +15 -17
  142. package/src/fdc3.d.ts +3 -0
  143. package/src/fdc3.js +1 -1
  144. package/src/mock.d.ts +2 -2
  145. package/src/mock.js +3 -3
  146. package/src/namespaces.d.ts +21 -0
  147. package/src/namespaces.js +24 -0
  148. package/src/shapes/WebOptions.d.ts +1 -0
  149. package/src/shapes/WindowOptions.d.ts +1 -0
  150. package/src/shapes/protocol.d.ts +34 -26
  151. package/src/transport/transport.d.ts +6 -5
  152. package/src/transport/transport.js +26 -28
  153. package/src/transport/wire.d.ts +9 -7
  154. package/src/util/http.d.ts +1 -1
  155. package/src/util/http.js +16 -11
  156. package/src/util/inaccessibleObject.d.ts +2 -0
  157. package/src/util/inaccessibleObject.js +49 -0
  158. package/src/util/normalize-config.js +5 -5
@@ -1,165 +1,166 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
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;
8
7
  };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
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);
14
12
  };
13
+ var _ChannelProvider_connections, _ChannelProvider_protectedObj, _ChannelProvider_strategy, _ChannelProvider_removeEndpoint, _ChannelProvider_close;
15
14
  Object.defineProperty(exports, "__esModule", { value: true });
16
15
  exports.ChannelProvider = void 0;
17
16
  const channel_1 = require("./channel");
18
17
  const runtimeVersioning_1 = require("../../../util/runtimeVersioning");
19
- let ChannelProvider = /** @class */ (() => {
20
- var _connections, _protectedObj, _strategy, _removeEndpoint, _close;
21
- class ChannelProvider extends channel_1.ChannelBase {
22
- constructor(providerIdentity, wire, strategy) {
23
- super();
24
- _connections.set(this, void 0);
25
- _protectedObj.set(this, void 0);
26
- _strategy.set(this, void 0);
27
- _removeEndpoint.set(this, (identity) => {
28
- const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
29
- __classPrivateFieldGet(this, _strategy).closeEndpoint(identity.endpointId);
30
- __classPrivateFieldSet(this, _connections, remainingConnections);
31
- });
32
- // Must be bound.
33
- this.processAction = async (action, payload, senderIdentity) => {
34
- if (ChannelProvider.clientIsMultiRuntime(senderIdentity) &&
35
- !runtimeVersioning_1.runtimeUuidMeetsMinimumRuntimeVersion(senderIdentity.runtimeUuid, '18.87.56.0')) {
36
- this.handleMultiRuntimeLegacyClient(senderIdentity);
37
- }
38
- else {
39
- this.checkForClientConnection(senderIdentity);
40
- }
41
- return super.processAction(action, payload, senderIdentity);
42
- };
43
- _close.set(this, () => {
44
- __classPrivateFieldGet(this, _strategy).close();
45
- const remove = ChannelProvider.removalMap.get(this);
46
- if (remove) {
47
- remove();
48
- }
49
- });
50
- __classPrivateFieldSet(this, _protectedObj, new channel_1.ProtectedItems(providerIdentity, wire));
51
- this.connectListener = () => undefined;
52
- this.disconnectListener = () => undefined;
53
- __classPrivateFieldSet(this, _connections, []);
54
- __classPrivateFieldSet(this, _strategy, strategy);
55
- strategy.receive(this.processAction);
56
- }
57
- get connections() {
58
- return [...__classPrivateFieldGet(this, _connections)];
59
- }
60
- static handleClientDisconnection(channel, payload) {
61
- const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
62
- if (removeById) {
63
- __classPrivateFieldGet(channel, _removeEndpoint).call(channel, removeById);
18
+ class ChannelProvider extends channel_1.ChannelBase {
19
+ constructor(providerIdentity, wire, strategy) {
20
+ super();
21
+ _ChannelProvider_connections.set(this, void 0);
22
+ _ChannelProvider_protectedObj.set(this, void 0);
23
+ _ChannelProvider_strategy.set(this, void 0);
24
+ _ChannelProvider_removeEndpoint.set(this, (identity) => {
25
+ const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
26
+ __classPrivateFieldGet(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
27
+ __classPrivateFieldSet(this, _ChannelProvider_connections, remainingConnections, "f");
28
+ });
29
+ // Must be bound.
30
+ this.processAction = async (action, payload, senderIdentity) => {
31
+ if (ChannelProvider.clientIsMultiRuntime(senderIdentity) &&
32
+ !(0, runtimeVersioning_1.runtimeUuidMeetsMinimumRuntimeVersion)(senderIdentity.runtimeUuid, '18.87.56.0')) {
33
+ this.handleMultiRuntimeLegacyClient(senderIdentity);
64
34
  }
65
35
  else {
66
- const multipleRemoves = channel.connections.filter((identity) => {
67
- return identity.uuid === payload.uuid && identity.name === payload.name;
68
- });
69
- multipleRemoves.forEach(__classPrivateFieldGet(channel, _removeEndpoint));
36
+ this.checkForClientConnection(senderIdentity);
70
37
  }
71
- channel.disconnectListener(payload);
72
- }
73
- static setProviderRemoval(provider, remove) {
74
- ChannelProvider.removalMap.set(provider, remove);
75
- }
76
- dispatch(to, action, payload) {
77
- var _a;
78
- const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
79
- if (endpointId && __classPrivateFieldGet(this, _strategy).isEndpointConnected(endpointId)) {
80
- return __classPrivateFieldGet(this, _strategy).send(endpointId, action, payload);
38
+ return super.processAction(action, payload, senderIdentity);
39
+ };
40
+ _ChannelProvider_close.set(this, () => {
41
+ __classPrivateFieldGet(this, _ChannelProvider_strategy, "f").close();
42
+ const remove = ChannelProvider.removalMap.get(this);
43
+ if (remove) {
44
+ remove();
81
45
  }
82
- return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
83
- }
84
- async processConnection(senderId, payload) {
85
- __classPrivateFieldGet(this, _connections).push(senderId);
86
- return this.connectListener(senderId, payload);
87
- }
88
- publish(action, payload) {
89
- return this.connections.map((to) => __classPrivateFieldGet(this, _strategy).send(to.endpointId, action, payload));
90
- }
91
- onConnection(listener) {
92
- this.connectListener = listener;
93
- }
94
- onDisconnection(listener) {
95
- this.disconnectListener = listener;
46
+ });
47
+ __classPrivateFieldSet(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, wire), "f");
48
+ this.connectListener = () => undefined;
49
+ this.disconnectListener = () => undefined;
50
+ __classPrivateFieldSet(this, _ChannelProvider_connections, [], "f");
51
+ __classPrivateFieldSet(this, _ChannelProvider_strategy, strategy, "f");
52
+ strategy.receive(this.processAction);
53
+ }
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"));
96
67
  }
97
- async destroy() {
98
- const protectedObj = __classPrivateFieldGet(this, _protectedObj);
99
- const { channelName } = protectedObj.providerIdentity;
100
- __classPrivateFieldSet(this, _connections, []);
101
- await protectedObj.wire.sendAction('destroy-channel', { channelName });
102
- __classPrivateFieldGet(this, _close).call(this);
68
+ channel.disconnectListener(payload);
69
+ }
70
+ static setProviderRemoval(provider, remove) {
71
+ ChannelProvider.removalMap.set(provider, remove);
72
+ }
73
+ dispatch(to, action, payload) {
74
+ var _a;
75
+ const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
76
+ if (endpointId && __classPrivateFieldGet(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
77
+ return __classPrivateFieldGet(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
103
78
  }
104
- checkForClientConnection(clientIdentity) {
105
- if (!this.isClientConnected(clientIdentity)) {
106
- throw new Error(`This action was sent from a client that is not connected to the provider.
79
+ return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
80
+ }
81
+ async processConnection(senderId, payload) {
82
+ __classPrivateFieldGet(this, _ChannelProvider_connections, "f").push(senderId);
83
+ return this.connectListener(senderId, payload);
84
+ }
85
+ publish(action, payload) {
86
+ return this.connections.map((to) => __classPrivateFieldGet(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
87
+ }
88
+ onConnection(listener) {
89
+ this.connectListener = listener;
90
+ }
91
+ onDisconnection(listener) {
92
+ this.disconnectListener = listener;
93
+ }
94
+ async destroy() {
95
+ const protectedObj = __classPrivateFieldGet(this, _ChannelProvider_protectedObj, "f");
96
+ const { channelName } = protectedObj.providerIdentity;
97
+ __classPrivateFieldSet(this, _ChannelProvider_connections, [], "f");
98
+ await protectedObj.wire.sendAction('destroy-channel', { channelName });
99
+ __classPrivateFieldGet(this, _ChannelProvider_close, "f").call(this);
100
+ }
101
+ async getAllClientInfo() {
102
+ return this.connections.map((clientInfo) => {
103
+ const { uuid, name, endpointId, entityType, connectionUrl } = clientInfo;
104
+ return { uuid, name, endpointId, entityType, connectionUrl };
105
+ });
106
+ }
107
+ checkForClientConnection(clientIdentity) {
108
+ if (!this.isClientConnected(clientIdentity)) {
109
+ throw new Error(`This action was sent from a client that is not connected to the provider.
107
110
  Client Identity: {uuid: ${clientIdentity.uuid}, name: ${clientIdentity.name}, endpointId: ${clientIdentity.endpointId}}`);
108
- }
109
- }
110
- isClientConnected(clientIdentity) {
111
- if (ChannelProvider.clientIdentityIncludesEndpointId(clientIdentity)) {
112
- return this.connections.some((identity) => {
113
- return (
114
- // Might be redundant to check for uuid and name here after we get an endpointId match, but just in case
115
- identity.endpointId === clientIdentity.endpointId &&
116
- identity.uuid === clientIdentity.uuid &&
117
- identity.name === clientIdentity.name);
118
- });
119
- }
120
- return this.isLegacyClientConnected(clientIdentity);
121
111
  }
122
- isLegacyClientConnected(clientIdentity) {
112
+ }
113
+ isClientConnected(clientIdentity) {
114
+ if (ChannelProvider.clientIdentityIncludesEndpointId(clientIdentity)) {
123
115
  return this.connections.some((identity) => {
124
- return identity.uuid === clientIdentity.uuid && identity.name === clientIdentity.name;
116
+ return (
117
+ // Might be redundant to check for uuid and name here after we get an endpointId match, but just in case
118
+ identity.endpointId === clientIdentity.endpointId &&
119
+ identity.uuid === clientIdentity.uuid &&
120
+ identity.name === clientIdentity.name);
125
121
  });
126
122
  }
127
- handleMultiRuntimeLegacyClient(senderIdentity) {
128
- if (!this.isLegacyClientConnected(senderIdentity)) {
129
- throw new Error(`This action was sent from a client that is not connected to the provider. Client Identity:
123
+ return this.isLegacyClientConnected(clientIdentity);
124
+ }
125
+ isLegacyClientConnected(clientIdentity) {
126
+ return this.connections.some((identity) => {
127
+ return identity.uuid === clientIdentity.uuid && identity.name === clientIdentity.name;
128
+ });
129
+ }
130
+ handleMultiRuntimeLegacyClient(senderIdentity) {
131
+ if (!this.isLegacyClientConnected(senderIdentity)) {
132
+ throw new Error(`This action was sent from a client that is not connected to the provider. Client Identity:
130
133
  {uuid: ${senderIdentity.uuid}, name: ${senderIdentity.name}, endpointId: ${senderIdentity.endpointId}}`);
131
- }
132
134
  }
133
- getEndpointIdForOpenFinId(clientIdentity, action) {
134
- var _a;
135
- const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
136
- if (matchingConnections.length >= 2) {
137
- const protectedObj = __classPrivateFieldGet(this, _protectedObj);
138
- const { uuid, name } = clientIdentity;
139
- const providerUuid = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.uuid;
140
- const providerName = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.name;
141
- // eslint-disable-next-line no-console
142
- console.warn(`WARNING: Dispatch call may have unintended results. The "to" argument of your dispatch call is missing the
135
+ }
136
+ getEndpointIdForOpenFinId(clientIdentity, action) {
137
+ var _a;
138
+ const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
139
+ if (matchingConnections.length >= 2) {
140
+ const protectedObj = __classPrivateFieldGet(this, _ChannelProvider_protectedObj, "f");
141
+ const { uuid, name } = clientIdentity;
142
+ const providerUuid = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.uuid;
143
+ const providerName = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.name;
144
+ // eslint-disable-next-line no-console
145
+ console.warn(`WARNING: Dispatch call may have unintended results. The "to" argument of your dispatch call is missing the
143
146
  "endpointId" parameter. The identity you are dispatching to ({uuid: ${uuid}, name: ${name}})
144
147
  has multiple channelClients for this channel. Your dispatched action: (${action}) from the provider:
145
148
  ({uuid: ${providerUuid}, name: ${providerName}}) will only be processed by the most recently-created client.`);
146
- }
147
- // Pop to return the most recently created endpointId.
148
- return (_a = matchingConnections.pop()) === null || _a === void 0 ? void 0 : _a.endpointId;
149
- }
150
- // eslint-disable-next-line class-methods-use-this
151
- static clientIdentityIncludesEndpointId(subscriptionIdentity) {
152
- return subscriptionIdentity.endpointId !== undefined;
153
- }
154
- // eslint-disable-next-line class-methods-use-this
155
- static clientIsMultiRuntime(subscriptionIdentity) {
156
- return subscriptionIdentity.runtimeUuid !== undefined;
157
149
  }
150
+ // Pop to return the most recently created endpointId.
151
+ return (_a = matchingConnections.pop()) === null || _a === void 0 ? void 0 : _a.endpointId;
152
+ }
153
+ // eslint-disable-next-line class-methods-use-this
154
+ static clientIdentityIncludesEndpointId(subscriptionIdentity) {
155
+ return subscriptionIdentity.endpointId !== undefined;
156
+ }
157
+ // eslint-disable-next-line class-methods-use-this
158
+ static clientIsMultiRuntime(subscriptionIdentity) {
159
+ return subscriptionIdentity.runtimeUuid !== undefined;
158
160
  }
159
- _connections = new WeakMap(), _protectedObj = new WeakMap(), _strategy = new WeakMap(), _removeEndpoint = new WeakMap(), _close = new WeakMap();
160
- // The following line should be changed following a typescript update.
161
- // static #removalMap = new WeakMap<ChannelProvider, Function>();
162
- ChannelProvider.removalMap = new WeakMap();
163
- return ChannelProvider;
164
- })();
161
+ }
165
162
  exports.ChannelProvider = ChannelProvider;
163
+ _ChannelProvider_connections = new WeakMap(), _ChannelProvider_protectedObj = new WeakMap(), _ChannelProvider_strategy = new WeakMap(), _ChannelProvider_removeEndpoint = new WeakMap(), _ChannelProvider_close = new WeakMap();
164
+ // The following line should be changed following a typescript update.
165
+ // static #removalMap = new WeakMap<ChannelProvider, Function>();
166
+ ChannelProvider.removalMap = new WeakMap();
@@ -54,7 +54,7 @@ class InterApplicationBus extends base_1.Base {
54
54
  * @tutorial InterApplicationBus.send
55
55
  */
56
56
  async send(destination, topic, message) {
57
- const errorMsg = validate_1.validateIdentity(destination);
57
+ const errorMsg = (0, validate_1.validateIdentity)(destination);
58
58
  if (errorMsg) {
59
59
  throw new Error(errorMsg);
60
60
  }
@@ -1,7 +1,9 @@
1
+ import type * as OpenFin from '../../OpenFin';
1
2
  import { Base } from '../base';
2
3
  import { InteropBroker } from './InteropBroker';
3
4
  import { InteropClient } from './InteropClient';
4
5
  /**
6
+ * @PORTED
5
7
  * @typedef { object } InteropConfig
6
8
  * @summary Information relevant to the Interop Broker.
7
9
  * @property {string} [currentContextGroup] Context Group for the client. (green, yellow, red, etc.)
@@ -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.)
@@ -26,11 +31,15 @@ class InteropModule extends base_1.Base {
26
31
  * @static
27
32
  */
28
33
  async init(name, override = defaultOverride) {
34
+ var _a;
29
35
  this.wire.sendAction('interop-init').catch((e) => {
30
36
  // don't expose, analytics-only call
31
37
  });
32
38
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
33
39
  const options = await this.fin.Application.getCurrentSync().getInfo();
40
+ const opts = (_a = options.initialOptions.interopBrokerConfiguration) !== null && _a !== void 0 ? _a : {};
41
+ const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
42
+ const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(opts));
34
43
  let provider;
35
44
  const getProvider = () => {
36
45
  if (!provider) {
@@ -38,7 +47,16 @@ class InteropModule extends base_1.Base {
38
47
  }
39
48
  return provider;
40
49
  };
41
- return override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration || {});
50
+ const throwingGetProvider = async () => {
51
+ // eslint-disable-next-line no-console
52
+ throw new Error(BrokerParamAccessError);
53
+ };
54
+ const OverrideableBroker = InteropBroker_1.InteropBroker.createClosedConstructor(this.wire, getProvider, opts);
55
+ // We need to use these objects because removing them entirely would be a breaking change and we want an informative error
56
+ // @ts-expect-error
57
+ const broker = await override(OverrideableBroker, objectThatThrows, throwingGetProvider, warningOptsClone);
58
+ (0, overrideCheck_1.overrideCheck)(broker, (0, overrideCheck_1.getDefaultViewFdc3VersionFromAppInfo)(options));
59
+ return broker;
42
60
  }
43
61
  /**
44
62
  * Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
@@ -1,6 +1,9 @@
1
+ import { TargetApp } from './fdc3/shapes/fdc3v1';
2
+ import { AppIdentifier } from './fdc3/shapes/fdc3v2';
3
+ import type * as OpenFin from '../../OpenFin';
1
4
  import { Base } from '../base';
2
5
  import type Transport from '../../transport/transport';
3
- import Identity = OpenFin.Identity;
6
+ declare type Identity = OpenFin.Identity;
4
7
  /**
5
8
  * {@link https://developers.openfin.co/of-docs/docs/enable-color-linking **THE INTEROP API IS EXPERIMENTAL. IF YOU WOULD LIKE TO USE IT, PLEASE USE OUR DEFAULT IMPLEMENTATION IN BROWSER**}
6
9
  *
@@ -46,6 +49,32 @@ import Identity = OpenFin.Identity;
46
49
  * }
47
50
  * ```
48
51
  *
52
+ * By default the Interop Broker logs all actions to the console. You can disable this by using the logging option in `interopBrokerConfiguration`:
53
+ * ```js
54
+ * {
55
+ * "runtime": {
56
+ * "arguments": "--v=1 --inspect",
57
+ * "version": "alpha-v19"
58
+ * },
59
+ * "platform": {
60
+ * "uuid": "platform_customization_local",
61
+ * "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
62
+ * "autoShow": false,
63
+ * "providerUrl": "http://localhost:5555/provider.html",
64
+ * "interopBrokerConfiguration": {
65
+ * "logging": {
66
+ * "beforeAction": {
67
+ * "enabled": false
68
+ * },
69
+ * "afterAction": {
70
+ * "enabled": false
71
+ * }
72
+ * }
73
+ * }
74
+ * }
75
+ * }
76
+ * ```
77
+ *
49
78
  * ---
50
79
  * **2. Overriding**
51
80
  *
@@ -74,7 +103,7 @@ import Identity = OpenFin.Identity;
74
103
  * };
75
104
  * return new Override();
76
105
  * },
77
- * interopOverride: async (InteropBroker, provider, options, ...args) => {
106
+ * interopOverride: async (InteropBroker) => {
78
107
  * class Override extends InteropBroker {
79
108
  * async joinContextGroup(channelName = 'default', target) {
80
109
  * console.log('before super joinContextGroup')
@@ -83,37 +112,7 @@ import Identity = OpenFin.Identity;
83
112
  * }
84
113
  * }
85
114
  *
86
- * options.contextGroups = [
87
- * {
88
- * id: 'green',
89
- * displayMetadata: {
90
- * color: '#00CC88',
91
- * name: 'green'
92
- * }
93
- * },
94
- * {
95
- * id: 'purple',
96
- * displayMetadata: {
97
- * color: '#8C61FF',
98
- * name: 'purple'
99
- * }
100
- * },
101
- * {
102
- * id: 'orange',
103
- * displayMetadata: {
104
- * color: '#FF8C4C',
105
- * name: 'orange'
106
- * }
107
- * },
108
- * {
109
- * id: 'red',
110
- * displayMetadata: {
111
- * color: '#FF5E60',
112
- * name: 'red'
113
- * }
114
- * }
115
- * ];
116
- * return new Override(provider, options, ...args);
115
+ * return new Override();
117
116
  * }
118
117
  * });
119
118
  * ```
@@ -131,44 +130,56 @@ export declare class InteropBroker extends Base {
131
130
  private lastContextMap;
132
131
  private sessionContextGroupMap;
133
132
  private channel;
133
+ private logging;
134
134
  constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options?: any);
135
+ static createClosedConstructor(...args: ConstructorParameters<typeof InteropBroker>): {
136
+ new (): InteropBroker;
137
+ };
135
138
  /**
139
+ * @REMOVED
136
140
  * SetContextOptions interface
137
141
  * @typedef { object } SetContextOptions
138
142
  * @property { Context } {context} - New context to set.
139
143
  */
140
144
  /**
145
+ * @REMOVED
141
146
  * GetContextOptions interface
142
147
  * @typedef { object } GetContextOptions
143
148
  * @property { string } [contextType] - Context Type
144
149
  */
145
150
  /**
151
+ * @REMOVED
146
152
  * JoinContextGroupOptions interface
147
153
  * @typedef { object } JoinContextGroupOptions
148
154
  * @property { string } contextGroupId - Id of the context group.
149
155
  * @property { Identity | ClientIdentity } [target] - Identity of the entity you wish to join to a context group.
150
156
  */
151
157
  /**
158
+ * @REMOVED
152
159
  * AddClientToContextGroupOptions interface
153
160
  * @typedef { object } AddClientToContextGroupOptions
154
161
  * @property { string } contextGroupId - Name of the context group.
155
162
  */
156
163
  /**
164
+ * @REMOVED
157
165
  * RemoveFromContextGroupOptions interface
158
166
  * @typedef { object } RemoveFromContextGroupOptions
159
167
  * @property { Identity | ClientIdentity } target - Identity of the entity you wish to join to a context group.
160
168
  */
161
169
  /**
170
+ * @REMOVED
162
171
  * GetInfoForContextGroupOptions interface
163
172
  * @typedef { object } GetInfoForContextGroupOptions
164
173
  * @property { string } contextGroupId - Name of the context group to get info for.
165
174
  */
166
175
  /**
176
+ * @REMOVED
167
177
  * GetAllClientsInContextGroupOptions interface
168
178
  * @typedef { object } GetAllClientsInContextGroupOptions
169
179
  * @property { string } contextGroupId - Name of the context group to get info for.
170
180
  */
171
181
  /**
182
+ * @PORTED
172
183
  * InfoForIntentOptions interface
173
184
  * @typedef { object } InfoForIntentOptions
174
185
  * @property { string } name Name of the intent to get info for.
@@ -329,23 +340,23 @@ export declare class InteropBroker extends Base {
329
340
  * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
330
341
  */
331
342
  fdc3HandleOpen({ app, context }: {
332
- app: FDC3.TargetApp | FDC3v2.AppIdentifier;
343
+ app: TargetApp | AppIdentifier;
333
344
  context: OpenFin.Context;
334
- }, clientIdentity: OpenFin.ClientIdentity): Promise<void | FDC3v2.AppIdentifier>;
345
+ }, clientIdentity: OpenFin.ClientIdentity): Promise<void | AppIdentifier>;
335
346
  /**
336
347
  * Responsible for resolving the fdc3.findInstances call.
337
348
  * Must be overridden
338
349
  * @param { AppIdentifier(2) } app AppIdentifier that was passed to fdc3.findInstances
339
350
  * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
340
351
  */
341
- fdc3HandleFindInstances(app: FDC3v2.AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
352
+ fdc3HandleFindInstances(app: AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
342
353
  /**
343
354
  * Responsible for resolving the fdc3.getAppMetadata call.
344
355
  * Must be overridden
345
356
  * @param { AppIdentifier(2) } app AppIdentifier that was passed to fdc3.getAppMetadata
346
357
  * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
347
358
  */
348
- fdc3HandleGetAppMetadata(app: FDC3v2.AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
359
+ fdc3HandleGetAppMetadata(app: AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
349
360
  /**
350
361
  * This function is called by the Interop Broker whenever a Context handler would fire.
351
362
  * For FDC3 2.0 you would need to override this function and add the contextMetadata as
@@ -377,7 +388,18 @@ export declare class InteropBroker extends Base {
377
388
  * @param clientIdentity
378
389
  * @returns { Promise<ImplementationMetadata(2)> }
379
390
  */
380
- fdc3HandleGetInfo(clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
391
+ fdc3HandleGetInfo(payload: {
392
+ fdc3Version: string;
393
+ }, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
394
+ /**
395
+ * Returns an array of info for each Interop Client connected to the Interop Broker.
396
+ *
397
+ * FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
398
+ * an AppIdentifier.
399
+ * @return { Promise<Array<ClientInfo>> }
400
+ * @tutorial interop.getAllClientInfo
401
+ */
402
+ getAllClientInfo(): Promise<Array<OpenFin.ClientInfo>>;
381
403
  decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
382
404
  applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
383
405
  updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
@@ -407,7 +429,7 @@ export declare class InteropBroker extends Base {
407
429
  private static hasEndpointId;
408
430
  static isContextTypeCompatible(contextType: string, registeredContextType: string | undefined): boolean;
409
431
  private setContextGroupMap;
410
- private static setCurrentContextGroupInClientOptions;
432
+ private setCurrentContextGroupInClientOptions;
411
433
  private setupChannelProvider;
412
434
  private wireChannel;
413
435
  /**
@@ -425,3 +447,4 @@ export declare class InteropBroker extends Base {
425
447
  */
426
448
  isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean> | boolean;
427
449
  }
450
+ export {};