aotrautils 0.0.1900 → 0.0.1902

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.
aotrautils/.gitignore ADDED
@@ -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:45)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (26/07/2026-02:34:09)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -29,7 +29,7 @@ if(typeof(window)==="undefined") window=global;
29
29
 
30
30
  //=========================================================================
31
31
  // GLOBAL CONSTANTS :
32
- PERFORM_TESTS_ON_LIBRARY=false;
32
+ window.PERFORM_TESTS_ON_LIBRARY=false;
33
33
 
34
34
  //FLATTEN / UNFLATTEN JSON CONSTANTS :
35
35
 
@@ -2690,7 +2690,7 @@ window.startsWith=window.aotest({
2690
2690
  scenario2ok : [ [ "https://example.com", "http://" ], false ]
2691
2691
  }, function(str, subStr){
2692
2692
  return str.lastIndexOf(subStr, 0) === 0;
2693
- }, !PERFORM_TESTS_ON_LIBRARY);
2693
+ }, !window.PERFORM_TESTS_ON_LIBRARY);
2694
2694
 
2695
2695
 
2696
2696
 
@@ -2860,7 +2860,7 @@ scenario4 : [ [ " test1 \r\r\ntest2", "compactHTML" ], "test1 \n\n\ntest2" ]
2860
2860
 
2861
2861
  // «Soft» mode is default mode :
2862
2862
  return str.replace(/[\s\t\n\r]+/igm, " ").trim();
2863
- }, !PERFORM_TESTS_ON_LIBRARY);
2863
+ }, !window.PERFORM_TESTS_ON_LIBRARY);
2864
2864
 
2865
2865
 
2866
2866
  window.dec2hex=function(d){
@@ -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
 
@@ -3414,7 +3414,7 @@ window.aotest({
3414
3414
  dummy : "obj1"
3415
3415
  } ], false ]
3416
3416
 
3417
- }, isArray, !PERFORM_TESTS_ON_LIBRARY);
3417
+ }, isArray, !window.PERFORM_TESTS_ON_LIBRARY);
3418
3418
 
3419
3419
  window.arraysEqual=function(array1, array2){
3420
3420
  if(!array1 && !array2)
@@ -3500,7 +3500,7 @@ window.aotest({
3500
3500
  dummy : "tab8"
3501
3501
  } ], true ]
3502
3502
 
3503
- }, arraysEqual, !PERFORM_TESTS_ON_LIBRARY);
3503
+ }, arraysEqual, !window.PERFORM_TESTS_ON_LIBRARY);
3504
3504
 
3505
3505
  window.objectsEqual=window.aotest({
3506
3506
  name : "objectsEqual",
@@ -3575,7 +3575,7 @@ window.objectsEqual=window.aotest({
3575
3575
  }
3576
3576
 
3577
3577
  return true;
3578
- }, !PERFORM_TESTS_ON_LIBRARY);
3578
+ }, !window.PERFORM_TESTS_ON_LIBRARY);
3579
3579
 
3580
3580
 
3581
3581
 
@@ -3698,7 +3698,7 @@ Math.coerceInRange=window.aotest({
3698
3698
  value=Math.abs(value);
3699
3699
  }
3700
3700
  return Math.min(Math.max(value, min), max);
3701
- }, !PERFORM_TESTS_ON_LIBRARY);
3701
+ }, !window.PERFORM_TESTS_ON_LIBRARY);
3702
3702
 
3703
3703
 
