aotrautils-srv 0.0.1899 → 0.0.1900

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.
@@ -0,0 +1 @@
1
+ /node_modules/
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- /*utils COMMONS library associated with aotra version : «1_29072022-2359 (25/07/2026-23:51:49)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (26/07/2026-02:13:18)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -2873,7 +2873,7 @@ window.hex2dec=function(h){
2873
2873
 
2874
2874
 
2875
2875
  window.hashSafe=function(str){
2876
- if(typeof(crypto)==="undefined" || typeof(crypto.createHash)==="undefined"){
2876
+ if(typeof(window.crypto)==="undefined" || typeof(window.crypto.createHash)==="undefined"){
2877
2877
 
2878
2878
  // // TRACE
2879
2879
  // console.log("ERROR : NodeJS installation does not include «crypto» node module dependency. Trying to use client-side hashing infrastructure.");
@@ -2898,7 +2898,7 @@ window.hashSafe=function(str){
2898
2898
  }
2899
2899
  return getHashedString(str);
2900
2900
  }
2901
- return crypto.createHash("md5").update(str).digest("hex");
2901
+ return window.crypto.createHash("md5").update(str).digest("hex");
2902
2902
  }
2903
2903
 
2904
2904
 
@@ -5470,7 +5470,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5470
5470
 
5471
5471
 
5472
5472
 
5473
- /*utils AI library associated with aotra version : «1_29072022-2359 (25/07/2026-23:51:49)»*/
5473
+ /*utils AI library associated with aotra version : «1_29072022-2359 (26/07/2026-02:13:18)»*/
5474
5474
  /*-----------------------------------------------------------------------------*/
5475
5475
 
5476
5476
 
