aotrautils-srv 0.0.2039 → 0.0.2041

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-02:53:54)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (18/10/2026-02:46:46)»*/
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 AI library associated with aotra version : «1_29072022-2359 (17/10/2026-02:53:54)»*/
5513
+ /*utils AI library associated with aotra version : «1_29072022-2359 (18/10/2026-02:46:46)»*/
5489
5514
  /*-----------------------------------------------------------------------------*/
5490
5515
 
5491
5516
 
@@ -5749,7 +5774,7 @@ window.getLLMAPIClient=(modelName, apiURL, agentRole, defaultPrompt, llmProvider
5749
5774
 
5750
5775
 
5751
5776
 
5752
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (17/10/2026-02:53:54)»*/
5777
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (18/10/2026-02:46:46)»*/
5753
5778
  /*-----------------------------------------------------------------------------*/
5754
5779
 
5755
5780
 
@@ -8623,8 +8648,8 @@ window.launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=
8623
8648
 
8624
8649
 
8625
8650
  }catch(error) {
8626
- response.writeHead(erreur.error || 500, { "Content-Type": "application/json" });
8627
- response.end(JSON.stringify({ error: erreur.error || "ERROR : HTTPO Endpoints encountered an error" }));
8651
+ response.writeHead(error.error || 500, { "Content-Type": "application/json" });
8652
+ response.end(JSON.stringify({ error: error.error || "ERROR : HTTP Endpoints encountered an error" }));
8628
8653
  }
8629
8654
  }
8630
8655
 
@@ -9296,9 +9321,9 @@ window.isURLLocalhost=(url)=>{
9296
9321
 
9297
9322
 
9298
9323
  window.assert={};
9299
- window.assert.notNull=(value, errorMessage=null)=>{
9324
+ window.assert.notNull=(value, variableName=null, errorMessage=null)=>{
9300
9325
  if(typeof(value)=="undefined" || value==null)
9301
- throw new Error(nonull(errorMessage, "ERROR : Value is null."));
9326
+ throw new Error(nonull(errorMessage, (variableName?"ERROR : "+variableName+" is null.":"ERROR : Value is null.")));
9302
9327
  };
9303
9328
 
9304
9329
 
@@ -9849,14 +9874,14 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9849
9874
  // DBG
9850
9875
  lognow("(SERVER) (ServerReceptionEntryPointsBag) Registering receive (NEW API) for message type «"+messageType+"»...");
9851
9876
 
9852
- const channelNameParam=this.channelNameParam;
9877
+ const channelName=this.channelName;
9853
9878
  const clientsRoomsTag=this.clientsRoomsTag;
9854
9879
  const messageTypes=(!messageType || empty(messageType) ? [] :
9855
9880
  (isArray(messageType) ? messageType : [messageType])
9856
9881
  );
9857
9882
  const listenerConfig={listenerMessageTypes:messageTypes, httpEndpointDefinition:httpEndpointDefinition};
9858
9883
  const serverReceptionEntryPoint=
9859
- new window.ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, listenerConfig, asyncDoOnIncomingMessage, this);
9884
+ new window.ServerReceptionEntryPoint(channelName, clientsRoomsTag, listenerConfig, asyncDoOnIncomingMessage, this);
9860
9885
  this.serverReceptionEntryPoints.push(serverReceptionEntryPoint);
9861
9886
 
9862
9887
  if(httpEndpointDefinition){
@@ -9869,6 +9894,22 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9869
9894
 
9870
9895
  return this;
9871
9896
  }
9897
+
9898
+ addAPIEndpointsExposition(){
9899
+ const self=this;
9900
+ this.addReceiveListener("endpoints", async (message, clientSocket=null)=>{// (Also handles backupUUID tests executions)
9901
+ const results=[];
9902
+ foreach(self.serverReceptionEntryPoints, serverReceptionEntryPoint=>{
9903
+ const conf=serverReceptionEntryPoint.listenerConfig;
9904
+ if(!conf || !conf.httpEndpointDefinition)
9905
+ return "continue";
9906
+ const httpEndpoint=conf.httpEndpointDefinition;
9907
+ results.push({httpMethod:httpEndpoint.httpMethod,urlPath:httpEndpoint.urlPath});
9908
+ });
9909
+ return {endpoints:results};
9910
+ },{urlPath:"/endpoints", httpMethod:"GET"})
9911
+ return this;
9912
+ }
9872
9913
 
9873
9914
  }
9874
9915
 
@@ -9876,7 +9917,7 @@ window.ServerReceptionEntryPointsBag=class ServerReceptionEntryPointsBag{
9876
9917
 
9877
9918
  window.ServerReceptionEntryPoint=class ServerReceptionEntryPoint{
9878
9919
 
9879
- constructor(channelNameParam, clientsRoomsTag, listenerConfig=null, asyncDoOnIncomingMessage, parentServerReceptionEntryPointsBag=null){
9920
+ constructor(channelNameParam, clientsRoomsTag, listenerConfig=null, asyncDoOnIncomingMessage=null, parentServerReceptionEntryPointsBag=null){
9880
9921
  this.channelName=channelNameParam;
9881
9922
  this.clientsRoomsTag=clientsRoomsTag;
9882
9923
  this.listenerConfig=listenerConfig;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.2039",
3
+ "version": "0.0.2041",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "aotrautils-srv",
9
- "version": "0.0.2039",
9
+ "version": "0.0.2041",
10
10
  "license": "HGPL-1.0",
11
11
  "dependencies": {
12
12
  "atob": "^2.1.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.2039",
3
+ "version": "0.0.2041",
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)",