3704
3704
  Math.getMinMax=function(strMinMaxRange, separator="¬>"){
@@ -5470,7 +5470,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5470
5470
 
5471
5471
 
5472
5472
 
5473
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (25/07/2026-23:51:45)»*/
5473
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (26/07/2026-02:34:09)»*/
5474
5474
  /*-----------------------------------------------------------------------------*/
5475
5475
  /* ## Utility global methods in a browser (htmljs) client environment.
5476
5476
  *
@@ -5501,7 +5501,7 @@ if(typeof(window)==="undefined") window=global;
5501
5501
  // GLOBAL CONSTANTS :
5502
5502
 
5503
5503
  const APOSTROPHE="’";
5504
- PERFORM_TESTS_ON_LIBRARY=false;
5504
+ window.PERFORM_TESTS_ON_LIBRARY=false;
5505
5505
 
5506
5506
  // CAUTION ! Apparently nodejs ECMAscript does not do lazy evaluation when it's for throwing declaraion exceptions (it's logical, when you think a second about it..)
5507
5507
  function isUserMediaAvailable(){
@@ -5515,7 +5515,7 @@ if(typeof aotest === "undefined"){
5515
5515
  // If aotest library is not available, then we replace aotest calls with simple tested function calls :
5516
5516
  aotest=function(testcase,testedFunction){ return testedFunction; };
5517
5517
  // TRACE IF NEEDED
5518
- if(PERFORM_TESTS_ON_LIBRARY) console.log("WARN : aotest library not found, deactivating aotest unit test abilities.");
5518
+ if(window.PERFORM_TESTS_ON_LIBRARY) console.log("WARN : aotest library not found, deactivating aotest unit test abilities.");
5519
5519
  }
5520
5520
  if(typeof monitorProgression === "undefined"){
5521
5521
  monitorProgression=function(progressionTotalAmount,monitoredFunction){ return monitoredFunction; };
@@ -5826,7 +5826,7 @@ cssStringToJQueryObject=aotest({
5826
5826
  result[name.replace("*/", "").trim()]=value;
5827
5827
  }
5828
5828
  return result;
5829
- }, !PERFORM_TESTS_ON_LIBRARY);
5829
+ }, !window.PERFORM_TESTS_ON_LIBRARY);
5830
5830
 
5831
5831
  // HTML elements management :
5832
5832
 
@@ -6388,7 +6388,7 @@ var isURLHttps=aotest(
6388
6388
  // Function definition
6389
6389
  , function(url){
6390
6390
  return startsWith(url.toLowerCase(), "https://");
6391
- }, !PERFORM_TESTS_ON_LIBRARY);
6391
+ }, !window.PERFORM_TESTS_ON_LIBRARY);
6392
6392
 
6393
6393
 
6394
6394
  /*DEPRECATED, use new URL("...") instead !*/
