@kinotic-ai/core 1.6.0 → 1.6.2
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.
- package/dist/index.cjs +38 -27
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +38 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -302,14 +302,17 @@ class StompConnectionManager {
|
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
304
|
async deactivate(force) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
this.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
305
|
+
const rxStomp = this.rxStomp;
|
|
306
|
+
if (rxStomp) {
|
|
307
|
+
await rxStomp.deactivate({ force });
|
|
308
|
+
if (this.rxStomp === rxStomp) {
|
|
309
|
+
this.serverHeadersSubscription?.unsubscribe();
|
|
310
|
+
this.serverHeadersSubscription = null;
|
|
311
|
+
this.stompErrorsSubscription?.unsubscribe();
|
|
312
|
+
this.stompErrorsSubscription = null;
|
|
313
|
+
this.rxStomp = null;
|
|
314
|
+
this._replyToCri = null;
|
|
315
|
+
}
|
|
313
316
|
}
|
|
314
317
|
return;
|
|
315
318
|
}
|
|
@@ -321,9 +324,7 @@ class StompConnectionManager {
|
|
|
321
324
|
}
|
|
322
325
|
}
|
|
323
326
|
async signalFatal(err) {
|
|
324
|
-
|
|
325
|
-
console.error("StompConnectionManager fatal error, deactivating connection", err);
|
|
326
|
-
}
|
|
327
|
+
this.debugLogger("Fatal error, deactivating connection: %O", err);
|
|
327
328
|
await this.deactivate();
|
|
328
329
|
this.fatalErrorsSubject.next(err);
|
|
329
330
|
}
|
|
@@ -374,6 +375,7 @@ class Event {
|
|
|
374
375
|
class EventBus {
|
|
375
376
|
serverInfo = null;
|
|
376
377
|
stompConnectionManager = new StompConnectionManager;
|
|
378
|
+
connectionLifecycle = Promise.resolve();
|
|
377
379
|
replyToCri = null;
|
|
378
380
|
requestRepliesObservable = null;
|
|
379
381
|
requestRepliesSubject = null;
|
|
@@ -394,23 +396,32 @@ class EventBus {
|
|
|
394
396
|
isConnected() {
|
|
395
397
|
return this.stompConnectionManager.connected;
|
|
396
398
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
+
connect(connectionInfo) {
|
|
400
|
+
return this.serializeLifecycle(async () => {
|
|
401
|
+
if (!this.stompConnectionManager.active) {
|
|
402
|
+
this.cleanup();
|
|
403
|
+
const connectedInfo = await this.stompConnectionManager.activate(connectionInfo);
|
|
404
|
+
this.serverInfo = new ServerInfo;
|
|
405
|
+
this.serverInfo.host = connectionInfo.host;
|
|
406
|
+
this.serverInfo.port = connectionInfo.port;
|
|
407
|
+
this.serverInfo.useSSL = connectionInfo.useSSL;
|
|
408
|
+
this.replyToCri = this.stompConnectionManager.replyToCri;
|
|
409
|
+
return connectedInfo;
|
|
410
|
+
} else {
|
|
411
|
+
throw new Error("Event Bus connection already active");
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
disconnect(force) {
|
|
416
|
+
return this.serializeLifecycle(async () => {
|
|
417
|
+
await this.stompConnectionManager.deactivate(force);
|
|
399
418
|
this.cleanup();
|
|
400
|
-
|
|
401
|
-
this.serverInfo = new ServerInfo;
|
|
402
|
-
this.serverInfo.host = connectionInfo.host;
|
|
403
|
-
this.serverInfo.port = connectionInfo.port;
|
|
404
|
-
this.serverInfo.useSSL = connectionInfo.useSSL;
|
|
405
|
-
this.replyToCri = this.stompConnectionManager.replyToCri;
|
|
406
|
-
return connectedInfo;
|
|
407
|
-
} else {
|
|
408
|
-
throw new Error("Event Bus connection already active");
|
|
409
|
-
}
|
|
419
|
+
});
|
|
410
420
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
this.
|
|
421
|
+
serializeLifecycle(operation) {
|
|
422
|
+
const result = this.connectionLifecycle.then(operation);
|
|
423
|
+
this.connectionLifecycle = result.catch(() => {});
|
|
424
|
+
return result;
|
|
414
425
|
}
|
|
415
426
|
send(event) {
|
|
416
427
|
if (this.stompConnectionManager.rxStomp) {
|
|
@@ -993,7 +1004,7 @@ var import_operators2 = require("rxjs/operators");
|
|
|
993
1004
|
// packages/core/package.json
|
|
994
1005
|
var package_default = {
|
|
995
1006
|
name: "@kinotic-ai/core",
|
|
996
|
-
version: "1.6.
|
|
1007
|
+
version: "1.6.2",
|
|
997
1008
|
type: "module",
|
|
998
1009
|
files: [
|
|
999
1010
|
"dist"
|
package/dist/index.d.cts
CHANGED
|
@@ -1062,6 +1062,7 @@ declare class Event implements IEvent {
|
|
|
1062
1062
|
declare class EventBus implements IEventBus {
|
|
1063
1063
|
serverInfo: ServerInfo | null;
|
|
1064
1064
|
private stompConnectionManager;
|
|
1065
|
+
private connectionLifecycle;
|
|
1065
1066
|
private replyToCri;
|
|
1066
1067
|
private requestRepliesObservable;
|
|
1067
1068
|
private requestRepliesSubject;
|
|
@@ -1072,6 +1073,8 @@ declare class EventBus implements IEventBus {
|
|
|
1072
1073
|
isConnected(): boolean;
|
|
1073
1074
|
connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
|
|
1074
1075
|
disconnect(force?: boolean): Promise<void>;
|
|
1076
|
+
/** Runs connect and disconnect one at a time so they never overlap on the shared socket. */
|
|
1077
|
+
private serializeLifecycle;
|
|
1075
1078
|
send(event: IEvent): void;
|
|
1076
1079
|
request(event: IEvent): Promise<IEvent>;
|
|
1077
1080
|
requestStream(event: IEvent, sendControlEvents?: boolean): Observable3<IEvent>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1062,6 +1062,7 @@ declare class Event implements IEvent {
|
|
|
1062
1062
|
declare class EventBus implements IEventBus {
|
|
1063
1063
|
serverInfo: ServerInfo | null;
|
|
1064
1064
|
private stompConnectionManager;
|
|
1065
|
+
private connectionLifecycle;
|
|
1065
1066
|
private replyToCri;
|
|
1066
1067
|
private requestRepliesObservable;
|
|
1067
1068
|
private requestRepliesSubject;
|
|
@@ -1072,6 +1073,8 @@ declare class EventBus implements IEventBus {
|
|
|
1072
1073
|
isConnected(): boolean;
|
|
1073
1074
|
connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
|
|
1074
1075
|
disconnect(force?: boolean): Promise<void>;
|
|
1076
|
+
/** Runs connect and disconnect one at a time so they never overlap on the shared socket. */
|
|
1077
|
+
private serializeLifecycle;
|
|
1075
1078
|
send(event: IEvent): void;
|
|
1076
1079
|
request(event: IEvent): Promise<IEvent>;
|
|
1077
1080
|
requestStream(event: IEvent, sendControlEvents?: boolean): Observable3<IEvent>;
|
package/dist/index.js
CHANGED
|
@@ -204,14 +204,17 @@ class StompConnectionManager {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
async deactivate(force) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
const rxStomp = this.rxStomp;
|
|
208
|
+
if (rxStomp) {
|
|
209
|
+
await rxStomp.deactivate({ force });
|
|
210
|
+
if (this.rxStomp === rxStomp) {
|
|
211
|
+
this.serverHeadersSubscription?.unsubscribe();
|
|
212
|
+
this.serverHeadersSubscription = null;
|
|
213
|
+
this.stompErrorsSubscription?.unsubscribe();
|
|
214
|
+
this.stompErrorsSubscription = null;
|
|
215
|
+
this.rxStomp = null;
|
|
216
|
+
this._replyToCri = null;
|
|
217
|
+
}
|
|
215
218
|
}
|
|
216
219
|
return;
|
|
217
220
|
}
|
|
@@ -223,9 +226,7 @@ class StompConnectionManager {
|
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
async signalFatal(err) {
|
|
226
|
-
|
|
227
|
-
console.error("StompConnectionManager fatal error, deactivating connection", err);
|
|
228
|
-
}
|
|
229
|
+
this.debugLogger("Fatal error, deactivating connection: %O", err);
|
|
229
230
|
await this.deactivate();
|
|
230
231
|
this.fatalErrorsSubject.next(err);
|
|
231
232
|
}
|
|
@@ -276,6 +277,7 @@ class Event {
|
|
|
276
277
|
class EventBus {
|
|
277
278
|
serverInfo = null;
|
|
278
279
|
stompConnectionManager = new StompConnectionManager;
|
|
280
|
+
connectionLifecycle = Promise.resolve();
|
|
279
281
|
replyToCri = null;
|
|
280
282
|
requestRepliesObservable = null;
|
|
281
283
|
requestRepliesSubject = null;
|
|
@@ -296,23 +298,32 @@ class EventBus {
|
|
|
296
298
|
isConnected() {
|
|
297
299
|
return this.stompConnectionManager.connected;
|
|
298
300
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
connect(connectionInfo) {
|
|
302
|
+
return this.serializeLifecycle(async () => {
|
|
303
|
+
if (!this.stompConnectionManager.active) {
|
|
304
|
+
this.cleanup();
|
|
305
|
+
const connectedInfo = await this.stompConnectionManager.activate(connectionInfo);
|
|
306
|
+
this.serverInfo = new ServerInfo;
|
|
307
|
+
this.serverInfo.host = connectionInfo.host;
|
|
308
|
+
this.serverInfo.port = connectionInfo.port;
|
|
309
|
+
this.serverInfo.useSSL = connectionInfo.useSSL;
|
|
310
|
+
this.replyToCri = this.stompConnectionManager.replyToCri;
|
|
311
|
+
return connectedInfo;
|
|
312
|
+
} else {
|
|
313
|
+
throw new Error("Event Bus connection already active");
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
disconnect(force) {
|
|
318
|
+
return this.serializeLifecycle(async () => {
|
|
319
|
+
await this.stompConnectionManager.deactivate(force);
|
|
301
320
|
this.cleanup();
|
|
302
|
-
|
|
303
|
-
this.serverInfo = new ServerInfo;
|
|
304
|
-
this.serverInfo.host = connectionInfo.host;
|
|
305
|
-
this.serverInfo.port = connectionInfo.port;
|
|
306
|
-
this.serverInfo.useSSL = connectionInfo.useSSL;
|
|
307
|
-
this.replyToCri = this.stompConnectionManager.replyToCri;
|
|
308
|
-
return connectedInfo;
|
|
309
|
-
} else {
|
|
310
|
-
throw new Error("Event Bus connection already active");
|
|
311
|
-
}
|
|
321
|
+
});
|
|
312
322
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
this.
|
|
323
|
+
serializeLifecycle(operation) {
|
|
324
|
+
const result = this.connectionLifecycle.then(operation);
|
|
325
|
+
this.connectionLifecycle = result.catch(() => {});
|
|
326
|
+
return result;
|
|
316
327
|
}
|
|
317
328
|
send(event) {
|
|
318
329
|
if (this.stompConnectionManager.rxStomp) {
|
|
@@ -898,7 +909,7 @@ import { first, map as map2 } from "rxjs/operators";
|
|
|
898
909
|
// packages/core/package.json
|
|
899
910
|
var package_default = {
|
|
900
911
|
name: "@kinotic-ai/core",
|
|
901
|
-
version: "1.6.
|
|
912
|
+
version: "1.6.2",
|
|
902
913
|
type: "module",
|
|
903
914
|
files: [
|
|
904
915
|
"dist"
|