aotrautils-srv 0.0.1119 → 0.0.1120
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 (18/03/2025-23:35:
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (18/03/2025-23:35:55)»*/
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
5
5
|
|
6
6
|
|
@@ -2312,7 +2312,7 @@ window.LZWString={
|
|
2312
2312
|
|
2313
2313
|
writeBit : function(value, data){
|
2314
2314
|
data.val=(data.val << 1) | value;
|
2315
|
-
if
|
2315
|
+
if(data.position == 15){
|
2316
2316
|
data.position=0;
|
2317
2317
|
data.string += String.fromCharCode(data.val);
|
2318
2318
|
data.val=0;
|
@@ -2322,7 +2322,7 @@ window.LZWString={
|
|
2322
2322
|
},
|
2323
2323
|
|
2324
2324
|
writeBits : function(numBits, value, data){
|
2325
|
-
if
|
2325
|
+
if(typeof(value)=="string")
|
2326
2326
|
value=value.charCodeAt(0);
|
2327
2327
|
for (var i=0 ; i<numBits ; i++){
|
2328
2328
|
this.writeBit(value&1, data);
|
@@ -2331,8 +2331,8 @@ window.LZWString={
|
|
2331
2331
|
},
|
2332
2332
|
|
2333
2333
|
produceW : function (context){
|
2334
|
-
if
|
2335
|
-
if
|
2334
|
+
if(Object.prototype.hasOwnProperty.call(context.dictionaryToCreate,context.w)){
|
2335
|
+
if(context.w.charCodeAt(0)<256){
|
2336
2336
|
this.writeBits(context.numBits, 0, context.data);
|
2337
2337
|
this.writeBits(8, context.w, context.data);
|
2338
2338
|
} else {
|
@@ -2349,7 +2349,7 @@ window.LZWString={
|
|
2349
2349
|
|
2350
2350
|
decrementEnlargeIn : function(context){
|
2351
2351
|
context.enlargeIn--;
|
2352
|
-
if
|
2352
|
+
if(context.enlargeIn == 0){
|
2353
2353
|
context.enlargeIn=Math.pow(2, context.numBits);
|
2354
2354
|
context.numBits++;
|
2355
2355
|
}
|
@@ -2371,13 +2371,13 @@ window.LZWString={
|
|
2371
2371
|
|
2372
2372
|
for (i=0; i<uncompressed.length; i += 1){
|
2373
2373
|
context.c=uncompressed.charAt(i);
|
2374
|
-
if
|
2374
|
+
if(!Object.prototype.hasOwnProperty.call(context.dictionary,context.c)){
|
2375
2375
|
context.dictionary[context.c]=context.dictSize++;
|
2376
2376
|
context.dictionaryToCreate[context.c]=true;
|
2377
2377
|
}
|
2378
2378
|
|
2379
2379
|
context.wc=context.w + context.c;
|
2380
|
-
if
|
2380
|
+
if(Object.prototype.hasOwnProperty.call(context.dictionary,context.wc)){
|
2381
2381
|
context.w=context.wc;
|
2382
2382
|
} else {
|
2383
2383
|
this.produceW(context);
|
@@ -2388,7 +2388,7 @@ window.LZWString={
|
|
2388
2388
|
}
|
2389
2389
|
|
2390
2390
|
// Output the code for w.
|
2391
|
-
if
|
2391
|
+
if(context.w !== ""){
|
2392
2392
|
this.produceW(context);
|
2393
2393
|
}
|
2394
2394
|
|
@@ -2403,7 +2403,7 @@ window.LZWString={
|
|
2403
2403
|
readBit : function(data){
|
2404
2404
|
var res=data.val & data.position;
|
2405
2405
|
data.position >>= 1;
|
2406
|
-
if
|
2406
|
+
if(data.position == 0){
|
2407
2407
|
data.position=32768;
|
2408
2408
|
data.val=data.string.charCodeAt(data.index++);
|
2409
2409
|
}
|
@@ -2459,7 +2459,7 @@ window.LZWString={
|
|
2459
2459
|
|
2460
2460
|
switch (c){
|
2461
2461
|
case 0:
|
2462
|
-
if
|
2462
|
+
if(errorCount++>10000) return "Error";
|
2463
2463
|
c=String.fromCharCode(this.readBits(8, data));
|
2464
2464
|
dictionary[dictSize++]=c;
|
2465
2465
|
c=dictSize-1;
|
@@ -2475,15 +2475,15 @@ window.LZWString={
|
|
2475
2475
|
return result;
|
2476
2476
|
}
|
2477
2477
|
|
2478
|
-
if
|
2478
|
+
if(enlargeIn == 0){
|
2479
2479
|
enlargeIn=Math.pow(2, numBits);
|
2480
2480
|
numBits++;
|
2481
2481
|
}
|
2482
2482
|
|
2483
|
-
if
|
2483
|
+
if(dictionary[c]){
|
2484
2484
|
entry=dictionary[c];
|
2485
2485
|
} else {
|
2486
|
-
if
|
2486
|
+
if(c === dictSize){
|
2487
2487
|
entry=w + w.charAt(0);
|
2488
2488
|
} else {
|
2489
2489
|
return null;
|
@@ -2497,7 +2497,7 @@ window.LZWString={
|
|
2497
2497
|
|
2498
2498
|
w=entry;
|
2499
2499
|
|
2500
|
-
if
|
2500
|
+
if(enlargeIn == 0){
|
2501
2501
|
enlargeIn=Math.pow(2, numBits);
|
2502
2502
|
numBits++;
|
2503
2503
|
}
|
@@ -4883,8 +4883,8 @@ 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
|
4887
|
-
if
|
4886
|
+
if(obj === null || isPrimitive(obj)) return obj; // Primitives stay unchanged
|
4887
|
+
if(contains(visitedObjects,obj)) return { [POINTER_TO_ATTR_NAME] : obj }; // Return if already processed
|
4888
4888
|
|
4889
4889
|
const id = (isRoot?ROOT_UUID:getUUID());
|
4890
4890
|
visitedObjects.push(obj); // Mark object as processed
|
@@ -4898,11 +4898,11 @@ 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
|
4901
|
+
if(item === null || isPrimitive(item)){
|
4902
4902
|
serialized[indexOrKey]=item; // Primitives stay unchanged
|
4903
4903
|
return "continue";
|
4904
4904
|
}
|
4905
|
-
if
|
4905
|
+
if(!contains(visitedObjects,item)){
|
4906
4906
|
process(item, map);
|
4907
4907
|
}
|
4908
4908
|
serialized[indexOrKey] = { [POINTER_TO_ATTR_NAME] : item }; // Return if already processed;
|
@@ -4933,7 +4933,7 @@ function restoreGraph(flatData, keepClassName=false, UUID_ATTR_NAME, CLASSNAME_A
|
|
4933
4933
|
|
4934
4934
|
function revive(id, keepClassName, restoredObjects = {}) {
|
4935
4935
|
|
4936
|
-
if
|
4936
|
+
if(!id || !flatData[id]) return null;
|
4937
4937
|
const found=restoredObjects[id];
|
4938
4938
|
if(restoredObjects[id]) return found;
|
4939
4939
|
|
@@ -5159,7 +5159,7 @@ window.parseJSON=function(strParam){
|
|
5159
5159
|
|
5160
5160
|
if(!isString(strParam)) return strParam;
|
5161
5161
|
|
5162
|
-
if
|
5162
|
+
if(nothing(strParam))
|
5163
5163
|
return null;
|
5164
5164
|
var str=toOneSimplifiedLine(strParam.trim())
|
5165
5165
|
// OLD : Safer, but necessited to never use «'» in literal strings, and use «´» acute character instead !
|
@@ -5205,7 +5205,7 @@ window.stringifyObject=function(objectToStringify){
|
|
5205
5205
|
|
5206
5206
|
if(objectToStringify==null) return null;
|
5207
5207
|
|
5208
|
-
if
|
5208
|
+
if(JSON && JSON.stringify && typeof JSON.stringify !== "undefined" && typeof JSON.stringify === "function"){
|
5209
5209
|
return JSON.stringify(objectToStringify);
|
5210
5210
|
}
|
5211
5211
|
if(typeof jQuery !== "undefined" && typeof jQuery.stringify !== "undefined" && typeof jQuery.stringify === "function"){
|
@@ -5246,7 +5246,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
5246
5246
|
|
5247
5247
|
|
5248
5248
|
|
5249
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (18/03/2025-23:35:
|
5249
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (18/03/2025-23:35:55)»*/
|
5250
5250
|
/*-----------------------------------------------------------------------------*/
|
5251
5251
|
|
5252
5252
|
|
@@ -5390,7 +5390,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
|
|
5390
5390
|
|
5391
5391
|
|
5392
5392
|
|
5393
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (18/03/2025-23:35:
|
5393
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (18/03/2025-23:35:55)»*/
|
5394
5394
|
/*-----------------------------------------------------------------------------*/
|
5395
5395
|
|
5396
5396
|
|
aotrautils-srv/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "aotrautils-srv",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.1120",
|
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)",
|