aotrautils 0.0.1207 → 0.0.1209

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 (30/03/2025-02:28:42)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (30/03/2025-02:55:21)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4059,7 +4059,7 @@ window.areEquivalentFlatMaps=function(o1,o2,UUID_ATTR_NAME=DEFAULT_UUID_ATTR_NAM
4059
4059
  if((o1!=null)!==(o2!=null)) return false;
4060
4060
 
4061
4061
  // We ignore uuid keys :
4062
- const ignoredAttributes=[UUID_ATTR_NAME,POINTER_TO_ATTR_NAME];
4062
+ //const ignoredAttributes=[UUID_ATTR_NAME,POINTER_TO_ATTR_NAME];
4063
4063
 
4064
4064
 
4065
4065
  if(Object.keys(o1).length!==Object.keys(o2).length){
@@ -4079,7 +4079,8 @@ window.areEquivalentFlatMaps=function(o1,o2,UUID_ATTR_NAME=DEFAULT_UUID_ATTR_NAM
4079
4079
 
4080
4080
  let entry=o1[key];
4081
4081
 
4082
- let s1=hashSafe(getSignatureOnNonCycledObject(entry,false,ignoredAttributes));
4082
+ //let s1=hashSafe(getSignatureOnNonCycledObject(entry,false,ignoredAttributes));
4083
+ let s1=hashSafe(getSignatureOnFlatObject(entry,false));
4083
4084
  signatures1.push(s1);
4084
4085
 
4085
4086
  },()=>{ return true; }
@@ -4091,7 +4092,8 @@ window.areEquivalentFlatMaps=function(o1,o2,UUID_ATTR_NAME=DEFAULT_UUID_ATTR_NAM
4091
4092
 
4092
4093
  let entry=o2[key];
4093
4094
 
4094
- let s2=hashSafe(getSignatureOnNonCycledObject(entry,false,ignoredAttributes));
4095
+ //let s2=hashSafe(getSignatureOnNonCycledObject(entry,false,ignoredAttributes));
4096
+ let s2=hashSafe(getSignatureOnFlatObject(entry,false));
4095
4097
 
4096
4098
  if(!contains(signatures1,s2)){
4097
4099
 
@@ -4241,20 +4243,24 @@ window.areEquivalent=function(obj1Param,obj2Param,flattenBeforeCompute=false, UU
4241
4243
  if(isArrayObj1!==isArrayObj2) return false;
4242
4244
 
4243
4245
  let obj1, obj2;
4246
+ let s1,s2;
4244
4247
  if(flattenBeforeCompute){
4245
4248
  // CAUTION : The UUIDs generation can alter the result !
4246
- obj1=JSON.decycle(obj1Param);
4247
- obj2=JSON.decycle(obj2Param);
4249
+ obj1=JSON.decycle(obj1Param);
4250
+ obj2=JSON.decycle(obj2Param);
4251
+ s1=getSignatureOnFlatObject(obj1, false);
4252
+ s2=getSignatureOnFlatObject(obj2, false);
4248
4253
  }else{
4249
- obj1=obj1Param;
4250
- obj2=obj2Param;
4254
+ obj1=obj1Param;
4255
+ obj2=obj2Param;
4256
+ s1=getSignatureOnObject(obj1, false);
4257
+ s2=getSignatureOnObject(obj2, false);
4251
4258
  }
4252
4259
 
4253
4260
  //We ignore uuid keys :
4254
- const ignoredAttributes=[UUID_ATTR_NAME,POINTER_TO_ATTR_NAME];
4255
-
4256
- let s1=getSignatureOnNonCycledObject(obj1,false,ignoredAttributes);
4257
- let s2=getSignatureOnNonCycledObject(obj2,false,ignoredAttributes);
4261
+ //const ignoredAttributes=[UUID_ATTR_NAME,POINTER_TO_ATTR_NAME];
4262
+ //s1=getSignatureOnNonCycledObject(obj1,false,ignoredAttributes);
4263
+ //s2=getSignatureOnNonCycledObject(obj2,false,ignoredAttributes);
4258
4264
 
4259
4265
  // DBG
4260
4266
  //lognow("+++++++++++++++++SIGNATURE 1:",s1);
@@ -4350,8 +4356,25 @@ window.calculateProtoDelta=function(obj1,obj2,
4350
4356
  return result;
4351
4357
  };
4352
4358
 
4359
+
4360
+ /*public*/window.getSignatureOnObject=function(obj, isHashed=true){
4361
+ // We always flatten the input object first :
4362
+ const flatObj=getAsFlatStructure(obj);
4363
+
4364
+ return getSignatureOnFlatObject(flatObj, isHashed);
4365
+ }
4366
+
4367
+ /*public*/window.getSignatureOnFlatObject=function(flatObj, isHashed=true){
4368
+
4369
+ // We construct a simple array, to get rid of the identifiers values :
4370
+ foreach(flatObj,item=>flatArray.push(item));
4371
+
4372
+ return getSignatureOnNonCycledObject(flatObj, isHashed, [DEFAULT_UUID_ATTR_NAME, DEFAULT_POINTER_TO_ATTR_NAME]);
4373
+ }
4374
+
4375
+ // DO NOT CALL DIRECTLY :
4353
4376
  // CAUTION : will cause an INFINITE LOOP if the object contains a CYCLE !
4354
- /*private*/window.getSignatureOnNonCycledObject=function(obj,isHashed=true,attributesNamesToIgnore=null){
4377
+ /*private*/window.getSignatureOnNonCycledObject=function(obj, isHashed=true, attributesNamesToIgnore=null){
4355
4378
  var result="";
4356
4379
  if(obj==null) return "null";
4357
4380
  if(isPrimitive(obj)) return ""+obj;
@@ -4848,7 +4871,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4848
4871
 
4849
4872
 
4850
4873
 
4851
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (30/03/2025-02:28:42)»*/
4874
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (30/03/2025-02:55:21)»*/
4852
4875
  /*-----------------------------------------------------------------------------*/
4853
4876
  /* ## Utility global methods in a browser (htmljs) client environment.
4854
4877
  *
@@ -13420,7 +13443,7 @@ getAORTACClient=function(clientId=getUUID(), serverNodeOrigin="ws://127.0.0.1:40
13420
13443
 
13421
13444
 
13422
13445
 
13423
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (30/03/2025-02:28:42)»*/
13446
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (30/03/2025-02:55:21)»*/
13424
13447
  /*-----------------------------------------------------------------------------*/
13425
13448
 
13426
13449
 
@@ -14659,7 +14682,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14659
14682
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14660
14683
 
14661
14684
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14662
- /*utils AI library associated with aotra version : «1_29072022-2359 (30/03/2025-02:28:42)»*/
14685
+ /*utils AI library associated with aotra version : «1_29072022-2359 (30/03/2025-02:55:21)»*/
14663
14686
  /*-----------------------------------------------------------------------------*/
14664
14687
 
14665
14688
 
@@ -14803,7 +14826,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
14803
14826
 
14804
14827
 
14805
14828
 
14806
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (30/03/2025-02:28:42)»*/
14829
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (30/03/2025-02:55:21)»*/
14807
14830
  /*-----------------------------------------------------------------------------*/
14808
14831
 
14809
14832
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1207",
3
+ "version": "0.0.1209",
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)",