aotrautils-srv 0.0.1754 → 0.0.1756

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 (13/06/2025-23:25:40)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (14/06/2025-01:54:01)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -3947,22 +3947,39 @@ window.setByDottedPath=(obj, path, value)=>{
3947
3947
  if(!contains(path,".")){
3948
3948
  obj[path]=value;
3949
3949
  }
3950
- let currentObject=obj;
3950
+
3951
3951
  const pathParts=path.split(".");
3952
+ let currentObject=obj;
3952
3953
  for(let i=0; i<pathParts.length-1; i++) {
3954
+
3955
+ if(isString(currentObject)){
3956
+ // Here we are trying to set a value inside an object, but the attribute is actually a JSON string !
3957
+ try{
3958
+ currentObject=parseJSON(currentObject);
3959
+ }catch(error){
3960
+ // Here we have a string, and we want to set a value inside the attribute, but it's not an object !
3961
+ const subPath=pathParts.slice(i+1);
3962
+ currentObject=setByDottedPath=(currentObject, subPath.join("."), value);
3963
+ return;
3964
+ }
3965
+ }
3966
+
3953
3967
  const part=pathParts[i];
3968
+ // We create the sub-object if not already present:
3954
3969
  if(!(part in currentObject)) {
3955
3970
  const nextIsIndex=(!isNaN(pathParts[i + 1]));
3956
3971
  currentObject[part]=(nextIsIndex ? [] : {});
3957
3972
  }
3958
3973
  currentObject=currentObject[part];
3974
+
3959
3975
  }
3960
- const lastAttributeNameInPath=pathParts[pathParts.length - 1];
3976
+ const lastAttributeNameInPath=pathParts[pathParts.length-1];
3961
3977
  currentObject[lastAttributeNameInPath]=value;
3962
3978
  };
3963
3979
 
3964
3980
 
3965
3981
 
3982
+
3966
3983
  getUUID=function(mode=null){
3967
3984
 
3968
3985
  let uuid="";
@@ -4992,7 +5009,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4992
5009
 
4993
5010
 
4994
5011
 
4995
- /*utils AI library associated with aotra version : «1_29072022-2359 (13/06/2025-23:25:40)»*/
5012
+ /*utils AI library associated with aotra version : «1_29072022-2359 (14/06/2025-01:54:01)»*/
4996
5013
  /*-----------------------------------------------------------------------------*/
4997
5014
 
4998
5015
 
@@ -5138,7 +5155,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
5138
5155
 
5139
5156
 
5140
5157
 
5141
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (13/06/2025-23:25:40)»*/
5158
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (14/06/2025-01:54:01)»*/
5142
5159
  /*-----------------------------------------------------------------------------*/
5143
5160
 
5144
5161
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1754",
3
+ "version": "0.0.1756",
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)",