aotrautils-srv 0.0.2038 → 0.0.2039

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- /*utils COMMONS library associated with aotra version : «1_29072022-2359 (17/10/2026-01:27:15)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (17/10/2026-02:53:54)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -5485,7 +5485,7 @@ window.AOTRAUTILS_LIB_IS_LOADED=true;
5485
5485
 
5486
5486
 
5487
5487
 
5488
- /*utils AI library associated with aotra version : «1_29072022-2359 (17/10/2026-01:27:15)»*/
5488
+ /*utils AI library associated with aotra version : «1_29072022-2359 (17/10/2026-02:53:54)»*/
5489
5489
  /*-----------------------------------------------------------------------------*/
5490
5490
 
5491
5491
 
@@ -5749,7 +5749,7 @@ window.getLLMAPIClient=(modelName, apiURL, agentRole, defaultPrompt, llmProvider
5749
5749
 
5750
5750
 
5751
5751
 
5752
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (17/10/2026-01:27:15)»*/
5752
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (17/10/2026-02:53:54)»*/
5753
5753
  /*-----------------------------------------------------------------------------*/
5754
5754
 
5755
5755
 
@@ -8603,7 +8603,7 @@ window.launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=
8603
8603
 
8604
8604
  // (we bypass the channel and message types filters !)
8605
8605
  try{
8606
- httpEndpointResultObject.body=await serverReceptionEntryPoint.execute(eventOrMessage, null, false);
8606
+ httpEndpointResultObject.body=await serverReceptionEntryPoint.executeWithAllPrerequisites(dataWrapped, eventOrMessage, null);
8607
8607
  }catch(treatmentsChannelError){
8608
8608
  // TODO : FIXME : DUPLICATED CODE !!!
8609
8609
  const errorMessage="ERROR : An error has occured during the processing of a client message on channel treatments.";
@@ -9769,7 +9769,7 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9769
9769
  this.clientsRoomsTag=clientsRoomsTag;
9770
9770
 
9771
9771
  this.serverReceptionEntryPoints=[];
9772
- this.asyncPrerequisiteMethods=[];
9772
+ this.asyncPrerequisiteMethods=new Set();
9773
9773
  }
9774
9774
 
9775
9775
  // Executed whenever any message is received on any channel :
@@ -9817,8 +9817,9 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9817
9817
 
9818
9818
  }
9819
9819
 
9820
+
9820
9821
  addReceiveListenerPrerequisite(asyncPrerequisiteMethod){
9821
- this.asyncPrerequisiteMethods.push(asyncPrerequisiteMethod);
9822
+ this.asyncPrerequisiteMethods.add(asyncPrerequisiteMethod);
9822
9823
  // TRACE
9823
9824
  lognow("INFO : Added prerequisite: asyncPrerequisiteMethods:",asyncPrerequisiteMethod);
9824
9825
  return this;
@@ -9844,6 +9845,10 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9844
9845
  // I-
9845
9846
  // ASYNC
9846
9847
  addReceiveListener(messageType, asyncDoOnIncomingMessage, httpEndpointDefinition=null){
9848
+
9849
+ // DBG
9850
+ lognow("(SERVER) (ServerReceptionEntryPointsBag) Registering receive (NEW API) for message type «"+messageType+"»...");
9851
+
9847
9852
  const channelNameParam=this.channelNameParam;
9848
9853
  const clientsRoomsTag=this.clientsRoomsTag;
9849
9854
  const messageTypes=(!messageType || empty(messageType) ? [] :
@@ -9851,7 +9856,7 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9851
9856
  );
9852
9857
  const listenerConfig={listenerMessageTypes:messageTypes, httpEndpointDefinition:httpEndpointDefinition};
9853
9858
  const serverReceptionEntryPoint=
9854
- new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, asyncDoOnIncomingMessage);
9859
+ new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, asyncDoOnIncomingMessage, this);
9855
9860
  this.serverReceptionEntryPoints.push(serverReceptionEntryPoint);
9856
9861
 
