@openfin/remote-adapter 44.100.61 → 44.100.105

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 (2) hide show
  1. package/out/remote-adapter.js +375 -191
  2. package/package.json +5 -5
@@ -20,13 +20,13 @@ var InteropBroker$1 = {};
20
20
 
21
21
  var base = {};
22
22
 
23
- var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
23
+ var __classPrivateFieldSet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
24
24
  if (kind === "m") throw new TypeError("Private method is not writable");
25
25
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
26
26
  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");
27
27
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
28
28
  };
29
- var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
29
+ var __classPrivateFieldGet$j = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
30
30
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
31
31
  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");
32
32
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -110,9 +110,9 @@ class EmitterBase extends Base {
110
110
  this.emit = (eventType, payload, ...args) => {
111
111
  return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
112
112
  };
113
- this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
113
+ this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
114
114
  this.getOrCreateEmitter = () => {
115
- return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
115
+ return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
116
116
  };
117
117
  this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
118
118
  this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
@@ -150,8 +150,8 @@ class EmitterBase extends Base {
150
150
  // This will only be reached if unsubscribe from event that does not exist but do not want to error here
151
151
  return Promise.resolve();
152
152
  };
153
- __classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
154
- __classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
153
+ __classPrivateFieldSet$i(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
154
+ __classPrivateFieldSet$i(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
155
155
  }
156
156
  /**
157
157
  * Adds a listener to the end of the listeners array for the specified event.
@@ -179,7 +179,7 @@ class EmitterBase extends Base {
179
179
  */
180
180
  async once(eventType, listener, options) {
181
181
  const deregister = () => this.deregisterEventListener(eventType);
182
- __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
182
+ __classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
183
183
  await this.registerEventListener(eventType, options, (emitter) => {
184
184
  emitter.once(eventType, deregister);
185
185
  emitter.once(eventType, listener);
@@ -210,7 +210,7 @@ class EmitterBase extends Base {
210
210
  */
211
211
  async prependOnceListener(eventType, listener, options) {
212
212
  const deregister = () => this.deregisterEventListener(eventType);
213
- __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
213
+ __classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
214
214
  await this.registerEventListener(eventType, options, (emitter) => {
215
215
  emitter.prependOnceListener(eventType, listener);
216
216
  emitter.once(eventType, deregister);
@@ -229,7 +229,7 @@ class EmitterBase extends Base {
229
229
  const emitter = await this.deregisterEventListener(eventType, options);
230
230
  if (emitter) {
231
231
  emitter.removeListener(eventType, listener);
232
- const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
232
+ const deregister = __classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
233
233
  if (deregister) {
234
234
  emitter.removeListener(eventType, deregister);
235
235
  }
@@ -275,7 +275,7 @@ class EmitterBase extends Base {
275
275
  deleteEmitterIfNothingRegistered(emitter) {
276
276
  // TODO: maybe emitterMap should clean up itself..
277
277
  if (emitter.eventNames().length === 0) {
278
- this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
278
+ this.wire.eventAggregator.delete(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
279
279
  }
280
280
  }
281
281
  }
@@ -808,13 +808,13 @@ class AsyncRetryableLazy {
808
808
  }
809
809
  lazy.AsyncRetryableLazy = AsyncRetryableLazy;
810
810
 
811
- var __classPrivateFieldSet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
811
+ var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
812
812
  if (kind === "m") throw new TypeError("Private method is not writable");
813
813
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
814
814
  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");
815
815
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
816
816
  };
817
- var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
817
+ var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
818
818
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
819
819
  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");
820
820
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1005,12 +1005,12 @@ class InteropBroker extends base_1$n.Base {
1005
1005
  _InteropBroker_contextGroups.set(this, void 0);
1006
1006
  _InteropBroker_providerPromise.set(this, void 0);
1007
1007
  this.getProvider = () => {
1008
- return __classPrivateFieldGet$h(this, _InteropBroker_providerPromise, "f").getValue();
1008
+ return __classPrivateFieldGet$i(this, _InteropBroker_providerPromise, "f").getValue();
1009
1009
  };
1010
1010
  this.interopClients = new Map();
1011
1011
  this.contextGroupsById = new Map();
1012
- __classPrivateFieldSet$g(this, _InteropBroker_contextGroups, options.contextGroups ?? [...defaultContextGroups], "f");
1013
- __classPrivateFieldSet$g(this, _InteropBroker_fdc3Info, options.fdc3Info, "f");
1012
+ __classPrivateFieldSet$h(this, _InteropBroker_contextGroups, options.contextGroups ?? [...defaultContextGroups], "f");
1013
+ __classPrivateFieldSet$h(this, _InteropBroker_fdc3Info, options.fdc3Info, "f");
1014
1014
  if (options?.logging) {
1015
1015
  this.logging = options.logging;
1016
1016
  }
@@ -1018,7 +1018,7 @@ class InteropBroker extends base_1$n.Base {
1018
1018
  this.lastContextMap = new Map();
1019
1019
  this.sessionContextGroupMap = new Map();
1020
1020
  this.privateChannelProviderMap = new Map();
1021
- __classPrivateFieldSet$g(this, _InteropBroker_providerPromise, new lazy_1$3.Lazy(createProvider), "f");
1021
+ __classPrivateFieldSet$h(this, _InteropBroker_providerPromise, new lazy_1$3.Lazy(createProvider), "f");
1022
1022
  this.setContextGroupMap();
1023
1023
  this.setupChannelProvider();
1024
1024
  }
@@ -1190,8 +1190,8 @@ class InteropBroker extends base_1$n.Base {
1190
1190
  if (!this.getContextGroups().find((contextGroupInfo) => contextGroupInfo.id === contextGroupId)) {
1191
1191
  throw new Error(`Attempting to join a context group that does not exist: ${contextGroupId}. You may only join existing context groups.`);
1192
1192
  }
1193
- const oldContextGroupId = clientSubscriptionState.contextGroupId;
1194
- if (oldContextGroupId !== contextGroupId) {
1193
+ const previousContextGroupId = clientSubscriptionState.contextGroupId;
1194
+ if (previousContextGroupId !== contextGroupId) {
1195
1195
  clientSubscriptionState.contextGroupId = contextGroupId;
1196
1196
  await this.setCurrentContextGroupInClientOptions(clientIdentity, contextGroupId);
1197
1197
  const contextGroupMap = this.contextGroupsById.get(contextGroupId);
@@ -1210,6 +1210,13 @@ class InteropBroker extends base_1$n.Base {
1210
1210
  }
1211
1211
  }
1212
1212
  }
1213
+ // All settled will suppress uncaught exceptions. We don't want to await this because it could
1214
+ // result in the operation hanging.
1215
+ Promise.allSettled(this.channel.publish('client-changed-context-group', {
1216
+ identity: clientIdentity,
1217
+ contextGroupId,
1218
+ previousContextGroupId: previousContextGroupId || null
1219
+ }));
1213
1220
  }
1214
1221
  }
1215
1222
  // Removes the target from its context group. Similar structure to joinContextGroup.
@@ -1269,10 +1276,18 @@ class InteropBroker extends base_1$n.Base {
1269
1276
  // don't expose, analytics-only call
1270
1277
  });
1271
1278
  const clientState = this.getClientState(clientIdentity);
1279
+ const previousContextGroupId = clientState?.contextGroupId;
1272
1280
  if (clientState) {
1273
1281
  clientState.contextGroupId = undefined;
1274
1282
  }
1275
1283
  await this.setCurrentContextGroupInClientOptions(clientIdentity, null);
1284
+ // All settled will suppress uncaught exceptions. We don't want to await this because it could
1285
+ // result in the operation hanging.
1286
+ Promise.allSettled(this.channel.publish('client-changed-context-group', {
1287
+ identity: clientIdentity,
1288
+ contextGroupId: null,
1289
+ previousContextGroupId: previousContextGroupId || null
1290
+ }));
1276
1291
  }
1277
1292
  // Used by platform windows to know what client groups the provider has declared. Also used internally to access context groups. Overrideable so that the platform developer can modify it.
1278
1293
  /**
@@ -1286,7 +1301,7 @@ class InteropBroker extends base_1$n.Base {
1286
1301
  // don't expose, analytics-only call
1287
1302
  });
1288
1303
  // Create copy for immutability
1289
- return __classPrivateFieldGet$h(this, _InteropBroker_contextGroups, "f").map((contextGroup) => {
1304
+ return __classPrivateFieldGet$i(this, _InteropBroker_contextGroups, "f").map((contextGroup) => {
1290
1305
  return { ...contextGroup };
1291
1306
  });
1292
1307
  }
@@ -1697,7 +1712,7 @@ class InteropBroker extends base_1$n.Base {
1697
1712
  const { fdc3Version } = payload;
1698
1713
  return {
1699
1714
  fdc3Version,
1700
- ...__classPrivateFieldGet$h(this, _InteropBroker_fdc3Info, "f"),
1715
+ ...__classPrivateFieldGet$i(this, _InteropBroker_fdc3Info, "f"),
1701
1716
  optionalFeatures: {
1702
1717
  OriginatingAppMetadata: false,
1703
1718
  UserChannelMembershipAPIs: true
@@ -7608,13 +7623,13 @@ function errorToPOJO(error) {
7608
7623
  }
7609
7624
  errors.errorToPOJO = errorToPOJO;
7610
7625
 
7611
- var __classPrivateFieldSet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7626
+ var __classPrivateFieldSet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7612
7627
  if (kind === "m") throw new TypeError("Private method is not writable");
7613
7628
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
7614
7629
  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");
7615
7630
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7616
7631
  };
7617
- var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7632
+ var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7618
7633
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7619
7634
  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");
7620
7635
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -7642,19 +7657,19 @@ class Transport extends events_1$5.EventEmitter {
7642
7657
  // Typing as unknown to avoid circular dependency, should not be used directly.
7643
7658
  _Transport_fin.set(this, void 0);
7644
7659
  this.connectSync = () => {
7645
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7660
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7646
7661
  wire.connectSync();
7647
7662
  };
7648
7663
  // This function is only used in our tests.
7649
7664
  this.getPort = () => {
7650
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7665
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7651
7666
  return wire.getPort();
7652
7667
  };
7653
- __classPrivateFieldSet$f(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
7668
+ __classPrivateFieldSet$g(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
7654
7669
  this.environment = environment;
7655
- this.sendRaw = __classPrivateFieldGet$g(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$g(this, _Transport_wire, "f"));
7670
+ this.sendRaw = __classPrivateFieldGet$h(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$h(this, _Transport_wire, "f"));
7656
7671
  this.registerMessageHandler(this.handleMessage.bind(this));
7657
- __classPrivateFieldGet$g(this, _Transport_wire, "f").on('disconnected', () => {
7672
+ __classPrivateFieldGet$h(this, _Transport_wire, "f").on('disconnected', () => {
7658
7673
  for (const [, { handleNack }] of this.wireListeners) {
7659
7674
  handleNack({ reason: 'Remote connection has closed' });
7660
7675
  }
@@ -7666,24 +7681,24 @@ class Transport extends events_1$5.EventEmitter {
7666
7681
  this.me = (0, me_1$1.getBaseMe)(entityType, uuid, name);
7667
7682
  }
7668
7683
  getFin() {
7669
- if (!__classPrivateFieldGet$g(this, _Transport_fin, "f")) {
7684
+ if (!__classPrivateFieldGet$h(this, _Transport_fin, "f")) {
7670
7685
  throw new Error('No Fin object registered for this transport');
7671
7686
  }
7672
- return __classPrivateFieldGet$g(this, _Transport_fin, "f");
7687
+ return __classPrivateFieldGet$h(this, _Transport_fin, "f");
7673
7688
  }
7674
7689
  registerFin(_fin) {
7675
- if (__classPrivateFieldGet$g(this, _Transport_fin, "f")) {
7690
+ if (__classPrivateFieldGet$h(this, _Transport_fin, "f")) {
7676
7691
  throw new Error('Fin object has already been registered for this transport');
7677
7692
  }
7678
- __classPrivateFieldSet$f(this, _Transport_fin, _fin, "f");
7693
+ __classPrivateFieldSet$g(this, _Transport_fin, _fin, "f");
7679
7694
  }
7680
7695
  shutdown() {
7681
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7696
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7682
7697
  return wire.shutdown();
7683
7698
  }
7684
7699
  async connect(config) {
7685
7700
  if ((0, wire_1.isConfigWithReceiver)(config)) {
7686
- await __classPrivateFieldGet$g(this, _Transport_wire, "f").connect(config.receiver);
7701
+ await __classPrivateFieldGet$h(this, _Transport_wire, "f").connect(config.receiver);
7687
7702
  return this.authorize(config);
7688
7703
  }
7689
7704
  if ((0, wire_1.isRemoteConfig)(config)) {
@@ -7699,13 +7714,13 @@ class Transport extends events_1$5.EventEmitter {
7699
7714
  return undefined;
7700
7715
  }
7701
7716
  async connectRemote(config) {
7702
- await __classPrivateFieldGet$g(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
7717
+ await __classPrivateFieldGet$h(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
7703
7718
  return this.authorize(config);
7704
7719
  }
7705
7720
  async connectByPort(config) {
7706
7721
  const { address, uuid } = config;
7707
7722
  const reqAuthPayload = { ...config, type: 'file-token' };
7708
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7723
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7709
7724
  await wire.connect(new (this.environment.getWsConstructor())(config.address));
7710
7725
  const requestExtAuthRet = await this.sendAction('request-external-authorization', {
7711
7726
  uuid,
@@ -7741,7 +7756,7 @@ class Transport extends events_1$5.EventEmitter {
7741
7756
  payload,
7742
7757
  messageId
7743
7758
  };
7744
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7759
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7745
7760
  this.addWireListener(messageId, resolve, (payload) => this.nackHandler(payload, reject, callSites), uncorrelated);
7746
7761
  return wire.send(msg).catch(reject);
7747
7762
  });
@@ -7763,7 +7778,7 @@ class Transport extends events_1$5.EventEmitter {
7763
7778
  const resolver = (data) => {
7764
7779
  resolve(data.payload);
7765
7780
  };
7766
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7781
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7767
7782
  return wire
7768
7783
  .send(origData)
7769
7784
  .then(() => this.addWireListener(id, resolver, (payload) => this.nackHandler(payload, reject), false))
@@ -8281,6 +8296,11 @@ class System extends base_1$h.EmitterBase {
8281
8296
  /**
8282
8297
  * Returns a unique identifier (UUID) provided by the machine.
8283
8298
  *
8299
+ * On Windows, the machine ID is the `MachineGuid` value located in the Windows Registry at:
8300
+ * `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography`.
8301
+ *
8302
+ * On macOS, the machine ID is the hardware UUID of the machine, obtained via native OS APIs.
8303
+ *
8284
8304
  * @example
8285
8305
  * ```js
8286
8306
  * fin.System.getMachineId().then(id => console.log(id)).catch(err => console.log(err));
@@ -10369,12 +10389,12 @@ class ChannelError extends Error {
10369
10389
  }
10370
10390
  channelError.ChannelError = ChannelError;
10371
10391
 
10372
- var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10392
+ var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10373
10393
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10374
10394
  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");
10375
10395
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10376
10396
  };
10377
- var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10397
+ var __classPrivateFieldSet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10378
10398
  if (kind === "m") throw new TypeError("Private method is not writable");
10379
10399
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10380
10400
  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");
@@ -10418,7 +10438,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
10418
10438
  static closeChannelByEndpointId(id) {
10419
10439
  const channel = channelClientsByEndpointId.get(id);
10420
10440
  if (channel) {
10421
- __classPrivateFieldGet$f(channel, _ChannelClient_close, "f").call(channel);
10441
+ __classPrivateFieldGet$g(channel, _ChannelClient_close, "f").call(channel);
10422
10442
  }
10423
10443
  }
10424
10444
  /**
@@ -10429,7 +10449,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
10429
10449
  for (const channelClient of channelClientsByEndpointId.values()) {
10430
10450
  if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
10431
10451
  channelClient.disconnectListener(eventPayload);
10432
- __classPrivateFieldGet$f(channelClient, _ChannelClient_close, "f").call(channelClient);
10452
+ __classPrivateFieldGet$g(channelClient, _ChannelClient_close, "f").call(channelClient);
10433
10453
  }
10434
10454
  }
10435
10455
  }
@@ -10444,12 +10464,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
10444
10464
  this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
10445
10465
  _ChannelClient_close.set(this, () => {
10446
10466
  channelClientsByEndpointId.delete(this.endpointId);
10447
- __classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").close();
10467
+ __classPrivateFieldGet$g(this, _ChannelClient_strategy, "f").close();
10448
10468
  });
10449
- __classPrivateFieldSet$e(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
10469
+ __classPrivateFieldSet$f(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
10450
10470
  this.disconnectListener = () => undefined;
10451
10471
  this.endpointId = routingInfo.endpointId;
10452
- __classPrivateFieldSet$e(this, _ChannelClient_strategy, strategy, "f");
10472
+ __classPrivateFieldSet$f(this, _ChannelClient_strategy, strategy, "f");
10453
10473
  channelClientsByEndpointId.set(this.endpointId, this);
10454
10474
  strategy.receive(this.processAction);
10455
10475
  }
@@ -10457,7 +10477,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
10457
10477
  * a read-only provider identity
10458
10478
  */
10459
10479
  get providerIdentity() {
10460
- const protectedObj = __classPrivateFieldGet$f(this, _ChannelClient_protectedObj, "f");
10480
+ const protectedObj = __classPrivateFieldGet$g(this, _ChannelClient_protectedObj, "f");
10461
10481
  return protectedObj.providerIdentity;
10462
10482
  }
10463
10483
  /**
@@ -10486,9 +10506,9 @@ class ChannelClient extends channel_1$1.ChannelBase {
10486
10506
  * ```
10487
10507
  */
10488
10508
  async dispatch(action, payload) {
10489
- if (__classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
10509
+ if (__classPrivateFieldGet$g(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
10490
10510
  const callSites = transport_errors_1$1.RuntimeError.getCallSite();
10491
- return __classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
10511
+ return __classPrivateFieldGet$g(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
10492
10512
  throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
10493
10513
  });
10494
10514
  }
@@ -10540,10 +10560,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
10540
10560
  */
10541
10561
  async disconnect() {
10542
10562
  await this.sendDisconnectAction();
10543
- __classPrivateFieldGet$f(this, _ChannelClient_close, "f").call(this);
10563
+ __classPrivateFieldGet$g(this, _ChannelClient_close, "f").call(this);
10544
10564
  }
10545
10565
  async sendDisconnectAction() {
10546
- const protectedObj = __classPrivateFieldGet$f(this, _ChannelClient_protectedObj, "f");
10566
+ const protectedObj = __classPrivateFieldGet$g(this, _ChannelClient_protectedObj, "f");
10547
10567
  await protectedObj.close();
10548
10568
  }
10549
10569
  /**
@@ -10576,13 +10596,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
10576
10596
 
10577
10597
  var strategy$3 = {};
10578
10598
 
10579
- var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10599
+ var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10580
10600
  if (kind === "m") throw new TypeError("Private method is not writable");
10581
10601
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10582
10602
  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");
10583
10603
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10584
10604
  };
10585
- var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10605
+ var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10586
10606
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10587
10607
  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");
10588
10608
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -10607,7 +10627,7 @@ class ClassicStrategy {
10607
10627
  // connection problems occur
10608
10628
  _ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
10609
10629
  this.send = async (endpointId, action, payload) => {
10610
- const to = __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
10630
+ const to = __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
10611
10631
  if (!to) {
10612
10632
  throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
10613
10633
  }
@@ -10619,13 +10639,13 @@ class ClassicStrategy {
10619
10639
  }
10620
10640
  delete cleanId.isLocalEndpointId;
10621
10641
  // grab the promise before awaiting it to save in our pending messages map
10622
- const p = __classPrivateFieldGet$e(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
10642
+ const p = __classPrivateFieldGet$f(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
10623
10643
  ...cleanId,
10624
10644
  providerIdentity: this.providerIdentity,
10625
10645
  action,
10626
10646
  payload
10627
10647
  });
10628
- __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
10648
+ __classPrivateFieldGet$f(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
10629
10649
  const raw = await p
10630
10650
  .catch((error) => {
10631
10651
  if ('cause' in error) {
@@ -10635,16 +10655,16 @@ class ClassicStrategy {
10635
10655
  })
10636
10656
  .finally(() => {
10637
10657
  // clean up the pending promise
10638
- __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
10658
+ __classPrivateFieldGet$f(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
10639
10659
  });
10640
10660
  return raw.payload.data.result;
10641
10661
  };
10642
10662
  this.close = async () => {
10643
10663
  this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
10644
- [...__classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
10645
- __classPrivateFieldSet$d(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
10664
+ [...__classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
10665
+ __classPrivateFieldSet$e(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
10646
10666
  };
10647
- __classPrivateFieldSet$d(this, _ClassicStrategy_wire, wire, "f");
10667
+ __classPrivateFieldSet$e(this, _ClassicStrategy_wire, wire, "f");
10648
10668
  }
10649
10669
  onEndpointDisconnect(endpointId, listener) {
10650
10670
  // Never fires for 'classic'.
@@ -10653,20 +10673,20 @@ class ClassicStrategy {
10653
10673
  this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
10654
10674
  }
10655
10675
  async closeEndpoint(endpointId) {
10656
- const id = __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
10657
- __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
10658
- const pendingSet = __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
10676
+ const id = __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
10677
+ __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
10678
+ const pendingSet = __classPrivateFieldGet$f(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
10659
10679
  pendingSet?.forEach((p) => {
10660
10680
  const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
10661
10681
  p.cancel(new Error(errorMsg));
10662
10682
  });
10663
10683
  }
10664
10684
  isEndpointConnected(endpointId) {
10665
- return __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
10685
+ return __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
10666
10686
  }
10667
10687
  addEndpoint(endpointId, payload) {
10668
- __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
10669
- __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
10688
+ __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
10689
+ __classPrivateFieldGet$f(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
10670
10690
  }
10671
10691
  isValidEndpointPayload(payload) {
10672
10692
  return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
@@ -10682,12 +10702,12 @@ var strategy$2 = {};
10682
10702
 
10683
10703
  var endpoint = {};
10684
10704
 
10685
- var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10705
+ var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10686
10706
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10687
10707
  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");
10688
10708
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10689
10709
  };
10690
- var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10710
+ var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10691
10711
  if (kind === "m") throw new TypeError("Private method is not writable");
10692
10712
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10693
10713
  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");
@@ -10722,8 +10742,8 @@ class RTCEndpoint {
10722
10742
  if (this.rtc.rtcClient.connectionState !== 'connected') {
10723
10743
  this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
10724
10744
  this.close();
10725
- if (__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
10726
- __classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f").call(this);
10745
+ if (__classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f")) {
10746
+ __classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f").call(this);
10727
10747
  }
10728
10748
  }
10729
10749
  };
@@ -10771,9 +10791,9 @@ class RTCEndpoint {
10771
10791
  data = new TextDecoder().decode(e.data);
10772
10792
  }
10773
10793
  const { messageId, action, payload } = JSON.parse(data);
10774
- if (__classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f")) {
10794
+ if (__classPrivateFieldGet$e(this, _RTCEndpoint_processAction, "f")) {
10775
10795
  try {
10776
- const res = await __classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
10796
+ const res = await __classPrivateFieldGet$e(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
10777
10797
  this.rtc.channels.response.send(JSON.stringify({
10778
10798
  messageId,
10779
10799
  payload: res,
@@ -10807,25 +10827,25 @@ class RTCEndpoint {
10807
10827
  datachannel.onclose = (e) => {
10808
10828
  [...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.')));
10809
10829
  this.close();
10810
- if (__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
10811
- __classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f").call(this);
10830
+ if (__classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f")) {
10831
+ __classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f").call(this);
10812
10832
  }
10813
10833
  };
10814
10834
  });
10815
10835
  }
10816
10836
  onDisconnect(listener) {
10817
- if (!__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
10818
- __classPrivateFieldSet$c(this, _RTCEndpoint_disconnectListener, listener, "f");
10837
+ if (!__classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f")) {
10838
+ __classPrivateFieldSet$d(this, _RTCEndpoint_disconnectListener, listener, "f");
10819
10839
  }
10820
10840
  else {
10821
10841
  throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
10822
10842
  }
10823
10843
  }
10824
10844
  receive(listener) {
10825
- if (__classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f")) {
10845
+ if (__classPrivateFieldGet$e(this, _RTCEndpoint_processAction, "f")) {
10826
10846
  throw new Error('You have already set a listener for this RTC Endpoint.');
10827
10847
  }
10828
- __classPrivateFieldSet$c(this, _RTCEndpoint_processAction, listener, "f");
10848
+ __classPrivateFieldSet$d(this, _RTCEndpoint_processAction, listener, "f");
10829
10849
  }
10830
10850
  get connected() {
10831
10851
  return this.rtc.rtcClient.connectionState === 'connected';
@@ -10836,12 +10856,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
10836
10856
 
10837
10857
  var strategy$1 = {};
10838
10858
 
10839
- var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10859
+ var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10840
10860
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10841
10861
  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");
10842
10862
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10843
10863
  };
10844
- var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10864
+ var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10845
10865
  if (kind === "m") throw new TypeError("Private method is not writable");
10846
10866
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10847
10867
  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");
@@ -10862,11 +10882,11 @@ class EndpointStrategy {
10862
10882
  return this.getEndpointById(endpointId).send(action, payload);
10863
10883
  };
10864
10884
  this.close = async () => {
10865
- if (__classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f")) {
10866
- __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
10867
- __classPrivateFieldSet$b(this, _EndpointStrategy_endpointMap, new Map(), "f");
10885
+ if (__classPrivateFieldGet$d(this, _EndpointStrategy_connected, "f")) {
10886
+ __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
10887
+ __classPrivateFieldSet$c(this, _EndpointStrategy_endpointMap, new Map(), "f");
10868
10888
  }
10869
- __classPrivateFieldSet$b(this, _EndpointStrategy_connected, false, "f");
10889
+ __classPrivateFieldSet$c(this, _EndpointStrategy_connected, false, "f");
10870
10890
  };
10871
10891
  this.isValidEndpointPayload = validateEndpoint;
10872
10892
  }
@@ -10874,39 +10894,39 @@ class EndpointStrategy {
10874
10894
  this.getEndpointById(endpointId).onDisconnect(listener);
10875
10895
  }
10876
10896
  receive(listener) {
10877
- if (__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")) {
10897
+ if (__classPrivateFieldGet$d(this, _EndpointStrategy_processAction, "f")) {
10878
10898
  throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
10879
10899
  }
10880
- __classPrivateFieldSet$b(this, _EndpointStrategy_processAction, listener, "f");
10900
+ __classPrivateFieldSet$c(this, _EndpointStrategy_processAction, listener, "f");
10881
10901
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10882
- __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")));
10902
+ __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$d(this, _EndpointStrategy_processAction, "f")));
10883
10903
  }
10884
10904
  getEndpointById(endpointId) {
10885
- const endpoint = __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
10905
+ const endpoint = __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
10886
10906
  if (!endpoint) {
10887
10907
  throw new Error(`Client with endpoint id ${endpointId} is not connected`);
10888
10908
  }
10889
10909
  return endpoint;
10890
10910
  }
10891
10911
  get connected() {
10892
- return __classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f");
10912
+ return __classPrivateFieldGet$d(this, _EndpointStrategy_connected, "f");
10893
10913
  }
10894
10914
  isEndpointConnected(endpointId) {
10895
- return __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
10915
+ return __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
10896
10916
  }
10897
10917
  addEndpoint(endpointId, payload) {
10898
- if (!__classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f")) {
10918
+ if (!__classPrivateFieldGet$d(this, _EndpointStrategy_connected, "f")) {
10899
10919
  console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
10900
10920
  return;
10901
10921
  }
10902
10922
  const clientStrat = new this.EndpointType(payload);
10903
- if (__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")) {
10904
- clientStrat.receive(__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f"));
10923
+ if (__classPrivateFieldGet$d(this, _EndpointStrategy_processAction, "f")) {
10924
+ clientStrat.receive(__classPrivateFieldGet$d(this, _EndpointStrategy_processAction, "f"));
10905
10925
  }
10906
- __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
10926
+ __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
10907
10927
  }
10908
10928
  async closeEndpoint(endpointId) {
10909
- __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
10929
+ __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
10910
10930
  }
10911
10931
  }
10912
10932
  strategy$1.EndpointStrategy = EndpointStrategy;
@@ -11088,12 +11108,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
11088
11108
  }
11089
11109
  runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
11090
11110
 
11091
- var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11111
+ var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11092
11112
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
11093
11113
  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");
11094
11114
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11095
11115
  };
11096
- var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11116
+ var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11097
11117
  if (kind === "m") throw new TypeError("Private method is not writable");
11098
11118
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11099
11119
  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");
@@ -11137,19 +11157,19 @@ class ChannelProvider extends channel_1.ChannelBase {
11137
11157
  * a read-only array containing all the identities of connecting clients.
11138
11158
  */
11139
11159
  get connections() {
11140
- return [...__classPrivateFieldGet$b(this, _ChannelProvider_connections, "f")];
11160
+ return [...__classPrivateFieldGet$c(this, _ChannelProvider_connections, "f")];
11141
11161
  }
11142
11162
  static handleClientDisconnection(channel, payload) {
11143
11163
  if (payload?.endpointId) {
11144
11164
  const { uuid, name, endpointId, isLocalEndpointId } = payload;
11145
- __classPrivateFieldGet$b(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
11165
+ __classPrivateFieldGet$c(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
11146
11166
  }
11147
11167
  else {
11148
11168
  // this is here to support older runtimes that did not have endpointId
11149
11169
  const multipleRemoves = channel.connections.filter((identity) => {
11150
11170
  return identity.uuid === payload.uuid && identity.name === payload.name;
11151
11171
  });
11152
- multipleRemoves.forEach(__classPrivateFieldGet$b(channel, _ChannelProvider_removeEndpoint, "f"));
11172
+ multipleRemoves.forEach(__classPrivateFieldGet$c(channel, _ChannelProvider_removeEndpoint, "f"));
11153
11173
  }
11154
11174
  channel.disconnectListener(payload);
11155
11175
  }
@@ -11166,8 +11186,8 @@ class ChannelProvider extends channel_1.ChannelBase {
11166
11186
  _ChannelProvider_strategy.set(this, void 0);
11167
11187
  _ChannelProvider_removeEndpoint.set(this, (identity) => {
11168
11188
  const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
11169
- __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
11170
- __classPrivateFieldSet$a(this, _ChannelProvider_connections, remainingConnections, "f");
11189
+ __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
11190
+ __classPrivateFieldSet$b(this, _ChannelProvider_connections, remainingConnections, "f");
11171
11191
  });
11172
11192
  // Must be bound.
11173
11193
  this.processAction = async (action, payload, senderIdentity) => {
@@ -11181,17 +11201,17 @@ class ChannelProvider extends channel_1.ChannelBase {
11181
11201
  return super.processAction(action, payload, senderIdentity);
11182
11202
  };
11183
11203
  _ChannelProvider_close.set(this, () => {
11184
- __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").close();
11204
+ __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").close();
11185
11205
  const remove = ChannelProvider.removalMap.get(this);
11186
11206
  if (remove) {
11187
11207
  remove();
11188
11208
  }
11189
11209
  });
11190
- __classPrivateFieldSet$a(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
11210
+ __classPrivateFieldSet$b(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
11191
11211
  this.connectListener = () => undefined;
11192
11212
  this.disconnectListener = () => undefined;
11193
- __classPrivateFieldSet$a(this, _ChannelProvider_connections, [], "f");
11194
- __classPrivateFieldSet$a(this, _ChannelProvider_strategy, strategy, "f");
11213
+ __classPrivateFieldSet$b(this, _ChannelProvider_connections, [], "f");
11214
+ __classPrivateFieldSet$b(this, _ChannelProvider_strategy, strategy, "f");
11195
11215
  strategy.receive(this.processAction);
11196
11216
  }
11197
11217
  /**
@@ -11222,16 +11242,16 @@ class ChannelProvider extends channel_1.ChannelBase {
11222
11242
  */
11223
11243
  dispatch(to, action, payload) {
11224
11244
  const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
11225
- if (endpointId && __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
11245
+ if (endpointId && __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
11226
11246
  const callSites = transport_errors_1.RuntimeError.getCallSite();
11227
- return __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
11247
+ return __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
11228
11248
  throw new channel_error_1.ChannelError(e, action, payload, callSites);
11229
11249
  });
11230
11250
  }
11231
11251
  return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
11232
11252
  }
11233
11253
  async processConnection(senderId, payload) {
11234
- __classPrivateFieldGet$b(this, _ChannelProvider_connections, "f").push(senderId);
11254
+ __classPrivateFieldGet$c(this, _ChannelProvider_connections, "f").push(senderId);
11235
11255
  return this.connectListener(senderId, payload);
11236
11256
  }
11237
11257
  /**
@@ -11254,7 +11274,7 @@ class ChannelProvider extends channel_1.ChannelBase {
11254
11274
  * ```
11255
11275
  */
11256
11276
  publish(action, payload) {
11257
- return this.connections.map((to) => __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
11277
+ return this.connections.map((to) => __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
11258
11278
  }
11259
11279
  /**
11260
11280
  * Register a listener that is called on every new client connection.
@@ -11328,11 +11348,11 @@ class ChannelProvider extends channel_1.ChannelBase {
11328
11348
  * ```
11329
11349
  */
11330
11350
  async destroy() {
11331
- const protectedObj = __classPrivateFieldGet$b(this, _ChannelProvider_protectedObj, "f");
11351
+ const protectedObj = __classPrivateFieldGet$c(this, _ChannelProvider_protectedObj, "f");
11332
11352
  protectedObj.providerIdentity;
11333
- __classPrivateFieldSet$a(this, _ChannelProvider_connections, [], "f");
11353
+ __classPrivateFieldSet$b(this, _ChannelProvider_connections, [], "f");
11334
11354
  await protectedObj.close();
11335
- __classPrivateFieldGet$b(this, _ChannelProvider_close, "f").call(this);
11355
+ __classPrivateFieldGet$c(this, _ChannelProvider_close, "f").call(this);
11336
11356
  }
11337
11357
  /**
11338
11358
  * Returns an array with info on every Client connected to the Provider
@@ -11402,7 +11422,7 @@ class ChannelProvider extends channel_1.ChannelBase {
11402
11422
  getEndpointIdForOpenFinId(clientIdentity, action) {
11403
11423
  const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
11404
11424
  if (matchingConnections.length >= 2) {
11405
- const protectedObj = __classPrivateFieldGet$b(this, _ChannelProvider_protectedObj, "f");
11425
+ const protectedObj = __classPrivateFieldGet$c(this, _ChannelProvider_protectedObj, "f");
11406
11426
  const { uuid, name } = clientIdentity;
11407
11427
  const providerUuid = protectedObj?.providerIdentity.uuid;
11408
11428
  const providerName = protectedObj?.providerIdentity.name;
@@ -11614,13 +11634,13 @@ class CombinedStrategy {
11614
11634
  }
11615
11635
  strategy.default = CombinedStrategy;
11616
11636
 
11617
- var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11637
+ var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11618
11638
  if (kind === "m") throw new TypeError("Private method is not writable");
11619
11639
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11620
11640
  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");
11621
11641
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11622
11642
  };
11623
- var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11643
+ var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11624
11644
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
11625
11645
  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");
11626
11646
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -11669,8 +11689,8 @@ class ConnectionManager extends base_1$e.Base {
11669
11689
  };
11670
11690
  this.providerMap = new Map();
11671
11691
  this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
11672
- __classPrivateFieldSet$9(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
11673
- __classPrivateFieldSet$9(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
11692
+ __classPrivateFieldSet$a(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
11693
+ __classPrivateFieldSet$a(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
11674
11694
  wire.registerMessageHandler(this.onmessage.bind(this));
11675
11695
  }
11676
11696
  createProvider(options, providerIdentity) {
@@ -11681,7 +11701,7 @@ class ConnectionManager extends base_1$e.Base {
11681
11701
  case 'rtc':
11682
11702
  return new strategy_2.RTCStrategy();
11683
11703
  case 'classic':
11684
- return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f"),
11704
+ return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$b(this, _ConnectionManager_messageReceiver, "f"),
11685
11705
  // Providers do not have an endpointId, use channelId as endpointId in the strategy.
11686
11706
  providerIdentity.channelId, providerIdentity);
11687
11707
  default:
@@ -11717,7 +11737,7 @@ class ConnectionManager extends base_1$e.Base {
11717
11737
  const supportedProtocols = await Promise.all(protocols.map(async (type) => {
11718
11738
  switch (type) {
11719
11739
  case 'rtc': {
11720
- const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
11740
+ const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$b(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
11721
11741
  rtcPacket = { rtcClient, channels, channelsOpened };
11722
11742
  return {
11723
11743
  type: 'rtc',
@@ -11744,18 +11764,18 @@ class ConnectionManager extends base_1$e.Base {
11744
11764
  routingInfo.endpointId = this.wire.environment.getNextMessageId();
11745
11765
  // For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
11746
11766
  // clients that are in the same context as the newly-connected client.
11747
- __classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
11767
+ __classPrivateFieldGet$b(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
11748
11768
  }
11749
11769
  const answer = routingInfo.answer ?? {
11750
11770
  supportedProtocols: [{ type: 'classic', version: 1 }]
11751
11771
  };
11752
11772
  const createStrategyFromAnswer = async (protocol) => {
11753
11773
  if (protocol.type === 'rtc' && rtcPacket) {
11754
- await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
11774
+ await __classPrivateFieldGet$b(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
11755
11775
  return new strategy_2.RTCStrategy();
11756
11776
  }
11757
11777
  if (protocol.type === 'classic') {
11758
- return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
11778
+ return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$b(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
11759
11779
  }
11760
11780
  return null;
11761
11781
  };
@@ -11823,7 +11843,7 @@ class ConnectionManager extends base_1$e.Base {
11823
11843
  clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
11824
11844
  const answer = await accumP;
11825
11845
  if (protocolToUse.type === 'rtc') {
11826
- const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
11846
+ const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$b(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
11827
11847
  answer.supportedProtocols.push({
11828
11848
  type: 'rtc',
11829
11849
  version: strategy_2.RTCInfo.version,
@@ -11871,13 +11891,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
11871
11891
  *
11872
11892
  * @packageDocumentation
11873
11893
  */
11874
- var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11894
+ var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11875
11895
  if (kind === "m") throw new TypeError("Private method is not writable");
11876
11896
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11877
11897
  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");
11878
11898
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11879
11899
  };
11880
- var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11900
+ var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11881
11901
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
11882
11902
  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");
11883
11903
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -11934,11 +11954,11 @@ class Channel extends base_1$d.EmitterBase {
11934
11954
  client_1.ChannelClient.handleProviderDisconnect(eventPayload);
11935
11955
  }),
11936
11956
  this.on('connected', (...args) => {
11937
- __classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").emit('connected', ...args);
11957
+ __classPrivateFieldGet$a(this, _Channel_internalEmitter, "f").emit('connected', ...args);
11938
11958
  })
11939
11959
  ]).catch(() => new Error('error setting up channel connection listeners'));
11940
11960
  }));
11941
- __classPrivateFieldSet$8(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
11961
+ __classPrivateFieldSet$9(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
11942
11962
  }
11943
11963
  /**
11944
11964
  *
@@ -12013,7 +12033,7 @@ class Channel extends base_1$d.EmitterBase {
12013
12033
  resolve(true);
12014
12034
  }
12015
12035
  };
12016
- __classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
12036
+ __classPrivateFieldGet$a(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
12017
12037
  });
12018
12038
  try {
12019
12039
  if (retryInfo.count > 0) {
@@ -12045,7 +12065,7 @@ class Channel extends base_1$d.EmitterBase {
12045
12065
  finally {
12046
12066
  retryInfo.count += 1;
12047
12067
  // in case of other errors, remove our listener
12048
- __classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
12068
+ __classPrivateFieldGet$a(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
12049
12069
  }
12050
12070
  } while (shouldWait); // If we're waiting we retry the above loop
12051
12071
  // Should wait was false, no channel was found.
@@ -12104,12 +12124,12 @@ class Channel extends base_1$d.EmitterBase {
12104
12124
  async connect(channelName, options = {}) {
12105
12125
  // Make sure we don't connect before listeners are set up
12106
12126
  // This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
12107
- await __classPrivateFieldGet$9(this, _Channel_readyToConnect, "f").getValue();
12127
+ await __classPrivateFieldGet$a(this, _Channel_readyToConnect, "f").getValue();
12108
12128
  if (!channelName || typeof channelName !== 'string') {
12109
12129
  throw new Error('Please provide a channelName string to connect to a channel.');
12110
12130
  }
12111
12131
  const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
12112
- const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createClientOffer(opts);
12132
+ const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$a(this, _Channel_connectionManager, "f").createClientOffer(opts);
12113
12133
  let connectionUrl;
12114
12134
  if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
12115
12135
  connectionUrl = (await this.fin.me.getInfo()).url;
@@ -12121,7 +12141,7 @@ class Channel extends base_1$d.EmitterBase {
12121
12141
  connectionUrl
12122
12142
  };
12123
12143
  const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
12124
- const strategy = await __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
12144
+ const strategy = await __classPrivateFieldGet$a(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
12125
12145
  const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
12126
12146
  // It is the client's responsibility to handle endpoint disconnection to the provider.
12127
12147
  // If the endpoint dies, the client will force a disconnection through the core.
@@ -12190,7 +12210,7 @@ class Channel extends base_1$d.EmitterBase {
12190
12210
  throw new Error('Please provide a channelName to create a channel');
12191
12211
  }
12192
12212
  const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
12193
- const channel = __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
12213
+ const channel = __classPrivateFieldGet$a(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
12194
12214
  // TODO: fix typing (internal)
12195
12215
  // @ts-expect-error
12196
12216
  this.on('client-disconnected', (eventPayload) => {
@@ -12756,13 +12776,13 @@ var Factory$3 = {};
12756
12776
 
12757
12777
  var Instance$2 = {};
12758
12778
 
12759
- var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12779
+ var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12760
12780
  if (kind === "m") throw new TypeError("Private method is not writable");
12761
12781
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
12762
12782
  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");
12763
12783
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12764
12784
  };
12765
- var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12785
+ var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12766
12786
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
12767
12787
  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");
12768
12788
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -12799,24 +12819,24 @@ class Platform extends base_1$9.EmitterBase {
12799
12819
  this.wire.sendAction('platform-get-client', this.identity).catch((e) => {
12800
12820
  // don't expose
12801
12821
  });
12802
- if (!Platform.clientMap.has(__classPrivateFieldGet$8(this, _Platform_channelName, "f"))) {
12803
- const clientPromise = __classPrivateFieldGet$8(this, _Platform_connectToProvider, "f").call(this);
12804
- Platform.clientMap.set(__classPrivateFieldGet$8(this, _Platform_channelName, "f"), clientPromise);
12822
+ if (!Platform.clientMap.has(__classPrivateFieldGet$9(this, _Platform_channelName, "f"))) {
12823
+ const clientPromise = __classPrivateFieldGet$9(this, _Platform_connectToProvider, "f").call(this);
12824
+ Platform.clientMap.set(__classPrivateFieldGet$9(this, _Platform_channelName, "f"), clientPromise);
12805
12825
  }
12806
12826
  // we set it above
12807
12827
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12808
- return Platform.clientMap.get(__classPrivateFieldGet$8(this, _Platform_channelName, "f"));
12828
+ return Platform.clientMap.get(__classPrivateFieldGet$9(this, _Platform_channelName, "f"));
12809
12829
  };
12810
12830
  _Platform_connectToProvider.set(this, async () => {
12811
12831
  try {
12812
- const client = await this._channel.connect(__classPrivateFieldGet$8(this, _Platform_channelName, "f"), { wait: false });
12832
+ const client = await this._channel.connect(__classPrivateFieldGet$9(this, _Platform_channelName, "f"), { wait: false });
12813
12833
  client.onDisconnection(() => {
12814
- Platform.clientMap.delete(__classPrivateFieldGet$8(this, _Platform_channelName, "f"));
12834
+ Platform.clientMap.delete(__classPrivateFieldGet$9(this, _Platform_channelName, "f"));
12815
12835
  });
12816
12836
  return client;
12817
12837
  }
12818
12838
  catch (e) {
12819
- Platform.clientMap.delete(__classPrivateFieldGet$8(this, _Platform_channelName, "f"));
12839
+ Platform.clientMap.delete(__classPrivateFieldGet$9(this, _Platform_channelName, "f"));
12820
12840
  throw new Error('The targeted Platform is not currently running. Listen for application-started event for the given Uuid.');
12821
12841
  }
12822
12842
  });
@@ -12829,7 +12849,7 @@ class Platform extends base_1$9.EmitterBase {
12829
12849
  if (errorMsg) {
12830
12850
  throw new Error(errorMsg);
12831
12851
  }
12832
- __classPrivateFieldSet$7(this, _Platform_channelName, channelName, "f");
12852
+ __classPrivateFieldSet$8(this, _Platform_channelName, channelName, "f");
12833
12853
  this._channel = this.fin.InterApplicationBus.Channel;
12834
12854
  this.identity = { uuid: identity.uuid };
12835
12855
  this.Layout = this.fin.Platform.Layout;
@@ -13885,13 +13905,13 @@ const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async
13885
13905
  };
13886
13906
  channelApiRelay.createRelayedDispatch = createRelayedDispatch;
13887
13907
 
13888
- var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13908
+ var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13889
13909
  if (kind === "m") throw new TypeError("Private method is not writable");
13890
13910
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13891
13911
  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");
13892
13912
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13893
13913
  };
13894
- var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13914
+ var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13895
13915
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13896
13916
  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");
13897
13917
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -13945,7 +13965,7 @@ class LayoutNode {
13945
13965
  * console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
13946
13966
  * ```
13947
13967
  */
13948
- this.isRoot = () => __classPrivateFieldGet$7(this, _LayoutNode_client, "f").isRoot(this.entityId);
13968
+ this.isRoot = () => __classPrivateFieldGet$8(this, _LayoutNode_client, "f").isRoot(this.entityId);
13949
13969
  /**
13950
13970
  * Checks if the TabStack or ColumnOrRow exists
13951
13971
  *
@@ -13965,7 +13985,7 @@ class LayoutNode {
13965
13985
  * console.log(`The entity exists: ${exists}`);
13966
13986
  * ```
13967
13987
  */
13968
- this.exists = () => __classPrivateFieldGet$7(this, _LayoutNode_client, "f").exists(this.entityId);
13988
+ this.exists = () => __classPrivateFieldGet$8(this, _LayoutNode_client, "f").exists(this.entityId);
13969
13989
  /**
13970
13990
  * Retrieves the parent of the TabStack or ColumnOrRow
13971
13991
  *
@@ -13986,11 +14006,11 @@ class LayoutNode {
13986
14006
  * ```
13987
14007
  */
13988
14008
  this.getParent = async () => {
13989
- const parent = await __classPrivateFieldGet$7(this, _LayoutNode_client, "f").getParent(this.entityId);
14009
+ const parent = await __classPrivateFieldGet$8(this, _LayoutNode_client, "f").getParent(this.entityId);
13990
14010
  if (!parent) {
13991
14011
  return undefined;
13992
14012
  }
13993
- return LayoutNode.getEntity(parent, __classPrivateFieldGet$7(this, _LayoutNode_client, "f"));
14013
+ return LayoutNode.getEntity(parent, __classPrivateFieldGet$8(this, _LayoutNode_client, "f"));
13994
14014
  };
13995
14015
  /**
13996
14016
  * Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
@@ -14041,8 +14061,8 @@ class LayoutNode {
14041
14061
  * @experimental
14042
14062
  */
14043
14063
  this.createAdjacentStack = async (views, options) => {
14044
- const entityId = await __classPrivateFieldGet$7(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
14045
- return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$7(this, _LayoutNode_client, "f"));
14064
+ const entityId = await __classPrivateFieldGet$8(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
14065
+ return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$8(this, _LayoutNode_client, "f"));
14046
14066
  };
14047
14067
  /**
14048
14068
  * Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
@@ -14070,16 +14090,16 @@ class LayoutNode {
14070
14090
  * @experimental
14071
14091
  */
14072
14092
  this.getAdjacentStacks = async (edge) => {
14073
- const adjacentStacks = await __classPrivateFieldGet$7(this, _LayoutNode_client, "f").getAdjacentStacks({
14093
+ const adjacentStacks = await __classPrivateFieldGet$8(this, _LayoutNode_client, "f").getAdjacentStacks({
14074
14094
  targetId: this.entityId,
14075
14095
  edge
14076
14096
  });
14077
14097
  return adjacentStacks.map((stack) => LayoutNode.getEntity({
14078
14098
  type: 'stack',
14079
14099
  entityId: stack.entityId
14080
- }, __classPrivateFieldGet$7(this, _LayoutNode_client, "f")));
14100
+ }, __classPrivateFieldGet$8(this, _LayoutNode_client, "f")));
14081
14101
  };
14082
- __classPrivateFieldSet$6(this, _LayoutNode_client, client, "f");
14102
+ __classPrivateFieldSet$7(this, _LayoutNode_client, client, "f");
14083
14103
  this.entityId = entityId;
14084
14104
  }
14085
14105
  }
@@ -14153,7 +14173,7 @@ class TabStack extends LayoutNode {
14153
14173
  * ```
14154
14174
  * @experimental
14155
14175
  */
14156
- this.getViews = () => __classPrivateFieldGet$7(this, _TabStack_client, "f").getStackViews(this.entityId);
14176
+ this.getViews = () => __classPrivateFieldGet$8(this, _TabStack_client, "f").getStackViews(this.entityId);
14157
14177
  /**
14158
14178
  * Adds or creates a view in this {@link TabStack}.
14159
14179
  *
@@ -14184,7 +14204,7 @@ class TabStack extends LayoutNode {
14184
14204
  * ```
14185
14205
  * @experimental
14186
14206
  */
14187
- this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$7(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
14207
+ this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$8(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
14188
14208
  /**
14189
14209
  * Removes a view from this {@link TabStack}.
14190
14210
  *
@@ -14214,7 +14234,7 @@ class TabStack extends LayoutNode {
14214
14234
  * ```
14215
14235
  */
14216
14236
  this.removeView = async (view) => {
14217
- await __classPrivateFieldGet$7(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
14237
+ await __classPrivateFieldGet$8(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
14218
14238
  };
14219
14239
  /**
14220
14240
  * Sets the active view of the {@link TabStack} without focusing it.
@@ -14238,9 +14258,9 @@ class TabStack extends LayoutNode {
14238
14258
  * @experimental
14239
14259
  */
14240
14260
  this.setActiveView = async (view) => {
14241
- await __classPrivateFieldGet$7(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
14261
+ await __classPrivateFieldGet$8(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
14242
14262
  };
14243
- __classPrivateFieldSet$6(this, _TabStack_client, client, "f");
14263
+ __classPrivateFieldSet$7(this, _TabStack_client, client, "f");
14244
14264
  }
14245
14265
  }
14246
14266
  layoutEntities.TabStack = TabStack;
@@ -14279,10 +14299,10 @@ class ColumnOrRow extends LayoutNode {
14279
14299
  * ```
14280
14300
  */
14281
14301
  this.getContent = async () => {
14282
- const contentItemEntities = await __classPrivateFieldGet$7(this, _ColumnOrRow_client, "f").getContent(this.entityId);
14283
- return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$7(this, _ColumnOrRow_client, "f")));
14302
+ const contentItemEntities = await __classPrivateFieldGet$8(this, _ColumnOrRow_client, "f").getContent(this.entityId);
14303
+ return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$8(this, _ColumnOrRow_client, "f")));
14284
14304
  };
14285
- __classPrivateFieldSet$6(this, _ColumnOrRow_client, client, "f");
14305
+ __classPrivateFieldSet$7(this, _ColumnOrRow_client, client, "f");
14286
14306
  this.type = type;
14287
14307
  }
14288
14308
  }
@@ -14297,7 +14317,7 @@ layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
14297
14317
  // TODO: eventually export this somehow
14298
14318
  layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
14299
14319
 
14300
- var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14320
+ var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14301
14321
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
14302
14322
  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");
14303
14323
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -14448,7 +14468,7 @@ class Layout extends base_1$8.Base {
14448
14468
  * @internal
14449
14469
  */
14450
14470
  static getClient(layout) {
14451
- return __classPrivateFieldGet$6(layout, _Layout_layoutClient, "f").getValue();
14471
+ return __classPrivateFieldGet$7(layout, _Layout_layoutClient, "f").getValue();
14452
14472
  }
14453
14473
  /**
14454
14474
  * @internal
@@ -14671,7 +14691,7 @@ class Layout extends base_1$8.Base {
14671
14691
  this.wire.sendAction('layout-get-root-item').catch(() => {
14672
14692
  // don't expose
14673
14693
  });
14674
- const client = await __classPrivateFieldGet$6(this, _Layout_layoutClient, "f").getValue();
14694
+ const client = await __classPrivateFieldGet$7(this, _Layout_layoutClient, "f").getValue();
14675
14695
  const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
14676
14696
  return layout_entities_1.LayoutNode.getEntity(root, client);
14677
14697
  }
@@ -14689,7 +14709,7 @@ class Layout extends base_1$8.Base {
14689
14709
  this.wire.sendAction('layout-get-stack-by-view').catch(() => {
14690
14710
  // don't expose
14691
14711
  });
14692
- const client = await __classPrivateFieldGet$6(this, _Layout_layoutClient, "f").getValue();
14712
+ const client = await __classPrivateFieldGet$7(this, _Layout_layoutClient, "f").getValue();
14693
14713
  const stack = await client.getStackByView(identity);
14694
14714
  if (!stack) {
14695
14715
  throw new Error(`No stack found for view: ${identity.uuid}/${identity.name}`);
@@ -14709,7 +14729,7 @@ class Layout extends base_1$8.Base {
14709
14729
  this.wire.sendAction('layout-add-view').catch((e) => {
14710
14730
  // don't expose
14711
14731
  });
14712
- const { identity } = await __classPrivateFieldGet$6(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-add-view', {
14732
+ const { identity } = await __classPrivateFieldGet$7(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-add-view', {
14713
14733
  viewOptions,
14714
14734
  location,
14715
14735
  targetView
@@ -14727,7 +14747,7 @@ class Layout extends base_1$8.Base {
14727
14747
  this.wire.sendAction('layout-close-view').catch((e) => {
14728
14748
  // don't expose
14729
14749
  });
14730
- await __classPrivateFieldGet$6(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-close-view', { viewIdentity });
14750
+ await __classPrivateFieldGet$7(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-close-view', { viewIdentity });
14731
14751
  }
14732
14752
  }
14733
14753
  Instance$1.Layout = Layout;
@@ -14741,12 +14761,12 @@ async function _Layout_forwardLayoutAction(action, payload) {
14741
14761
  return client.dispatch(action, { target: this.identity, opts: payload });
14742
14762
  };
14743
14763
 
14744
- var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14764
+ var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14745
14765
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
14746
14766
  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");
14747
14767
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14748
14768
  };
14749
- var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
14769
+ var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
14750
14770
  if (kind === "m") throw new TypeError("Private method is not writable");
14751
14771
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14752
14772
  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");
@@ -14812,23 +14832,23 @@ class LayoutModule extends base_1$7.Base {
14812
14832
  if (!this.wire.environment.layoutAllowedInContext(this.fin)) {
14813
14833
  throw new Error('Layout.init can only be called from a Window context.');
14814
14834
  }
14815
- if (__classPrivateFieldGet$5(this, _LayoutModule_layoutInitializationAttempted, "f")) {
14835
+ if (__classPrivateFieldGet$6(this, _LayoutModule_layoutInitializationAttempted, "f")) {
14816
14836
  throw new Error('Layout.init was already called, please use Layout.create to add additional layouts.');
14817
14837
  }
14818
14838
  if (this.wire.environment.type === 'openfin') {
14819
14839
  // preload the client
14820
14840
  await this.fin.Platform.getCurrentSync().getClient();
14821
14841
  }
14822
- __classPrivateFieldSet$5(this, _LayoutModule_layoutInitializationAttempted, true, "f");
14842
+ __classPrivateFieldSet$6(this, _LayoutModule_layoutInitializationAttempted, true, "f");
14823
14843
  // TODO: rename to createLayoutManager
14824
- __classPrivateFieldSet$5(this, _LayoutModule_layoutManager, await this.wire.environment.initLayoutManager(this.fin, this.wire, options), "f");
14825
- await this.wire.environment.applyLayoutSnapshot(this.fin, __classPrivateFieldGet$5(this, _LayoutModule_layoutManager, "f"), options);
14844
+ __classPrivateFieldSet$6(this, _LayoutModule_layoutManager, await this.wire.environment.initLayoutManager(this.fin, this.wire, options), "f");
14845
+ await this.wire.environment.applyLayoutSnapshot(this.fin, __classPrivateFieldGet$6(this, _LayoutModule_layoutManager, "f"), options);
14826
14846
  const meIdentity = { name: this.fin.me.name, uuid: this.fin.me.uuid };
14827
14847
  if (!options.layoutManagerOverride) {
14828
14848
  // CORE-1081 to be removed when we actually delete the `layoutManager` prop
14829
14849
  // in single-layout case, we return the undocumented layoutManager type
14830
14850
  const layoutIdentity = { layoutName: layout_constants_1.DEFAULT_LAYOUT_KEY, ...meIdentity };
14831
- return __classPrivateFieldGet$5(this, _LayoutModule_getLayoutManagerSpy, "f").call(this, layoutIdentity);
14851
+ return __classPrivateFieldGet$6(this, _LayoutModule_getLayoutManagerSpy, "f").call(this, layoutIdentity);
14832
14852
  }
14833
14853
  return this.wrapSync(meIdentity);
14834
14854
  };
@@ -14857,13 +14877,13 @@ class LayoutModule extends base_1$7.Base {
14857
14877
  * @returns
14858
14878
  */
14859
14879
  this.getCurrentLayoutManagerSync = () => {
14860
- return __classPrivateFieldGet$5(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.getCurrentLayoutManagerSync()`);
14880
+ return __classPrivateFieldGet$6(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.getCurrentLayoutManagerSync()`);
14861
14881
  };
14862
14882
  this.create = async (options) => {
14863
- return this.wire.environment.createLayout(__classPrivateFieldGet$5(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.create()`), options);
14883
+ return this.wire.environment.createLayout(__classPrivateFieldGet$6(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.create()`), options);
14864
14884
  };
14865
14885
  this.destroy = async (layoutIdentity) => {
14866
- return this.wire.environment.destroyLayout(__classPrivateFieldGet$5(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.destroy()`), layoutIdentity);
14886
+ return this.wire.environment.destroyLayout(__classPrivateFieldGet$6(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.destroy()`), layoutIdentity);
14867
14887
  };
14868
14888
  }
14869
14889
  /**
@@ -15004,10 +15024,10 @@ class LayoutModule extends base_1$7.Base {
15004
15024
  }
15005
15025
  Factory$2.LayoutModule = LayoutModule;
15006
15026
  _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
15007
- if (!__classPrivateFieldGet$5(this, _LayoutModule_layoutManager, "f")) {
15027
+ if (!__classPrivateFieldGet$6(this, _LayoutModule_layoutManager, "f")) {
15008
15028
  throw new Error(`You must call init before using the API ${method}`);
15009
15029
  }
15010
- return __classPrivateFieldGet$5(this, _LayoutModule_layoutManager, "f");
15030
+ return __classPrivateFieldGet$6(this, _LayoutModule_layoutManager, "f");
15011
15031
  };
15012
15032
 
15013
15033
  (function (exports) {
@@ -15369,13 +15389,13 @@ var InteropClient$1 = {};
15369
15389
 
15370
15390
  var SessionContextGroupClient$1 = {};
15371
15391
 
15372
- var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15392
+ var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15373
15393
  if (kind === "m") throw new TypeError("Private method is not writable");
15374
15394
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15375
15395
  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");
15376
15396
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15377
15397
  };
15378
- var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15398
+ var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15379
15399
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15380
15400
  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");
15381
15401
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -15389,7 +15409,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15389
15409
  super(wire);
15390
15410
  _SessionContextGroupClient_clientPromise.set(this, void 0);
15391
15411
  this.id = id;
15392
- __classPrivateFieldSet$4(this, _SessionContextGroupClient_clientPromise, client, "f");
15412
+ __classPrivateFieldSet$5(this, _SessionContextGroupClient_clientPromise, client, "f");
15393
15413
  }
15394
15414
  /**
15395
15415
  * Sets a context for the session context group.
@@ -15401,7 +15421,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15401
15421
  this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
15402
15422
  // don't expose, analytics-only call
15403
15423
  });
15404
- const client = await __classPrivateFieldGet$4(this, _SessionContextGroupClient_clientPromise, "f");
15424
+ const client = await __classPrivateFieldGet$5(this, _SessionContextGroupClient_clientPromise, "f");
15405
15425
  return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
15406
15426
  sessionContextGroupId: this.id,
15407
15427
  context
@@ -15411,7 +15431,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15411
15431
  this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
15412
15432
  // don't expose, analytics-only call
15413
15433
  });
15414
- const client = await __classPrivateFieldGet$4(this, _SessionContextGroupClient_clientPromise, "f");
15434
+ const client = await __classPrivateFieldGet$5(this, _SessionContextGroupClient_clientPromise, "f");
15415
15435
  return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
15416
15436
  sessionContextGroupId: this.id,
15417
15437
  type
@@ -15424,7 +15444,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15424
15444
  if (typeof contextHandler !== 'function') {
15425
15445
  throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
15426
15446
  }
15427
- const client = await __classPrivateFieldGet$4(this, _SessionContextGroupClient_clientPromise, "f");
15447
+ const client = await __classPrivateFieldGet$5(this, _SessionContextGroupClient_clientPromise, "f");
15428
15448
  let handlerId;
15429
15449
  if (contextType) {
15430
15450
  handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1$6.generateId)()}`;
@@ -15437,7 +15457,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15437
15457
  return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
15438
15458
  }
15439
15459
  async createUnsubscribeCb(handlerId) {
15440
- const client = await __classPrivateFieldGet$4(this, _SessionContextGroupClient_clientPromise, "f");
15460
+ const client = await __classPrivateFieldGet$5(this, _SessionContextGroupClient_clientPromise, "f");
15441
15461
  return async () => {
15442
15462
  client.remove(handlerId);
15443
15463
  await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
@@ -15455,6 +15475,139 @@ class SessionContextGroupClient extends base_1$5.Base {
15455
15475
  SessionContextGroupClient$1.default = SessionContextGroupClient;
15456
15476
  _SessionContextGroupClient_clientPromise = new WeakMap();
15457
15477
 
15478
+ var channelEvents = {};
15479
+
15480
+ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15481
+ if (kind === "m") throw new TypeError("Private method is not writable");
15482
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15483
+ 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");
15484
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15485
+ };
15486
+ var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15487
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15488
+ 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");
15489
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15490
+ };
15491
+ var _a, _ChannelEvents_channelClient, _ChannelEvents_isChannelReady, _ChannelEvents_actionsByClient, _ChannelEvents_getActions, _ChannelEvents_createRegistration, _ChannelEvents_getRegistration, _ChannelEvents_getOrCreateRegistration;
15492
+ Object.defineProperty(channelEvents, "__esModule", { value: true });
15493
+ channelEvents.ChannelEvents = void 0;
15494
+ /**
15495
+ * Channel events creates a event like syntax out of a channel action, allowing multiple events to be triggered
15496
+ * from a single action (normally only one callback can be created per action).
15497
+ *
15498
+ * This Class essentially allows us to multiplex channel actions to multiple callbacks.
15499
+ */
15500
+ class ChannelEvents {
15501
+ constructor(channelClient) {
15502
+ // eslint-disable-next-line
15503
+ _ChannelEvents_channelClient.set(this, void 0);
15504
+ _ChannelEvents_isChannelReady.set(this, false);
15505
+ _ChannelEvents_getActions.set(this, async () => {
15506
+ const channelClient = await __classPrivateFieldGet$4(this, _ChannelEvents_channelClient, "f");
15507
+ let actions = __classPrivateFieldGet$4(ChannelEvents, _a, "f", _ChannelEvents_actionsByClient).get(channelClient);
15508
+ if (!actions) {
15509
+ actions = {};
15510
+ __classPrivateFieldGet$4(ChannelEvents, _a, "f", _ChannelEvents_actionsByClient).set(channelClient, actions);
15511
+ }
15512
+ return actions;
15513
+ });
15514
+ _ChannelEvents_createRegistration.set(this, (actionId) => {
15515
+ const callbacks = [];
15516
+ let registrationPromise;
15517
+ const onChannelAction = (data) => {
15518
+ callbacks.forEach((callback) => callback(data));
15519
+ };
15520
+ return {
15521
+ callbacks,
15522
+ dispose: async (callback) => {
15523
+ const index = callbacks.indexOf(callback);
15524
+ if (index >= 0) {
15525
+ callbacks.splice(index, 1);
15526
+ if (callbacks.length === 0) {
15527
+ const client = await __classPrivateFieldGet$4(this, _ChannelEvents_channelClient, "f");
15528
+ client.remove(actionId);
15529
+ }
15530
+ }
15531
+ },
15532
+ waitForRegistration: async () => {
15533
+ // Use lazy eval to only setup and register the channel on first attempt.
15534
+ if (!registrationPromise) {
15535
+ registrationPromise = (async () => {
15536
+ const client = await __classPrivateFieldGet$4(this, _ChannelEvents_channelClient, "f");
15537
+ await client.register(actionId, onChannelAction);
15538
+ })();
15539
+ }
15540
+ await registrationPromise;
15541
+ }
15542
+ };
15543
+ });
15544
+ _ChannelEvents_getRegistration.set(this, async (actionId) => {
15545
+ const actions = await __classPrivateFieldGet$4(this, _ChannelEvents_getActions, "f").call(this);
15546
+ return actions[actionId];
15547
+ });
15548
+ _ChannelEvents_getOrCreateRegistration.set(this, async (actionId) => {
15549
+ const actions = await __classPrivateFieldGet$4(this, _ChannelEvents_getActions, "f").call(this);
15550
+ const registration = await __classPrivateFieldGet$4(this, _ChannelEvents_getRegistration, "f").call(this, actionId);
15551
+ if (!registration) {
15552
+ actions[actionId] = __classPrivateFieldGet$4(this, _ChannelEvents_createRegistration, "f").call(this, actionId);
15553
+ }
15554
+ return actions[actionId];
15555
+ });
15556
+ /**
15557
+ * Add a listener for the given channel action.
15558
+ *
15559
+ * This will register a handler for the specified channel action if this is the first time we have requested one, or reuse an existing one if it exists.
15560
+ *
15561
+ * Note, only void channel actions are currently supported.
15562
+ *
15563
+ * @param action Action ID, must match the underlying channel action.
15564
+ * @param callback Callback to be called whenever the action is dispatched.
15565
+ */
15566
+ this.addListener = async (action, callback) => {
15567
+ const event = await __classPrivateFieldGet$4(this, _ChannelEvents_getOrCreateRegistration, "f").call(this, action);
15568
+ event.callbacks.push(callback);
15569
+ // This ensures we only resolve the subscription once the action is registered
15570
+ await event.waitForRegistration();
15571
+ };
15572
+ /**
15573
+ * Removes a callback associated with a given action if it exists.
15574
+ *
15575
+ * If this callback is the last one associated with the specified action, the underlying channel action registration is
15576
+ * also removed.
15577
+ * @param action Action ID to remove
15578
+ * @param callback Callback to remove.
15579
+ */
15580
+ this.removeListener = async (action, callback) => {
15581
+ if (!__classPrivateFieldGet$4(this, _ChannelEvents_isChannelReady, "f")) {
15582
+ return;
15583
+ }
15584
+ const registration = await __classPrivateFieldGet$4(this, _ChannelEvents_getRegistration, "f").call(this, action);
15585
+ if (registration) {
15586
+ const event = await __classPrivateFieldGet$4(this, _ChannelEvents_getOrCreateRegistration, "f").call(this, action);
15587
+ await event.dispose(callback);
15588
+ }
15589
+ };
15590
+ __classPrivateFieldSet$4(this, _ChannelEvents_channelClient, channelClient, "f");
15591
+ Promise.resolve(channelClient)
15592
+ .then(() => {
15593
+ __classPrivateFieldSet$4(this, _ChannelEvents_isChannelReady, true, "f");
15594
+ })
15595
+ .catch(() => {
15596
+ // eslint-disable-next-line
15597
+ console.warn('Channel Connection error occurred in channel client. Channel-events registrations will fail.');
15598
+ });
15599
+ }
15600
+ }
15601
+ channelEvents.ChannelEvents = ChannelEvents;
15602
+ _a = ChannelEvents, _ChannelEvents_channelClient = new WeakMap(), _ChannelEvents_isChannelReady = new WeakMap(), _ChannelEvents_getActions = new WeakMap(), _ChannelEvents_createRegistration = new WeakMap(), _ChannelEvents_getRegistration = new WeakMap(), _ChannelEvents_getOrCreateRegistration = new WeakMap();
15603
+ /**
15604
+ * Static map of actions by channel client. This ensures we can reuse the same event and keep track of all its callbacks.
15605
+ *
15606
+ * Weak map will also ensure that when a channel is GC'ed we also tear down the actions/callbacks associated
15607
+ * with it.
15608
+ */
15609
+ _ChannelEvents_actionsByClient = { value: new WeakMap() };
15610
+
15458
15611
  var __classPrivateFieldSet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15459
15612
  if (kind === "m") throw new TypeError("Private method is not writable");
15460
15613
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -15469,12 +15622,13 @@ var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateF
15469
15622
  var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15470
15623
  return (mod && mod.__esModule) ? mod : { "default": mod };
15471
15624
  };
15472
- var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory;
15625
+ var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory, _InteropClient_channelEvents;
15473
15626
  Object.defineProperty(InteropClient$1, "__esModule", { value: true });
15474
15627
  InteropClient$1.InteropClient = void 0;
15475
15628
  const base_1$4 = base;
15476
15629
  const SessionContextGroupClient_1 = __importDefault$4(SessionContextGroupClient$1);
15477
15630
  const utils_1$5 = utils$3;
15631
+ const channel_events_1 = channelEvents;
15478
15632
  /**
15479
15633
  * The Interop Client API is broken up into two groups:
15480
15634
  *
@@ -15533,13 +15687,43 @@ class InteropClient extends base_1$4.Base {
15533
15687
  _InteropClient_clientPromise.set(this, void 0);
15534
15688
  _InteropClient_sessionContextGroups.set(this, void 0);
15535
15689
  _InteropClient_fdc3Factory.set(this, void 0);
15690
+ _InteropClient_channelEvents.set(this, void 0);
15691
+ /*
15692
+ Client APIs
15693
+ */
15694
+ /**
15695
+ * `addListener` allows the InteropClient to subscribe to events emitted by the connected InteropBroker.
15696
+ * @param type The event type to subscribe to.
15697
+ * @param listener Callback invoked whenever the event occurs.
15698
+ * @returns Promise resolving with void once the listener is registered.
15699
+ */
15700
+ this.addListener = async (type, listener) => {
15701
+ try {
15702
+ await __classPrivateFieldGet$3(this, _InteropClient_channelEvents, "f").addListener(type, listener);
15703
+ }
15704
+ catch (error) {
15705
+ throw new Error(`An unexpected error occurred when adding a listener to the event ${type}. \n${error.stack}.`);
15706
+ }
15707
+ };
15708
+ /**
15709
+ * `removeListener` removes a registered event listener.
15710
+ * @param type The event type to subscribe to.
15711
+ * @param listener Callback to be removed.
15712
+ * @returns Promise resolving with void even if no callback was found.
15713
+ */
15714
+ this.removeListener = async (type, listener) => {
15715
+ try {
15716
+ await __classPrivateFieldGet$3(this, _InteropClient_channelEvents, "f").removeListener(type, listener);
15717
+ }
15718
+ catch (error) {
15719
+ throw new Error(`An unexpected error occurred when removing a listener for the event ${type}. \n${error.stack}.`);
15720
+ }
15721
+ };
15536
15722
  __classPrivateFieldSet$3(this, _InteropClient_sessionContextGroups, new Map(), "f");
15537
15723
  __classPrivateFieldSet$3(this, _InteropClient_clientPromise, clientPromise, "f");
15538
15724
  __classPrivateFieldSet$3(this, _InteropClient_fdc3Factory, fdc3Factory, "f");
15725
+ __classPrivateFieldSet$3(this, _InteropClient_channelEvents, new channel_events_1.ChannelEvents(clientPromise), "f");
15539
15726
  }
15540
- /*
15541
- Client APIs
15542
- */
15543
15727
  /**
15544
15728
  * Sets a context for the context group of the current entity.
15545
15729
  *
@@ -16053,7 +16237,7 @@ class InteropClient extends base_1$4.Base {
16053
16237
  }
16054
16238
  }
16055
16239
  InteropClient$1.InteropClient = InteropClient;
16056
- _InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap(), _InteropClient_fdc3Factory = new WeakMap();
16240
+ _InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap(), _InteropClient_fdc3Factory = new WeakMap(), _InteropClient_channelEvents = new WeakMap();
16057
16241
 
16058
16242
  var fdc3ClientFactory = {};
16059
16243