@kinotic-ai/core 1.6.0 → 1.6.1
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 +37 -24
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +37 -24
- 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
|
}
|
|
@@ -374,6 +377,7 @@ class Event {
|
|
|
374
377
|
class EventBus {
|
|
375
378
|
serverInfo = null;
|
|
376
379
|
stompConnectionManager = new StompConnectionManager;
|
|
380
|
+
connectionLifecycle = Promise.resolve();
|
|
377
381
|
replyToCri = null;
|
|
378
382
|
requestRepliesObservable = null;
|
|
379
383
|
requestRepliesSubject = null;
|
|
@@ -394,23 +398,32 @@ class EventBus {
|
|
|
394
398
|
isConnected() {
|
|
395
399
|
return this.stompConnectionManager.connected;
|
|
396
400
|
}
|
|
397
|
-
|
|
398
|
-
|
|
401
|
+
connect(connectionInfo) {
|
|
402
|
+
return this.serializeLifecycle(async () => {
|
|
403
|
+
if (!this.stompConnectionManager.active) {
|
|
404
|
+
this.cleanup();
|
|
405
|
+
const connectedInfo = await this.stompConnectionManager.activate(connectionInfo);
|
|
406
|
+
this.serverInfo = new ServerInfo;
|
|
407
|
+
this.serverInfo.host = connectionInfo.host;
|
|
408
|
+
this.serverInfo.port = connectionInfo.port;
|
|
409
|
+
this.serverInfo.useSSL = connectionInfo.useSSL;
|
|
410
|
+
this.replyToCri = this.stompConnectionManager.replyToCri;
|
|
411
|
+
return connectedInfo;
|
|
412
|
+
} else {
|
|
413
|
+
throw new Error("Event Bus connection already active");
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
disconnect(force) {
|
|
418
|
+
return this.serializeLifecycle(async () => {
|
|
419
|
+
await this.stompConnectionManager.deactivate(force);
|
|
399
420
|
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
|
-
}
|
|
421
|
+
});
|
|
410
422
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
this.
|
|
423
|
+
serializeLifecycle(operation) {
|
|
424
|
+
const result = this.connectionLifecycle.then(operation);
|
|
425
|
+
this.connectionLifecycle = result.catch(() => {});
|
|
426
|
+
return result;
|
|
414
427
|
}
|
|
415
428
|
send(event) {
|
|
416
429
|
if (this.stompConnectionManager.rxStomp) {
|
|
@@ -993,7 +1006,7 @@ var import_operators2 = require("rxjs/operators");
|
|
|
993
1006
|
// packages/core/package.json
|
|
994
1007
|
var package_default = {
|
|
995
1008
|
name: "@kinotic-ai/core",
|
|
996
|
-
version: "1.6.
|
|
1009
|
+
version: "1.6.1",
|
|
997
1010
|
type: "module",
|
|
998
1011
|
files: [
|
|
999
1012
|
"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
|
}
|
|
@@ -276,6 +279,7 @@ class Event {
|
|
|
276
279
|
class EventBus {
|
|
277
280
|
serverInfo = null;
|
|
278
281
|
stompConnectionManager = new StompConnectionManager;
|
|
282
|
+
connectionLifecycle = Promise.resolve();
|
|
279
283
|
replyToCri = null;
|
|
280
284
|
requestRepliesObservable = null;
|
|
281
285
|
requestRepliesSubject = null;
|
|
@@ -296,23 +300,32 @@ class EventBus {
|
|
|
296
300
|
isConnected() {
|
|
297
301
|
return this.stompConnectionManager.connected;
|
|
298
302
|
}
|
|
299
|
-
|
|
300
|
-
|
|
303
|
+
connect(connectionInfo) {
|
|
304
|
+
return this.serializeLifecycle(async () => {
|
|
305
|
+
if (!this.stompConnectionManager.active) {
|
|
306
|
+
this.cleanup();
|
|
307
|
+
const connectedInfo = await this.stompConnectionManager.activate(connectionInfo);
|
|
308
|
+
this.serverInfo = new ServerInfo;
|
|
309
|
+
this.serverInfo.host = connectionInfo.host;
|
|
310
|
+
this.serverInfo.port = connectionInfo.port;
|
|
311
|
+
this.serverInfo.useSSL = connectionInfo.useSSL;
|
|
312
|
+
this.replyToCri = this.stompConnectionManager.replyToCri;
|
|
313
|
+
return connectedInfo;
|
|
314
|
+
} else {
|
|
315
|
+
throw new Error("Event Bus connection already active");
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
disconnect(force) {
|
|
320
|
+
return this.serializeLifecycle(async () => {
|
|
321
|
+
await this.stompConnectionManager.deactivate(force);
|
|
301
322
|
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
|
-
}
|
|
323
|
+
});
|
|
312
324
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
this.
|
|
325
|
+
serializeLifecycle(operation) {
|
|
326
|
+
const result = this.connectionLifecycle.then(operation);
|
|
327
|
+
this.connectionLifecycle = result.catch(() => {});
|
|
328
|
+
return result;
|
|
316
329
|
}
|
|
317
330
|
send(event) {
|
|
318
331
|
if (this.stompConnectionManager.rxStomp) {
|
|
@@ -898,7 +911,7 @@ import { first, map as map2 } from "rxjs/operators";
|
|
|
898
911
|
// packages/core/package.json
|
|
899
912
|
var package_default = {
|
|
900
913
|
name: "@kinotic-ai/core",
|
|
901
|
-
version: "1.6.
|
|
914
|
+
version: "1.6.1",
|
|
902
915
|
type: "module",
|
|
903
916
|
files: [
|
|
904
917
|
"dist"
|