@magic-xpa/engine 4.1300.0-dev4130.182 → 4.1300.0-dev4130.184

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.
@@ -3,8 +3,8 @@ import { XMLConstants, StorageAttribute, ViewRefreshMode, InternalInterface, Log
3
3
  import { RecordUtils, GuiFieldBase, ExpVal, BlobType, FieldDef, GuiTaskBase, MgControlBase, PropInterface, GuiDataCollection, CommandType, Commands, HtmlProperties, ControlTable, Modifiers, KeyboardItem, TaskDefinitionIdTableSaxHandler, DisplayConvertor, VectorType, PIC, MgTimer, GuiConstants, RuntimeContextBase, UsernamePasswordCredentials, Styles, Manager, NUM_TYPE, GuiExpressionEvaluator, ExpressionInterface, DataModificationTypes, GuiDataViewBase, ObjectReferencesCollection, EMPTY_DCREF, ObjectReferenceBase, PropTable, FieldsTable as FieldsTable$1, DcValuesBuilderBase, MgFormBase, GuiEnvironment, TaskDefinitionId, Events, Helps, FocusManager, EventsProcessor, UIBridge } from '@magic-xpa/gui';
4
4
  import { HttpHeaders, HttpErrorResponse } from '@angular/common/http';
5
5
  import { timer, Subject } from 'rxjs';
6
- import * as CryptoJS from 'crypto-js';
7
6
  import { io } from 'socket.io-client';
7
+ import * as CryptoJS from 'crypto-js';
8
8
 
9
9
  ///
10
10
  /// This class is used to hold references to global objects, using their interfaces/base classes. This allows other objects to access those global objects
@@ -7706,6 +7706,7 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
7706
7706
  HttpClientEvents.CheckAndSetSessionCounter_Event = this.CheckAndSetSessionCounter.bind(this);
7707
7707
  HttpClientEvents.ComputeAndLogRequestInfo_Event = this.ComputeAndLogRequestInfo.bind(this);
7708
7708
  AccessHelper.eventsManager.SpinnerStopped.subscribe(clientBusyTime => this.ClientActivated());
7709
+ SubscriberClient.SubscribeTopics_Event = this.SubscribeTopics.bind(this);
7709
7710
  }
7710
7711
  /// <summary>
7711
7712
  /// Log the current request information in console
@@ -7826,6 +7827,10 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
7826
7827
  //let uInt8Array:Uint8Array = new Uint8Array(response);
7827
7828
  return this.ArrayBufferToString(response);
7828
7829
  }
7830
+ async SubscribeTopics(topics, socket) {
7831
+ const token = await RemoteCommandsProcessor.GetInstance().GetSubscriptionTokenFromServer(Array.from(topics));
7832
+ socket.emit('subscribe', Array.from(topics), token, ClientManager.Instance.GetRuntimeCtxID());
7833
+ }
7829
7834
  }
7830
7835
  /// <summary>helper class: details from the runtime-engine - environment values.
7831
7836
  /// Handshake response: <Richclientresponse> <ContextID>...</ContextID> <Environment InputPassword="Y|N"
@@ -13863,6 +13868,7 @@ class SubscriberClient {
13863
13868
  static instance;
13864
13869
  socket;
13865
13870
  subscribedTopics = new Set();
13871
+ static SubscribeTopics_Event = null;
13866
13872
  constructor(task) {
13867
13873
  // Connect to the Socket.IO server with subscriber role
13868
13874
  const serverUrl = EnvParamsTable.Instance.get(ConstInterface.MG_TAG_PUBSUB_SERVER_URI);
@@ -13874,14 +13880,12 @@ class SubscriberClient {
13874
13880
  }
13875
13881
  });
13876
13882
  // Handle connection
13877
- this.socket.on('connect', () => {
13883
+ this.socket.on('connect', async () => {
13878
13884
  Logger.Instance.WriteDevToLog("SubscriberClient connected to server : " + this.socket.id);
13879
- // Case 1: Subscribe to all topics initially
13880
- // Case 2: Subscribe to topics that were subscribed with previous session (reconnected after a disconnection)
13885
+ // Case 2: Subscribe to topics that were subscribed with previous session between client and pubsub middleware.
13886
+ // (reconnected to middleware after a disconnection)
13881
13887
  if (this.subscribedTopics.size > 0) {
13882
- this.subscribedTopics.forEach(topic => {
13883
- this.socket.emit('subscribe', topic);
13884
- });
13888
+ await SubscriberClient.SubscribeTopics_Event(this.subscribedTopics, this.socket);
13885
13889
  }
13886
13890
  });
13887
13891
  // Handle disconnection
@@ -13984,6 +13988,10 @@ class SubscriberClient {
13984
13988
  disconnect() {
13985
13989
  this.socket.disconnect();
13986
13990
  }
13991
+ static async SubscribeTopics(topics, socket) {
13992
+ if (this.SubscribeTopics_Event !== null)
13993
+ this.SubscribeTopics_Event(topics, socket);
13994
+ }
13987
13995
  }
13988
13996
 
13989
13997
  class ExpressionEvaluator extends GuiExpressionEvaluator {
@@ -39869,7 +39877,7 @@ class CommandsTable {
39869
39877
  }
39870
39878
  }
39871
39879
 
39872
- let CurrentClientVersion = '4.1300.0-dev4130.182';
39880
+ let CurrentClientVersion = '4.1300.0-dev4130.184';
39873
39881
 
39874
39882
  // @dynamic
39875
39883
  class ClientManager {