@openfin/core 29.72.18 → 29.73.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 (64) hide show
  1. package/OpenFin.d.ts +40 -23
  2. package/package.json +1 -1
  3. package/src/api/application/Factory.js +3 -3
  4. package/src/api/application/index.js +7 -3
  5. package/src/api/base.js +18 -20
  6. package/src/api/external-application/index.js +7 -3
  7. package/src/api/fin.js +2 -2
  8. package/src/api/frame/Factory.js +2 -2
  9. package/src/api/frame/index.js +7 -3
  10. package/src/api/interappbus/channel/client.js +24 -26
  11. package/src/api/interappbus/channel/connection-manager.js +24 -26
  12. package/src/api/interappbus/channel/index.js +16 -18
  13. package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
  14. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +24 -26
  15. package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
  16. package/src/api/interappbus/channel/provider.js +134 -139
  17. package/src/api/interappbus/index.js +1 -1
  18. package/src/api/interop/InteropBroker.js +9 -9
  19. package/src/api/interop/InteropClient.js +38 -40
  20. package/src/api/interop/SessionContextGroupClient.js +22 -24
  21. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +17 -0
  22. package/src/api/interop/fdc3/PrivateChannelClient.js +82 -0
  23. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +40 -0
  24. package/src/api/interop/fdc3/PrivateChannelProvider.js +224 -0
  25. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -1
  26. package/src/api/interop/fdc3/fdc3-1.2.js +1 -27
  27. package/src/api/interop/fdc3/fdc3-2.0.d.ts +20 -1
  28. package/src/api/interop/fdc3/fdc3-2.0.js +29 -4
  29. package/src/api/interop/fdc3/utils.d.ts +4 -0
  30. package/src/api/interop/fdc3/utils.js +112 -4
  31. package/src/api/interop/index.js +7 -3
  32. package/src/api/interop/utils.js +20 -14
  33. package/src/api/platform/Factory.js +5 -5
  34. package/src/api/platform/Instance.js +11 -12
  35. package/src/api/platform/index.js +7 -3
  36. package/src/api/platform/layout/Factory.js +18 -20
  37. package/src/api/platform/layout/Instance.d.ts +1 -1
  38. package/src/api/platform/layout/Instance.js +2 -2
  39. package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
  40. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +17 -8
  41. package/src/api/platform/layout/controllers/tab-drag-controller.js +44 -22
  42. package/src/api/platform/layout/index.js +7 -3
  43. package/src/api/platform/layout/utils/bounds-observer.js +5 -3
  44. package/src/api/snapshot-source/Factory.js +1 -1
  45. package/src/api/snapshot-source/Instance.js +33 -35
  46. package/src/api/snapshot-source/index.js +7 -3
  47. package/src/api/snapshot-source/utils.js +2 -1
  48. package/src/api/view/Factory.js +2 -2
  49. package/src/api/view/Instance.d.ts +31 -1
  50. package/src/api/view/Instance.js +31 -1
  51. package/src/api/view/index.js +7 -3
  52. package/src/api/window/Factory.js +2 -2
  53. package/src/api/window/Instance.d.ts +3 -0
  54. package/src/api/window/Instance.js +3 -0
  55. package/src/api/window/index.js +7 -3
  56. package/src/environment/node-env.js +2 -2
  57. package/src/environment/openfin-env.js +15 -17
  58. package/src/fdc3.js +1 -1
  59. package/src/mock.js +1 -2
  60. package/src/transport/transport.js +26 -28
  61. package/src/transport/wire.d.ts +9 -7
  62. package/src/util/http.d.ts +1 -1
  63. package/src/util/http.js +16 -11
  64. package/src/util/normalize-config.js +5 -5
@@ -1,18 +1,16 @@
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
  };
15
- var _wire, _endpointIdentityMap;
13
+ var _ClassicStrategy_wire, _ClassicStrategy_endpointIdentityMap;
16
14
  Object.defineProperty(exports, "__esModule", { value: true });
17
15
  exports.ClassicInfo = exports.ClassicStrategy = void 0;
