@interopio/browser 3.3.3 → 3.3.4

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.
@@ -6112,7 +6112,7 @@ class IoC {
6112
6112
  }
6113
6113
  }
6114
6114
 
6115
- var version$1 = "3.3.3";
6115
+ var version$1 = "3.3.4";
6116
6116
 
6117
6117
  const createFactoryFunction = (coreFactoryFunction) => {
6118
6118
  return async (userConfig) => {
@@ -9069,7 +9069,7 @@ const ContextMessageReplaySpec = {
9069
9069
  }
9070
9070
  };
9071
9071
 
9072
- var version = "6.3.3";
9072
+ var version = "6.3.4";
9073
9073
 
9074
9074
  function prepareConfig (configuration, ext, glue42gd) {
9075
9075
  let nodeStartingContext;
@@ -13039,6 +13039,10 @@ class ClientRepository {
13039
13039
  return unsubscribeFunc;
13040
13040
  }
13041
13041
  getServerById(id) {
13042
+ const server = this.servers[id];
13043
+ if (!server) {
13044
+ return undefined;
13045
+ }
13042
13046
  return this.hideServerMethodSystemFlags(this.servers[id]);
13043
13047
  }
13044
13048
  reset() {
@@ -13351,7 +13355,7 @@ class ServerStreaming {
13351
13355
  }
13352
13356
  handleAddInterest(msg) {
13353
13357
  const caller = this.repository.getServerById(msg.caller_id);
13354
- const instance = caller.instance;
13358
+ const instance = caller?.instance ?? {};
13355
13359
  const requestContext = {
13356
13360
  msg,
13357
13361
  arguments: msg.arguments_kv || {},
@@ -13523,7 +13527,7 @@ class ServerProtocol {
13523
13527
  if (method === undefined) {
13524
13528
  return;
13525
13529
  }
13526
- const client = this.clientRepository.getServerById(callerId).instance;
13530
+ const client = this.clientRepository.getServerById(callerId)?.instance;
13527
13531
  const invocationArgs = { args, instance: client };
13528
13532
  this.callbacks.execute("onInvoked", method, invocationId, invocationArgs);
13529
13533
  }
@@ -13536,9 +13540,15 @@ class UserSubscription {
13536
13540
  return this.subscriptionData.params.arguments || {};
13537
13541
  }
13538
13542
  get servers() {
13539
- return this.subscriptionData.trackedServers
13540
- .filter((pair) => pair.subscriptionId)
13541
- .map((pair) => this.repository.getServerById(pair.serverId).instance);
13543
+ return this.subscriptionData.trackedServers.reduce((servers, pair) => {
13544
+ if (pair.subscriptionId) {
13545
+ const server = this.repository.getServerById(pair.serverId)?.instance;
13546
+ if (server) {
13547
+ servers.push(server);
13548
+ }
13549
+ }
13550
+ return servers;
13551
+ }, []);
13542
13552
  }
13543
13553
  get serverInstance() {
13544
13554
  return this.servers[0];
@@ -13828,18 +13838,19 @@ class ClientStreaming {
13828
13838
  if (typeof subscription !== "object") {
13829
13839
  return;
13830
13840
  }
13831
- const trackedServersFound = subscription.trackedServers.filter((server) => {
13832
- return server.subscriptionId === msg.subscription_id;
13841
+ const trackedServersFound = subscription.trackedServers.filter((s) => {
13842
+ return s.subscriptionId === msg.subscription_id;
13833
13843
  });
13834
13844
  if (trackedServersFound.length !== 1) {
13835
13845
  return;
13836
13846
  }
13837
13847
  const isPrivateData = msg.oob;
13838
13848
  const sendingServerId = trackedServersFound[0].serverId;
13849
+ const server = this.repository.getServerById(sendingServerId);
13839
13850
  const receivedStreamData = () => {
13840
13851
  return {
13841
13852
  data: msg.data,
13842
- server: this.repository.getServerById(sendingServerId).instance,
13853
+ server: server?.instance ?? {},
13843
13854
  requestArguments: subscription.params.arguments,
13844
13855
  message: undefined,
13845
13856
  private: isPrivateData,
@@ -13893,7 +13904,7 @@ class ClientStreaming {
13893
13904
  const closingServerId = (closersCount > 0) ? subscription.queued.closers[closersCount - 1] : null;
13894
13905
  let closingServer;
13895
13906
  if (closingServerId !== undefined && typeof closingServerId === "string") {
13896
- closingServer = this.repository.getServerById(closingServerId).instance;
13907
+ closingServer = this.repository.getServerById(closingServerId)?.instance ?? {};
13897
13908
  }
13898
13909
  subscription.handlers.onClosed.forEach((callback) => {
13899
13910
  if (typeof callback !== "function") {
@@ -14005,13 +14016,15 @@ class ClientProtocol {
14005
14016
  const serverId = msg.server_id;
14006
14017
  const methodIdList = msg.methods;
14007
14018
  const server = this.repository.getServerById(serverId);
14008
- const serverMethodKeys = Object.keys(server.methods);
14009
- serverMethodKeys.forEach((methodKey) => {
14010
- const method = server.methods[methodKey];
14011
- if (methodIdList.indexOf(method.gatewayId) > -1) {
14012
- this.repository.removeServerMethod(serverId, methodKey);
14013
- }
14014
- });
14019
+ if (server) {
14020
+ const serverMethodKeys = Object.keys(server.methods);
14021
+ serverMethodKeys.forEach((methodKey) => {
14022
+ const method = server.methods[methodKey];
14023
+ if (methodIdList.indexOf(method.gatewayId) > -1) {
14024
+ this.repository.removeServerMethod(serverId, methodKey);
14025
+ }
14026
+ });
14027
+ }
14015
14028
  }
14016
14029
  handleResultMessage(msg) {
14017
14030
  const invocationId = msg._tag.invocationId;
@@ -14021,7 +14034,7 @@ class ClientProtocol {
14021
14034
  return {
14022
14035
  invocationId,
14023
14036
  result,
14024
- instance: server.instance,
14037
+ instance: server?.instance,
14025
14038
  status: InvokeStatus.Success,
14026
14039
  message: ""
14027
14040
  };
@@ -14037,7 +14050,7 @@ class ClientProtocol {
14037
14050
  return {
14038
14051
  invocationId,
14039
14052
  result: context,
14040
- instance: server.instance,
14053
+ instance: server?.instance,
14041
14054
  status: InvokeStatus.Error,
14042
14055
  message
14043
14056
  };