@openfin/node-adapter 40.82.16 → 40.82.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/out/node-adapter.js +84 -59
  2. package/package.json +2 -2
@@ -73,7 +73,7 @@ async function promiseMapSerial(arr, func) {
73
73
  }
74
74
  promises.promiseMapSerial = promiseMapSerial;
75
75
 
76
- var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
76
+ var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
77
77
  if (kind === "m") throw new TypeError("Private method is not writable");
78
78
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
79
79
  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");
@@ -202,7 +202,7 @@ class EmitterBase extends Base {
202
202
  // This will only be reached if unsubscribe from event that does not exist but do not want to error here
203
203
  return Promise.resolve();
204
204
  };
205
- __classPrivateFieldSet$c(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
205
+ __classPrivateFieldSet$d(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
206
206
  this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
207
207
  }
208
208
  /**
@@ -1021,7 +1021,7 @@ const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async
1021
1021
  };
1022
1022
  channelApiRelay.createRelayedDispatch = createRelayedDispatch;
1023
1023
 
1024
- var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1024
+ var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1025
1025
  if (kind === "m") throw new TypeError("Private method is not writable");
1026
1026
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1027
1027
  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");
@@ -1215,7 +1215,7 @@ class LayoutNode {
1215
1215
  entityId: stack.entityId
1216
1216
  }, __classPrivateFieldGet$d(this, _LayoutNode_client, "f")));
1217
1217
  };
1218
- __classPrivateFieldSet$b(this, _LayoutNode_client, client, "f");
1218
+ __classPrivateFieldSet$c(this, _LayoutNode_client, client, "f");
1219
1219
  this.entityId = entityId;
1220
1220
  }
1221
1221
  }
@@ -1374,7 +1374,7 @@ class TabStack extends LayoutNode {
1374
1374
  this.setActiveView = async (view) => {
1375
1375
  await __classPrivateFieldGet$d(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
1376
1376
  };
1377
- __classPrivateFieldSet$b(this, _TabStack_client, client, "f");
1377
+ __classPrivateFieldSet$c(this, _TabStack_client, client, "f");
1378
1378
  }
1379
1379
  }
1380
1380
  layoutEntities.TabStack = TabStack;
@@ -1416,7 +1416,7 @@ class ColumnOrRow extends LayoutNode {
1416
1416
  const contentItemEntities = await __classPrivateFieldGet$d(this, _ColumnOrRow_client, "f").getContent(this.entityId);
1417
1417
  return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$d(this, _ColumnOrRow_client, "f")));
1418
1418
  };
1419
- __classPrivateFieldSet$b(this, _ColumnOrRow_client, client, "f");
1419
+ __classPrivateFieldSet$c(this, _ColumnOrRow_client, client, "f");
1420
1420
  this.type = type;
1421
1421
  }
1422
1422
  }
@@ -2990,11 +2990,8 @@ function requireInstance$2 () {
2990
2990
  // don't expose
2991
2991
  });
2992
2992
  try {
2993
- const layoutWindow = await this.getCurrentWindow();
2994
- const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
2995
- const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
2996
- const stackDefinition = (await client.getStackByView(this.identity));
2997
- return layout_entities_1.LayoutNode.getEntity(stackDefinition, client);
2993
+ const layout = await this.getParentLayout();
2994
+ return layout.getStackByViewIdentity(this.identity);
2998
2995
  }
2999
2996
  catch (error) {
3000
2997
  throw new transport_errors_1.RuntimeError({ reason: 'This view does not belong to a stack.', error });
@@ -8032,7 +8029,7 @@ var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateF
8032
8029
  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");
8033
8030
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8034
8031
  };
8035
- var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8032
+ var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8036
8033
  if (kind === "m") throw new TypeError("Private method is not writable");
8037
8034
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8038
8035
  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");
@@ -8104,10 +8101,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
8104
8101
  channelClientsByEndpointId.delete(this.endpointId);
8105
8102
  __classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").close();
8106
8103
  });
8107
- __classPrivateFieldSet$a(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
8104
+ __classPrivateFieldSet$b(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
8108
8105
  this.disconnectListener = () => undefined;
8109
8106
  this.endpointId = routingInfo.endpointId;
8110
- __classPrivateFieldSet$a(this, _ChannelClient_strategy, strategy, "f");
8107
+ __classPrivateFieldSet$b(this, _ChannelClient_strategy, strategy, "f");
8111
8108
  channelClientsByEndpointId.set(this.endpointId, this);
8112
8109
  strategy.receive(this.processAction);
8113
8110
  }
@@ -8234,7 +8231,7 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
8234
8231
 
8235
8232
  var strategy$3 = {};
8236
8233
 
8237
- var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8234
+ var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8238
8235
  if (kind === "m") throw new TypeError("Private method is not writable");
8239
8236
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8240
8237
  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");
@@ -8300,9 +8297,9 @@ class ClassicStrategy {
8300
8297
  this.close = async () => {
8301
8298
  this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
8302
8299
  [...__classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
8303
- __classPrivateFieldSet$9(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
8300
+ __classPrivateFieldSet$a(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
8304
8301
  };
8305
- __classPrivateFieldSet$9(this, _ClassicStrategy_wire, wire, "f");
8302
+ __classPrivateFieldSet$a(this, _ClassicStrategy_wire, wire, "f");
8306
8303
  }
8307
8304
  onEndpointDisconnect(endpointId, listener) {
8308
8305
  // Never fires for 'classic'.
@@ -8364,7 +8361,7 @@ var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateF
8364
8361
  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");
8365
8362
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8366
8363
  };
8367
- var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8364
+ var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8368
8365
  if (kind === "m") throw new TypeError("Private method is not writable");
8369
8366
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8370
8367
  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");
@@ -8492,7 +8489,7 @@ class RTCEndpoint {
8492
8489
  }
8493
8490
  onDisconnect(listener) {
8494
8491
  if (!__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
8495
- __classPrivateFieldSet$8(this, _RTCEndpoint_disconnectListener, listener, "f");
8492
+ __classPrivateFieldSet$9(this, _RTCEndpoint_disconnectListener, listener, "f");
8496
8493
  }
8497
8494
  else {
8498
8495
  throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
@@ -8502,7 +8499,7 @@ class RTCEndpoint {
8502
8499
  if (__classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f")) {
8503
8500
  throw new Error('You have already set a listener for this RTC Endpoint.');
8504
8501
  }
8505
- __classPrivateFieldSet$8(this, _RTCEndpoint_processAction, listener, "f");
8502
+ __classPrivateFieldSet$9(this, _RTCEndpoint_processAction, listener, "f");
8506
8503
  }
8507
8504
  get connected() {
8508
8505
  return this.rtc.rtcClient.connectionState === 'connected';
@@ -8518,7 +8515,7 @@ var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateF
8518
8515
  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");
8519
8516
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8520
8517
  };
8521
- var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8518
+ var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8522
8519
  if (kind === "m") throw new TypeError("Private method is not writable");
8523
8520
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8524
8521
  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");
@@ -8541,9 +8538,9 @@ class EndpointStrategy {
8541
8538
  this.close = async () => {
8542
8539
  if (__classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f")) {
8543
8540
  __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
8544
- __classPrivateFieldSet$7(this, _EndpointStrategy_endpointMap, new Map(), "f");
8541
+ __classPrivateFieldSet$8(this, _EndpointStrategy_endpointMap, new Map(), "f");
8545
8542
  }
8546
- __classPrivateFieldSet$7(this, _EndpointStrategy_connected, false, "f");
8543
+ __classPrivateFieldSet$8(this, _EndpointStrategy_connected, false, "f");
8547
8544
  };
8548
8545
  this.isValidEndpointPayload = validateEndpoint;
8549
8546
  }
@@ -8554,7 +8551,7 @@ class EndpointStrategy {
8554
8551
  if (__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")) {
8555
8552
  throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
8556
8553
  }
8557
- __classPrivateFieldSet$7(this, _EndpointStrategy_processAction, listener, "f");
8554
+ __classPrivateFieldSet$8(this, _EndpointStrategy_processAction, listener, "f");
8558
8555
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8559
8556
  __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")));
8560
8557
  }
@@ -8770,7 +8767,7 @@ var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateF
8770
8767
  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");
8771
8768
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8772
8769
  };
8773
- var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8770
+ var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8774
8771
  if (kind === "m") throw new TypeError("Private method is not writable");
8775
8772
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8776
8773
  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");
@@ -8843,7 +8840,7 @@ class ChannelProvider extends channel_1.ChannelBase {
8843
8840
  _ChannelProvider_removeEndpoint.set(this, (identity) => {
8844
8841
  const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
8845
8842
  __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
8846
- __classPrivateFieldSet$6(this, _ChannelProvider_connections, remainingConnections, "f");
8843
+ __classPrivateFieldSet$7(this, _ChannelProvider_connections, remainingConnections, "f");
8847
8844
  });
8848
8845
  // Must be bound.
8849
8846
  this.processAction = async (action, payload, senderIdentity) => {
@@ -8863,11 +8860,11 @@ class ChannelProvider extends channel_1.ChannelBase {
8863
8860
  remove();
8864
8861
  }
8865
8862
  });
8866
- __classPrivateFieldSet$6(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
8863
+ __classPrivateFieldSet$7(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
8867
8864
  this.connectListener = () => undefined;
8868
8865
  this.disconnectListener = () => undefined;
8869
- __classPrivateFieldSet$6(this, _ChannelProvider_connections, [], "f");
8870
- __classPrivateFieldSet$6(this, _ChannelProvider_strategy, strategy, "f");
8866
+ __classPrivateFieldSet$7(this, _ChannelProvider_connections, [], "f");
8867
+ __classPrivateFieldSet$7(this, _ChannelProvider_strategy, strategy, "f");
8871
8868
  strategy.receive(this.processAction);
8872
8869
  }
8873
8870
  /**
@@ -9006,7 +9003,7 @@ class ChannelProvider extends channel_1.ChannelBase {
9006
9003
  async destroy() {
9007
9004
  const protectedObj = __classPrivateFieldGet$8(this, _ChannelProvider_protectedObj, "f");
9008
9005
  protectedObj.providerIdentity;
9009
- __classPrivateFieldSet$6(this, _ChannelProvider_connections, [], "f");
9006
+ __classPrivateFieldSet$7(this, _ChannelProvider_connections, [], "f");
9010
9007
  await protectedObj.close();
9011
9008
  __classPrivateFieldGet$8(this, _ChannelProvider_close, "f").call(this);
9012
9009
  }
@@ -9290,7 +9287,7 @@ class CombinedStrategy {
9290
9287
  }
9291
9288
  strategy.default = CombinedStrategy;
9292
9289
 
9293
- var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9290
+ var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9294
9291
  if (kind === "m") throw new TypeError("Private method is not writable");
9295
9292
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9296
9293
  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");
@@ -9345,8 +9342,8 @@ class ConnectionManager extends base_1$f.Base {
9345
9342
  };
9346
9343
  this.providerMap = new Map();
9347
9344
  this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
9348
- __classPrivateFieldSet$5(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
9349
- __classPrivateFieldSet$5(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
9345
+ __classPrivateFieldSet$6(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
9346
+ __classPrivateFieldSet$6(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
9350
9347
  wire.registerMessageHandler(this.onmessage.bind(this));
9351
9348
  }
9352
9349
  createProvider(options, providerIdentity) {
@@ -9547,7 +9544,7 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
9547
9544
  *
9548
9545
  * @packageDocumentation
9549
9546
  */
9550
- var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9547
+ var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9551
9548
  if (kind === "m") throw new TypeError("Private method is not writable");
9552
9549
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9553
9550
  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");
@@ -9614,7 +9611,7 @@ class Channel extends base_1$e.EmitterBase {
9614
9611
  })
