aotrautils 0.0.2043 → 0.0.2045

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 (17/10/2026-01:26:49)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (18/10/2026-01:57:55)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -457,6 +457,30 @@ if(!window.aotestAllTestsManager){
457
457
  // Utility methods for aotest framework :
458
458
 
459
459
  // UI/CLI ONLY :
460
+
461
+ window.aotestMethods.getTestsMapForScenarii=(testsArray, scenariiNames=null/*(OPTIONAL)*/)=>{
462
+ const testsMap={};
463
+
464
+ if(!scenariiNames || scenariiNames=="" || scenariiNames=="*"){// Case we want all tests from all scenarii:
465
+ foreach(testsArray, (test, testName)=>{
466
+ // (to avoid doing this treatment several times unecessarily)
467
+ if(testsMap[testName]) return "continue";
468
+ testsMap[testName]=test;
469
+ });
470
+ }else{
471
+ foreach(scenariiNames,scenarioName=>{
472
+ foreach(testsArray,(test,testName)=>{
473
+ // (to avoid doing this treatment several times unecessarily)
474
+ if(testsMap[testName]) return "continue";
475
+ testsMap[testName]=test;
476
+ },(test, testName)=>(contains(Object.keys(test),scenarioName)));
477
+ });
478
+ }
479
+
480
+ return testsMap;
481
+ };
482
+
483
+
460
484
  window.aotestMethods.getParentTestByScenarioNameInTestsArray=function(testsArray, scenarioName){
461
485
  return foreach(testsArray,test=>{
462
486
  return window.aotestMethods.iterateOverScenariiInSingleTest(test, (parentTest, scenario)=>{
@@ -560,7 +584,7 @@ window.aotestMethods.getScenarioInSingleTest=function(test, scenarioName=null){
560
584
  window.aotestMethods.getScenariiInSingleTest=function(test, scenariiNames=null){
561
585
  let results={};
562
586
  window.aotestMethods.iterateOverScenariiInSingleTest(test,(t,s,sName)=>{
563
- if(!scenariiNames || contains(scenariiNames, sName)){
587
+ if(!scenariiNames || scenariiNames=="" || scenariiNames=="*" || contains(scenariiNames, sName)){
564
588
  results[sName]=s;
565
589
  }
566
590
  });
@@ -578,6 +602,7 @@ window.aotestMethods.iterateOverScenariiInSingleTest=function(test, doOnEachIter
578
602
 
579
603
 
580
604
 
605
+
581
606
  /*public*/window.aotestMethods.iterateOverValuesOnClonedObject=function(scenarioParam, doOnIterationForValue, visited=[], valuePath="", isValueFunction=null){
582
607
 
583
608
  // CAUTION : We ABSOLUTELY need to iterate over a deep copy, or else it will create weird incomprehensible bugs
@@ -5485,7 +5510,7 @@ window.AOTRAUTILS_LIB_IS_LOADED=true;
5485
5510
 
5486
5511
 
5487
5512
 
5488
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (17/10/2026-01:26:49)»*/
5513
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (18/10/2026-01:57:55)»*/
5489
5514
  /*-----------------------------------------------------------------------------*/
5490
5515
  /* ## Utility global methods in a browser (htmljs) client environment.
5491
5516
  *
@@ -13053,7 +13078,7 @@ window.createOritaMicroClient=function(url, port, isNode=false, staticMicroClien
13053
13078
 
13054
13079
 
13055
13080
 
13056
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (17/10/2026-01:26:49)»*/
13081
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (18/10/2026-01:57:55)»*/
13057
13082
  /*-----------------------------------------------------------------------------*/
13058
13083
 
13059
13084
 
@@ -14142,10 +14167,10 @@ function rayVsUnitSphereClosestPoint(p, r) {
14142
14167
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14143
14168
 
14144
14169
  window.AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14145
- /*utils 3D library associated with aotra version : «1_29072022-2359 (17/10/2026-01:26:49)»*/
14170
+ /*utils 3D library associated with aotra version : «1_29072022-2359 (18/10/2026-01:57:55)»*/
14146
14171
  /*-----------------------------------------------------------------------------*/
14147
14172
 
14148
- /*utils AI library associated with aotra version : «1_29072022-2359 (17/10/2026-01:26:49)»*/
14173
+ /*utils AI library associated with aotra version : «1_29072022-2359 (18/10/2026-01:57:55)»*/
14149
14174
  /*-----------------------------------------------------------------------------*/
14150
14175
 
14151
14176
 
@@ -14409,7 +14434,7 @@ window.getLLMAPIClient=(modelName, apiURL, agentRole, defaultPrompt, llmProvider
14409
14434
 
14410
14435
 
14411
14436
 
14412
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (17/10/2026-01:26:49)»*/
14437
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (18/10/2026-01:57:55)»*/
14413
14438
  /*-----------------------------------------------------------------------------*/
14414
14439
 
14415
14440
 
@@ -17263,7 +17288,7 @@ window.launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=
17263
17288
 
17264
17289
  // (we bypass the channel and message types filters !)
17265
17290
  try{
17266
- httpEndpointResultObject.body=await serverReceptionEntryPoint.execute(eventOrMessage, null, false);
17291
+ httpEndpointResultObject.body=await serverReceptionEntryPoint.executeWithAllPrerequisites(dataWrapped, eventOrMessage, null);
17267
17292
  }catch(treatmentsChannelError){
17268
17293
  // TODO : FIXME : DUPLICATED CODE !!!
17269
17294
  const errorMessage="ERROR : An error has occured during the processing of a client message on channel treatments.";
@@ -17956,9 +17981,9 @@ window.isURLLocalhost=(url)=>{
17956
17981
 
17957
17982
 
17958
17983
  window.assert={};
17959
- window.assert.notNull=(value, errorMessage=null)=>{
17984
+ window.assert.notNull=(value, variableName=null, errorMessage=null)=>{
17960
17985
  if(typeof(value)=="undefined" || value==null)
17961
- throw new Error(nonull(errorMessage, "ERROR : Value is null."));
17986
+ throw new Error(nonull(errorMessage, (variableName?"ERROR : "+variableName+" is null.":"ERROR : Value is null.")));
17962
17987
  };
17963
17988
 
17964
17989
 
@@ -18429,7 +18454,7 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
18429
18454
  this.clientsRoomsTag=clientsRoomsTag;
18430
18455
 
18431
18456
  this.serverReceptionEntryPoints=[];
18432
- this.asyncPrerequisiteMethods=[];
18457
+ this.asyncPrerequisiteMethods=new Set();
18433
18458
  }
18434
18459
 
18435
18460
  // Executed whenever any message is received on any channel :
@@ -18477,8 +18502,9 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
18477
18502
 
18478
18503
  }
18479
18504
 
18505
+
18480
18506
  addReceiveListenerPrerequisite(asyncPrerequisiteMethod){
18481
- this.asyncPrerequisiteMethods.push(asyncPrerequisiteMethod);
18507
+ this.asyncPrerequisiteMethods.add(asyncPrerequisiteMethod);
18482
18508
  // TRACE
18483
18509
  lognow("INFO : Added prerequisite: asyncPrerequisiteMethods:",asyncPrerequisiteMethod);
18484
18510
  return this;
@@ -18504,6 +18530,10 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
18504
18530
  // I-
18505
18531
  // ASYNC
18506
18532
  addReceiveListener(messageType, asyncDoOnIncomingMessage, httpEndpointDefinition=null){
18533
+
18534
+ // DBG
18535
+ lognow("(SERVER) (ServerReceptionEntryPointsBag) Registering receive (NEW API) for message type «"+messageType+"»...");
18536
+
18507
18537
  const channelNameParam=this.channelNameParam;
18508
18538
  const clientsRoomsTag=this.clientsRoomsTag;
18509
18539
  const messageTypes=(!messageType || empty(messageType) ? [] :
@@ -18511,7 +18541,7 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
18511
18541
  );
18512
18542
  const listenerConfig={listenerMessageTypes:messageTypes, httpEndpointDefinition:httpEndpointDefinition};
18513
18543
  const serverReceptionEntryPoint=
18514
- new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, asyncDoOnIncomingMessage);
18544
+ new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, asyncDoOnIncomingMessage, this);
18515
18545
  this.serverReceptionEntryPoints.push(serverReceptionEntryPoint);
18516
18546
 
18517
18547
  if(httpEndpointDefinition){
@@ -18531,11 +18561,12 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
18531
18561
 
18532
18562
  window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
18533
18563
 
18534
- constructor(channelNameParam, clientsRoomsTag, listenerConfig=null, asyncDoOnIncomingMessage){
18564
+ constructor(channelNameParam, clientsRoomsTag, listenerConfig=null, asyncDoOnIncomingMessage, parentServerReceptionEntryPointsBag=null){
18535
18565
  this.channelName=channelNameParam;
18536
18566
  this.clientsRoomsTag=clientsRoomsTag;
18537
18567
  this.listenerConfig=listenerConfig;
18538
18568
  this.asyncDoOnIncomingMessage=asyncDoOnIncomingMessage;
18569
+ this.parentServerReceptionEntryPointsBag=parentServerReceptionEntryPointsBag;
18539
18570
  }
18540
18571
 
18541
18572
  async execute(eventOrMessage, clientSocketParam=null){
@@ -18543,7 +18574,7 @@ window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
18543
18574
  if(!eventOrMessage){
18544
18575
  // TRACE
18545
18576
  lognow("ERROR : No message received.");
18546
- return;
18577
+ return null;
18547
18578
  }
18548
18579
 
18549
18580
  // OLD :
@@ -18562,7 +18593,7 @@ window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
18562
18593
 
18563
18594
  // Room information is stored in client socket object :
18564
18595
  const isClientInRoom=window.WebsocketImplementation.isInRoom(clientSocketParam, this.clientsRoomsTag);
18565
- if(!isClientInRoom) return;
18596
+ if(!isClientInRoom) return null;
18566
18597
 
18567
18598
 
18568
18599
  if(this.listenerConfig){
@@ -18571,7 +18602,7 @@ window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
18571
18602
  // Else we check if the message matches the required message types :
18572
18603
  if( dataWrapped.data && dataWrapped.data.type
18573
18604
  && !contains(this.listenerConfig.listenerMessageTypes, dataWrapped.data.type))
18574
- return;
18605
+ return null;
18575
18606
  }
18576
18607
  }
18577
18608
 
@@ -18588,6 +18619,13 @@ window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
18588
18619
  }
18589
18620
 
18590
18621
  }
18622
+
18623
+ async executeWithAllPrerequisites(dataWrapped, originalEventOrMessage, clientSocket){
18624
+ if(this.parentServerReceptionEntryPointsBag)
18625
+ await this.parentServerReceptionEntryPointsBag.executeAllPrerequisites(dataWrapped, originalEventOrMessage, clientSocket);
18626
+ return await this.execute(originalEventOrMessage, clientSocket);
18627
+ }
18628
+
18591
18629
  }
18592
18630
 
18593
18631
 
@@ -18641,10 +18679,10 @@ window.NodeServerInstance=class NodeServerInstance{
18641
18679
  receive(channelNameParam, doOnIncomingMessage, listenerConfig=null, clientsRoomsTag=null){
18642
18680
 
18643
18681
  // DBG
18644
- lognow("(SERVER) Registering receive (OLD API) for channel «"+channelNameParam+"»...");
18682
+ lognow("(SERVER) (NodeServerInstance) Registering receive (OLD API) for channel «"+channelNameParam+"»...");
18645
18683
 
18646
18684
  const serverReceptionEntryPoint=
18647
- new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, doOnIncomingMessage);
18685
+ new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, doOnIncomingMessage, null);
18648
18686
  this.serverReceptionEntryPoints.push(serverReceptionEntryPoint);
18649
18687
 
18650
18688
  //OLD: // SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
@@ -18825,7 +18863,7 @@ window.NodeServerInstance=class NodeServerInstance{
18825
18863
  // We execute the events registration listeners entry points:
18826
18864
  // DEPRECATED : OLD API :
18827
18865
  foreach(self.serverReceptionEntryPoints, (serverReceptionEntryPoint,i)=>{
18828
- serverReceptionEntryPoint.execute(eventOrMessage, clientSocket, true).then(()=>{
18866
+ serverReceptionEntryPoint.execute(eventOrMessage, clientSocket).then(()=>{
18829
18867
  /*DO NOTHING*/
18830
18868
  }).catch(treatmentsChannelError=>{
18831
18869
  // TODO : FIXME : DUPLICATED CODE !!!
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.2043",
3
+ "version": "0.0.2045",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "aotrautils",
9
- "version": "0.0.2043",
9
+ "version": "0.0.2045",
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.2043",
3
+ "version": "0.0.2045",
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)",