aotrautils-srv 0.0.222 → 0.0.223

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.0.0.000 (22/07/2022-01:01:02)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (30/07/2022-00:00:12)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -23,7 +23,6 @@
23
23
 
24
24
 
25
25
  // COMPATIBILITY browser javascript / nodejs environment :
26
-
27
26
  if(typeof(window)==="undefined") window=global;
28
27
 
29
28
 
@@ -4828,7 +4827,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4828
4827
 
4829
4828
 
4830
4829
 
4831
- /*utils SERVER library associated with aotra version : «1.0.0.000 (22/07/2022-01:01:02)»*/
4830
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (30/07/2022-00:00:12)»*/
4832
4831
  /*-----------------------------------------------------------------------------*/
4833
4832
 
4834
4833
 
@@ -4852,7 +4851,6 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4852
4851
 
4853
4852
 
4854
4853
  // COMPATIBILITY browser javascript / nodejs environment :
4855
-
4856
4854
  if(typeof(window)==="undefined") window=global;
4857
4855
 
4858
4856
 
@@ -4888,12 +4886,12 @@ const FILE_ENCODING="utf8";
4888
4886
  if(typeof(fs)==="undefined"){
4889
4887
  // TRACE
4890
4888
  console.log("WARN : Could not find the nodejs dependency «fs», aborting persister setup.");
4891
- window.getPersister=()=>{ return null; };
4889
+ getPersister=()=>{ return null; };
4892
4890
 
4893
4891
  }else{
4894
4892
 
4895
4893
 
4896
- window.getPersister=function(dataDirPath,suffix=""){
4894
+ getPersister=function(dataDirPath,suffix=""){
4897
4895
 
4898
4896
  let self={
4899
4897
 
@@ -5091,16 +5089,15 @@ WebsocketImplementation={
5091
5089
  // https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
5092
5090
  if(isNodeContext){
5093
5091
  if(typeof(WebSocket)==="undefined"){
5094
- WebSocket=require("ws");
5095
5092
  // TRACE
5096
5093
  console.log("«ws» SERVER library not called yet, calling it now.");
5094
+ WebSocket=require("ws");
5095
+ if(typeof(WebSocket)==="undefined"){
5096
+ // TRACE
5097
+ console.log("ERROR : «ws» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
5098
+ }
5097
5099
  return WebsocketImplementation;
5098
5100
  }
5099
- if(typeof(WebSocket)==="undefined"){
5100
- // TRACE
5101
- console.log("ERROR : «ws» CONSOLE/BROWSER CLIENT/SERVER library not found. Cannot launch nodejs server. Aborting.");
5102
- return WebsocketImplementation;
5103
- }
5104
5101
  }
5105
5102
 
5106
5103
  }
@@ -5446,7 +5443,7 @@ WebsocketImplementation={
5446
5443
  connectToServer:(serverURL, port, isSecure=false, timeout)=>{
5447
5444
 
5448
5445
  // TRACE
5449
- lognow("INFO : Using websocket implementation : "+(WebsocketImplementation.isNodeContext?"node (server-side)":"browser (client-side)"));
5446
+ lognow("INFO : Using socket library flavor : "+(WebsocketImplementation.isNodeContext?"node (client/server-side)":"browser (client-side only)"));
5450
5447
 
5451
5448
  if(WebsocketImplementation.isNodeContext)
5452
5449
  return WebsocketImplementation.connectToServerFromNode(serverURL, port, isSecure, timeout);
@@ -5462,16 +5459,18 @@ WebsocketImplementation={
5462
5459
  /*private*/connectToServerFromNode:(serverURL, port, isSecure, timeout)=>{
5463
5460
 
5464
5461
 
5465
- // NEW : ws :
5466
- if(typeof(WebSocket)==="undefined"){
5467
- // TRACE
5468
- lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
5469
- return null;
5470
- }
5471
-
5472
5462
  // NODE CLIENT MODE ONLY :
5473
5463
  let clientSocket;
5474
5464
  if(!WebsocketImplementation.useSocketIOImplementation){
5465
+
5466
+ // NEW : ws :
5467
+ if(typeof(WebSocket)==="undefined"){
5468
+ // TRACE
5469
+ lognow("ERROR : CLIENT : Could not find websocket client lib, aborting client connection.");
5470
+ return null;
5471
+ }
5472
+
5473
+
5475
5474
  clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{ rejectUnauthorized:false, secure: isSecure });
5476
5475
  }else{
5477
5476
  // NOW : socket.io :
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.222",
3
+ "version": "0.0.223",
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)",