@openfin/node-adapter 34.78.19 → 34.78.21

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.
@@ -351,7 +351,7 @@ class InternalError extends Error {
351
351
  const { message, name, stack, ...rest } = err;
352
352
  super(message);
353
353
  this.name = name || 'Error';
354
- this.stack = stack !== null && stack !== void 0 ? stack : this.toString();
354
+ this.stack = stack ?? this.toString();
355
355
  Object.keys(rest).forEach(key => {
356
356
  this[key] = rest[key];
357
357
  });
@@ -360,7 +360,6 @@ class InternalError extends Error {
360
360
  // For documentation of the error methods being used see here: https://v8.dev/docs/stack-trace-api
361
361
  class RuntimeError extends Error {
362
362
  static getCallSite(callsToRemove = 0) {
363
- var _a, _b;
364
363
  const length = Error.stackTraceLimit;
365
364
  const realCallsToRemove = callsToRemove + 1; // remove this call;
366
365
  Error.stackTraceLimit = length + realCallsToRemove;
@@ -369,7 +368,7 @@ class RuntimeError extends Error {
369
368
  // This will be called when we access the `stack` property
370
369
  Error.prepareStackTrace = (_, stack) => stack;
371
370
  // stack is optional in non chromium contexts
372
- const stack = (_b = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.slice(realCallsToRemove)) !== null && _b !== void 0 ? _b : [];
371
+ const stack = new Error().stack?.slice(realCallsToRemove) ?? [];
373
372
  Error.prepareStackTrace = _prepareStackTrace;
374
373
  Error.stackTraceLimit = length;
375
374
  return stack;
@@ -391,7 +390,7 @@ class RuntimeError extends Error {
391
390
  const { reason, error } = payload;
392
391
  super(reason);
393
392
  this.name = 'RuntimeError';
394
- if (error === null || error === void 0 ? void 0 : error.stack) {
393
+ if (error?.stack) {
395
394
  this.cause = new InternalError(error);
396
395
  }
397
396
  if (callSites) {
@@ -764,7 +763,7 @@ class ChannelsExposer {
764
763
  this.exposeFunction = async (target, config) => {
765
764
  const { key, options, meta } = config;
766
765
  const { id } = meta;
767
- const action = `${id}.${(options === null || options === void 0 ? void 0 : options.action) || key}`;
766
+ const action = `${id}.${options?.action || key}`;
768
767
  await this.channelProviderOrClient.register(action, async ({ args }) => {
769
768
  return target(...args);
770
769
  });
@@ -2398,7 +2397,7 @@ class WebContents extends base_1$k.EmitterBase {
2398
2397
  this.wire.sendAction(`${this.entityType}-show-popup-window`, this.identity).catch(() => {
2399
2398
  // we do not want to expose this error, just continue if this analytics-only call fails
2400
2399
  });
2401
- if (options === null || options === void 0 ? void 0 : options.onPopupReady) {
2400
+ if (options?.onPopupReady) {
2402
2401
  const readyListener = async ({ popupName }) => {
2403
2402
  try {
2404
2403
  const popupWindow = this.fin.Window.wrapSync({ uuid: this.fin.me.uuid, name: popupName });
@@ -2417,8 +2416,8 @@ class WebContents extends base_1$k.EmitterBase {
2417
2416
  ...options,
2418
2417
  // Internal use only.
2419
2418
  // @ts-expect-error
2420
- hasResultCallback: !!(options === null || options === void 0 ? void 0 : options.onPopupResult),
2421
- hasReadyCallback: !!(options === null || options === void 0 ? void 0 : options.onPopupReady)
2419
+ hasResultCallback: !!options?.onPopupResult,
2420
+ hasReadyCallback: !!options?.onPopupReady
2422
2421
  },
2423
2422
  ...this.identity
2424
2423
  });
@@ -2443,7 +2442,7 @@ class WebContents extends base_1$k.EmitterBase {
2443
2442
  }
2444
2443
  return popupResult;
2445
2444
  };
2446
- if (options === null || options === void 0 ? void 0 : options.onPopupResult) {
2445
+ if (options?.onPopupResult) {
2447
2446
  const dispatchResultListener = async (payload) => {
2448
2447
  await options.onPopupResult(normalizePopupResult(payload));
2449
2448
  };
@@ -8323,7 +8322,7 @@ class ChannelBase {
8323
8322
  try {
8324
8323
  const mainAction = this.subscriptions.has(topic)
8325
8324
  ? this.subscriptions.get(topic)
8326
- : (currentPayload, id) => { var _a; return ((_a = this.defaultAction) !== null && _a !== void 0 ? _a : ChannelBase.defaultAction)(topic, currentPayload, id); };
8325
+ : (currentPayload, id) => (this.defaultAction ?? ChannelBase.defaultAction)(topic, currentPayload, id);
8327
8326
  const preActionProcessed = this.preAction ? await this.preAction(topic, payload, senderIdentity) : payload;
8328
8327
  const actionProcessed = await mainAction(preActionProcessed, senderIdentity);
8329
8328
  return this.postAction ? await this.postAction(topic, actionProcessed, senderIdentity) : actionProcessed;
@@ -8856,7 +8855,6 @@ class ClassicStrategy {
8856
8855
  // connection problems occur
8857
8856
  _ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
8858
8857
  this.send = async (endpointId, action, payload) => {
8859
- var _a;
8860
8858
  const to = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
8861
8859
  if (!to) {
8862
8860
  throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
@@ -8876,13 +8874,12 @@ class ClassicStrategy {
8876
8874
  action,
8877
8875
  payload
8878
8876
  });
8879
- (_a = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)) === null || _a === void 0 ? void 0 : _a.add(p);
8877
+ __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
8880
8878
  const raw = await p.catch((error) => {
8881
8879
  throw new Error(error.message);
8882
8880
  }).finally(() => {
8883
- var _a;
8884
8881
  // clean up the pending promise
8885
- (_a = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)) === null || _a === void 0 ? void 0 : _a.delete(p);
8882
+ __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
8886
8883
  });
8887
8884
  return raw.payload.data.result;
8888
8885
  };
@@ -8903,8 +8900,8 @@ class ClassicStrategy {
8903
8900
  const id = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
8904
8901
  __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
8905
8902
  const pendingSet = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
8906
- pendingSet === null || pendingSet === void 0 ? void 0 : pendingSet.forEach((p) => {
8907
- const errorMsg = `Channel connection with identity uuid: ${id === null || id === void 0 ? void 0 : id.uuid} / name: ${id === null || id === void 0 ? void 0 : id.name} / endpointId: ${endpointId} no longer connected.`;
8903
+ pendingSet?.forEach((p) => {
8904
+ const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
8908
8905
  p.cancel(new Error(errorMsg));
8909
8906
  });
8910
8907
  }
@@ -8916,9 +8913,8 @@ class ClassicStrategy {
8916
8913
  __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
8917
8914
  }
8918
8915
  isValidEndpointPayload(payload) {
8919
- var _a, _b;
8920
- return (typeof ((_a = payload === null || payload === void 0 ? void 0 : payload.endpointIdentity) === null || _a === void 0 ? void 0 : _a.endpointId) === 'string' ||
8921
- typeof ((_b = payload === null || payload === void 0 ? void 0 : payload.endpointIdentity) === null || _b === void 0 ? void 0 : _b.channelId) === 'string');
8916
+ return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
8917
+ typeof payload?.endpointIdentity?.channelId === 'string');
8922
8918
  }
8923
8919
  }
8924
8920
  strategy$2.ClassicStrategy = ClassicStrategy;
@@ -8995,13 +8991,12 @@ class RTCEndpoint {
8995
8991
  this.rtc.rtcClient.close();
8996
8992
  };
8997
8993
  this.rtc.channels.response.addEventListener('message', (e) => {
8998
- var _a;
8999
8994
  let { data } = e;
9000
8995
  if (e.data instanceof ArrayBuffer) {
9001
8996
  data = new TextDecoder().decode(e.data);
9002
8997
  }
9003
8998
  const { messageId, payload, success, error } = JSON.parse(data);
9004
- const { resolve, reject } = (_a = this.responseMap.get(messageId)) !== null && _a !== void 0 ? _a : {};
8999
+ const { resolve, reject } = this.responseMap.get(messageId) ?? {};
9005
9000
  if (resolve && reject) {
9006
9001
  this.responseMap.delete(messageId);
9007
9002
  if (success) {
@@ -9250,9 +9245,8 @@ class RTCICEManager extends base_1$i.EmitterBase {
9250
9245
  const rtcConnectionId = Math.random().toString();
9251
9246
  const rtcClient = this.createRtcPeer();
9252
9247
  rtcClient.addEventListener('icecandidate', async (e) => {
9253
- var _a;
9254
9248
  if (e.candidate) {
9255
- await this.raiseClientIce(rtcConnectionId, { candidate: (_a = e.candidate) === null || _a === void 0 ? void 0 : _a.toJSON() });
9249
+ await this.raiseClientIce(rtcConnectionId, { candidate: e.candidate?.toJSON() });
9256
9250
  }
9257
9251
  });
9258
9252
  await this.listenForProviderIce(rtcConnectionId, async (payload) => {
@@ -9277,9 +9271,8 @@ class RTCICEManager extends base_1$i.EmitterBase {
9277
9271
  const requestChannelPromise = RTCICEManager.createDataChannelPromise('request', rtcClient);
9278
9272
  const responseChannelPromise = RTCICEManager.createDataChannelPromise('response', rtcClient);
9279
9273
  rtcClient.addEventListener('icecandidate', async (e) => {
9280
- var _a;
9281
9274
  if (e.candidate) {
9282
- await this.raiseProviderIce(rtcConnectionId, { candidate: (_a = e.candidate) === null || _a === void 0 ? void 0 : _a.toJSON() });
9275
+ await this.raiseProviderIce(rtcConnectionId, { candidate: e.candidate?.toJSON() });
9283
9276
  }
9284
9277
  });
9285
9278
  await this.listenForClientIce(rtcConnectionId, async (payload) => {
@@ -9461,8 +9454,7 @@ class ChannelProvider extends channel_1.ChannelBase {
9461
9454
  * ```
9462
9455
  */
9463
9456
  dispatch(to, action, payload) {
9464
- var _a;
9465
- const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
9457
+ const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
9466
9458
  if (endpointId && __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
9467
9459
  return __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
9468
9460
  }
@@ -9638,13 +9630,12 @@ class ChannelProvider extends channel_1.ChannelBase {
9638
9630
  }
9639
9631
  }
9640
9632
  getEndpointIdForOpenFinId(clientIdentity, action) {
9641
- var _a;
9642
9633
  const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
9643
9634
  if (matchingConnections.length >= 2) {
9644
9635
  const protectedObj = __classPrivateFieldGet$9(this, _ChannelProvider_protectedObj, "f");
9645
9636
  const { uuid, name } = clientIdentity;
9646
- const providerUuid = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.uuid;
9647
- const providerName = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.name;
9637
+ const providerUuid = protectedObj?.providerIdentity.uuid;
9638
+ const providerName = protectedObj?.providerIdentity.name;
9648
9639
  // eslint-disable-next-line no-console
9649
9640
  console.warn(`WARNING: Dispatch call may have unintended results. The "to" argument of your dispatch call is missing the
9650
9641
  "endpointId" parameter. The identity you are dispatching to ({uuid: ${uuid}, name: ${name}})
@@ -9652,7 +9643,7 @@ class ChannelProvider extends channel_1.ChannelBase {
9652
9643
  ({uuid: ${providerUuid}, name: ${providerName}}) will only be processed by the most recently-created client.`);
9653
9644
  }
9654
9645
  // Pop to return the most recently created endpointId.
9655
- return (_a = matchingConnections.pop()) === null || _a === void 0 ? void 0 : _a.endpointId;
9646
+ return matchingConnections.pop()?.endpointId;
9656
9647
  }
9657
9648
  // eslint-disable-next-line class-methods-use-this
9658
9649
  static clientIdentityIncludesEndpointId(subscriptionIdentity) {
@@ -9695,9 +9686,10 @@ class MessageReceiver extends base_1$h.Base {
9695
9686
  wire.registerMessageHandler(this.onmessage.bind(this));
9696
9687
  }
9697
9688
  async processChannelMessage(msg) {
9698
- var _a, _b;
9699
9689
  const { senderIdentity, providerIdentity, action, ackToSender, payload, intendedTargetIdentity } = msg.payload;
9700
- const key = (_b = (_a = intendedTargetIdentity.channelId) !== null && _a !== void 0 ? _a : intendedTargetIdentity.endpointId) !== null && _b !== void 0 ? _b : this.latestEndpointIdByChannelId.get(providerIdentity.channelId); // No endpointId was passed, make best attempt
9690
+ const key = intendedTargetIdentity.channelId ?? // The recipient is a provider
9691
+ intendedTargetIdentity.endpointId ?? // The recipient is a client
9692
+ this.latestEndpointIdByChannelId.get(providerIdentity.channelId); // No endpointId was passed, make best attempt
9701
9693
  const handler = this.endpointMap.get(key);
9702
9694
  if (!handler) {
9703
9695
  ackToSender.payload.success = false;
@@ -9777,12 +9769,9 @@ class ProtocolManager {
9777
9769
  return supported;
9778
9770
  };
9779
9771
  this.getCompatibleProtocols = (providerProtocols, clientOffer) => {
9780
- const supported = clientOffer.supportedProtocols.filter((clientProtocol) => providerProtocols.some((providerProtocol) => {
9781
- var _a;
9782
- return providerProtocol.type === clientProtocol.type &&
9783
- clientProtocol.version >= providerProtocol.minimumVersion &&
9784
- providerProtocol.version >= ((_a = clientProtocol.minimumVersion) !== null && _a !== void 0 ? _a : 0);
9785
- }));
9772
+ const supported = clientOffer.supportedProtocols.filter((clientProtocol) => providerProtocols.some((providerProtocol) => providerProtocol.type === clientProtocol.type &&
9773
+ clientProtocol.version >= providerProtocol.minimumVersion &&
9774
+ providerProtocol.version >= (clientProtocol.minimumVersion ?? 0)));
9786
9775
  return supported.slice(0, clientOffer.maxProtocols);
9787
9776
  };
9788
9777
  }
@@ -9907,7 +9896,7 @@ class ConnectionManager extends base_1$g.Base {
9907
9896
  }
9908
9897
  createProvider(options, providerIdentity) {
9909
9898
  const opts = Object.assign(this.wire.environment.getDefaultChannelOptions().create, options || {});
9910
- const protocols = this.protocolManager.getProviderProtocols(opts === null || opts === void 0 ? void 0 : opts.protocols);
9899
+ const protocols = this.protocolManager.getProviderProtocols(opts?.protocols);
9911
9900
  const createSingleStrategy = (stratType) => {
9912
9901
  switch (stratType) {
9913
9902
  case 'rtc':
@@ -9944,7 +9933,7 @@ class ConnectionManager extends base_1$g.Base {
9944
9933
  return channel;
9945
9934
  }
9946
9935
  async createClientOffer(options) {
9947
- const protocols = this.protocolManager.getClientProtocols(options === null || options === void 0 ? void 0 : options.protocols);
9936
+ const protocols = this.protocolManager.getClientProtocols(options?.protocols);
9948
9937
  let rtcPacket;
9949
9938
  const supportedProtocols = await Promise.all(protocols.map(async (type) => {
9950
9939
  switch (type) {
@@ -9972,14 +9961,13 @@ class ConnectionManager extends base_1$g.Base {
9972
9961
  };
9973
9962
  }
9974
9963
  async createClientStrategy(rtcPacket, routingInfo) {
9975
- var _a;
9976
9964
  if (!routingInfo.endpointId) {
9977
9965
  routingInfo.endpointId = this.wire.environment.getNextMessageId();
9978
9966
  // For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
9979
9967
  // clients that are in the same context as the newly-connected client.
9980
9968
  __classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
9981
9969
  }
9982
- const answer = (_a = routingInfo.answer) !== null && _a !== void 0 ? _a : {
9970
+ const answer = routingInfo.answer ?? {
9983
9971
  supportedProtocols: [{ type: 'classic', version: 1 }]
9984
9972
  };
9985
9973
  const createStrategyFromAnswer = async (protocol) => {
@@ -10037,7 +10025,7 @@ class ConnectionManager extends base_1$g.Base {
10037
10025
  if (!(provider instanceof provider_1$1.ChannelProvider)) {
10038
10026
  throw Error('Cannot connect to a channel client');
10039
10027
  }
10040
- const offer = clientOffer !== null && clientOffer !== void 0 ? clientOffer : {
10028
+ const offer = clientOffer ?? {
10041
10029
  supportedProtocols: [{ type: 'classic', version: 1 }],
10042
10030
  maxProtocols: 1
10043
10031
  };
@@ -11856,7 +11844,6 @@ class Platform extends base_1$7.EmitterBase {
11856
11844
  *
11857
11845
  */
11858
11846
  async reparentView(viewIdentity, target) {
11859
- var _a;
11860
11847
  // eslint-disable-next-line no-console
11861
11848
  console.warn('Platform.reparentView has been deprecated, please use Platform.createView');
11862
11849
  this.wire.sendAction('platform-reparent-view', this.identity).catch((e) => {
@@ -11864,7 +11851,7 @@ class Platform extends base_1$7.EmitterBase {
11864
11851
  });
11865
11852
  const normalizedViewIdentity = {
11866
11853
  ...viewIdentity,
11867
- uuid: (_a = viewIdentity.uuid) !== null && _a !== void 0 ? _a : this.identity.uuid
11854
+ uuid: viewIdentity.uuid ?? this.identity.uuid
11868
11855
  };
11869
11856
  const view = await this.fin.View.wrap(normalizedViewIdentity);
11870
11857
  const viewOptions = await view.getOptions();
@@ -12656,6 +12643,25 @@ class Layout extends base_1$6.Base {
12656
12643
  target: this.identity
12657
12644
  });
12658
12645
  }
12646
+ /**
12647
+ * Retrieves the attached views in current window layout.
12648
+ *
12649
+ * @example
12650
+ * ```js
12651
+ * const layout = fin.Platform.Layout.getCurrentSync();
12652
+ * const views = await layout.getCurrentViews();
12653
+ * ```
12654
+ */
12655
+ async getCurrentViews() {
12656
+ this.wire.sendAction('layout-get-views').catch((e) => {
12657
+ // don't expose
12658
+ });
12659
+ const client = await this.platform.getClient();
12660
+ const viewIdentities = await client.dispatch('get-layout-views', {
12661
+ target: this.identity
12662
+ });
12663
+ return viewIdentities.map((identity) => this.fin.View.wrapSync(identity));
12664
+ }
12659
12665
  /**
12660
12666
  * Retrieves the top level content item of the layout.
12661
12667
  *
@@ -13397,9 +13403,8 @@ function requireSessionContextGroupBroker () {
13397
13403
  this.lastContext = context;
13398
13404
  const clientSubscriptionStates = Array.from(this.clients.values());
13399
13405
  clientSubscriptionStates.forEach((client) => {
13400
- var _a;
13401
13406
  // eslint-disable-next-line no-unused-expressions
13402
- (_a = client.contextHandlers.get(context.type)) === null || _a === void 0 ? void 0 : _a.forEach((handlerId) => {
13407
+ client.contextHandlers.get(context.type)?.forEach((handlerId) => {
13403
13408
  this.provider.dispatch(client.clientIdentity, handlerId, context);
13404
13409
  });
13405
13410
  if (client.globalHandler) {
@@ -14006,10 +14011,10 @@ function requireInteropBroker () {
14006
14011
  this.getProvider = getProvider;
14007
14012
  this.interopClients = new Map();
14008
14013
  this.contextGroupsById = new Map();
14009
- if (options === null || options === void 0 ? void 0 : options.contextGroups) {
14014
+ if (options?.contextGroups) {
14010
14015
  contextGroups = options.contextGroups;
14011
14016
  }
14012
- if (options === null || options === void 0 ? void 0 : options.logging) {
14017
+ if (options?.logging) {
14013
14018
  this.logging = options.logging;
14014
14019
  }
14015
14020
  this.intentClientMap = new Map();
@@ -14144,18 +14149,17 @@ function requireInteropBroker () {
14144
14149
  *
14145
14150
  */
14146
14151
  getCurrentContext(getCurrentContextOptions, clientIdentity) {
14147
- var _a;
14148
14152
  this.wire.sendAction('interop-broker-get-current-context').catch((e) => {
14149
14153
  // don't expose, analytics-only call
14150
14154
  });
14151
14155
  const clientState = this.getClientState(clientIdentity);
14152
- if (!(clientState === null || clientState === void 0 ? void 0 : clientState.contextGroupId)) {
14156
+ if (!clientState?.contextGroupId) {
14153
14157
  throw new Error('You must be a member of a context group to call getCurrentContext');
14154
14158
  }
14155
14159
  const { contextGroupId } = clientState;
14156
14160
  const contextGroupState = this.contextGroupsById.get(contextGroupId);
14157
14161
  const lastContextType = this.lastContextMap.get(contextGroupId);
14158
- const contextType = (_a = getCurrentContextOptions === null || getCurrentContextOptions === void 0 ? void 0 : getCurrentContextOptions.contextType) !== null && _a !== void 0 ? _a : lastContextType;
14162
+ const contextType = getCurrentContextOptions?.contextType ?? lastContextType;
14159
14163
  return contextGroupState && contextType ? contextGroupState.get(contextType) : undefined;
14160
14164
  }
14161
14165
  /*
@@ -14806,10 +14810,9 @@ function requireInteropBroker () {
14806
14810
  }
14807
14811
  // Used to restore interop broker state in snapshots.
14808
14812
  applySnapshot(snapshot, options) {
14809
- var _a;
14810
- const contextGroupStates = (_a = snapshot === null || snapshot === void 0 ? void 0 : snapshot.interopSnapshotDetails) === null || _a === void 0 ? void 0 : _a.contextGroupStates;
14813
+ const contextGroupStates = snapshot?.interopSnapshotDetails?.contextGroupStates;
14811
14814
  if (contextGroupStates) {
14812
- if (!(options === null || options === void 0 ? void 0 : options.closeExistingWindows)) {
14815
+ if (!options?.closeExistingWindows) {
14813
14816
  this.updateExistingClients(contextGroupStates);
14814
14817
  }
14815
14818
  this.rehydrateContextGroupStates(contextGroupStates);
@@ -14860,7 +14863,7 @@ function requireInteropBroker () {
14860
14863
  contextHandlerRegistered({ contextType, handlerId }, clientIdentity) {
14861
14864
  const handlerInfo = { contextType, handlerId };
14862
14865
  const clientState = this.getClientState(clientIdentity);
14863
- clientState === null || clientState === void 0 ? void 0 : clientState.contextHandlers.set(handlerId, handlerInfo);
14866
+ clientState?.contextHandlers.set(handlerId, handlerInfo);
14864
14867
  if (clientState && clientState.contextGroupId) {
14865
14868
  const { contextGroupId } = clientState;
14866
14869
  const contextGroupMap = this.contextGroupsById.get(contextGroupId);
@@ -14882,7 +14885,7 @@ function requireInteropBroker () {
14882
14885
  async intentHandlerRegistered(payload, clientIdentity) {
14883
14886
  const { handlerId } = payload;
14884
14887
  const clientIntentInfo = this.intentClientMap.get(clientIdentity.name);
14885
- const handlerInfo = clientIntentInfo === null || clientIntentInfo === void 0 ? void 0 : clientIntentInfo.get(handlerId);
14888
+ const handlerInfo = clientIntentInfo?.get(handlerId);
14886
14889
  if (!clientIntentInfo) {
14887
14890
  this.intentClientMap.set(clientIdentity.name, new Map());
14888
14891
  const newHandlerInfoMap = this.intentClientMap.get(clientIdentity.name);
@@ -15051,8 +15054,8 @@ function requireInteropBroker () {
15051
15054
  clientIdentity
15052
15055
  };
15053
15056
  // Only allow the client to join a contextGroup that actually exists.
15054
- if ((payload === null || payload === void 0 ? void 0 : payload.currentContextGroup) && this.contextGroupsById.has(payload.currentContextGroup)) {
15055
- clientSubscriptionState.contextGroupId = payload === null || payload === void 0 ? void 0 : payload.currentContextGroup;
15057
+ if (payload?.currentContextGroup && this.contextGroupsById.has(payload.currentContextGroup)) {
15058
+ clientSubscriptionState.contextGroupId = payload?.currentContextGroup;
15056
15059
  }
15057
15060
  this.interopClients.set(clientIdentity.endpointId, clientSubscriptionState);
15058
15061
  });
@@ -15070,17 +15073,15 @@ function requireInteropBroker () {
15070
15073
  this.clientDisconnected(clientIdentity);
15071
15074
  });
15072
15075
  channel.beforeAction(async (action, payload, clientIdentity) => {
15073
- var _a, _b;
15074
15076
  if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
15075
15077
  throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
15076
15078
  }
15077
- if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.beforeAction) === null || _b === void 0 ? void 0 : _b.enabled) {
15079
+ if (this.logging?.beforeAction?.enabled) {
15078
15080
  console.log(action, payload, clientIdentity);
15079
15081
  }
15080
15082
  });
15081
15083
  channel.afterAction((action, payload, clientIdentity) => {
15082
- var _a, _b;
15083
- if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.afterAction) === null || _b === void 0 ? void 0 : _b.enabled) {
15084
+ if (this.logging?.afterAction?.enabled) {
15084
15085
  console.log(action, payload, clientIdentity);
15085
15086
  }
15086
15087
  });
@@ -15929,9 +15930,8 @@ function requireOverrideCheck () {
15929
15930
  overrideCheck.overrideCheck = overrideCheck.getDefaultViewFdc3VersionFromAppInfo = void 0;
15930
15931
  const InteropBroker_1 = requireInteropBroker();
15931
15932
  function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }) {
15932
- var _a, _b, _c, _d;
15933
- const setVersion = (_c = (_b = (_a = manifest.platform) === null || _a === void 0 ? void 0 : _a.defaultViewOptions) === null || _b === void 0 ? void 0 : _b.fdc3InteropApi) !== null && _c !== void 0 ? _c : (_d = initialOptions.defaultViewOptions) === null || _d === void 0 ? void 0 : _d.fdc3InteropApi;
15934
- return ['1.2', '2.0'].includes(setVersion !== null && setVersion !== void 0 ? setVersion : '') ? setVersion : undefined;
15933
+ const setVersion = manifest.platform?.defaultViewOptions?.fdc3InteropApi ?? initialOptions.defaultViewOptions?.fdc3InteropApi;
15934
+ return ['1.2', '2.0'].includes(setVersion ?? '') ? setVersion : undefined;
15935
15935
  }
15936
15936
  overrideCheck.getDefaultViewFdc3VersionFromAppInfo = getDefaultViewFdc3VersionFromAppInfo;
15937
15937
  // TODO: Unit test this
@@ -16004,13 +16004,12 @@ function requireFactory () {
16004
16004
  * ```
16005
16005
  */
16006
16006
  async init(name, override = defaultOverride) {
16007
- var _a;
16008
16007
  this.wire.sendAction('interop-init').catch(() => {
16009
16008
  // don't expose, analytics-only call
16010
16009
  });
16011
16010
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
16012
16011
  const options = await this.fin.Application.getCurrentSync().getInfo();
16013
- const opts = (_a = options.initialOptions.interopBrokerConfiguration) !== null && _a !== void 0 ? _a : {};
16012
+ const opts = options.initialOptions.interopBrokerConfiguration ?? {};
16014
16013
  const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
16015
16014
  const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(opts));
16016
16015
  let provider;
@@ -17253,10 +17252,15 @@ function requireNodeEnv () {
17253
17252
  /* eslint-disable class-methods-use-this */
17254
17253
  const fs_1 = require$$0$2;
17255
17254
  const crypto_1 = require$$1$1;
17256
- const WS = require$$2$1;
17255
+ const _WS = require$$2$1;
17257
17256
  const environment_1 = environment;
17258
17257
  const port_discovery_1 = requirePortDiscovery();
17259
17258
  const transport_errors_1 = transportErrors;
17259
+ // Due to https://github.com/rollup/rollup/issues/1267, we need this guard
17260
+ // to ensure the import works with and without the 'esModuleInterop' ts flag.
17261
+ // This is due to our mocha tests not being compatible with esModuleInterop,
17262
+ // whereas rollup enforces it.
17263
+ const WS = _WS.default || _WS;
17260
17264
  class NodeEnvironment {
17261
17265
  constructor() {
17262
17266
  this.messageCounter = 0;
@@ -17764,11 +17768,10 @@ function requireMain () {
17764
17768
  const environment = new node_env_1.default();
17765
17769
  // Connect to an OpenFin Runtime
17766
17770
  async function connect(config) {
17767
- var _a;
17768
17771
  const normalized = await (0, normalize_config_1.validateConfig)(config);
17769
17772
  const wire = new transport_1.Transport(websocket_1.default, environment, {
17770
17773
  ...normalized,
17771
- name: (_a = normalized.name) !== null && _a !== void 0 ? _a : normalized.uuid
17774
+ name: normalized.name ?? normalized.uuid
17772
17775
  });
17773
17776
  await wire.connect(normalized);
17774
17777
  return new fin_1.Fin(wire);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "34.78.19",
3
+ "version": "34.78.21",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",