9615
9612
  ]).catch(() => new Error('error setting up channel connection listeners'));
9616
9613
  }));
9617
- __classPrivateFieldSet$4(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
9614
+ __classPrivateFieldSet$5(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
9618
9615
  }
9619
9616
  /**
9620
9617
  *
@@ -10757,19 +10754,23 @@ var Factory$3 = {};
10757
10754
 
10758
10755
  var Instance$2 = {};
10759
10756
 
10757
+ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10758
+ if (kind === "m") throw new TypeError("Private method is not writable");
10759
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10760
+ 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");
10761
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10762
+ };
10760
10763
  var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10761
10764
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10762
10765
  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");
10763
10766
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10764
10767
  };
10765
- var _Platform_connectToProvider;
10768
+ var _Platform_channelName, _Platform_connectToProvider;
10766
10769
  Object.defineProperty(Instance$2, "__esModule", { value: true });
10767
10770
  Instance$2.Platform = void 0;
10768
10771
  /* eslint-disable import/prefer-default-export, no-undef */
10769
10772
  const base_1$6 = base;
10770
10773
  const validate_1$1 = validate;
10771
- // Reuse clients to avoid overwriting already-registered client in provider
10772
- const clientMap = new Map();
10773
10774
  /** Manages the life cycle of windows and views in the application.
10774
10775
  *
10775
10776
  * Enables taking snapshots of itself and applying them to restore a previous configuration
@@ -10780,34 +10781,40 @@ class Platform extends base_1$6.EmitterBase {
10780
10781
  * @internal
10781
10782
  */
10782
10783
  // eslint-disable-next-line no-shadow
10783
- constructor(identity, channel) {
10784
+ constructor(wire, identity, channelName = `custom-frame-${identity.uuid}`) {
10784
10785
  // we piggyback off of application event emitter because from the core's perspective platform is just an app.
10785
- super(channel.wire, 'application', identity.uuid);
10786
- this.getClient = (identity) => {
10786
+ super(wire, 'application', identity.uuid);
10787
+ /**
10788
+ * @internal
10789
+ */
10790
+ _Platform_channelName.set(this, void 0);
10791
+ this.getClient = (identity = this.identity) => {
10792
+ if (identity.uuid !== this.identity.uuid) {
10793
+ // I have no idea why we allow passing in a different identity, but we do.
10794
+ // Doing this above the analytics call so we only register one call.
10795
+ return new Platform(this.wire, identity).getClient();
10796
+ }
10787
10797
  this.wire.sendAction('platform-get-client', this.identity).catch((e) => {
10788
10798
  // don't expose
10789
10799
  });
10790
- const target = identity || this.identity;
10791
- const { uuid } = target;
10792
- if (!clientMap.has(uuid)) {
10793
- const clientPromise = __classPrivateFieldGet$5(this, _Platform_connectToProvider, "f").call(this, uuid);
10794
- clientMap.set(uuid, clientPromise);
10800
+ if (!Platform.clientMap.has(__classPrivateFieldGet$5(this, _Platform_channelName, "f"))) {
10801
+ const clientPromise = __classPrivateFieldGet$5(this, _Platform_connectToProvider, "f").call(this);
10802
+ Platform.clientMap.set(__classPrivateFieldGet$5(this, _Platform_channelName, "f"), clientPromise);
10795
10803
  }
10796
10804
  // we set it above
10797
10805
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10798
- return clientMap.get(uuid);
10806
+ return Platform.clientMap.get(__classPrivateFieldGet$5(this, _Platform_channelName, "f"));
10799
10807
  };
10800
- _Platform_connectToProvider.set(this, async (uuid) => {
10808
+ _Platform_connectToProvider.set(this, async () => {
10801
10809
  try {
10802
- const channelName = `custom-frame-${uuid}`;
10803
- const client = await this._channel.connect(channelName, { wait: false });
10810
+ const client = await this._channel.connect(__classPrivateFieldGet$5(this, _Platform_channelName, "f"), { wait: false });
10804
10811
  client.onDisconnection(() => {
10805
- clientMap.delete(uuid);
10812
+ Platform.clientMap.delete(__classPrivateFieldGet$5(this, _Platform_channelName, "f"));
10806
10813
  });
10807
10814
  return client;
10808
10815
  }
10809
10816
  catch (e) {
10810
- clientMap.delete(uuid);
10817
+ Platform.clientMap.delete(__classPrivateFieldGet$5(this, _Platform_channelName, "f"));
10811
10818
  throw new Error('The targeted Platform is not currently running. Listen for application-started event for the given Uuid.');
10812
10819
  }
10813
10820
  });
@@ -10820,7 +10827,8 @@ class Platform extends base_1$6.EmitterBase {
10820
10827
  if (errorMsg) {
10821
10828
  throw new Error(errorMsg);
10822
10829
  }
10823
- this._channel = channel;
10830
+ __classPrivateFieldSet$4(this, _Platform_channelName, channelName, "f");
10831
+ this._channel = this.fin.InterApplicationBus.Channel;
10824
10832
  this.identity = { uuid: identity.uuid };
10825
10833
  this.Layout = this.fin.Platform.Layout;
10826
10834
  this.Application = this.fin.Application.wrapSync(this.identity);
@@ -11585,7 +11593,13 @@ class Platform extends base_1$6.EmitterBase {
11585
11593
  }
11586
11594
  }
11587
11595
  Instance$2.Platform = Platform;
11588
- _Platform_connectToProvider = new WeakMap();
11596
+ _Platform_channelName = new WeakMap(), _Platform_connectToProvider = new WeakMap();
11597
+ /**
11598
+ * @internal
11599
+ * Reuse clients to avoid overwriting already-registered client in provider
11600
+ * This ensures that only channel client is created per channel name per `fin` instance
11601
+ */
11602
+ Platform.clientMap = new Map();
11589
11603
 
11590
11604
  var layout = {};
11591
11605
 
@@ -11986,6 +12000,17 @@ class Layout extends base_1$5.Base {
11986
12000
  const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
11987
12001
  return layout_entities_1.LayoutNode.getEntity(root, client);
11988
12002
  }
12003
+ async getStackByViewIdentity(identity) {
12004
+ this.wire.sendAction('layout-get-stack-by-view').catch(() => {
12005
+ // don't expose
12006
+ });
12007
+ const client = await __classPrivateFieldGet$4(this, _Layout_layoutClient, "f").getValue();
12008
+ const stack = await client.getStackByView(identity);
12009
+ if (!stack) {
12010
+ throw new Error(`No stack found for view: ${identity.uuid}/${identity.name}`);
12011
+ }
12012
+ return layout_entities_1.LayoutNode.getEntity(stack, client);
12013
+ }
11989
12014
  }
11990
12015
  Instance$1.Layout = Layout;
11991
12016
  _Layout_layoutClient = new WeakMap();
@@ -12179,7 +12204,7 @@ class LayoutModule extends base_1$4.Base {
12179
12204
  this.wire.sendAction('layout-get-current').catch((e) => {
12180
12205
  // don't expose
12181
12206
  });
12182
- if (!this.fin.me.isWindow) {
12207
+ if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
12183
12208
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
12184
12209
  }
12185
12210
  const { uuid, name } = this.fin.me;
@@ -12202,7 +12227,7 @@ class LayoutModule extends base_1$4.Base {
12202
12227
  this.wire.sendAction('layout-get-current-sync').catch((e) => {
12203
12228
  // don't expose
12204
12229
  });
12205
- if (!this.fin.me.isWindow) {
12230
+ if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
12206
12231
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
12207
12232
  }
12208
12233
  const { uuid, name } = this.fin.me;
@@ -12344,7 +12369,7 @@ class PlatformModule extends base_1$3.Base {
12344
12369
  this.wire.sendAction('platform-wrap').catch((e) => {
12345
12370
  // don't expose
12346
12371
  });
12347
- return new Instance_1$1.Platform({ uuid: identity.uuid }, this._channel);
12372
+ return new Instance_1$1.Platform(this.wire, { uuid: identity.uuid });
12348
12373
  }
12349
12374
  /**
12350
12375
  * Synchronously returns a Platform object that represents an existing platform.
@@ -12361,7 +12386,7 @@ class PlatformModule extends base_1$3.Base {
12361
12386
  this.wire.sendAction('platform-wrap-sync').catch((e) => {
12362
12387
  // don't expose
12363
12388
  });
12364
- return new Instance_1$1.Platform({ uuid: identity.uuid }, this._channel);
12389
+ return new Instance_1$1.Platform(this.wire, { uuid: identity.uuid });
12365
12390
  }
12366
12391
  /**
12367
12392
  * Asynchronously returns a Platform object that represents the current platform.
@@ -17631,7 +17656,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
17631
17656
  };
17632
17657
  }
17633
17658
  getAdapterVersionSync() {
17634
- return "40.82.16";
17659
+ return "40.82.19";
17635
17660
  }
17636
17661
  observeBounds(element, onChange) {
17637
17662
  throw new Error('Method not implemented.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "40.82.16",
3
+ "version": "40.82.19",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",
@@ -23,7 +23,7 @@
23
23
  "author": "OpenFin",
24
24
  "dependencies": {
25
25
  "@types/node": "^20.14.2",
26
- "@openfin/core": "40.82.16",
26
+ "@openfin/core": "40.82.19",
27
27
  "lodash": "^4.17.21",
28
28
  "ws": "^7.3.0"
29
29
  }