aotrautils 0.0.1815 → 0.0.1816

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/03/2026-14:56:54)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (16/03/2026-18:05:12)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -3209,7 +3209,7 @@ window.containsIgnoreCase=function(str, chunk,/*OPTIONAL*/useRegexp){
3209
3209
  };
3210
3210
 
3211
3211
  window.isString=function (str){
3212
- return str && typeof(str)==="string";
3212
+ return str!=null && typeof(str)==="string";
3213
3213
  };
3214
3214
 
3215
3215
  window.containsOneOf=function(container, objectsToFind,/*OPTIONAL*/useRegexp=false,searchInKeysOnly=false){
@@ -5076,7 +5076,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5076
5076
 
5077
5077
 
5078
5078
 
5079
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (15/03/2026-14:56:54)»*/
5079
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (16/03/2026-18:05:12)»*/
5080
5080
  /*-----------------------------------------------------------------------------*/
5081
5081
  /* ## Utility global methods in a browser (htmljs) client environment.
5082
5082
  *
@@ -11469,90 +11469,6 @@ function getPointsFromSVGDString(str){
11469
11469
 
11470
11470
 
11471
11471
 
11472
- // -Client :
11473
-
11474
- // TODO : Use everywhere it's applicable !
11475
- initClient=function(isNodeContext=true, useSocketIOImplementation=/*DEBUG*/false, doOnServerConnection=null, url, /*OPTIONAL*/port=25000, isSecure=true, /*OPTIONAL*/timeout=10000, /*OPTIONAL*/selfParam=null){
11476
- let aotraClient={};
11477
-
11478
- aotraClient.client={};
11479
- aotraClient.client.start=function(){
11480
-
11481
- // DBG
11482
- lognow("INFO : Setting up client :...");
11483
-
11484
- let socketToServerClientInstance=WebsocketImplementation.getStatic(isNodeContext, useSocketIOImplementation).connectToServer(url, port, isSecure, timeout);
11485
- if(!socketToServerClientInstance){
11486
- // TRACE
11487
- lognow("ERROR : CLIENT : Could not get socketToServerClientInstance, aborting client connection.");
11488
- return null;
11489
- }
11490
-
11491
- // When client is connected, we execute the callback :
11492
- // CAUTION : MUST BE CALLED ONLY ONCE !
11493
- socketToServerClientInstance.onConnectionToServer(()=>{
11494
- if(doOnServerConnection){
11495
- if(selfParam) doOnServerConnection.apply(selfParam,[socketToServerClientInstance]);
11496
- else doOnServerConnection(socketToServerClientInstance);
11497
- }
11498
-
11499
-
11500
- });
11501
-
11502
- // // Errors handling :
11503
- // if(doOnError && useSocketIOImplementation /*TODO : FIXME: FOR NOW, ONLY WORKS FOR SOCKET.IO IMPLEMENTATION !'*/){
11504
- //
11505
- //// // DBG
11506
- //// lognow(">>> serverSocket:",serverSocket);
11507
- //
11508
- //
11509
- // const errorMethod=function(){
11510
- // // TRACE
11511
- // lognow("ERROR : CLIENT : Client encountered an error while trying to connect to server.");
11512
- //
11513
- // if(selfParam) doOnError.apply(selfParam);
11514
- // else doOnError();
11515
- // };
11516
- //
11517
- // socketToServerClientInstance.clientSocket.on("connect_error", errorMethod);
11518
- //
11519
- //// // DOES NOT SEEM TO WORK :
11520
- //// socketToServerClientInstance.on("connect_failed", errorMethod);
11521
- //// // DOES NOT SEEM TO WORK :
11522
- //// socketToServerClientInstance.on("error", errorMethod);
11523
- //
11524
- // }
11525
- //
11526
- // // Data messages handling :
11527
- // if(doOnMessage){
11528
- // socketToServerClientInstance.onIncomingMessage((message)=>{
11529
- // if(selfParam) doOnMessage.apply(selfParam,[message]);
11530
- // else doOnMessage(message);
11531
- // });
11532
- // }
11533
-
11534
- // DBG
11535
- lognow("aotraClient.client:",aotraClient.client);
11536
-
11537
- // DBG
11538
- // aotraClient.clientSocket.addEventListener("close",()=>{
11539
- // // TRACE
11540
- // lognow("WARN : CONNECTION CLOSED !");
11541
- // });
11542
-
11543
-
11544
- aotraClient.client.socketToServerClientInstance=socketToServerClientInstance;
11545
-
11546
- return aotraClient;
11547
- };
11548
-
11549
-
11550
- return aotraClient;
11551
- }
11552
-
11553
-
11554
-
11555
-
11556
11472
  // ========================= FUSRODA CLIENT : =========================
