aotrautils-srv 0.0.1130 → 0.0.1132
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 (19/03/2025-
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (19/03/2025-03:00:17)»*/
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
5
5
|
|
6
6
|
|
@@ -4883,7 +4883,7 @@ function flattenGraph(root, UUID_ATTR_NAME, CLASSNAME_ATTR_NAME, POINTER_TO_ATTR
|
|
4883
4883
|
|
4884
4884
|
function process(obj, map, isRoot=false) { // Store objects by ID
|
4885
4885
|
|
4886
|
-
if(obj === null || isPrimitive(obj)) return obj; // Primitives stay unchanged
|
4886
|
+
if(typeof(obj)==="undefined" || obj === null || isPrimitive(obj)) return obj; // Primitives stay unchanged
|
4887
4887
|
if(visitedObjects.has(obj)) return { [POINTER_TO_ATTR_NAME] : visitedObjects.get(obj) }; // Return if already processed
|
4888
4888
|
|
4889
4889
|
const id = (isRoot?ROOT_UUID:getUUID());
|
@@ -4898,7 +4898,7 @@ function flattenGraph(root, UUID_ATTR_NAME, CLASSNAME_ATTR_NAME, POINTER_TO_ATTR
|
|
4898
4898
|
foreach(obj,(item,indexOrKey)=>{
|
4899
4899
|
|
4900
4900
|
let value=null;
|
4901
|
-
if(item === null || isPrimitive(item)){
|
4901
|
+
if(typeof(item)==="undefined" || item === null || isPrimitive(item)){
|
4902
4902
|
serialized[indexOrKey]=item; // Primitives stay unchanged
|
4903
4903
|
return "continue";
|
4904
4904
|
}
|
@@ -4933,32 +4933,30 @@ function restoreGraph(flatData, keepClassName=false, UUID_ATTR_NAME, CLASSNAME_A
|
|
4933
4933
|
|
4934
4934
|
function revive(id, keepClassName, restoredObjects = {}) {
|
4935
4935
|
|
4936
|
-
if(!id ||
|
4936
|
+
if(!id || typeof(flatData[id])==="undefined" || flatData[id]==null) return null;
|
4937
4937
|
const found=restoredObjects[id];
|
4938
4938
|
if(restoredObjects[id]) return found;
|
4939
4939
|
|
4940
4940
|
const objData = flatData[id];
|
4941
4941
|
const className = objData[CLASSNAME_ATTR_NAME];
|
4942
|
-
|
4943
|
-
const instance = instanciate(className);
|
4942
|
+
const newInstance = instanciate(className);
|
4944
4943
|
|
4945
|
-
restoredObjects[id]=
|
4944
|
+
restoredObjects[id]=newInstance; // Assign ID early to handle circular references
|
4946
4945
|
|
4947
4946
|
foreach(objData,(item,indexOrKey)=>{
|
4948
|
-
if(item==null){
|
4949
|
-
|
4947
|
+
if(typeof(item)==="undefined" || item==null){
|
4948
|
+
newInstance[indexOrKey]=null;
|
4950
4949
|
}else{
|
4951
4950
|
const isRef = (!isPrimitive(item) && (POINTER_TO_ATTR_NAME in item));
|
4952
4951
|
const attrName=item[POINTER_TO_ATTR_NAME];
|
4953
|
-
|
4952
|
+
newInstance[indexOrKey] = isRef ? revive(attrName, keepClassName, restoredObjects) : item/*Case primitev or null*/;
|
4954
4953
|
}
|
4955
4954
|
},(item,indexOrKey)=> (
|
4956
4955
|
!contains([UUID_ATTR_NAME,POINTER_TO_ATTR_NAME],indexOrKey)
|
4957
4956
|
&& (keepClassName && indexOrKey===CLASSNAME_ATTR_NAME) || indexOrKey!==CLASSNAME_ATTR_NAME)
|
4958
4957
|
);
|
4959
4958
|
|
4960
|
-
|
4961
|
-
return instance;
|
4959
|
+
return newInstance;
|
4962
4960
|
}
|
4963
4961
|
|
4964
4962
|
return revive(ROOT_UUID, keepClassName);
|
@@ -5246,7 +5244,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
5246
5244
|
|
5247
5245
|
|
5248
5246
|
|
5249
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (19/03/2025-
|
5247
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (19/03/2025-03:00:17)»*/
|
5250
5248
|
/*-----------------------------------------------------------------------------*/
|
5251
5249
|
|
5252
5250
|
|
@@ -5390,7 +5388,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
|
|
5390
5388
|
|
5391
5389
|
|
5392
5390
|
|
5393
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (19/03/2025-
|
5391
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (19/03/2025-03:00:17)»*/
|
5394
5392
|
/*-----------------------------------------------------------------------------*/
|
5395
5393
|
|
5396
5394
|
|
aotrautils-srv/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "aotrautils-srv",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.1132",
|
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)",
|