aotrautils-srv 0.0.1753 → 0.0.1755

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-22:21:14)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (14/06/2025-00:05:09)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -3947,17 +3947,31 @@ window.setByDottedPath=(obj, path, value)=>{
3947
3947
  if(!contains(path,".")){
3948
3948
  obj[path]=value;
3949
3949
  }
3950
+
3951
+ const pathParts=path.split(".");
3952
+
3953
+ if(isString(obj)){
3954
+ // Here we are trying to set a value inside an object, but the attribute is actually a JSON string !
3955
+ try{
3956
+ obj=parseJSON(obj);
3957
+ }catch(error){
3958
+ const lastAttributeNameInPath=pathParts[pathParts.length-1];
3959
+ currentObject[lastAttributeNameInPath]=value;
3960
+ return;
3961
+ }
3962
+ }
3963
+
3950
3964
  let currentObject=obj;
3951
- const parts=path.split(".");
3952
- for(let i=0; i<parts.length-1; i++) {
3953
- const part=parts[i];
3965
+ for(let i=0; i<pathParts.length-1; i++) {
3966
+ const part=pathParts[i];
3954
3967
  if(!(part in currentObject)) {
3955
- const nextIsIndex=(!isNaN(parts[i + 1]));
3968
+ const nextIsIndex=(!isNaN(pathParts[i + 1]));
3956
3969
  currentObject[part]=(nextIsIndex ? [] : {});
3957
3970
  }
3958
3971
  currentObject=currentObject[part];
3959
3972
  }
3960
- currentObject[parts[parts.length - 1]]=value;
3973
+ const lastAttributeNameInPath=pathParts[pathParts.length-1];
3974
+ currentObject[lastAttributeNameInPath]=value;
3961
3975
  };
3962
3976
 
3963
3977
 
@@ -4991,7 +5005,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4991
5005
 
4992
5006
 
4993
5007
 
4994
- /*utils AI library associated with aotra version : «1_29072022-2359 (13/06/2025-22:21:14)»*/
5008
+ /*utils AI library associated with aotra version : «1_29072022-2359 (14/06/2025-00:05:09)»*/
4995
5009
  /*-----------------------------------------------------------------------------*/
4996
5010
 
4997
5011
 
@@ -5137,7 +5151,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
5137
5151
 
5138
5152
 
5139
5153
 
5140
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (13/06/2025-22:21:14)»*/
5154
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (14/06/2025-00:05:09)»*/
5141
5155
  /*-----------------------------------------------------------------------------*/
5142
5156
 
5143
5157
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1753",
3
+ "version": "0.0.1755",
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)",