aotrautils 0.0.1575 → 0.0.1577
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.
- aotrautils/aotrautils.build.js +24 -20
- aotrautils/package.json +1 -1
aotrautils/aotrautils.build.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (11/05/2025-
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (11/05/2025-01:14:05)»*/
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
5
5
|
|
6
6
|
|
@@ -4895,7 +4895,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
4895
4895
|
|
4896
4896
|
|
4897
4897
|
|
4898
|
-
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (11/05/2025-
|
4898
|
+
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (11/05/2025-01:14:05)»*/
|
4899
4899
|
/*-----------------------------------------------------------------------------*/
|
4900
4900
|
/* ## Utility global methods in a browser (htmljs) client environment.
|
4901
4901
|
*
|
@@ -13497,7 +13497,7 @@ getAORTACClient=function(clientId=getUUID(), serverNodeOrigin="ws://127.0.0.1:40
|
|
13497
13497
|
|
13498
13498
|
|
13499
13499
|
|
13500
|
-
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (11/05/2025-
|
13500
|
+
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (11/05/2025-01:14:05)»*/
|
13501
13501
|
/*-----------------------------------------------------------------------------*/
|
13502
13502
|
|
13503
13503
|
|
@@ -14736,7 +14736,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
|
|
14736
14736
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
14737
14737
|
|
14738
14738
|
AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
|
14739
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (11/05/2025-
|
14739
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (11/05/2025-01:14:05)»*/
|
14740
14740
|
/*-----------------------------------------------------------------------------*/
|
14741
14741
|
|
14742
14742
|
|
@@ -14882,7 +14882,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
|
|
14882
14882
|
|
14883
14883
|
|
14884
14884
|
|
14885
|
-
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (11/05/2025-
|
14885
|
+
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (11/05/2025-01:14:05)»*/
|
14886
14886
|
/*-----------------------------------------------------------------------------*/
|
14887
14887
|
|
14888
14888
|
|
@@ -15895,8 +15895,11 @@ getListManager=function(config){
|
|
15895
15895
|
// USE THIS INSTEAD :
|
15896
15896
|
performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyOrNamedArgs=null,isNodeContext=false,addCORSHeader=ADD_CORS_HEADER){
|
15897
15897
|
|
15898
|
+
// Body
|
15898
15899
|
let requestBodyOrNamedArgsStr=null;
|
15899
15900
|
if(requestBodyOrNamedArgs){
|
15901
|
+
if(isString(requestBodyOrNamedArgs) && !isObject(requestBodyOrNamedArgs))
|
15902
|
+
throw new Error("ERROR : Body for request cannot be a string ! Must be a simple object.");
|
15900
15903
|
try{
|
15901
15904
|
requestBodyOrNamedArgsStr=stringifyObject(requestBodyOrNamedArgs)
|
15902
15905
|
// We remove all the breaklines :
|
@@ -15905,7 +15908,14 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
|
|
15905
15908
|
requestBodyOrNamedArgsStr=""+requestBodyOrNamedArgs;
|
15906
15909
|
}
|
15907
15910
|
}
|
15908
|
-
|
15911
|
+
let body=null;
|
15912
|
+
// Not the same way to send parameters, with POST/PUT http method :
|
15913
|
+
if(contains(["POST","PUT"],httpMethod) && requestBodyOrNamedArgs){
|
15914
|
+
// CAUTION : IF POST/PUT METHOD THEN WE MUST NOT PASS A STRING, BUT A PLAIN OBJECT ! ELSE IT WILL CAUSE STRANGE BUGS !!!
|
15915
|
+
body=requestBodyOrNamedArgs;
|
15916
|
+
}
|
15917
|
+
|
15918
|
+
// Headers
|
15909
15919
|
if(contains(["POST","PUT"],httpMethod)){
|
15910
15920
|
headers["Content-Type"]="application/json";
|
15911
15921
|
if(requestBodyOrNamedArgsStr)
|
@@ -15924,13 +15934,13 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
|
|
15924
15934
|
// DBG
|
15925
15935
|
lognow("formatted API URL : "+completeURL);
|
15926
15936
|
}
|
15927
|
-
|
15937
|
+
|
15928
15938
|
// CASE BROWSER CONTEXT :
|
15929
15939
|
if(!isNodeContext || typeof(require)=="undefined"){
|
15930
15940
|
// TRACE
|
15931
15941
|
lognow("INFO : We are not running in a browser context (isNodeContext:"+isNodeContext+";typeof(require):"+(typeof(require))+"). Using browser library.");
|
15932
15942
|
|
15933
|
-
|
15943
|
+
|
15934
15944
|
return new Promise((resolve,reject)=>{
|
15935
15945
|
fetch(completeURL, {
|
15936
15946
|
method: httpMethod,
|
@@ -16005,12 +16015,9 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
|
|
16005
16015
|
// A chunk of data has been received.
|
16006
16016
|
response.on("data", (chunk) => {
|
16007
16017
|
responseDataStr += chunk;
|
16008
|
-
|
16009
|
-
//
|
16010
|
-
|
16011
|
-
lognow(">>>str:"+str);
|
16012
|
-
|
16013
|
-
|
16018
|
+
// // DEBUG ONLY
|
16019
|
+
// const str = Buffer.from(chunk).toString("utf8");
|
16020
|
+
// lognow(">>>str:"+str);
|
16014
16021
|
});
|
16015
16022
|
|
16016
16023
|
// The whole response has been received.
|
@@ -16060,12 +16067,9 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
|
|
16060
16067
|
reject({error:error, httpStatus:null});
|
16061
16068
|
});
|
16062
16069
|
|
16063
|
-
|
16064
|
-
|
16065
|
-
|
16066
|
-
// (We need to stringify parameters or else we'll have an error :)
|
16067
|
-
if(requestBodyOrNamedArgs)
|
16068
|
-
request.write(requestBodyOrNamedArgsStr);
|
16070
|
+
// Not the same way to send parameters, with POST/PUT http method :
|
16071
|
+
if(contains(["POST","PUT"],httpMethod) && body){
|
16072
|
+
request.write(body);
|
16069
16073
|
}
|
16070
16074
|
|
16071
16075
|
// End the request
|
aotrautils/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "aotrautils",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.1577",
|
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)",
|