aotrautils-srv 0.0.440 → 0.0.442

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 (23/01/2023-22:48:24)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (23/01/2023-23:08:25)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -2858,12 +2858,11 @@ window.contains=function(container, objectToFind,/*OPTIONAL*/useRegexp=false,sea
2858
2858
  // console.log("WARN : Container is empty ! Cannot search for «"+objectToFind+"».");
2859
2859
  return false;
2860
2860
  }
2861
- // if(!isString(container) && objectToFind && isFunction(objectToFind)){
2862
- // return !!foreach(container, (item, keyOrIndex)=>{
2863
- // if(objectToFind(item, keyOrIndex)) return true;
2864
- // });
2865
- // }else
2866
- {
2861
+ if(!isString(container) && objectToFind && isFunction(objectToFind)){
2862
+ return !!foreach(container, (item, keyOrIndex)=>{
2863
+ if(objectToFind(item, keyOrIndex)) return true;
2864
+ });
2865
+ }else{
2867
2866
  // Note : We also allow the search of null plain items in a container !
2868
2867
 
2869
2868
  if(isArray(container)){
@@ -4865,7 +4864,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4865
4864
 
4866
4865
 
4867
4866
 
4868
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (23/01/2023-22:48:24)»*/
4867
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (23/01/2023-23:08:25)»*/
4869
4868
  /*-----------------------------------------------------------------------------*/
4870
4869
 
4871
4870
 
@@ -5763,36 +5762,36 @@ WebsocketImplementation={
5763
5762
  lognow("INFO : (CLIENT-BROWSER) SETTING UP RECEIVE for :",channelNameParam);
5764
5763
 
5765
5764
 
5766
- // const receptionEntryPoint={
5767
- // channelName:channelNameParam,
5768
- // clientsRoomsTag:clientsRoomsTag,
5769
- // // TODO : ADD TO ALL OTHER SUBSYSTEMS !
5770
- // id:receptionEntryPointId,
5771
- //
5772
- // execute:(eventOrMessage)=>{
5773
- //
5774
- // const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
5775
- //
5776
- //// // DBG
5777
- //// lognow("(CLIENT) (DEBUG) CLIENT RECEIVED SOMETHING FROM SERVER :",dataWrapped);
5778
- //
5779
- // // Channel information is stored in exchanged data :
5780
- // if(dataWrapped.channelName && dataWrapped.channelName!==channelNameParam) return;
5781
- //
5782
- // const clientSocket=browserInstance.clientSocket;
5783
- //
5784
- // // Room information is stored in client socket object :
5785
- // if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
5786
- //
5787
- // if(doOnIncomingMessage) doOnIncomingMessage(dataWrapped.data, clientSocket);
5788
- //
5789
- //
5790
- // }
5791
- // };
5792
- //
5793
- // // TODO : ADD TO ALL OTHER SUBSYSTEMS !
5794
- // if(!contains(browserInstance.receptionEntryPoints,(l)=>(l.id && receptionEntryPoint.id && l.id===receptionEntryPoint.id)))
5795
- // browserInstance.receptionEntryPoints.push(receptionEntryPoint);
5765
+ const receptionEntryPoint={
5766
+ channelName:channelNameParam,
5767
+ clientsRoomsTag:clientsRoomsTag,
5768
+ // TODO : ADD TO ALL OTHER SUBSYSTEMS !
5769
+ id:receptionEntryPointId,
5770
+
5771
+ execute:(eventOrMessage)=>{
5772
+
5773
+ const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
5774
+
5775
+ // // DBG
5776
+ // lognow("(CLIENT) (DEBUG) CLIENT RECEIVED SOMETHING FROM SERVER :",dataWrapped);
5777
+
5778
+ // Channel information is stored in exchanged data :
5779
+ if(dataWrapped.channelName && dataWrapped.channelName!==channelNameParam) return;
5780
+
5781
+ const clientSocket=browserInstance.clientSocket;
5782
+
5783
+ // Room information is stored in client socket object :
5784
+ if(!WebsocketImplementation.isInRoom(clientSocket,clientsRoomsTag)) return;
5785
+
5786
+ if(doOnIncomingMessage) doOnIncomingMessage(dataWrapped.data, clientSocket);
5787
+
5788
+
5789
+ }
5790
+ };
5791
+
5792
+ // TODO : ADD TO ALL OTHER SUBSYSTEMS !
5793
+ if(!contains(browserInstance.receptionEntryPoints,(l)=>(l.id && receptionEntryPoint.id && l.id===receptionEntryPoint.id)))
5794
+ browserInstance.receptionEntryPoints.push(receptionEntryPoint);
5796
5795
 
5797
5796
 
5798
5797
  return browserInstance;
@@ -5807,19 +5806,19 @@ WebsocketImplementation={
5807
5806
  // CURRENT
5808
5807
  sendChainable:(channelNameParam, data, clientsRoomsTag=null)=>{
5809
5808
 
5810
- // browserInstance.send(channelNameParam, data, clientsRoomsTag);
5811
- //
5812
- // const resultPromise={
5813
- // clientsRoomsTag:clientsRoomsTag,
5814
- // thenWhenReceiveMessageType:(channelNameForResponse, messageTypeForResponse, doOnIncomingMessageForResponse)=>{
5815
- // const listenerId=messageTypeForResponse;
5816
- // browserInstance.receive(channelNameForResponse, doOnIncomingMessageForResponse, this.clientsRoomsTag, listenerId);
5817
- // return this;
5818
- // }
5819
- // };
5820
- //
5821
- //
5822
- // return resultPromise;
5809
+ browserInstance.send(channelNameParam, data, clientsRoomsTag);
5810
+
5811
+ const resultPromise={
5812
+ clientsRoomsTag:clientsRoomsTag,
5813
+ thenWhenReceiveMessageType:(channelNameForResponse, messageTypeForResponse, doOnIncomingMessageForResponse)=>{
5814
+ const listenerId=messageTypeForResponse;
5815
+ browserInstance.receive(channelNameForResponse, doOnIncomingMessageForResponse, this.clientsRoomsTag, listenerId);
5816
+ return this;
5817
+ }
5818
+ };
5819
+
5820
+
5821
+ return resultPromise;
5823
5822
  },
5824
5823
 
5825
5824
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.440",
3
+ "version": "0.0.442",
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)",