@kinotic-ai/core 1.5.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 -42
- package/dist/index.d.cts +19 -38
- package/dist/index.d.ts +19 -38
- package/dist/index.js +37 -42
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -74,7 +74,6 @@ __export(exports_src, {
|
|
|
74
74
|
Scope: () => Scope,
|
|
75
75
|
Publish: () => Publish,
|
|
76
76
|
ParticipantConstants: () => ParticipantConstants,
|
|
77
|
-
Participant: () => Participant,
|
|
78
77
|
Pageable: () => Pageable,
|
|
79
78
|
Order: () => Order,
|
|
80
79
|
OffsetPageable: () => OffsetPageable,
|
|
@@ -303,14 +302,17 @@ class StompConnectionManager {
|
|
|
303
302
|
});
|
|
304
303
|
}
|
|
305
304
|
async deactivate(force) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
this.
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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
|
+
}
|
|
314
316
|
}
|
|
315
317
|
return;
|
|
316
318
|
}
|
|
@@ -375,6 +377,7 @@ class Event {
|
|
|
375
377
|
class EventBus {
|
|
376
378
|
serverInfo = null;
|
|
377
379
|
stompConnectionManager = new StompConnectionManager;
|
|
380
|
+
connectionLifecycle = Promise.resolve();
|
|
378
381
|
replyToCri = null;
|
|
379
382
|
requestRepliesObservable = null;
|
|
380
383
|
requestRepliesSubject = null;
|
|
@@ -395,23 +398,32 @@ class EventBus {
|
|
|
395
398
|
isConnected() {
|
|
396
399
|
return this.stompConnectionManager.connected;
|
|
397
400
|
}
|
|
398
|
-
|
|
399
|
-
|
|
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);
|
|
400
420
|
this.cleanup();
|
|
401
|
-
|
|
402
|
-
this.serverInfo = new ServerInfo;
|
|
403
|
-
this.serverInfo.host = connectionInfo.host;
|
|
404
|
-
this.serverInfo.port = connectionInfo.port;
|
|
405
|
-
this.serverInfo.useSSL = connectionInfo.useSSL;
|
|
406
|
-
this.replyToCri = this.stompConnectionManager.replyToCri;
|
|
407
|
-
return connectedInfo;
|
|
408
|
-
} else {
|
|
409
|
-
throw new Error("Event Bus connection already active");
|
|
410
|
-
}
|
|
421
|
+
});
|
|
411
422
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
this.
|
|
423
|
+
serializeLifecycle(operation) {
|
|
424
|
+
const result = this.connectionLifecycle.then(operation);
|
|
425
|
+
this.connectionLifecycle = result.catch(() => {});
|
|
426
|
+
return result;
|
|
415
427
|
}
|
|
416
428
|
send(event) {
|
|
417
429
|
if (this.stompConnectionManager.rxStomp) {
|
|
@@ -994,7 +1006,7 @@ var import_operators2 = require("rxjs/operators");
|
|
|
994
1006
|
// packages/core/package.json
|
|
995
1007
|
var package_default = {
|
|
996
1008
|
name: "@kinotic-ai/core",
|
|
997
|
-
version: "1.
|
|
1009
|
+
version: "1.6.1",
|
|
998
1010
|
type: "module",
|
|
999
1011
|
files: [
|
|
1000
1012
|
"dist"
|
|
@@ -1477,23 +1489,6 @@ class ConnectedInfo {
|
|
|
1477
1489
|
replyToId;
|
|
1478
1490
|
participant;
|
|
1479
1491
|
}
|
|
1480
|
-
// packages/core/src/api/security/Participant.ts
|
|
1481
|
-
class Participant {
|
|
1482
|
-
id;
|
|
1483
|
-
tenantId;
|
|
1484
|
-
authScopeType;
|
|
1485
|
-
authScopeId;
|
|
1486
|
-
metadata;
|
|
1487
|
-
roles;
|
|
1488
|
-
constructor(id, tenantId, authScopeType, authScopeId, metadata, roles) {
|
|
1489
|
-
this.id = id;
|
|
1490
|
-
this.tenantId = tenantId;
|
|
1491
|
-
this.authScopeType = authScopeType;
|
|
1492
|
-
this.authScopeId = authScopeId;
|
|
1493
|
-
this.metadata = metadata || new Map;
|
|
1494
|
-
this.roles = roles || [];
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
1492
|
// packages/core/src/api/security/ParticipantConstants.ts
|
|
1498
1493
|
class ParticipantConstants {
|
|
1499
1494
|
static PARTICIPANT_TYPE_METADATA_KEY = "type";
|
package/dist/index.d.cts
CHANGED
|
@@ -72,59 +72,37 @@ interface Identifiable<T> {
|
|
|
72
72
|
id: T | null;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
+
* Identifying information about a logged-in participant on the RPC layer.
|
|
76
|
+
*
|
|
77
|
+
* This is the base shape every participant shares, regardless of scope, and is what RPC-only
|
|
78
|
+
* consumers work with directly. The Kinotic OS contract layers scope-typed participants on top
|
|
79
|
+
* of it — see the participant types in {@code @kinotic-ai/os-api}.
|
|
80
|
+
*
|
|
81
|
+
* Mirrors the server {@code org.kinotic.core.api.security.Participant}.
|
|
82
|
+
*
|
|
75
83
|
* Created by Navíd Mitchell 🤪on 6/16/23.
|
|
76
84
|
*/
|
|
77
85
|
interface IParticipant extends Identifiable<string> {
|
|
78
86
|
/**
|
|
79
|
-
* The identity of the participant
|
|
80
|
-
*
|
|
81
|
-
* @return the identity of the participant
|
|
87
|
+
* The identity of the participant.
|
|
82
88
|
*/
|
|
83
89
|
id: string;
|
|
84
90
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @return the tenant or null if not using multi-tenancy
|
|
91
|
+
* Key/value pairs carrying additional information about the participant.
|
|
88
92
|
*/
|
|
89
|
-
|
|
93
|
+
metadata: Record<string, string>;
|
|
90
94
|
/**
|
|
91
|
-
*
|
|
92
|
-
* Well-known values are "SYSTEM", "ORGANIZATION", and "APPLICATION",
|
|
93
|
-
* but custom values are allowed for extensibility.
|
|
94
|
-
*/
|
|
95
|
-
authScopeType?: string | null;
|
|
96
|
-
/**
|
|
97
|
-
* The identifier of the specific scope this participant belongs to.
|
|
98
|
-
* For example, "kinotic" for system scope, an organization ID, or an application ID.
|
|
99
|
-
* Together with {@link authScopeType}, uniquely identifies which user pool
|
|
100
|
-
* this participant was authenticated from.
|
|
101
|
-
*/
|
|
102
|
-
authScopeId?: string | null;
|
|
103
|
-
/**
|
|
104
|
-
* Metadata is a map of key value pairs that can be used to store additional information about a participant
|
|
105
|
-
*
|
|
106
|
-
* @return a map of key value pairs
|
|
107
|
-
*/
|
|
108
|
-
metadata: Map<string, string>;
|
|
109
|
-
/**
|
|
110
|
-
* Roles are a list of strings that can be used to authorize a participant to perform certain actions
|
|
111
|
-
*
|
|
112
|
-
* @return a list of roles
|
|
95
|
+
* Roles used to authorize the participant to perform actions.
|
|
113
96
|
*/
|
|
114
97
|
roles: string[];
|
|
115
98
|
}
|
|
116
99
|
/**
|
|
100
|
+
* A logged-in participant on the RPC layer. Alias of {@link IParticipant}; the Kinotic OS contract
|
|
101
|
+
* ({@code @kinotic-ai/os-api}) narrows this to scope-typed participants.
|
|
102
|
+
*
|
|
117
103
|
* Created by Navid Mitchell on 6/2/20
|
|
118
104
|
*/
|
|
119
|
-
|
|
120
|
-
id: string;
|
|
121
|
-
tenantId?: string | null;
|
|
122
|
-
authScopeType?: string | null;
|
|
123
|
-
authScopeId?: string | null;
|
|
124
|
-
metadata: Map<string, string>;
|
|
125
|
-
roles: string[];
|
|
126
|
-
constructor(id: string, tenantId?: string, authScopeType?: string, authScopeId?: string, metadata?: Map<string, string>, roles?: string[]);
|
|
127
|
-
}
|
|
105
|
+
type Participant = IParticipant;
|
|
128
106
|
/**
|
|
129
107
|
* Contains information about the connection that was established
|
|
130
108
|
*/
|
|
@@ -1084,6 +1062,7 @@ declare class Event implements IEvent {
|
|
|
1084
1062
|
declare class EventBus implements IEventBus {
|
|
1085
1063
|
serverInfo: ServerInfo | null;
|
|
1086
1064
|
private stompConnectionManager;
|
|
1065
|
+
private connectionLifecycle;
|
|
1087
1066
|
private replyToCri;
|
|
1088
1067
|
private requestRepliesObservable;
|
|
1089
1068
|
private requestRepliesSubject;
|
|
@@ -1094,6 +1073,8 @@ declare class EventBus implements IEventBus {
|
|
|
1094
1073
|
isConnected(): boolean;
|
|
1095
1074
|
connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
|
|
1096
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;
|
|
1097
1078
|
send(event: IEvent): void;
|
|
1098
1079
|
request(event: IEvent): Promise<IEvent>;
|
|
1099
1080
|
requestStream(event: IEvent, sendControlEvents?: boolean): Observable3<IEvent>;
|
package/dist/index.d.ts
CHANGED
|
@@ -72,59 +72,37 @@ interface Identifiable<T> {
|
|
|
72
72
|
id: T | null;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
+
* Identifying information about a logged-in participant on the RPC layer.
|
|
76
|
+
*
|
|
77
|
+
* This is the base shape every participant shares, regardless of scope, and is what RPC-only
|
|
78
|
+
* consumers work with directly. The Kinotic OS contract layers scope-typed participants on top
|
|
79
|
+
* of it — see the participant types in {@code @kinotic-ai/os-api}.
|
|
80
|
+
*
|
|
81
|
+
* Mirrors the server {@code org.kinotic.core.api.security.Participant}.
|
|
82
|
+
*
|
|
75
83
|
* Created by Navíd Mitchell 🤪on 6/16/23.
|
|
76
84
|
*/
|
|
77
85
|
interface IParticipant extends Identifiable<string> {
|
|
78
86
|
/**
|
|
79
|
-
* The identity of the participant
|
|
80
|
-
*
|
|
81
|
-
* @return the identity of the participant
|
|
87
|
+
* The identity of the participant.
|
|
82
88
|
*/
|
|
83
89
|
id: string;
|
|
84
90
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @return the tenant or null if not using multi-tenancy
|
|
91
|
+
* Key/value pairs carrying additional information about the participant.
|
|
88
92
|
*/
|
|
89
|
-
|
|
93
|
+
metadata: Record<string, string>;
|
|
90
94
|
/**
|
|
91
|
-
*
|
|
92
|
-
* Well-known values are "SYSTEM", "ORGANIZATION", and "APPLICATION",
|
|
93
|
-
* but custom values are allowed for extensibility.
|
|
94
|
-
*/
|
|
95
|
-
authScopeType?: string | null;
|
|
96
|
-
/**
|
|
97
|
-
* The identifier of the specific scope this participant belongs to.
|
|
98
|
-
* For example, "kinotic" for system scope, an organization ID, or an application ID.
|
|
99
|
-
* Together with {@link authScopeType}, uniquely identifies which user pool
|
|
100
|
-
* this participant was authenticated from.
|
|
101
|
-
*/
|
|
102
|
-
authScopeId?: string | null;
|
|
103
|
-
/**
|
|
104
|
-
* Metadata is a map of key value pairs that can be used to store additional information about a participant
|
|
105
|
-
*
|
|
106
|
-
* @return a map of key value pairs
|
|
107
|
-
*/
|
|
108
|
-
metadata: Map<string, string>;
|
|
109
|
-
/**
|
|
110
|
-
* Roles are a list of strings that can be used to authorize a participant to perform certain actions
|
|
111
|
-
*
|
|
112
|
-
* @return a list of roles
|
|
95
|
+
* Roles used to authorize the participant to perform actions.
|
|
113
96
|
*/
|
|
114
97
|
roles: string[];
|
|
115
98
|
}
|
|
116
99
|
/**
|
|
100
|
+
* A logged-in participant on the RPC layer. Alias of {@link IParticipant}; the Kinotic OS contract
|
|
101
|
+
* ({@code @kinotic-ai/os-api}) narrows this to scope-typed participants.
|
|
102
|
+
*
|
|
117
103
|
* Created by Navid Mitchell on 6/2/20
|
|
118
104
|
*/
|
|
119
|
-
|
|
120
|
-
id: string;
|
|
121
|
-
tenantId?: string | null;
|
|
122
|
-
authScopeType?: string | null;
|
|
123
|
-
authScopeId?: string | null;
|
|
124
|
-
metadata: Map<string, string>;
|
|
125
|
-
roles: string[];
|
|
126
|
-
constructor(id: string, tenantId?: string, authScopeType?: string, authScopeId?: string, metadata?: Map<string, string>, roles?: string[]);
|
|
127
|
-
}
|
|
105
|
+
type Participant = IParticipant;
|
|
128
106
|
/**
|
|
129
107
|
* Contains information about the connection that was established
|
|
130
108
|
*/
|
|
@@ -1084,6 +1062,7 @@ declare class Event implements IEvent {
|
|
|
1084
1062
|
declare class EventBus implements IEventBus {
|
|
1085
1063
|
serverInfo: ServerInfo | null;
|
|
1086
1064
|
private stompConnectionManager;
|
|
1065
|
+
private connectionLifecycle;
|
|
1087
1066
|
private replyToCri;
|
|
1088
1067
|
private requestRepliesObservable;
|
|
1089
1068
|
private requestRepliesSubject;
|
|
@@ -1094,6 +1073,8 @@ declare class EventBus implements IEventBus {
|
|
|
1094
1073
|
isConnected(): boolean;
|
|
1095
1074
|
connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
|
|
1096
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;
|
|
1097
1078
|
send(event: IEvent): void;
|
|
1098
1079
|
request(event: IEvent): Promise<IEvent>;
|
|
1099
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.
|
|
914
|
+
version: "1.6.1",
|
|
902
915
|
type: "module",
|
|
903
916
|
files: [
|
|
904
917
|
"dist"
|
|
@@ -1381,23 +1394,6 @@ class ConnectedInfo {
|
|
|
1381
1394
|
replyToId;
|
|
1382
1395
|
participant;
|
|
1383
1396
|
}
|
|
1384
|
-
// packages/core/src/api/security/Participant.ts
|
|
1385
|
-
class Participant {
|
|
1386
|
-
id;
|
|
1387
|
-
tenantId;
|
|
1388
|
-
authScopeType;
|
|
1389
|
-
authScopeId;
|
|
1390
|
-
metadata;
|
|
1391
|
-
roles;
|
|
1392
|
-
constructor(id, tenantId, authScopeType, authScopeId, metadata, roles) {
|
|
1393
|
-
this.id = id;
|
|
1394
|
-
this.tenantId = tenantId;
|
|
1395
|
-
this.authScopeType = authScopeType;
|
|
1396
|
-
this.authScopeId = authScopeId;
|
|
1397
|
-
this.metadata = metadata || new Map;
|
|
1398
|
-
this.roles = roles || [];
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
1397
|
// packages/core/src/api/security/ParticipantConstants.ts
|
|
1402
1398
|
class ParticipantConstants {
|
|
1403
1399
|
static PARTICIPANT_TYPE_METADATA_KEY = "type";
|
|
@@ -1418,7 +1414,6 @@ export {
|
|
|
1418
1414
|
Scope,
|
|
1419
1415
|
Publish,
|
|
1420
1416
|
ParticipantConstants,
|
|
1421
|
-
Participant,
|
|
1422
1417
|
Pageable,
|
|
1423
1418
|
Order,
|
|
1424
1419
|
OffsetPageable,
|