aotrautils-srv 0.0.1839 → 0.0.1840

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 (05/04/2026-12:42:24)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (09/04/2026-01:44:45)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4117,13 +4117,30 @@ window.instanciate=function(className=null){
4117
4117
  if(className==="Array") return [];
4118
4118
 
4119
4119
 
4120
- const classInWindow=window[className];
4121
- if(!classInWindow){
4120
+ let classInWindow=globalThis[className];
4121
+ if(typeof(classInWindow)=="undefined"){
4122
4122
  // TRACE
4123
- lognow(`WARN : CAUTION : «${className}» class does not seem to be registered in the global window object. This can lead to problems instanciating it in a pure nodejs context.`);
4123
+ lognow(`WARN : CAUTION : «${className}» class does not seem to be registered in the globalThis object. This can lead to problems instanciating it in a pure nodejs context.`);
4124
+ classInWindow=window[className];
4125
+ if(typeof(classInWindow)=="undefined"){
4126
+ // TRACE
4127
+ lognow(`WARN : CAUTION : «${className}» class does not seem to be registered in the window object. This can lead to problems instanciating it in a pure nodejs context.`);
4128
+ if(typeof(global)!="undefined"){
4129
+ lognow(`WARN : Trying with global object...`);
4130
+ classInWindow=global[className];
4131
+ if(!classInWindow){
4132
+ // TRACE
4133
+ lognow(`ERROR : CAUTION : «${className}» class does not seem to be registered in the global object. Cannot instanciate it.`);
4134
+ return newObj;
4135
+ }
4136
+ }else{
4137
+ // TRACE
4138
+ lognow(`ERROR : CAUTION : «${className}» class does not seem to be accessible in the globalThis nor window object, and global object does not exist. Cannot instanciate it.`);
4139
+ return newObj;
4140
+ }
4141
+ }
4124
4142
  }
4125
4143
 
4126
-
4127
4144
  // OLD :
4128
4145
  // try{
4129
4146
  // try{
@@ -4162,6 +4179,7 @@ window.instanciate=function(className=null){
4162
4179
  // }
4163
4180
  // }
4164
4181
 
4182
+ // NEW :
4165
4183
  newObj=new classInWindow();
4166
4184
  return newObj;
4167
4185
  };
@@ -5384,7 +5402,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5384
5402
 
5385
5403
 
5386
5404
 
5387
- /*utils AI library associated with aotra version : «1_29072022-2359 (05/04/2026-12:42:24)»*/
5405
+ /*utils AI library associated with aotra version : «1_29072022-2359 (09/04/2026-01:44:45)»*/
5388
5406
  /*-----------------------------------------------------------------------------*/
5389
5407
 
5390
5408
 
@@ -5530,7 +5548,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
5530
5548
 
5531
5549
 
5532
5550
 
5533
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (05/04/2026-12:42:24)»*/
5551
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (09/04/2026-01:44:45)»*/
5534
5552
  /*-----------------------------------------------------------------------------*/
5535
5553
 
5536
5554
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1839",
3
+ "version": "0.0.1840",
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)",