9857
9862
  if(httpEndpointDefinition){
@@ -9871,11 +9876,12 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9871
9876
 
9872
9877
  window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
9873
9878
 
9874
- constructor(channelNameParam, clientsRoomsTag, listenerConfig=null, asyncDoOnIncomingMessage){
9879
+ constructor(channelNameParam, clientsRoomsTag, listenerConfig=null, asyncDoOnIncomingMessage, parentServerReceptionEntryPointsBag=null){
9875
9880
  this.channelName=channelNameParam;
9876
9881
  this.clientsRoomsTag=clientsRoomsTag;
9877
9882
  this.listenerConfig=listenerConfig;
9878
9883
  this.asyncDoOnIncomingMessage=asyncDoOnIncomingMessage;
9884
+ this.parentServerReceptionEntryPointsBag=parentServerReceptionEntryPointsBag;
9879
9885
  }
9880
9886
 
9881
9887
  async execute(eventOrMessage, clientSocketParam=null){
@@ -9883,7 +9889,7 @@ window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
9883
9889
  if(!eventOrMessage){
9884
9890
  // TRACE
9885
9891
  lognow("ERROR : No message received.");
9886
- return;
9892
+ return null;
9887
9893
  }
9888
9894
 
9889
9895
  // OLD :
@@ -9902,7 +9908,7 @@ window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
9902
9908
 
9903
9909
  // Room information is stored in client socket object :
9904
9910
  const isClientInRoom=window.WebsocketImplementation.isInRoom(clientSocketParam, this.clientsRoomsTag);
9905
- if(!isClientInRoom) return;
9911
+ if(!isClientInRoom) return null;
9906
9912
 
9907
9913
 
9908
9914
  if(this.listenerConfig){
@@ -9911,7 +9917,7 @@ window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
9911
9917
  // Else we check if the message matches the required message types :
9912
9918
  if( dataWrapped.data && dataWrapped.data.type
9913
9919
  && !contains(this.listenerConfig.listenerMessageTypes, dataWrapped.data.type))
9914
- return;
9920
+ return null;
9915
9921
  }
9916
9922
  }
9917
9923
 
@@ -9928,6 +9934,13 @@ window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
9928
9934
  }
9929
9935
 
9930
9936
  }
9937
+
9938
+ async executeWithAllPrerequisites(dataWrapped, originalEventOrMessage, clientSocket){
9939
+ if(this.parentServerReceptionEntryPointsBag)
9940
+ await this.parentServerReceptionEntryPointsBag.executeAllPrerequisites(dataWrapped, originalEventOrMessage, clientSocket);
9941
+ return await this.execute(originalEventOrMessage, clientSocket);
9942
+ }
9943
+
9931
9944
  }
9932
9945
 
9933
9946
 
@@ -9981,10 +9994,10 @@ window.NodeServerInstance=class NodeServerInstance{
9981
9994
  receive(channelNameParam, doOnIncomingMessage, listenerConfig=null, clientsRoomsTag=null){
9982
9995
 
9983
9996
  // DBG
9984
- lognow("(SERVER) Registering receive (OLD API) for channel «"+channelNameParam+"»...");
9997
+ lognow("(SERVER) (NodeServerInstance) Registering receive (OLD API) for channel «"+channelNameParam+"»...");
9985
9998
 
9986
9999
  const serverReceptionEntryPoint=
9987
- new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, doOnIncomingMessage);
10000
+ new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, doOnIncomingMessage, null);
9988
10001
  this.serverReceptionEntryPoints.push(serverReceptionEntryPoint);
9989
10002
 
9990
10003
  //OLD: // SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
@@ -10165,7 +10178,7 @@ window.NodeServerInstance=class NodeServerInstance{
10165
10178
  // We execute the events registration listeners entry points:
10166
10179
  // DEPRECATED : OLD API :
10167
10180
  foreach(self.serverReceptionEntryPoints, (serverReceptionEntryPoint,i)=>{
10168
- serverReceptionEntryPoint.execute(eventOrMessage, clientSocket, true).then(()=>{
10181
+ serverReceptionEntryPoint.execute(eventOrMessage, clientSocket).then(()=>{
10169
10182
  /*DO NOTHING*/
10170
10183
  }).catch(treatmentsChannelError=>{
10171
10184
  // TODO : FIXME : DUPLICATED CODE !!!
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.2038",
3
+ "version": "0.0.2039",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "aotrautils-srv",
9
- "version": "0.0.2038",
9
+ "version": "0.0.2039",
10
10
  "license": "HGPL-1.0",
11
11
  "dependencies": {
12
12
  "atob": "^2.1.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.2038",
3
+ "version": "0.0.2039",
4
4
  "main": "aotrautils-srv.build.js",
5
5
  "description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",