aotrautils 0.0.955 → 0.0.957

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/04/2024-02:47:27)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (15/04/2024-03:00:19)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -5275,7 +5275,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5275
5275
 
5276
5276
 
5277
5277
 
5278
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (15/04/2024-02:47:27)»*/
5278
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (15/04/2024-03:00:19)»*/
5279
5279
  /*-----------------------------------------------------------------------------*/
5280
5280
  /* ## Utility global methods in a browser (htmljs) client environment.
5281
5281
  *
@@ -13486,7 +13486,7 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
13486
13486
 
13487
13487
 
13488
13488
 
13489
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (15/04/2024-02:47:27)»*/
13489
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (15/04/2024-03:00:19)»*/
13490
13490
  /*-----------------------------------------------------------------------------*/
13491
13491
 
13492
13492
 
@@ -14725,7 +14725,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14725
14725
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14726
14726
 
14727
14727
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14728
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (15/04/2024-02:47:27)»*/
14728
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (15/04/2024-03:00:19)»*/
14729
14729
  /*-----------------------------------------------------------------------------*/
14730
14730
 
14731
14731
 
@@ -15517,6 +15517,52 @@ WebsocketImplementation={
15517
15517
  },
15518
15518
 
15519
15519
 
15520
+
15521
+ // TODO : FIXME : DUPLICATED CODE !
15522
+ sendChainable:(channelNameParam, data, clientsRoomsTag=null)=>{
15523
+
15524
+ // DBG
15525
+ lognow(">>>>>>sendChainable NODE CLIENT ("+channelNameParam+"):data:",data);
15526
+
15527
+ // We add a message id :
15528
+ const messageId=getUUID();
15529
+ data.messageId=messageId;
15530
+
15531
+ // 1) We prepare the reception :
15532
+ const resultPromise={
15533
+ clientsRoomsTag:clientsRoomsTag,
15534
+ messageId:messageId,
15535
+ thenWhenReceiveMessageType:(channelNameForResponse, listenerConfig={messageType:"",condition:()=>true}, doOnIncomingMessageForResponse)=>{
15536
+ listenerConfig=nonull(listenerConfig,{messageType:"",condition:()=>true});
15537
+ const listenerId=nonull(listenerConfig.messageType,"");
15538
+
15539
+ nodeClientInstance.receive(channelNameForResponse, (dataLocal, clientSocket)=>{
15540
+
15541
+
15542
+ // We check if the message matches the condition :
15543
+ if(listenerConfig.condition && !listenerConfig.condition(dataLocal, clientSocket)) return ;
15544
+
15545
+ // We check if we have the same message id:
15546
+ if(resultPromise.messageId!==dataLocal.messageId){
15547
+ // DBG
15548
+ lognow("resultPromise.messageId:"+resultPromise.messageId+"|dataLocal.messageId"+dataLocal.messageId);
15549
+ return;
15550
+ }
15551
+
15552
+ doOnIncomingMessageForResponse(dataLocal, clientSocket);
15553
+ }, resultPromise.clientsRoomsTag, listenerId, {destroyListenerAfterReceiving:true});
15554
+ return resultPromise;
15555
+ }
15556
+ };
15557
+
15558
+ // 2) We send the data :
15559
+ nodeClientInstance.send(channelNameParam, data, clientsRoomsTag);
15560
+
15561
+
15562
+ return resultPromise;
15563
+ },
15564
+
15565
+
15520
15566
  send:(channelNameParam, data, clientsRoomsTag=null)=>{
15521
15567
 
15522
15568
  // // DBG
@@ -15716,16 +15762,12 @@ WebsocketImplementation={
15716
15762
  },
15717
15763
 
15718
15764
 
15719
-
15720
-
15721
-
15722
15765
 
15723
-
15766
+ // TODO : FIXME : DUPLICATED CODE !
15724
15767
  sendChainable:(channelNameParam, data, clientsRoomsTag=null)=>{
15725
15768
 
15726
-
15727
15769
  // DBG
15728
- lognow(">>>>>>sendChainable("+channelNameParam+"):data:",data);
15770
+ lognow(">>>>>>sendChainable BROWSER CLIENT ("+channelNameParam+"):data:",data);
15729
15771
 
15730
15772
  // We add a message id :
15731
15773
  const messageId=getUUID();
@@ -15736,6 +15778,7 @@ WebsocketImplementation={
15736
15778
  clientsRoomsTag:clientsRoomsTag,
15737
15779
  messageId:messageId,
15738
15780
  thenWhenReceiveMessageType:(channelNameForResponse, listenerConfig={messageType:"",condition:()=>true}, doOnIncomingMessageForResponse)=>{
15781
+ listenerConfig=nonull(listenerConfig,{messageType:"",condition:()=>true});
15739
15782
  const listenerId=nonull(listenerConfig.messageType,"");
15740
15783
 
15741
15784
  browserInstance.receive(channelNameForResponse, (dataLocal, clientSocket)=>{
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.955",
3
+ "version": "0.0.957",
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)",