aotrautils 0.0.1044 → 0.0.1045

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 (30/09/2024-00:42:25)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (12/10/2024-15:45:05)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -5259,7 +5259,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5259
5259
 
5260
5260
 
5261
5261
 
5262
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (30/09/2024-00:42:25)»*/
5262
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (12/10/2024-15:45:05)»*/
5263
5263
  /*-----------------------------------------------------------------------------*/
5264
5264
  /* ## Utility global methods in a browser (htmljs) client environment.
5265
5265
  *
@@ -13472,9 +13472,15 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
13472
13472
 
13473
13473
 
13474
13474
 
13475
+ // Nodejs compatibility :
13476
+ if(typeof(module)!=="undefined"){
13477
+ module.exports = { ORITA_CONSTANTS: ORITA_CONSTANTS, createOritaMicroClient:createOritaMicroClient };
13478
+ }
13479
+
13480
+
13475
13481
 
13476
13482
 
13477
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (30/09/2024-00:42:25)»*/
13483
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (12/10/2024-15:45:05)»*/
13478
13484
  /*-----------------------------------------------------------------------------*/
13479
13485
 
13480
13486
 
@@ -14713,7 +14719,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14713
14719
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14714
14720
 
14715
14721
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14716
- /*utils AI library associated with aotra version : «1_29072022-2359 (30/09/2024-00:42:25)»*/
14722
+ /*utils AI library associated with aotra version : «1_29072022-2359 (12/10/2024-15:45:05)»*/
14717
14723
  /*-----------------------------------------------------------------------------*/
14718
14724
 
14719
14725
 
@@ -14857,7 +14863,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
14857
14863
 
14858
14864
 
14859
14865
 
14860
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (30/09/2024-00:42:25)»*/
14866
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (12/10/2024-15:45:05)»*/
14861
14867
  /*-----------------------------------------------------------------------------*/
14862
14868
 
14863
14869
 
@@ -16748,6 +16754,98 @@ appendGetParameters=function(apiURL, namedArgs){
16748
16754
  };
16749
16755
 
16750
16756
 
16757
+
16758
+ //*********************************** AUTO-ORGANIZING REAL-TIME AORTAC CLUSTERIZATION (AORTAC) *********************************** */
16759
+
16760
+ class AORTACNode{
16761
+ constructor(selfOrigin="127.0.0.1:40000",outcomingNodesOrigins=[], model, controller, sslConfig={/*OPTIONAL*/port:null,/*OPTIONAL*/certPath:null,/*OPTIONAL*/keyPath:null}){
16762
+ this.selfOrigin=selfOrigin;
16763
+ this.outcomingNodesOrigins=outcomingNodesOrigins;
16764
+
16765
+ this.model=model; // must implement function
16766
+ this.controller=controller; // Must implement function
16767
+ this.serverId=getUUID();
16768
+
16769
+ this.server=null;
16770
+ this.clients={};
16771
+ this.incomingServers={};
16772
+ this.outcomingServers={};
16773
+
16774
+ }
16775
+
16776
+ start(){
16777
+
16778
+ const self=this;
16779
+ this.server = initNodeServerInfrastructureWrapper(
16780
+ // On each client connection :
16781
+ null,
16782
+ // On client finalization :
16783
+ function(server){
16784
+
16785
+ self.server=server;
16786
+
16787
+ server.receive("protocol", (message, clientSocket)=>{
16788
+
16789
+ // TRACE
16790
+ console.log("INFO : SERVER : Client has sent a protocol message: ", message);
16791
+
16792
+ // ============== OTHER SERVER / CLIENT REGISTRATION PHASE ==============
16793
+
16794
+ if(message.type==="registerOtherServer"){
16795
+ const incomingServerId=message.serverId;
16796
+
16797
+ self.incomingServers[incomingServerId]={clientSocket:clientSocket};
16798
+
16799
+ }else if(message.type==="registerClient"){
16800
+ const clientId=message.clientId;
16801
+
16802
+ self.clients[incomingServerId]={clientSocket:clientSocket};
16803
+ }
16804
+
16805
+ });
16806
+
16807
+
16808
+ // We try to connect to all the other outcoming servers :
16809
+ foreach(self.outcomingNodesOrigins, outcomingNodeOrigin=>{
16810
+ let outcomingNodeHost;
16811
+ let outcomingNodePort;
16812
+ if(contains(outcomingNodeOrigin,":")){
16813
+ const splits=outcomingNodeOrigin.split(":");
16814
+ outcomingNodeHost=splits[0];
16815
+ outcomingNodePort=splits[1];
16816
+ }
16817
+ const isSecure=(contains(outcomingNodeOrigin,"wss"));
16818
+ const clientInstance=connectToServer:(outcomingNodeHost,outcomingNodePort, isSecure, 5000);
16819
+
16820
+ self.outcomingServers[]={clientInstanceToServer:clientInstance};
16821
+
16822
+ });
16823
+
16824
+
16825
+
16826
+
16827
+ ////
16828
+ // CURRENT AORTAC
16829
+
16830
+
16831
+ },this.sslConfig.port, this.sslConfig.certPath, this.sslConfig.keyPath);
16832
+
16833
+
16834
+ }
16835
+
16836
+ }
16837
+
16838
+ getAORTACNode=function(selfOrigin="127.0.0.1:40000",outcomingNodesOrigins=[]){
16839
+ return new AORTACNode(selfOrigin,outcomingNodesOrigins);
16840
+ }
16841
+
16842
+
16843
+
16844
+
16845
+
16846
+
16847
+
16848
+
16751
16849
  /* INCLUDED EXTERNAL LIBRAIRIES
16752
16850
  */
16753
16851
  "use strict";var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message};this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message};this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message};this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message};this.message=a}}};
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1044",
3
+ "version": "0.0.1045",
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)",