@@ -5730,7 +5730,7 @@ getLLMAPIClient=(modelName, apiURL, agentRole, defaultPrompt, llmProviderName=DE
5730
5730
 
5731
5731
 
5732
5732
 
5733
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (25/07/2026-23:51:49)»*/
5733
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (26/07/2026-02:13:18)»*/
5734
5734
  /*-----------------------------------------------------------------------------*/
5735
5735
 
5736
5736
 
@@ -7705,7 +7705,8 @@ function capitalize(str){
7705
7705
  // COMPATIBILITY browser javascript / nodejs environment :
7706
7706
  if(typeof(window)==="undefined") window=global;
7707
7707
 
7708
-
7708
+ // Cryptography hashing utils :
7709
+ window.crypto=require("node:crypto");
7709
7710
 
7710
7711
  // OLD : socket.io :
7711
7712
  // https://stackoverflow.com/questions/31156884/how-to-use-https-on-node-js-using-express-socket-io
@@ -7734,16 +7735,13 @@ const ADD_CORS_HEADER=true;
7734
7735
  console.log("DEBUG : Importing «fs» dependency.");
7735
7736
 
7736
7737
 
7737
- if(typeof(require)!=="undefined" && typeof(fs)==="undefined" ){
7738
+ if(typeof(require)!=="undefined" && typeof(window.fs)==="undefined" ){
7738
7739
  window.fs=require("fs");
7739
7740
  }
7740
7741
 
7741
- // For debug (WORKAROUND):
7742
- fs=window.fs;
7743
-
7744
7742
 
7745
7743
  // Nodejs filesystem utils :
7746
- if(typeof(fs)==="undefined"){
7744
+ if(typeof(window.fs)==="undefined"){
7747
7745
  // TRACE
7748
7746
  console.log("WARN : Could not find the nodejs dependency «fs», aborting persister setup.");
7749
7747
  window.getPersister=()=>{ return null; };
@@ -7774,7 +7772,7 @@ if(typeof(fs)==="undefined"){
7774
7772
 
7775
7773
  try{
7776
7774
 
7777
- resultFlat=fs.readFileSync(path, FILE_ENCODING);
7775
+ resultFlat=window.fs.readFileSync(path, FILE_ENCODING);
7778
7776
 
7779
7777
  }catch(error){
7780
7778
  // TRACE
@@ -7816,7 +7814,7 @@ if(typeof(fs)==="undefined"){
7816
7814
 
7817
7815
 
7818
7816
  let path=self.getPath(clientId,repositoryName);
7819
- fs.writeFile(path, dataFlatStr, FILE_ENCODING, (error) => {
7817
+ window.fs.writeFile(path, dataFlatStr, FILE_ENCODING, (error) => {
7820
7818
  if(error){
7821
7819
  // TRACE
7822
7820
  console.log("ERROR : Could not write file «"+path+"»:",error);
@@ -7836,12 +7834,12 @@ if(typeof(fs)==="undefined"){
7836
7834
 
7837
7835
 
7838
7836
  window.fileExists=(filePath)=>{
7839
- if(typeof(fs)=="undefined"){
7837
+ if(typeof(window.fs)=="undefined"){
7840
7838
  // TRACE
7841
7839
  lognow("ERROR : «fs» node dependency is not available ! Cannot test if file exists.");
7842
7840
  return null;
7843
7841
  }
7844
- return fs.existsSync(filePath);
7842
+ return window.fs.existsSync(filePath);
7845
7843
  };
7846
7844
 
7847
7845
 
@@ -7869,16 +7867,12 @@ window.getURLOrConsoleParameter=(parameterName)=>{
7869
7867
 
7870
7868
  getConsoleServerParams=function(portParam=null, certPathParam=null, keyPathParam=null, ignoreConsoleArgs=false, argsOffset=0){
7871
7869
 
7872
- // Node dependencies :
7873
- // https=require("https");
7874
- // fs=require("fs");
7875
-
7876
- if(typeof(https)==="undefined"){
7870
+ if(typeof(window.https)==="undefined"){
7877
7871
  // TRACE
7878
7872
  console.log("WARN : Could not find the nodejs dependency «https», aborting SSL setup.");
7879
7873
  return null;
7880
7874
  }
7881
- if(typeof(fs)==="undefined"){
7875
+ if(typeof(window.fs)==="undefined"){
7882
7876
  // TRACE
7883
7877
  console.log("WARN : Could not find the nodejs dependency «fs», aborting SSL setup.");
7884
7878
  return null;
@@ -7907,8 +7901,8 @@ getConsoleServerParams=function(portParam=null, certPathParam=null, keyPathParam
7907
7901
  result.sslOptions=null;
7908
7902
  if(result.isSecure){
7909
7903
  result.sslOptions={
7910
- cert: fs.readFileSync(result.certPath),
7911
- key: fs.readFileSync(result.keyPath),
7904
+ cert:window.fs.readFileSync(result.certPath),
7905
+ key:window.fs.readFileSync(result.keyPath),
7912
7906
  };
7913
7907
  }
7914
7908
 
@@ -8308,15 +8302,15 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, d
8308
8302
  const EXCLUDED_FILENAMES_PARTS=[".keyHash.",".pem"];
8309
8303
 
8310
8304
 
8311
- if(typeof(https)==="undefined"){
8305
+ if(typeof(window.https)==="undefined"){
8312
8306
  // TRACE
8313
8307
  console.log("«https» SERVER library not called yet, calling it now.");
8314
- https=require("https");
8308
+ window.https=require("https");
8315
8309
  }
8316
- if(typeof(http)==="undefined"){
8310
+ if(typeof(window.http)==="undefined"){
8317
8311
  // TRACE
8318
8312
  console.log("«http» SERVER library not called yet, calling it now.");
8319
- http=require("http");
8313
+ window.http=require("http");
8320
8314
  }
8321
8315
 
8322
8316
 
@@ -8357,13 +8351,13 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, d
8357
8351
  if(addCORSHeader) headers["Access-Control-Allow-Origin"]="*";
8358
8352
 
8359
8353
 
8360
- fs.readFile(filePath, function(error, fileContent){
8354
+ window.fs.readFile(filePath, function(error, fileContent){
8361
8355
  if(error){
8362
8356
  if(error.code=="ENOENT"){
8363
8357
  // TRACE
8364
8358
  console.log("ERROR 404 file not found :"+filePath);
8365
8359
 
8366
- fs.readFile("./404.html", function(error, fileContent){
8360
+ window.fs.readFile("./404.html", function(error, fileContent){
8367
8361
  response.writeHead(200, headers);
8368
8362
  response.end(fileContent, "utf-8");
8369
8363
  });
@@ -8402,12 +8396,12 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, d
8402
8396
 
8403
8397
  let listenableServer;
8404
8398
  if(sslOptions){
8405
- let httpsServer=https.createServer(sslOptions, handler).listen(port);
8399
+ let httpsServer=window.https.createServer(sslOptions, handler).listen(port);
8406
8400
  // TRACE
8407
8401
  console.log("INFO : SERVER : HTTPS Server launched and listening on port " + port + "!");
8408
8402
  listenableServer=httpsServer;
8409
8403
  }else{
8410
- let httpServer=http.createServer(handler).listen(port);
8404
+ let httpServer=window.http.createServer(handler).listen(port);
8411
8405
  // TRACE
8412
8406
  console.log("INFO : SERVER : HTTP Server launched and listening on port " + port + "!");
8413
8407
  listenableServer=httpServer;
@@ -8565,14 +8559,14 @@ initNodeServerInfrastructureWrapper=function(doOnClientConnection=null, doOnFina
8565
8559
  // Eventual encryption options :
8566
8560
  let sslOptions=null;
8567
8561
  if(!isForceUnsecure){
8568
- if(typeof(fs)==="undefined"){
8562
+ if(typeof(window.fs)==="undefined"){
8569
8563
  // TRACE
8570
8564
  lognow("ERROR : «fs» node subsystem not present, cannot access files. Aborting SSL configuration of server.");
8571
8565
  }else{
8572
8566
  try{
8573
8567
  sslOptions={
8574
- cert: fs.readFileSync(certPath, {encoding: "utf8"}),
8575
- key: fs.readFileSync(keyPath, {encoding: "utf8"}),
8568
+ cert:window.fs.readFileSync(certPath, {encoding: "utf8"}),
8569
+ key:window.fs.readFileSync(keyPath, {encoding: "utf8"}),
8576
8570
  };
8577
8571
  }catch(exception){
8578
8572
  // TRACE
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1899",
3
+ "version": "0.0.1900",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "aotrautils-srv",
9
- "version": "0.0.1899",
9
+ "version": "0.0.1900",
10
10
  "license": "HGPL-1.0",
11
11
  "dependencies": {
12
12
  "atob": "^2.1.2",
13
+ "crypto": "^1.0.1",
13
14
  "fs": "^0.0.1-security",
14
15
  "https": "^1.0.0",
15
16
  "sjcl": "^1.0.8",
@@ -32,6 +33,13 @@
32
33
  "node": ">= 4.5.0"
33
34
  }
34
35
  },
36
+ "node_modules/crypto": {
37
+ "version": "1.0.1",
38
+ "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
39
+ "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==",
40
+ "deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.",
41
+ "license": "ISC"
42
+ },
35
43
  "node_modules/fs": {
36
44
  "version": "0.0.1-security",
37
45
  "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1899",
3
+ "version": "0.0.1900",
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)",