aotrautils 0.0.1346 → 0.0.1348

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 (12/04/2025-01:59:12)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (12/04/2025-02:38:35)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4898,7 +4898,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4898
4898
 
4899
4899
 
4900
4900
 
4901
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (12/04/2025-01:59:12)»*/
4901
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (12/04/2025-02:38:35)»*/
4902
4902
  /*-----------------------------------------------------------------------------*/
4903
4903
  /* ## Utility global methods in a browser (htmljs) client environment.
4904
4904
  *
@@ -13470,7 +13470,7 @@ getAORTACClient=function(clientId=getUUID(), serverNodeOrigin="ws://127.0.0.1:40
13470
13470
 
13471
13471
 
13472
13472
 
13473
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (12/04/2025-01:59:12)»*/
13473
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (12/04/2025-02:38:35)»*/
13474
13474
  /*-----------------------------------------------------------------------------*/
13475
13475
 
13476
13476
 
@@ -14709,7 +14709,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14709
14709
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14710
14710
 
14711
14711
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14712
- /*utils AI library associated with aotra version : «1_29072022-2359 (12/04/2025-01:59:12)»*/
14712
+ /*utils AI library associated with aotra version : «1_29072022-2359 (12/04/2025-02:38:35)»*/
14713
14713
  /*-----------------------------------------------------------------------------*/
14714
14714
 
14715
14715
 
@@ -14853,7 +14853,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
14853
14853
 
14854
14854
 
14855
14855
 
14856
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (12/04/2025-01:59:12)»*/
14856
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (12/04/2025-02:38:35)»*/
14857
14857
  /*-----------------------------------------------------------------------------*/
14858
14858
 
14859
14859
 
@@ -16627,13 +16627,13 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
16627
16627
  return response.json();
16628
16628
  }).then(data => {
16629
16629
 
16630
- if(data.error){
16631
- const error=data.error;
16632
- const statusCode=data.statusCode;
16633
-
16630
+ // CAUTION : .request(...) => statusCode, .fetch(...) => status (performHTTPRequest(...) uses fetch(...))
16631
+ const status=data.status;
16632
+ if(status!=200){
16633
+ const error=nonull(data.error, data.detail);
16634
16634
  // TRACE
16635
16635
  console.error("Error:", error);
16636
- reject(""+error, statusCode);
16636
+ reject(""+error, status);
16637
16637
  return;
16638
16638
  }
16639
16639
 
@@ -16691,16 +16691,34 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
16691
16691
  let responseData;
16692
16692
  try{
16693
16693
  responseData=parseJSON(responseDataStr);
16694
- }catch(error){
16694
+ }catch(parseError1){
16695
16695
  // CAUTION ! TODO : FIXME : We replace in response all single quotes with "`" (egrave) in order to avoid errors !
16696
16696
  // DEBUG
16697
16697
  responseDataStr=responseDataStr.replace(/'/gim,"`");
16698
- responseData=parseJSON(responseDataStr);
16698
+ try{
16699
+ responseData=parseJSON(responseDataStr);
16700
+ }catch(parseError2){
16701
+ // DBG
16702
+ lognow("WARN : Could not JSON parse the response data ! Must deal with the raw string:«"+responseDataStr+"»", parseError2);
16703
+ resolve( {response:response, responseDataStr:responseDataStr} );
16704
+ return;
16705
+ }
16706
+ }
16707
+
16708
+ // CAUTION : .request(...) => statusCode, .fetch(...) => status (performHTTPRequest(...) uses fetch(...))
16709
+ const status=reponse.status;
16710
+ if(status!=200){
16711
+ const error=nonull(reponse.statusMessage, "No error message for error code "+status);
16712
+ // TRACE
16713
+ console.error("Error:", error);
16714
+ reject(""+error, status);
16715
+ return;
16699
16716
  }
16717
+
16700
16718
  resolve( {responseData:responseData, response:response, responseDataStr:responseDataStr} );
16701
- }catch(error){
16719
+ }catch(parseError3){
16702
16720
  // DBG
16703
- lognow("WARN : Could not JSON parse the response data ! Must deal with the string:«"+responseDataStr+"»", error);
16721
+ lognow("WARN : Could not JSON parse the response data ! Must deal with the raw string:«"+responseDataStr+"»", parseError3);
16704
16722
  resolve( {response:response, responseDataStr:responseDataStr} );
16705
16723
  return;
16706
16724
  }
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1346",
3
+ "version": "0.0.1348",
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)",