18
16
  /*
@@ -24,12 +22,12 @@ class ClassicStrategy {
24
22
  this.messageReceiver = messageReceiver;
25
23
  this.endpointId = endpointId;
26
24
  this.providerIdentity = providerIdentity;
27
- _wire.set(this, void 0);
25
+ _ClassicStrategy_wire.set(this, void 0);
28
26
  // Store full endpointIdentity by endpointId of all known endpoints for this strategy instance.
29
27
  // (clients will only have 1: the provider, the provider will have all clients)
30
- _endpointIdentityMap.set(this, new Map());
28
+ _ClassicStrategy_endpointIdentityMap.set(this, new Map());
31
29
  this.send = async (endpointId, action, payload) => {
32
- const to = __classPrivateFieldGet(this, _endpointIdentityMap).get(endpointId);
30
+ const to = __classPrivateFieldGet(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
33
31
  if (!to) {
34
32
  throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
35
33
  }
@@ -40,7 +38,8 @@ class ClassicStrategy {
40
38
  delete cleanId.endpointId;
41
39
  }
42
40
  delete cleanId.isLocalEndpointId;
43
- const raw = await __classPrivateFieldGet(this, _wire).sendAction('send-channel-message', {
41
+ const raw = await __classPrivateFieldGet(this, _ClassicStrategy_wire, "f")
42
+ .sendAction('send-channel-message', {
44
43
  ...cleanId,
45
44
  providerIdentity: this.providerIdentity,
46
45
  action,
@@ -53,9 +52,9 @@ class ClassicStrategy {
53
52
  };
54
53
  this.close = async () => {
55
54
  this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
56
- __classPrivateFieldSet(this, _endpointIdentityMap, new Map());
55
+ __classPrivateFieldSet(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
57
56
  };
58
- __classPrivateFieldSet(this, _wire, wire);
57
+ __classPrivateFieldSet(this, _ClassicStrategy_wire, wire, "f");
59
58
  }
60
59
  onEndpointDisconnect(endpointId, listener) {
61
60
  // Never fires for 'classic'.
@@ -64,13 +63,13 @@ class ClassicStrategy {
64
63
  this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
65
64
  }
66
65
  async closeEndpoint(endpointId) {
67
- __classPrivateFieldGet(this, _endpointIdentityMap).delete(endpointId);
66
+ __classPrivateFieldGet(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
68
67
  }
69
68
  isEndpointConnected(endpointId) {
70
- return __classPrivateFieldGet(this, _endpointIdentityMap).has(endpointId);
69
+ return __classPrivateFieldGet(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
71
70
  }
72
71
  addEndpoint(endpointId, payload) {
73
- __classPrivateFieldGet(this, _endpointIdentityMap).set(endpointId, payload.endpointIdentity);
72
+ __classPrivateFieldGet(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
74
73
  }
75
74
  isValidEndpointPayload(payload) {
76
75
  var _a, _b;
@@ -79,6 +78,6 @@ class ClassicStrategy {
79
78
  }
80
79
  }
81
80
  exports.ClassicStrategy = ClassicStrategy;
82
- _wire = new WeakMap(), _endpointIdentityMap = new WeakMap();
81
+ _ClassicStrategy_wire = new WeakMap(), _ClassicStrategy_endpointIdentityMap = new WeakMap();
83
82
  // Arbitrarily starting at 5 to leave the door open to backfilling pre endpointId etc.
84
83
  exports.ClassicInfo = { version: 5, minimumVersion: 0, type: 'classic' };
@@ -1,19 +1,17 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-unused-vars */
3
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
4
- if (!privateMap.has(receiver)) {
5
- throw new TypeError("attempted to get private field on non-instance");
6
- }
7
- return privateMap.get(receiver);
3
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5
+ 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");
6
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8
7
  };
9
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to set private field on non-instance");
12
- }
13
- privateMap.set(receiver, value);
14
- return value;
8
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9
+ if (kind === "m") throw new TypeError("Private method is not writable");
10
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11
+ 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");
12
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15
13
  };
16
- var _processAction, _disconnectListener;
14
+ var _RTCEndpoint_processAction, _RTCEndpoint_disconnectListener;
17
15
  Object.defineProperty(exports, "__esModule", { value: true });
18
16
  exports.RTCEndpoint = void 0;
19
17
  const errors_1 = require("../../../../../util/errors");