@@ -12296,7 +12296,7 @@ window.gpioUtils = {
12296
12296
 
12297
12297
  const gpioFilePath = GPIO_BASE_PATH + "/gpio" + gpioNumber;
12298
12298
  const setDirection = () => {
12299
- fs.writeFile(gpioFilePath + "/direction", mode + "", (error) => {
12299
+ window.fs.writeFile(gpioFilePath + "/direction", mode + "", (error) => {
12300
12300
  if (error) {
12301
12301
  // TRACE
12302
12302
  lognow("ERROR : Could not set mode «" + mode + "» on pin «" + gpioNumber + "». Abording setup.", error);
@@ -12306,11 +12306,11 @@ window.gpioUtils = {
12306
12306
  });
12307
12307
  };
12308
12308
 
12309
- fs.access(gpioFilePath, fs.constants.F_OK, (error) => {
12309
+ window.fs.access(gpioFilePath, window.fs.constants.F_OK, (error) => {
12310
12310
  if (error) {
12311
12311
  // Case export file does not exists
12312
12312
  // In this case we export the gpio pin :
12313
- fs.writeFile(GPIO_BASE_PATH + "/export", gpioNumber + "", (error) => {
12313
+ window.fs.writeFile(GPIO_BASE_PATH + "/export", gpioNumber + "", (error) => {
12314
12314
  if (error) {
12315
12315
  // TRACE
12316
12316
  lognow("ERROR : Could not export pin «" + gpioNumber + "». Abording setup.", error);
@@ -12333,7 +12333,7 @@ window.gpioUtils = {
12333
12333
  }
12334
12334
 
12335
12335
  const gpioFilePath = GPIO_BASE_PATH + "/gpio" + gpioNumber;
12336
- fs.access(gpioFilePath, fs.constants.F_OK, (error) => {
12336
+ window.fs.access(gpioFilePath, window.fs.constants.F_OK, (error) => {
12337
12337
  if (error) {
12338
12338
  // Case export file does not exists
12339
12339
  // TRACE
@@ -12342,7 +12342,7 @@ window.gpioUtils = {
12342
12342
  }
12343
12343
  // Case export file already exists
12344
12344
  // In this case we export the gpio pin :
12345
- fs.writeFile(GPIO_BASE_PATH + "/unexport", gpioNumber + "", (error) => {
12345
+ window.fs.writeFile(GPIO_BASE_PATH + "/unexport", gpioNumber + "", (error) => {
12346
12346
  if (error) {
12347
12347
  // TRACE
12348
12348
  lognow("ERROR : Could not unexport pin «" + gpioNumber + "».", error);
@@ -12363,7 +12363,7 @@ window.gpioUtils = {
12363
12363
 
12364
12364
 
12365
12365
  const gpioFilePath = GPIO_BASE_PATH + "/gpio" + gpioNumber;
12366
- fs.access(gpioFilePath, fs.constants.F_OK, (error) => {
12366
+ window.fs.access(gpioFilePath, window.fs.constants.F_OK, (error) => {
12367
12367
  if (error) {
12368
12368
  // Case export file does not exists
12369
12369
  // TRACE
@@ -12376,7 +12376,7 @@ window.gpioUtils = {
12376
12376
 
12377
12377
  // Case export file already exists
12378
12378
  // In this case we export the gpio pin :
12379
- fs.writeFile(gpioFilePath + "/value", stateNumber + "", (error) => {
12379
+ window.fs.writeFile(gpioFilePath + "/value", stateNumber + "", (error) => {
12380
12380
  if (error) {
12381
12381
  // TRACE
12382
12382
  lognow("ERROR : Could not write «" + stateNumber + "» on pin «" + gpioNumber + "».", error);
@@ -12396,7 +12396,7 @@ window.gpioUtils = {
12396
12396
  }
12397
12397
 
12398
12398
  const gpioFilePath = GPIO_BASE_PATH + "/gpio" + gpioNumber;
12399
- fs.access(gpioFilePath, fs.constants.F_OK, (error) => {
12399
+ window.fs.access(gpioFilePath, window.fs.constants.F_OK, (error) => {
12400
12400
  if (error) {
12401
12401
  // Case export file does not exists
12402
12402
  // TRACE
@@ -12406,7 +12406,7 @@ window.gpioUtils = {
12406
12406
 
12407
12407
  // Case export file already exists
12408
12408
  // In this case we export the gpio pin :
12409
- fs.readFile(gpioFilePath + "/value", "utf-8", (error, data) => {
12409
+ window.fs.readFile(gpioFilePath + "/value", "utf-8", (error, data) => {
12410
12410
 
12411
12411
  // // DBG
12412
12412
  // lognow("DEBUG : read value:"+data);
@@ -13291,7 +13291,7 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
13291
13291
 
13292
13292
 
13293
13293
 
13294
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (25/07/2026-23:51:45)»*/
13294
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (26/07/2026-02:34:09)»*/
13295
13295
  /*-----------------------------------------------------------------------------*/
13296
13296
 
13297
13297
 
@@ -14376,10 +14376,10 @@ function rayVsUnitSphereClosestPoint(p, r) {
14376
14376
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14377
14377
 
14378
14378
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14379
- /*utils 3D library associated with aotra version : «1_29072022-2359 (25/07/2026-23:51:45)»*/
14379
+ /*utils 3D library associated with aotra version : «1_29072022-2359 (26/07/2026-02:34:09)»*/
14380
14380
  /*-----------------------------------------------------------------------------*/
14381
14381
 
14382
- /*utils AI library associated with aotra version : «1_29072022-2359 (25/07/2026-23:51:45)»*/
14382
+ /*utils AI library associated with aotra version : «1_29072022-2359 (26/07/2026-02:34:09)»*/
14383
14383
  /*-----------------------------------------------------------------------------*/
14384
14384
 
14385
14385
 
@@ -14639,7 +14639,7 @@ getLLMAPIClient=(modelName, apiURL, agentRole, defaultPrompt, llmProviderName=DE
14639
14639
 
14640
14640
 
14641
14641
 
14642
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (25/07/2026-23:51:45)»*/
14642
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (26/07/2026-02:34:09)»*/
14643
14643
  /*-----------------------------------------------------------------------------*/
14644
14644
 
14645
14645
 
@@ -16285,7 +16285,7 @@ window.getCurrentLevelPrototypeNameForAORTACServerCell=()=>{
16285
16285
 
16286
16286
 
16287
16287
  // COMPATIBILITY browser javascript / nodejs environment :
16288
- if(typeof(window)==="undefined") window=global;
16288
+ if(typeof(window)==="undefined") window=global;
16289
16289
 
16290
16290
 
16291
16291
  // ==================================================================================================================
@@ -16614,7 +16614,8 @@ function capitalize(str){
16614
16614
  // COMPATIBILITY browser javascript / nodejs environment :
16615
16615
  if(typeof(window)==="undefined") window=global;
16616
16616
 
16617
-
16617
+ // Cryptography hashing utils :
16618
+ window.crypto=require("node:crypto");
16618
16619
 
16619
16620
  // OLD : socket.io :
16620
16621
  // https://stackoverflow.com/questions/31156884/how-to-use-https-on-node-js-using-express-socket-io
@@ -16643,16 +16644,13 @@ const ADD_CORS_HEADER=true;
16643
16644
  console.log("DEBUG : Importing «fs» dependency.");
16644
16645
 
16645
16646
 
16646
- if(typeof(require)!=="undefined" && typeof(fs)==="undefined" ){
16647
+ if(typeof(require)!=="undefined" && typeof(window.fs)==="undefined" ){
16647
16648
  window.fs=require("fs");
16648
16649
  }
16649
16650
 
16650
- // For debug (WORKAROUND):
16651
- fs=window.fs;
16652
-
16653
16651
 
16654
16652
  // Nodejs filesystem utils :
16655
- if(typeof(fs)==="undefined"){
16653
+ if(typeof(window.fs)==="undefined"){
16656
16654
  // TRACE
16657
16655
  console.log("WARN : Could not find the nodejs dependency «fs», aborting persister setup.");
16658
16656
  window.getPersister=()=>{ return null; };
@@ -16683,7 +16681,7 @@ if(typeof(fs)==="undefined"){
16683
16681
 
16684
16682
  try{
16685
16683
 
16686
- resultFlat=fs.readFileSync(path, FILE_ENCODING);
16684
+ resultFlat=window.fs.readFileSync(path, FILE_ENCODING);
16687
16685
 
16688
16686
  }catch(error){
16689
16687
  // TRACE
@@ -16725,7 +16723,7 @@ if(typeof(fs)==="undefined"){
16725
16723
 
16726
16724
 
16727
16725
  let path=self.getPath(clientId,repositoryName);
16728
- fs.writeFile(path, dataFlatStr, FILE_ENCODING, (error) => {
16726
+ window.fs.writeFile(path, dataFlatStr, FILE_ENCODING, (error) => {
16729
16727
  if(error){
16730
16728
  // TRACE
16731
16729
  console.log("ERROR : Could not write file «"+path+"»:",error);
@@ -16745,12 +16743,12 @@ if(typeof(fs)==="undefined"){
16745
16743
 
16746
16744
 
16747
16745
  window.fileExists=(filePath)=>{
16748
- if(typeof(fs)=="undefined"){
16746
+ if(typeof(window.fs)=="undefined"){
16749
16747
  // TRACE
16750
16748
  lognow("ERROR : «fs» node dependency is not available ! Cannot test if file exists.");
16751
16749
  return null;
16752
16750
  }
16753
- return fs.existsSync(filePath);
16751
+ return window.fs.existsSync(filePath);
16754
16752
  };
16755
16753
 
16756
16754
 
@@ -16778,16 +16776,12 @@ window.getURLOrConsoleParameter=(parameterName)=>{
16778
16776
 
16779
16777
  getConsoleServerParams=function(portParam=null, certPathParam=null, keyPathParam=null, ignoreConsoleArgs=false, argsOffset=0){
16780
16778
 
16781
- // Node dependencies :
16782
- // https=require("https");
16783
- // fs=require("fs");
16784
-
16785
- if(typeof(https)==="undefined"){
16779
+ if(typeof(window.https)==="undefined"){
16786
16780
  // TRACE
16787
16781
  console.log("WARN : Could not find the nodejs dependency «https», aborting SSL setup.");
16788
16782
  return null;
16789
16783
  }
16790
- if(typeof(fs)==="undefined"){
16784
+ if(typeof(window.fs)==="undefined"){
16791
16785
  // TRACE
16792
16786
  console.log("WARN : Could not find the nodejs dependency «fs», aborting SSL setup.");
16793
16787
  return null;
@@ -16816,8 +16810,8 @@ getConsoleServerParams=function(portParam=null, certPathParam=null, keyPathParam
16816
16810
  result.sslOptions=null;
16817
16811
  if(result.isSecure){
16818
16812
  result.sslOptions={
16819
- cert: fs.readFileSync(result.certPath),
16820
- key: fs.readFileSync(result.keyPath),
16813
+ cert:window.fs.readFileSync(result.certPath),
16814
+ key:window.fs.readFileSync(result.keyPath),
16821
16815
  };
16822
16816
  }
16823
16817
 
@@ -17217,15 +17211,15 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, d
17217
17211
  const EXCLUDED_FILENAMES_PARTS=[".keyHash.",".pem"];
17218
17212
 
17219
17213
 
17220
- if(typeof(https)==="undefined"){
17214
+ if(typeof(window.https)==="undefined"){
17221
17215
  // TRACE
17222
17216
  console.log("«https» SERVER library not called yet, calling it now.");
17223
- https=require("https");
17217
+ window.https=require("https");
17224
17218
  }
17225
- if(typeof(http)==="undefined"){
17219
+ if(typeof(window.http)==="undefined"){
17226
17220
  // TRACE
17227
17221
  console.log("«http» SERVER library not called yet, calling it now.");
17228
- http=require("http");
17222
+ window.http=require("http");
17229
17223
  }
17230
17224
 
17231
17225
 
@@ -17266,13 +17260,13 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, d
17266
17260
  if(addCORSHeader) headers["Access-Control-Allow-Origin"]="*";
17267
17261
 
17268
17262
 
17269
- fs.readFile(filePath, function(error, fileContent){
17263
+ window.fs.readFile(filePath, function(error, fileContent){
17270
17264
  if(error){
17271
17265
  if(error.code=="ENOENT"){
17272
17266
  // TRACE
17273
17267
  console.log("ERROR 404 file not found :"+filePath);
17274
17268
 
17275
- fs.readFile("./404.html", function(error, fileContent){
17269
+ window.fs.readFile("./404.html", function(error, fileContent){
17276
17270
  response.writeHead(200, headers);
17277
17271
  response.end(fileContent, "utf-8");
17278
17272
  });
@@ -17311,12 +17305,12 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, d
17311
17305
 
17312
17306
  let listenableServer;
17313
17307
  if(sslOptions){
17314
- let httpsServer=https.createServer(sslOptions, handler).listen(port);
17308
+ let httpsServer=window.https.createServer(sslOptions, handler).listen(port);
17315
17309
  // TRACE
17316
17310
  console.log("INFO : SERVER : HTTPS Server launched and listening on port " + port + "!");
17317
17311
  listenableServer=httpsServer;
17318
17312
  }else{
17319
- let httpServer=http.createServer(handler).listen(port);
17313
+ let httpServer=window.http.createServer(handler).listen(port);
17320
17314
  // TRACE
17321
17315
  console.log("INFO : SERVER : HTTP Server launched and listening on port " + port + "!");
17322
17316
  listenableServer=httpServer;
@@ -17474,14 +17468,14 @@ initNodeServerInfrastructureWrapper=function(doOnClientConnection=null, doOnFina
17474
17468
  // Eventual encryption options :
17475
17469
  let sslOptions=null;
17476
17470
  if(!isForceUnsecure){
17477
- if(typeof(fs)==="undefined"){
17471
+ if(typeof(window.fs)==="undefined"){
17478
17472
  // TRACE
17479
17473
  lognow("ERROR : «fs» node subsystem not present, cannot access files. Aborting SSL configuration of server.");
17480
17474
  }else{
17481
17475
  try{
17482
17476
  sslOptions={
17483
- cert: fs.readFileSync(certPath, {encoding: "utf8"}),
17484
- key: fs.readFileSync(keyPath, {encoding: "utf8"}),
17477
+ cert:window.fs.readFileSync(certPath, {encoding: "utf8"}),
17478
+ key:window.fs.readFileSync(keyPath, {encoding: "utf8"}),
17485
17479
  };
17486
17480
  }catch(exception){
17487
17481
  // TRACE
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1900",
3
+ "version": "0.0.1902",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "aotrautils",
9
- "version": "0.0.1900",
9
+ "version": "0.0.1902",
10
10
  "license": "HGPL-1.0",
11
11
  "dependencies": {
12
12
  "atob": "^2.1.2",
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1900",
3
+ "version": "0.0.1902",
4
4
  "main": "aotrautils.build.js",
5
5
  "description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",