aotrautils-srv 0.0.1584 → 0.0.1586
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 (11/05/2025-
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (11/05/2025-14:10:33)»*/
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
5
5
|
|
6
6
|
|
@@ -4895,7 +4895,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
4895
4895
|
|
4896
4896
|
|
4897
4897
|
|
4898
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (11/05/2025-
|
4898
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (11/05/2025-14:10:33)»*/
|
4899
4899
|
/*-----------------------------------------------------------------------------*/
|
4900
4900
|
|
4901
4901
|
|
@@ -5041,7 +5041,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
|
|
5041
5041
|
|
5042
5042
|
|
5043
5043
|
|
5044
|
-
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (11/05/2025-
|
5044
|
+
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (11/05/2025-14:10:33)»*/
|
5045
5045
|
/*-----------------------------------------------------------------------------*/
|
5046
5046
|
|
5047
5047
|
|
@@ -6052,7 +6052,7 @@ getListManager=function(config){
|
|
6052
6052
|
// NO : IN A NODE CONTEXT WITH require("...") WILL RESULT IN AN UNDEFINED FUNCTION ERROR !!!
|
6053
6053
|
// function performHTTPRequest(...){...
|
6054
6054
|
// USE THIS INSTEAD :
|
6055
|
-
performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyOrNamedArgs=null,isNodeContext=false,addCORSHeader=ADD_CORS_HEADER){
|
6055
|
+
performHTTPRequest=function(completeURL, httpMethod="GET", headers={}, requestBodyOrNamedArgs=null, isNodeContext=false, addCORSHeader=ADD_CORS_HEADER, forceStringifyBody=true){
|
6056
6056
|
|
6057
6057
|
// Body
|
6058
6058
|
let requestBodyOrNamedArgsStr=null;
|
@@ -6067,18 +6067,24 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
|
|
6067
6067
|
requestBodyOrNamedArgsStr=""+requestBodyOrNamedArgs;
|
6068
6068
|
}
|
6069
6069
|
}
|
6070
|
+
|
6070
6071
|
let body=null;
|
6071
6072
|
// Not the same way to send parameters, with POST/PUT http method :
|
6072
6073
|
if(contains(["POST","PUT"],httpMethod) && requestBodyOrNamedArgs){
|
6073
|
-
|
6074
|
-
|
6074
|
+
if(forceStringifyBody){
|
6075
|
+
body=requestBodyOrNamedArgsStr;
|
6076
|
+
}else{
|
6077
|
+
body=requestBodyOrNamedArgs;
|
6078
|
+
}
|
6075
6079
|
}
|
6076
6080
|
|
6077
6081
|
// Headers
|
6078
6082
|
if(contains(["POST","PUT"],httpMethod)){
|
6079
6083
|
headers["Content-Type"]="application/json";
|
6080
|
-
|
6084
|
+
|
6085
|
+
if(requestBodyOrNamedArgsStr && forceStringifyBody){
|
6081
6086
|
headers["Content-Length"]=Buffer.byteLength(requestBodyOrNamedArgsStr);
|
6087
|
+
}
|
6082
6088
|
|
6083
6089
|
// To remove the CORS error message (cf. https://medium.com/@dtkatz/3-ways-to-fix-the-cors-error-and-how-access-control-allow-origin-works-d97d55946d9)
|
6084
6090
|
if(addCORSHeader) headers["Access-Control-Allow-Origin"]="*";
|
@@ -6099,7 +6105,6 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
|
|
6099
6105
|
// TRACE
|
6100
6106
|
lognow("INFO : We are not running in a browser context (isNodeContext:"+isNodeContext+";typeof(require):"+(typeof(require))+"). Using browser library.");
|
6101
6107
|
|
6102
|
-
|
6103
6108
|
return new Promise((resolve,reject)=>{
|
6104
6109
|
fetch(completeURL, {
|
6105
6110
|
method: httpMethod,
|
aotrautils-srv/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "aotrautils-srv",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.1586",
|
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)",
|