@@ -25,14 +23,14 @@ class RTCEndpoint {
25
23
  this.rtc = rtc;
26
24
  this.endpointIdentity = endpointIdentity;
27
25
  this.responseMap = new Map();
28
- _processAction.set(this, null);
29
- _disconnectListener.set(this, void 0);
26
+ _RTCEndpoint_processAction.set(this, null);
27
+ _RTCEndpoint_disconnectListener.set(this, void 0);
30
28
  this.connectionStateChangeHandler = (event) => {
31
29
  if (this.rtc.rtcClient.connectionState !== 'connected') {
32
30
  this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
33
31
  this.close();
34
- if (__classPrivateFieldGet(this, _disconnectListener)) {
35
- __classPrivateFieldGet(this, _disconnectListener).call(this);
32
+ if (__classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f")) {
33
+ __classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f").call(this);
36
34
  }
37
35
  }
38
36
  };
@@ -71,9 +69,9 @@ class RTCEndpoint {
71
69
  });
72
70
  this.rtc.channels.request.addEventListener('message', async (e) => {
73
71
  const { messageId, action, payload } = JSON.parse(e.data);
74
- if (__classPrivateFieldGet(this, _processAction)) {
72
+ if (__classPrivateFieldGet(this, _RTCEndpoint_processAction, "f")) {
75
73
  try {
76
- const res = await __classPrivateFieldGet(this, _processAction).call(this, action, payload, endpointIdentity);
74
+ const res = await __classPrivateFieldGet(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
77
75
  this.rtc.channels.response.send(JSON.stringify({
78
76
  messageId,
79
77
  payload: res,
@@ -86,7 +84,7 @@ class RTCEndpoint {
86
84
  if (this.rtc.channels.response.readyState === 'open') {
87
85
  this.rtc.channels.response.send(JSON.stringify({
88
86
  messageId,
89
- error: errors_1.errorToPOJO(error),
87
+ error: (0, errors_1.errorToPOJO)(error),
90
88
  success: false
91
89
  }));
92
90
  }
@@ -107,29 +105,29 @@ class RTCEndpoint {
107
105
  datachannel.onclose = (e) => {
108
106
  [...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
109
107
  this.close();
110
- if (__classPrivateFieldGet(this, _disconnectListener)) {
111
- __classPrivateFieldGet(this, _disconnectListener).call(this);
108
+ if (__classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f")) {
109
+ __classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f").call(this);
112
110
  }
113
111
  };
114
112
  });
115
113
  }
116
114
  onDisconnect(listener) {
117
- if (!__classPrivateFieldGet(this, _disconnectListener)) {
118
- __classPrivateFieldSet(this, _disconnectListener, listener);
115
+ if (!__classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f")) {
116
+ __classPrivateFieldSet(this, _RTCEndpoint_disconnectListener, listener, "f");
119
117
  }
120
118
  else {
121
119
  throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
122
120
  }
123
121
  }
124
122
  receive(listener) {
125
- if (__classPrivateFieldGet(this, _processAction)) {
123
+ if (__classPrivateFieldGet(this, _RTCEndpoint_processAction, "f")) {
126
124
  throw new Error('You have already set a listener for this RTC Endpoint.');
127
125
  }
128
- __classPrivateFieldSet(this, _processAction, listener);
126
+ __classPrivateFieldSet(this, _RTCEndpoint_processAction, listener, "f");
129
127
  }
130
128
  get connected() {
131
129
  return this.rtc.rtcClient.connectionState === 'connected';
132
130
  }
133
131
  }
134
132
  exports.RTCEndpoint = RTCEndpoint;
135
- _processAction = new WeakMap(), _disconnectListener = new WeakMap();
133
+ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = new WeakMap();
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to get private field on non-instance");
5
- }
6
- return privateMap.get(receiver);
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);
7
6
  };
8
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
9
- if (!privateMap.has(receiver)) {
10
- throw new TypeError("attempted to set private field on non-instance");
11
- }
12
- privateMap.set(receiver, value);
13
- return value;
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
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");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
14
12
  };
15
- var _processAction, _rtcEndpointMap, _connected;
13
+ var _RTCStrategy_processAction, _RTCStrategy_rtcEndpointMap, _RTCStrategy_connected;
16
14
  Object.defineProperty(exports, "__esModule", { value: true });
17
15
  exports.RTCInfo = exports.RTCStrategy = void 0;
18
16
  const endpoint_1 = require("./endpoint");
@@ -21,56 +19,56 @@ This is used to abstract out rtc messaging from the channels implementation usin
21
19
  */
22
20
  class RTCStrategy {
23
21
  constructor() {
24
- _processAction.set(this, null);
25
- _rtcEndpointMap.set(this, new Map());
26
- _connected.set(this, true);
22
+ _RTCStrategy_processAction.set(this, null);
23
+ _RTCStrategy_rtcEndpointMap.set(this, new Map());
24
+ _RTCStrategy_connected.set(this, true);
27
25
  this.send = async (endpointId, action, payload) => {
28
26
  return this.getEndpointById(endpointId).send(action, payload);
29
27
  };
30
28
  this.close = async () => {
31
- if (__classPrivateFieldGet(this, _connected)) {
32
- __classPrivateFieldGet(this, _rtcEndpointMap).forEach((rtcEndpoint) => rtcEndpoint.close());
33
- __classPrivateFieldSet(this, _rtcEndpointMap, new Map());
29
+ if (__classPrivateFieldGet(this, _RTCStrategy_connected, "f")) {
30
+ __classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").forEach((rtcEndpoint) => rtcEndpoint.close());
31
+ __classPrivateFieldSet(this, _RTCStrategy_rtcEndpointMap, new Map(), "f");
34
32
  }
35
- __classPrivateFieldSet(this, _connected, false);
33
+ __classPrivateFieldSet(this, _RTCStrategy_connected, false, "f");
36
34
  };
37
35
  }
38
36
  onEndpointDisconnect(endpointId, listener) {
39
37
  this.getEndpointById(endpointId).onDisconnect(listener);
40
38
  }
41
39
  receive(listener) {
42
- if (__classPrivateFieldGet(this, _processAction)) {
40
+ if (__classPrivateFieldGet(this, _RTCStrategy_processAction, "f")) {
43
41
  throw new Error('You have already set a listener for this RTC Strategy');
44
42
  }
45
- __classPrivateFieldSet(this, _processAction, listener);
46
- __classPrivateFieldGet(this, _rtcEndpointMap).forEach((rtcEndpoint) => rtcEndpoint.receive(__classPrivateFieldGet(this, _processAction)));
43
+ __classPrivateFieldSet(this, _RTCStrategy_processAction, listener, "f");
44
+ __classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").forEach((rtcEndpoint) => rtcEndpoint.receive(__classPrivateFieldGet(this, _RTCStrategy_processAction, "f")));
47
45
  }
48
46
  getEndpointById(endpointId) {
49
- const endpoint = __classPrivateFieldGet(this, _rtcEndpointMap).get(endpointId);
47
+ const endpoint = __classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").get(endpointId);
50
48
  if (!endpoint) {
51
49
  throw new Error(`Client with endpoint id ${endpointId} is not connected`);
52
50
  }
53
51
  return endpoint;
54
52
  }
55
53
  get connected() {
56
- return __classPrivateFieldGet(this, _connected);
54
+ return __classPrivateFieldGet(this, _RTCStrategy_connected, "f");
57
55
  }
58
56
  isEndpointConnected(endpointId) {
59
- return __classPrivateFieldGet(this, _rtcEndpointMap).has(endpointId);
57
+ return __classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").has(endpointId);
60
58
  }
61
59
  addEndpoint(endpointId, payload) {
62
- if (!__classPrivateFieldGet(this, _connected)) {
60
+ if (!__classPrivateFieldGet(this, _RTCStrategy_connected, "f")) {
63
61
  console.warn('Adding endpoint to disconnected RTC Strategy');
64
62
  return;
65
63
  }
66
64
  const clientStrat = new endpoint_1.RTCEndpoint(payload.rtc, payload.endpointIdentity);
67
- if (__classPrivateFieldGet(this, _processAction)) {
68
- clientStrat.receive(__classPrivateFieldGet(this, _processAction));
65
+ if (__classPrivateFieldGet(this, _RTCStrategy_processAction, "f")) {
66
+ clientStrat.receive(__classPrivateFieldGet(this, _RTCStrategy_processAction, "f"));
69
67
  }
70
- __classPrivateFieldGet(this, _rtcEndpointMap).set(endpointId, clientStrat);
68
+ __classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").set(endpointId, clientStrat);
71
69
  }
72
70
  async closeEndpoint(endpointId) {
73
- __classPrivateFieldGet(this, _rtcEndpointMap).delete(endpointId);
71
+ __classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").delete(endpointId);
74
72
  }
75
73
  isValidEndpointPayload(payload) {
76
74
  const isObject = (x) => {
@@ -83,5 +81,5 @@ class RTCStrategy {
83
81
  }
84
82
  }
85
83
  exports.RTCStrategy = RTCStrategy;
86
- _processAction = new WeakMap(), _rtcEndpointMap = new WeakMap(), _connected = new WeakMap();
84
+ _RTCStrategy_processAction = new WeakMap(), _RTCStrategy_rtcEndpointMap = new WeakMap(), _RTCStrategy_connected = new WeakMap();
87
85
  exports.RTCInfo = { version: 1, minimumVersion: 0, type: 'rtc' };
@@ -1,165 +1,160 @@
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
+ checkForClientConnection(clientIdentity) {
102
+ if (!this.isClientConnected(clientIdentity)) {
103
+ throw new Error(`This action was sent from a client that is not connected to the provider.
107
104
  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
105
  }
122
- isLegacyClientConnected(clientIdentity) {
106
+ }
107
+ isClientConnected(clientIdentity) {
108
+ if (ChannelProvider.clientIdentityIncludesEndpointId(clientIdentity)) {
123
109
  return this.connections.some((identity) => {
124
- return identity.uuid === clientIdentity.uuid && identity.name === clientIdentity.name;
110
+ return (
111
+ // Might be redundant to check for uuid and name here after we get an endpointId match, but just in case
112
+ identity.endpointId === clientIdentity.endpointId &&
113
+ identity.uuid === clientIdentity.uuid &&
114
+ identity.name === clientIdentity.name);
125
115
  });
126
116
  }
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:
117
+ return this.isLegacyClientConnected(clientIdentity);
118
+ }
119
+ isLegacyClientConnected(clientIdentity) {
120
+ return this.connections.some((identity) => {
121
+ return identity.uuid === clientIdentity.uuid && identity.name === clientIdentity.name;
122
+ });
123
+ }
124
+ handleMultiRuntimeLegacyClient(senderIdentity) {
125
+ if (!this.isLegacyClientConnected(senderIdentity)) {
126
+ throw new Error(`This action was sent from a client that is not connected to the provider. Client Identity:
130
127
  {uuid: ${senderIdentity.uuid}, name: ${senderIdentity.name}, endpointId: ${senderIdentity.endpointId}}`);
131
- }
132
128
  }
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
129
+ }
130
+ getEndpointIdForOpenFinId(clientIdentity, action) {
131
+ var _a;
132
+ const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
133
+ if (matchingConnections.length >= 2) {
134
+ const protectedObj = __classPrivateFieldGet(this, _ChannelProvider_protectedObj, "f");
135
+ const { uuid, name } = clientIdentity;
136
+ const providerUuid = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.uuid;
137
+ const providerName = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.name;
138
+ // eslint-disable-next-line no-console
139
+ console.warn(`WARNING: Dispatch call may have unintended results. The "to" argument of your dispatch call is missing the
143
140
  "endpointId" parameter. The identity you are dispatching to ({uuid: ${uuid}, name: ${name}})
144
141
  has multiple channelClients for this channel. Your dispatched action: (${action}) from the provider:
145
142
  ({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
143
  }
144
+ // Pop to return the most recently created endpointId.
145
+ return (_a = matchingConnections.pop()) === null || _a === void 0 ? void 0 : _a.endpointId;
146
+ }
147
+ // eslint-disable-next-line class-methods-use-this
148
+ static clientIdentityIncludesEndpointId(subscriptionIdentity) {
149
+ return subscriptionIdentity.endpointId !== undefined;
150
+ }
151
+ // eslint-disable-next-line class-methods-use-this
152
+ static clientIsMultiRuntime(subscriptionIdentity) {
153
+ return subscriptionIdentity.runtimeUuid !== undefined;
158
154
  }
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
- })();
155
+ }
165
156
  exports.ChannelProvider = ChannelProvider;
157
+ _ChannelProvider_connections = new WeakMap(), _ChannelProvider_protectedObj = new WeakMap(), _ChannelProvider_strategy = new WeakMap(), _ChannelProvider_removeEndpoint = new WeakMap(), _ChannelProvider_close = new WeakMap();
158
+ // The following line should be changed following a typescript update.
159
+ // static #removalMap = new WeakMap<ChannelProvider, Function>();
160
+ 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
  }