aotrautils-srv 0.0.2037 → 0.0.2038

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 (15/10/2026-21:45:34)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (17/10/2026-01:27:15)»*/
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 (15/10/2026-21:45:34)»*/
5488
+ /*utils AI library associated with aotra version : «1_29072022-2359 (17/10/2026-01:27:15)»*/
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 (15/10/2026-21:45:34)»*/
5752
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (17/10/2026-01:27:15)»*/
5753
5753
  /*-----------------------------------------------------------------------------*/
5754
5754
 
5755
5755
 
@@ -9374,7 +9374,7 @@ if(typeof(window)==="undefined") window=global;
9374
9374
  // clientSocket.isConnectionAlive=true;
9375
9375
  //});
9376
9376
 
9377
-
9377
+ const ERRORS_CHANNEL_NAME="errors";
9378
9378
 
9379
9379
 
9380
9380
  // ==================================================================================================================
@@ -9774,6 +9774,7 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9774
9774
 
9775
9775
  // Executed whenever any message is received on any channel :
9776
9776
  executeAll(eventOrMessage, clientSocket=null){ // FOR REAL-TIME ONLY :
9777
+ const self=this;
9777
9778
 
9778
9779
  const clientsRoomsTag=this.clientsRoomsTag;
9779
9780
  if(!window.WebsocketImplementation.isInRoom(clientSocket, clientsRoomsTag)) return;
@@ -9801,7 +9802,7 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9801
9802
  // TRACE
9802
9803
  lognow(errorMessage, treatmentsChannelError);
9803
9804
  const errorDataWrapped={errorMessage:errorMessage, cause:treatmentsChannelError};
9804
- self.sendError(errorDataWrapped, clientSocket);
9805
+ self.server.sendError(errorDataWrapped, clientSocket);
9805
9806
  });
9806
9807
 
9807
9808
  });
@@ -9811,7 +9812,7 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9811
9812
  // TRACE
9812
9813
  lognow(errorMessage, error);
9813
9814
  const errorDataWrapped={errorMessage:errorMessage, cause:error};
9814
- self.sendError(errorDataWrapped, clientSocket);
9815
+ self.server.sendError(errorDataWrapped, clientSocket);
9815
9816
  });
9816
9817
 
9817
9818
  }
@@ -10102,7 +10103,29 @@ window.NodeServerInstance=class NodeServerInstance{
10102
10103
 
10103
10104
  return dataWrapped;
10104
10105
  }
10105
-
10106
+
10107
+
10108
+ /*private*/sendError(error, clientSocketParam=null){
10109
+ // CAUTION ! NEVER DO THIS : clientSocketParam.send(...) ! (because it directly calls a single socket implementation !)
10110
+
10111
+ let errorMessageToSend=error;
10112
+ if(contains(typeof(error),"Error")){
10113
+ errorMessageToSend={
10114
+ type: error.type,
10115
+ httpStatus:error.httpStatus,
10116
+ error:(isString(error) ?
10117
+ {errorMessage:error}
10118
+ : {errorMessage:error.errorMessage, cause:(error.cause?{message:error.cause.message}:null)})
10119
+ };
10120
+ }
10121
+
10122
+ if(clientSocketParam){
10123
+ return this.send(ERRORS_CHANNEL_NAME, errorMessageToSend, null, clientSocketParam);
10124
+ }
10125
+ return errorMessageToSend;
10126
+ }
10127
+
10128
+
10106
10129
 
10107
10130
  onConnectionToClient(doOnConnection, doOnConnectionLost=null){
10108
10131
  const self=this;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.2037",
3
+ "version": "0.0.2038",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "aotrautils-srv",
9
- "version": "0.0.2037",
9
+ "version": "0.0.2038",
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.2037",
3
+ "version": "0.0.2038",
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)",