aotrautils-srv 0.0.597 → 0.0.598
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 (24/09/2023-
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (24/09/2023-23:01:21)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -507,7 +507,7 @@ window.aotestMethods.getScenariiInTest=function(test){
|
|
|
507
507
|
|
|
508
508
|
// CAUTION : We ABSOLUTELY need to iterate over a deep copy, or else it will create weird incomprehensible bugs
|
|
509
509
|
// if we do another recursive browsing on the initial object !!!
|
|
510
|
-
const scenario=
|
|
510
|
+
const scenario=parseJSON(stringifyObject(scenarioParam));
|
|
511
511
|
|
|
512
512
|
|
|
513
513
|
const basePath=valuePath;
|
|
@@ -3805,13 +3805,13 @@ window.instanciate=function(className=null){
|
|
|
3805
3805
|
JSON.stringifyDecycle=function(obj){
|
|
3806
3806
|
let decycled=JSON.decycle(obj,null,"$className");
|
|
3807
3807
|
// CANNOT USE stringifyObject(...) function because we are in a common, lower-level library !
|
|
3808
|
-
return
|
|
3808
|
+
return stringifyObject(decycled);
|
|
3809
3809
|
}
|
|
3810
3810
|
|
|
3811
3811
|
|
|
3812
3812
|
JSON.parseRecycle=function(str){
|
|
3813
3813
|
|
|
3814
|
-
const parsedDecycled=
|
|
3814
|
+
const parsedDecycled=parseJSON(str);
|
|
3815
3815
|
let restoreClass=function(objParam){
|
|
3816
3816
|
|
|
3817
3817
|
if(!objParam || isPrimitive(objParam)) return objParam;
|
|
@@ -4365,9 +4365,7 @@ window.getAsFlatStructureImpl=function(rawObject, stateOnly=false
|
|
|
4365
4365
|
});
|
|
4366
4366
|
|
|
4367
4367
|
|
|
4368
|
-
// // DBG
|
|
4369
4368
|
// CANNOT USE stringifyObject(...) function because we are in a common, lower-level library !
|
|
4370
|
-
// console.log("¬¬¬¬resultMap STRINGIFY",JSON.stringify(resultMap));
|
|
4371
4369
|
|
|
4372
4370
|
return resultMap;
|
|
4373
4371
|
};
|
|
@@ -4609,8 +4607,8 @@ window.getAsTreeStructureImpl=function(oldMap, stateOnly=false, removeTypeInfo=t
|
|
|
4609
4607
|
// as : {<POINTER_TO_ATTR_NAME> : "a uuid"} )*}) }
|
|
4610
4608
|
|
|
4611
4609
|
if(typeof(oldMap)==="string"){
|
|
4612
|
-
oldMap=
|
|
4613
|
-
// oldMap=
|
|
4610
|
+
oldMap=parseJSON(oldMap);
|
|
4611
|
+
// oldMap=parseJSON(oldMap.replace(/"/gim,"'"));
|
|
4614
4612
|
// oldMap=eval(oldMap);
|
|
4615
4613
|
}
|
|
4616
4614
|
|
|
@@ -4836,7 +4834,7 @@ JSON.decycle=function decycle(object, replacer, classNameAttributeName){
|
|
|
4836
4834
|
|
|
4837
4835
|
// var a=[];
|
|
4838
4836
|
// a[0]=a;
|
|
4839
|
-
// return
|
|
4837
|
+
// return stringifyObject(JSON.decycle(a));
|
|
4840
4838
|
|
|
4841
4839
|
//produces the string '[{"$ref":"$"}]'.
|
|
4842
4840
|
|
|
@@ -4900,7 +4898,7 @@ JSON.decycle=function decycle(object, replacer, classNameAttributeName){
|
|
|
4900
4898
|
nu={};
|
|
4901
4899
|
Object.keys(value).forEach(function (name){
|
|
4902
4900
|
// CANNOT USE stringifyObject(...) function because we are in a common, lower-level library !
|
|
4903
|
-
nu[name]=derez( value[name], path + "[" +
|
|
4901
|
+
nu[name]=derez( value[name], path + "[" + stringifyObject(name) + "]"
|
|
4904
4902
|
);
|
|
4905
4903
|
});
|
|
4906
4904
|
|
|
@@ -4937,7 +4935,7 @@ JSON.recycle=function recycle($){
|
|
|
4937
4935
|
|
|
4938
4936
|
//So,
|
|
4939
4937
|
// var s='[{"$ref":"$"}]';
|
|
4940
|
-
// return JSON.recycle(
|
|
4938
|
+
// return JSON.recycle(parseJSON(s));
|
|
4941
4939
|
//produces an array containing a single element which is the array itself.
|
|
4942
4940
|
|
|
4943
4941
|
var px=/^\$(?:\[(?:\d+|"(?:[^\\"\u0000-\u001f]|\\(?:[\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*")\])*$/;
|
|
@@ -4997,7 +4995,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4997
4995
|
|
|
4998
4996
|
|
|
4999
4997
|
|
|
5000
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (24/09/2023-
|
|
4998
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (24/09/2023-23:01:21)»*/
|
|
5001
4999
|
/*-----------------------------------------------------------------------------*/
|
|
5002
5000
|
|
|
5003
5001
|
|
|
@@ -5102,7 +5100,7 @@ if(typeof(fs)==="undefined"){
|
|
|
5102
5100
|
let resultData={};
|
|
5103
5101
|
|
|
5104
5102
|
// 1)
|
|
5105
|
-
if(!empty(resultFlat)) resultData=
|
|
5103
|
+
if(!empty(resultFlat)) resultData=parseJSON(resultFlat);
|
|
5106
5104
|
|
|
5107
5105
|
// 2)
|
|
5108
5106
|
if(!empty(resultData) && isFlatMap(resultData)){
|
|
@@ -5125,7 +5123,7 @@ if(typeof(fs)==="undefined"){
|
|
|
5125
5123
|
|
|
5126
5124
|
// reserved characters : -/\^$*+?.()|[]{}
|
|
5127
5125
|
// CANNOT USE stringifyObject(...) function because we are in a common, lower-level library !
|
|
5128
|
-
let dataFlatStr=
|
|
5126
|
+
let dataFlatStr=stringifyObject(dataFlatForClient)
|
|
5129
5127
|
// We «aerate» the produced JSON :
|
|
5130
5128
|
.replace(/":[\w]*\{/gim,"\":{\n").replace(/,"/gim,",\n\"")
|
|
5131
5129
|
// ...except for inline, escaped JSON string representations :
|
|
@@ -5314,11 +5312,11 @@ WebsocketImplementation={
|
|
|
5314
5312
|
let dataResult=eventOrMessage;
|
|
5315
5313
|
|
|
5316
5314
|
try{
|
|
5317
|
-
dataResult=(WebsocketImplementation.useFlatStrings || isString(eventOrMessage)?
|
|
5315
|
+
dataResult=(WebsocketImplementation.useFlatStrings || isString(eventOrMessage)?parseJSOn(eventOrMessage):eventOrMessage);
|
|
5318
5316
|
}catch(error1){
|
|
5319
5317
|
// TRACE
|
|
5320
5318
|
lognow(`ERROR : Failed to parse JSON for string «${dataResult}»`,error1);
|
|
5321
|
-
dataResult=(isString(eventOrMessage)?eventOrMessage:
|
|
5319
|
+
dataResult=(isString(eventOrMessage)?eventOrMessage:stringifyObject(eventOrMessage));
|
|
5322
5320
|
}
|
|
5323
5321
|
|
|
5324
5322
|
return dataResult;
|
|
@@ -5392,7 +5390,7 @@ WebsocketImplementation={
|
|
|
5392
5390
|
// // DBG
|
|
5393
5391
|
// lognow("(SERVER) RECEIVED SOMETHING FROM CLIENT...", eventOrMessage.data);
|
|
5394
5392
|
|
|
5395
|
-
// dataWrapped=
|
|
5393
|
+
// dataWrapped=parseJSON(dataWrapped);
|
|
5396
5394
|
// dataWrapped=getAt(dataWrapped,0);// We get the root element
|
|
5397
5395
|
|
|
5398
5396
|
|
|
@@ -5477,7 +5475,7 @@ WebsocketImplementation={
|
|
|
5477
5475
|
let dataWrapped={channelName:channelName, data:data};
|
|
5478
5476
|
|
|
5479
5477
|
|
|
5480
|
-
dataWrapped=
|
|
5478
|
+
dataWrapped=stringifyObject(dataWrapped);
|
|
5481
5479
|
|
|
5482
5480
|
// TODO : FIXME : Use one single interface !
|
|
5483
5481
|
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.send(dataWrapped);
|
|
@@ -5502,7 +5500,7 @@ WebsocketImplementation={
|
|
|
5502
5500
|
|
|
5503
5501
|
// Channel information is stored in exchanged data :
|
|
5504
5502
|
let dataWrapped={channelName:channelName, data:data};
|
|
5505
|
-
dataWrapped=
|
|
5503
|
+
dataWrapped=stringifyObject(dataWrapped);
|
|
5506
5504
|
|
|
5507
5505
|
|
|
5508
5506
|
// DBG
|
|
@@ -5740,9 +5738,9 @@ WebsocketImplementation={
|
|
|
5740
5738
|
clientsRoomsTag:clientsRoomsTag,
|
|
5741
5739
|
execute:(eventOrMessage)=>{
|
|
5742
5740
|
|
|
5743
|
-
// dataWrapped=
|
|
5741
|
+
// dataWrapped=parseJSON(dataWrapped);
|
|
5744
5742
|
// dataWrapped=getAt(dataWrapped,0);// We get the root element
|
|
5745
|
-
// const dataWrapped=(WebsocketImplementation.useFlatStrings?
|
|
5743
|
+
// const dataWrapped=(WebsocketImplementation.useFlatStrings?parseJSON(eventOrMessage):eventOrMessage);
|
|
5746
5744
|
|
|
5747
5745
|
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
|
5748
5746
|
|
|
@@ -5804,7 +5802,7 @@ WebsocketImplementation={
|
|
|
5804
5802
|
// console.log("(NODE CLIENT) SENDING DATA ! dataWrapped:",dataWrapped);
|
|
5805
5803
|
|
|
5806
5804
|
|
|
5807
|
-
dataWrapped=
|
|
5805
|
+
dataWrapped=stringifyObject(dataWrapped);
|
|
5808
5806
|
|
|
5809
5807
|
|
|
5810
5808
|
// // DBG
|
|
@@ -6056,7 +6054,7 @@ WebsocketImplementation={
|
|
|
6056
6054
|
console.log("(BROWSER) SENDING... : clientSocket :",clientSocket);
|
|
6057
6055
|
|
|
6058
6056
|
|
|
6059
|
-
dataWrapped=
|
|
6057
|
+
dataWrapped=stringifyObject(dataWrapped);
|
|
6060
6058
|
|
|
6061
6059
|
|
|
6062
6060
|
// TODO : FIXME : Use one single interface !
|
|
@@ -6313,7 +6311,7 @@ initNodeServerInfrastructureWrapper=function(doOnClientConnection=null, doOnFina
|
|
|
6313
6311
|
}else if(i==3){
|
|
6314
6312
|
if(!isHashAsked){
|
|
6315
6313
|
try{
|
|
6316
|
-
const jsonConf=
|
|
6314
|
+
const jsonConf=parseJSON(val);
|
|
6317
6315
|
argCLPort=jsonConf.port;
|
|
6318
6316
|
argCLCertPath=jsonConf.sslCertPath;
|
|
6319
6317
|
argCLKeyPath=jsonConf.sslKeyPath;
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.598",
|
|
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)",
|