aotrautils-srv 0.0.1494 → 0.0.1495
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 (
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (29/04/2025-00:11:03)»*/
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
5
5
|
|
6
6
|
|
@@ -4894,7 +4894,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
4894
4894
|
|
4895
4895
|
|
4896
4896
|
|
4897
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (
|
4897
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (29/04/2025-00:11:03)»*/
|
4898
4898
|
/*-----------------------------------------------------------------------------*/
|
4899
4899
|
|
4900
4900
|
|
@@ -5040,7 +5040,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
|
|
5040
5040
|
|
5041
5041
|
|
5042
5042
|
|
5043
|
-
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (
|
5043
|
+
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (29/04/2025-00:11:03)»*/
|
5044
5044
|
/*-----------------------------------------------------------------------------*/
|
5045
5045
|
|
5046
5046
|
|
@@ -7186,7 +7186,14 @@ class NodeServerInstance{
|
|
7186
7186
|
this.listenableServer.close(doOnCloseServer);
|
7187
7187
|
});
|
7188
7188
|
}
|
7189
|
-
|
7189
|
+
|
7190
|
+
|
7191
|
+
|
7192
|
+
// TODO : DEVELOP...
|
7193
|
+
//sendChainable(channelNameParam, data, clientsRoomsTag=null){
|
7194
|
+
//}
|
7195
|
+
|
7196
|
+
|
7190
7197
|
receive(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null){
|
7191
7198
|
const self=this;
|
7192
7199
|
|
@@ -7194,8 +7201,6 @@ class NodeServerInstance{
|
|
7194
7201
|
lognow("(SERVER) Registering receive for «"+channelNameParam+"»...");
|
7195
7202
|
|
7196
7203
|
const serverReceptionEntryPoint=new ServerReceptionEntryPoint(channelNameParam, clientsRoomsTag, doOnIncomingMessage);
|
7197
|
-
|
7198
|
-
///!!!
|
7199
7204
|
this.serverReceptionEntryPoints.push(serverReceptionEntryPoint);
|
7200
7205
|
|
7201
7206
|
// SPECIAL FOR THE SOCKETIO IMPLEMENTATION :
|
@@ -7209,11 +7214,6 @@ class NodeServerInstance{
|
|
7209
7214
|
return this;
|
7210
7215
|
}
|
7211
7216
|
|
7212
|
-
|
7213
|
-
// TODO : DEVELOP...
|
7214
|
-
//sendChainable(channelNameParam, data, clientsRoomsTag=null){
|
7215
|
-
//}
|
7216
|
-
|
7217
7217
|
|
7218
7218
|
send(channelName, data, clientsRoomsTag=null, clientSocketParam=null){
|
7219
7219
|
|
@@ -7446,11 +7446,11 @@ class ClientReceptionEntryPoint{
|
|
7446
7446
|
this.doOnIncomingMessage=doOnIncomingMessage;
|
7447
7447
|
}
|
7448
7448
|
|
7449
|
+
// III-
|
7449
7450
|
execute(eventOrMessage, clientSocket, clientReceptionEntryPoints){
|
7450
7451
|
|
7451
7452
|
const channelName=this.channelName;
|
7452
7453
|
|
7453
|
-
|
7454
7454
|
const dataWrapped=WebsocketImplementation.getMessageDataBothImplementations(eventOrMessage);
|
7455
7455
|
|
7456
7456
|
// Channel information is stored in exchanged data :
|
@@ -7459,17 +7459,31 @@ class ClientReceptionEntryPoint{
|
|
7459
7459
|
// Room information is stored in client socket object :
|
7460
7460
|
if(!WebsocketImplementation.isInRoom(clientSocket, this.clientsRoomsTag)) return;
|
7461
7461
|
|
7462
|
-
|
7463
7462
|
if( this.listenerConfig && this.listenerConfig.messageType && dataWrapped.type
|
7464
7463
|
&& this.listenerConfig.messageType===dataWrapped.type) return;
|
7465
7464
|
|
7465
|
+
const dataLocal=dataWrapped.data;
|
7466
|
+
|
7467
|
+
// We check if the message matches the condition :
|
7468
|
+
if(this.listenerConfig.condition && !lthis.istenerConfig.condition(dataLocal, clientSocket)) return ;
|
7469
|
+
|
7470
|
+
const messageIdLocal=this.listenerConfig.messageId;
|
7471
|
+
// We check if we have the same message id:
|
7472
|
+
if(messageIdLocal!==dataLocal.messageId){
|
7473
|
+
// DBG
|
7474
|
+
lognow("DEBUG : Message ignored : messageId:"+messageIdParam+"|dataLocal.messageId"+dataLocal.messageId);
|
7475
|
+
return;
|
7476
|
+
}
|
7477
|
+
|
7478
|
+
// --------------------------------
|
7479
|
+
|
7466
7480
|
// We remove one-time usage listeners :
|
7467
7481
|
// We remove BEFORE executing doOnIncomingMessage(), because in this reception entry point function we can have other listener registration UNDER THE SAME ID !
|
7468
7482
|
if(this.listenerConfig && this.listenerConfig.destroyListenerAfterReceiving)
|
7469
7483
|
remove(this, clientReceptionEntryPoints);
|
7470
7484
|
|
7471
7485
|
if(this.doOnIncomingMessage)
|
7472
|
-
this.doOnIncomingMessage(
|
7486
|
+
this.doOnIncomingMessage(dataLocal, clientSocket);
|
7473
7487
|
|
7474
7488
|
}
|
7475
7489
|
|
@@ -7486,33 +7500,8 @@ class ClientInstance{
|
|
7486
7500
|
this.clientReceptionEntryPoints=[];
|
7487
7501
|
|
7488
7502
|
}
|
7489
|
-
|
7490
|
-
|
7491
|
-
const self=this;
|
7492
|
-
|
7493
|
-
// DBG
|
7494
|
-
lognow("INFO : (CLIENT) SETTING UP RECEIVE for :",channelNameParam);
|
7495
|
-
|
7496
|
-
const clientReceptionEntryPoint=new ClientReceptionEntryPoint(channelNameParam, entryPointId, clientsRoomsTag, listenerConfig, doOnIncomingMessage);
|
7497
|
-
if(!contains.filter((l)=>(
|
7498
|
-
l.entryPointId && clientReceptionEntryPoint.entryPointId
|
7499
|
-
&& l.entryPointId===clientReceptionEntryPoint.entryPointId
|
7500
|
-
))(this.clientReceptionEntryPoints)){
|
7501
|
-
|
7502
|
-
this.clientReceptionEntryPoints.push(clientReceptionEntryPoint);
|
7503
|
-
}
|
7504
|
-
|
7505
|
-
const clientSocket=this.clientSocket;
|
7506
|
-
if(WebsocketImplementation.useSocketIOImplementation){
|
7507
|
-
// FOR THE SOCKETIO IMPLEMENTATION :
|
7508
|
-
clientSocket.on(channelNameParam, (eventOrMessage)=>{
|
7509
|
-
clientReceptionEntryPoint.execute(eventOrMessage, clientSocket, this.clientReceptionEntryPoints);
|
7510
|
-
});
|
7511
|
-
}
|
7512
|
-
|
7513
|
-
return this;
|
7514
|
-
}
|
7515
|
-
|
7503
|
+
|
7504
|
+
|
7516
7505
|
sendChainable(channelNameParam, data, clientsRoomsTag=null){
|
7517
7506
|
const self=this;
|
7518
7507
|
|
@@ -7527,25 +7516,14 @@ class ClientInstance{
|
|
7527
7516
|
const resultPromise={
|
7528
7517
|
// CAUTION : CANNOT STORE ANYTHING IN THE resultPromise, FOR ASYNC CALLS MAKES ITS DATA INCONSISTENT IN TIME !
|
7529
7518
|
thenWhenReceiveMessageType:(channelNameForResponse, listenerConfig={messageType:"",condition:()=>true}, doOnIncomingMessageForResponse)=>{
|
7519
|
+
|
7530
7520
|
listenerConfig=nonull(listenerConfig,{messageType:"",condition:()=>true});
|
7531
7521
|
const listenerId=nonull(listenerConfig.messageType,"");
|
7532
7522
|
|
7523
|
+
// I-
|
7533
7524
|
//
|
7534
|
-
self.receive(channelNameForResponse,
|
7535
|
-
|
7536
|
-
// We check if the message matches the condition :
|
7537
|
-
if(listenerConfig.condition && !listenerConfig.condition(dataLocal, clientSocket)) return ;
|
7538
|
-
|
7539
|
-
// We check if we have the same message id:
|
7540
|
-
if(messageIdParam!==dataLocal.messageId){
|
7541
|
-
// DBG
|
7542
|
-
lognow("DEBUG : Message ignored : resultPromise.messageId:"+resultPromise.messageId+"|dataLocal.messageId"+dataLocal.messageId);
|
7543
|
-
return;
|
7544
|
-
}
|
7545
|
-
|
7546
|
-
doOnIncomingMessageForResponse(dataLocal, clientSocket);
|
7547
|
-
|
7548
|
-
}, clientsRoomsTag, listenerId, {messageId:messageId, destroyListenerAfterReceiving:true});
|
7525
|
+
self.receive(channelNameForResponse, doOnIncomingMessageForResponse
|
7526
|
+
, clientsRoomsTag, listenerId, {messageId:messageId, destroyListenerAfterReceiving:true});
|
7549
7527
|
//
|
7550
7528
|
|
7551
7529
|
return resultPromise;
|
@@ -7558,6 +7536,35 @@ class ClientInstance{
|
|
7558
7536
|
|
7559
7537
|
return resultPromise;
|
7560
7538
|
}
|
7539
|
+
|
7540
|
+
// II-
|
7541
|
+
receive(channelNameParam, doOnIncomingMessage, clientsRoomsTag=null, entryPointId=null, listenerConfig={destroyListenerAfterReceiving:false}){
|
7542
|
+
const self=this;
|
7543
|
+
|
7544
|
+
// DBG
|
7545
|
+
lognow("INFO : (CLIENT) SETTING UP RECEIVE for :",channelNameParam);
|
7546
|
+
|
7547
|
+
const clientReceptionEntryPoint=new ClientReceptionEntryPoint(channelNameParam, entryPointId, clientsRoomsTag, listenerConfig, doOnIncomingMessage);
|
7548
|
+
if(!contains.filter((l)=>(
|
7549
|
+
l.entryPointId && clientReceptionEntryPoint.entryPointId
|
7550
|
+
&& l.entryPointId===clientReceptionEntryPoint.entryPointId
|
7551
|
+
))(this.clientReceptionEntryPoints)){
|
7552
|
+
|
7553
|
+
this.clientReceptionEntryPoints.push(clientReceptionEntryPoint);
|
7554
|
+
}
|
7555
|
+
|
7556
|
+
const clientSocket=this.clientSocket;
|
7557
|
+
if(WebsocketImplementation.useSocketIOImplementation){
|
7558
|
+
// FOR THE SOCKETIO IMPLEMENTATION :
|
7559
|
+
clientSocket.on(channelNameParam, (eventOrMessage)=>{
|
7560
|
+
clientReceptionEntryPoint.execute(eventOrMessage, clientSocket, this.clientReceptionEntryPoints);
|
7561
|
+
});
|
7562
|
+
}
|
7563
|
+
|
7564
|
+
return this;
|
7565
|
+
}
|
7566
|
+
|
7567
|
+
|
7561
7568
|
|
7562
7569
|
|
7563
7570
|
send(channelNameParam, data, clientsRoomsTag=null){
|
aotrautils-srv/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "aotrautils-srv",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.1495",
|
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)",
|