11557
11473
 
11558
11474
  class VNCFrame2D{
@@ -13245,7 +13161,7 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
13245
13161
 
13246
13162
 
13247
13163
 
13248
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (15/03/2026-14:56:54)»*/
13164
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (16/03/2026-18:05:12)»*/
13249
13165
  /*-----------------------------------------------------------------------------*/
13250
13166
 
13251
13167
 
@@ -14574,10 +14490,10 @@ function rayVsUnitSphereClosestPoint(p, r) {
14574
14490
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14575
14491
 
14576
14492
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14577
- /*utils 3D library associated with aotra version : «1_29072022-2359 (15/03/2026-14:56:54)»*/
14493
+ /*utils 3D library associated with aotra version : «1_29072022-2359 (16/03/2026-18:05:12)»*/
14578
14494
  /*-----------------------------------------------------------------------------*/
14579
14495
 
14580
- /*utils AI library associated with aotra version : «1_29072022-2359 (15/03/2026-14:56:54)»*/
14496
+ /*utils AI library associated with aotra version : «1_29072022-2359 (16/03/2026-18:05:12)»*/
14581
14497
  /*-----------------------------------------------------------------------------*/
14582
14498
 
14583
14499
 
@@ -14723,7 +14639,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
14723
14639
 
14724
14640
 
14725
14641
 
14726
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (15/03/2026-14:56:54)»*/
14642
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (16/03/2026-18:05:12)»*/
14727
14643
  /*-----------------------------------------------------------------------------*/
14728
14644
 
14729
14645
 
@@ -14771,10 +14687,14 @@ class AORTACServerCell{
14771
14687
 
14772
14688
  this.quorumNumber=quorumNumber;
14773
14689
  this.selfOrigin=selfOrigin;
14774
- const splits=splitURL(this.selfOrigin);
14775
- this.protocol=nonull(splits.protocol,"ws");
14776
- this.host=nonull(splits.host,"localhost");
14777
- this.port=nonull(splits.port,"30000");
14690
+ const infos=splitURL(this.selfOrigin);
14691
+
14692
+ //DBG
14693
+ lognow("infos:::::::::::::",infos);
14694
+
14695
+ this.protocol=nonull(infos.protocol,"ws");
14696
+ this.host=nonull(infos.host,"localhost");
14697
+ this.port=nonull(infos.port,"30000");
14778
14698
  this.sslConfig=sslConfig;
14779
14699
 
14780
14700
  this.server=null;
@@ -14882,10 +14802,10 @@ class AORTACServerCell{
14882
14802
  // We try to connect to all outcoming cells :
14883
14803
  foreach(this.outcomingCells, (outcomingCell, outcomingCellOrigin)=>{
14884
14804
 
14885
- const splits=splitURL(outcomingCellOrigin);
14886
- const outcomingCellProtocol=nonull(splits.protocol,"ws");
14887
- const outcomingCellHost=nonull(splits.host,"localhost");
14888
- const outcomingCellPort=nonull(splits.port,"40000");
14805
+ const infos=splitURL(outcomingCellOrigin);
14806
+ const outcomingCellProtocol=nonull(infos.protocol,"ws");
14807
+ const outcomingCellHost=nonull(infos.host,"localhost");
14808
+ const outcomingCellPort=nonull(infos.port,"40000");
14889
14809
 
14890
14810
  const clientInstance=initClient(true, false, (socketToServerClientInstance)=>{
14891
14811
 
@@ -15351,7 +15271,7 @@ window.ao=(incompleteModelObjectToDecorate)=>{
15351
15271
 
15352
15272
 
15353
15273
 
15354
- window.getAORTACServerNode=function(quorumNumber=1,selfOrigin="ws://127.0.0.1:40000", outcomingCellsOrigins=[], model, controller){
15274
+ window.getAORTACServerNode=function(quorumNumber=1, selfOrigin="ws://127.0.0.1:40000", outcomingCellsOrigins=[], model, controller){
15355
15275
  //return new AORTACServerNode("node_"+getUUID("short"), selfOrigin, outcomingCellsOrigins, model, controller);
15356
15276
  if(window.aortacCServerNodeInstance){
15357
15277
  // TRACE
@@ -15752,6 +15672,91 @@ if(typeof(window)==="undefined") window=global;
15752
15672
  // ==================================================================================================================
15753
15673
 
15754
15674
 
15675
+
15676
+
15677
+ // -Client :
15678
+
15679
+ // TODO : Use everywhere it's applicable !
15680
+ initClient=function(isNodeContext=true, useSocketIOImplementation=/*DEBUG*/false, doOnServerConnection=null, url, /*OPTIONAL*/port=25000, isSecure=true, /*OPTIONAL*/timeout=10000, /*OPTIONAL*/selfParam=null){
15681
+ let aotraClient={};
15682
+
15683
+ aotraClient.client={};
15684
+ aotraClient.client.start=function(){
15685
+
15686
+ // DBG
15687
+ lognow("INFO : Setting up client :...");
15688
+
15689
+ let socketToServerClientInstance=WebsocketImplementation.getStatic(isNodeContext, useSocketIOImplementation).connectToServer(url, port, isSecure, timeout);
15690
+ if(!socketToServerClientInstance){
15691
+ // TRACE
15692
+ lognow("ERROR : CLIENT : Could not get socketToServerClientInstance, aborting client connection.");
15693
+ return null;
15694
+ }
15695
+
15696
+ // When client is connected, we execute the callback :
15697
+ // CAUTION : MUST BE CALLED ONLY ONCE !
15698
+ socketToServerClientInstance.onConnectionToServer(()=>{
15699
+ if(doOnServerConnection){
15700
+ if(selfParam) doOnServerConnection.apply(selfParam,[socketToServerClientInstance]);
15701
+ else doOnServerConnection(socketToServerClientInstance);
15702
+ }
15703
+
15704
+
15705
+ });
15706
+
15707
+ // // Errors handling :
15708
+ // if(doOnError && useSocketIOImplementation /*TODO : FIXME: FOR NOW, ONLY WORKS FOR SOCKET.IO IMPLEMENTATION !'*/){
15709
+ //
15710
+ //// // DBG
15711
+ //// lognow(">>> serverSocket:",serverSocket);
15712
+ //
15713
+ //
15714
+ // const errorMethod=function(){
15715
+ // // TRACE
15716
+ // lognow("ERROR : CLIENT : Client encountered an error while trying to connect to server.");
15717
+ //
15718
+ // if(selfParam) doOnError.apply(selfParam);
15719
+ // else doOnError();
15720
+ // };
15721
+ //
15722
+ // socketToServerClientInstance.clientSocket.on("connect_error", errorMethod);
15723
+ //
15724
+ //// // DOES NOT SEEM TO WORK :
15725
+ //// socketToServerClientInstance.on("connect_failed", errorMethod);
15726
+ //// // DOES NOT SEEM TO WORK :
15727
+ //// socketToServerClientInstance.on("error", errorMethod);
15728
+ //
15729
+ // }
15730
+ //
15731
+ // // Data messages handling :
15732
+ // if(doOnMessage){
15733
+ // socketToServerClientInstance.onIncomingMessage((message)=>{
15734
+ // if(selfParam) doOnMessage.apply(selfParam,[message]);
15735
+ // else doOnMessage(message);
15736
+ // });
15737
+ // }
15738
+
15739
+ // DBG
15740
+ lognow("aotraClient.client:",aotraClient.client);
15741
+
15742
+ // DBG
15743
+ // aotraClient.clientSocket.addEventListener("close",()=>{
15744
+ // // TRACE
15745
+ // lognow("WARN : CONNECTION CLOSED !");
15746
+ // });
15747
+
15748
+
15749
+ aotraClient.client.socketToServerClientInstance=socketToServerClientInstance;
15750
+
15751
+ return aotraClient;
15752
+ };
15753
+
15754
+
15755
+ return aotraClient;
15756
+ }
15757
+
15758
+
15759
+
15755
15760
  class ClientReceptionEntryPoint{
15756
15761
 
15757
15762
  constructor(channelNameParam, entryPointId, clientsRoomsTag, listenerConfig, doOnIncomingMessage){
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1815",
3
+ "version": "0.0.1816",
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)",