@kinotic-ai/core 5.0.0-beta.25 → 5.0.0-beta.26
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 +121 -115
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +107 -103
- package/dist/node/index.cjs +9 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -19,13 +19,15 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
return cached;
|
|
20
20
|
}
|
|
21
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
24
|
+
for (let key of __getOwnPropNames(mod))
|
|
25
|
+
if (!__hasOwnProp.call(to, key))
|
|
26
|
+
__defProp(to, key, {
|
|
27
|
+
get: __accessProp.bind(mod, key),
|
|
28
|
+
enumerable: true
|
|
29
|
+
});
|
|
30
|
+
}
|
|
29
31
|
if (canCache)
|
|
30
32
|
cache.set(mod, to);
|
|
31
33
|
return to;
|
|
@@ -64,54 +66,54 @@ var __export = (target, all) => {
|
|
|
64
66
|
// packages/core/src/index.ts
|
|
65
67
|
var exports_src = {};
|
|
66
68
|
__export(exports_src, {
|
|
67
|
-
|
|
68
|
-
validateLabel: () => validateLabel,
|
|
69
|
-
scopeOptionalMethodNames: () => scopeOptionalMethodNames,
|
|
70
|
-
receivesContext: () => receivesContext,
|
|
71
|
-
isAdvertised: () => isAdvertised,
|
|
72
|
-
declareServiceDefinitions: () => declareServiceDefinitions,
|
|
73
|
-
createCRI: () => createCRI,
|
|
74
|
-
buildServerUrl: () => buildServerUrl,
|
|
75
|
-
buildBrokerUrl: () => buildBrokerUrl,
|
|
76
|
-
Zone: () => Zone,
|
|
77
|
-
Version: () => Version,
|
|
78
|
-
TextEventFactory: () => TextEventFactory,
|
|
79
|
-
Sort: () => Sort,
|
|
80
|
-
SessionKeepAliveMode: () => SessionKeepAliveMode,
|
|
81
|
-
SessionCredentialsResolver: () => SessionCredentialsResolver,
|
|
82
|
-
ServiceRegistry: () => ServiceRegistry,
|
|
83
|
-
ServiceIdentifier: () => ServiceIdentifier,
|
|
84
|
-
ServerInfo: () => ServerInfo,
|
|
85
|
-
ScopeOptional: () => ScopeOptional,
|
|
86
|
-
Scope: () => Scope,
|
|
87
|
-
RpcError: () => RpcError,
|
|
88
|
-
Publish: () => Publish,
|
|
89
|
-
ParticipantConstants: () => ParticipantConstants,
|
|
90
|
-
Pageable: () => Pageable,
|
|
91
|
-
Order: () => Order,
|
|
92
|
-
OffsetPageable: () => OffsetPageable,
|
|
93
|
-
NullHandling: () => NullHandling,
|
|
94
|
-
KinoticSingleton: () => KinoticSingleton,
|
|
95
|
-
Kinotic: () => Kinotic,
|
|
96
|
-
JsonEventFactory: () => JsonEventFactory,
|
|
97
|
-
FunctionalIterablePage: () => FunctionalIterablePage,
|
|
98
|
-
EventConstants: () => EventConstants,
|
|
99
|
-
EventBus: () => EventBus,
|
|
100
|
-
Event: () => Event,
|
|
101
|
-
EnvCredentialsResolver: () => EnvCredentialsResolver,
|
|
102
|
-
Direction: () => Direction,
|
|
103
|
-
DefaultCRI: () => DefaultCRI,
|
|
104
|
-
DataSourceUtils: () => DataSourceUtils,
|
|
105
|
-
CursorPageable: () => CursorPageable,
|
|
106
|
-
CrudServiceProxyFactory: () => CrudServiceProxyFactory,
|
|
107
|
-
CrudServiceProxy: () => CrudServiceProxy,
|
|
108
|
-
Context: () => Context,
|
|
109
|
-
ConnectedInfo: () => ConnectedInfo,
|
|
110
|
-
ChainedCredentialsResolver: () => ChainedCredentialsResolver,
|
|
111
|
-
BearerCredentialsResolver: () => BearerCredentialsResolver,
|
|
112
|
-
BasicCredentialsResolver: () => BasicCredentialsResolver,
|
|
69
|
+
AbstractIterablePage: () => AbstractIterablePage,
|
|
113
70
|
AuthorizationException: () => AuthorizationException,
|
|
114
|
-
|
|
71
|
+
BasicCredentialsResolver: () => BasicCredentialsResolver,
|
|
72
|
+
BearerCredentialsResolver: () => BearerCredentialsResolver,
|
|
73
|
+
ChainedCredentialsResolver: () => ChainedCredentialsResolver,
|
|
74
|
+
ConnectedInfo: () => ConnectedInfo,
|
|
75
|
+
Context: () => Context,
|
|
76
|
+
CrudServiceProxy: () => CrudServiceProxy,
|
|
77
|
+
CrudServiceProxyFactory: () => CrudServiceProxyFactory,
|
|
78
|
+
CursorPageable: () => CursorPageable,
|
|
79
|
+
DataSourceUtils: () => DataSourceUtils,
|
|
80
|
+
DefaultCRI: () => DefaultCRI,
|
|
81
|
+
Direction: () => Direction,
|
|
82
|
+
EnvCredentialsResolver: () => EnvCredentialsResolver,
|
|
83
|
+
Event: () => Event,
|
|
84
|
+
EventBus: () => EventBus,
|
|
85
|
+
EventConstants: () => EventConstants,
|
|
86
|
+
FunctionalIterablePage: () => FunctionalIterablePage,
|
|
87
|
+
JsonEventFactory: () => JsonEventFactory,
|
|
88
|
+
Kinotic: () => Kinotic,
|
|
89
|
+
KinoticSingleton: () => KinoticSingleton,
|
|
90
|
+
NullHandling: () => NullHandling,
|
|
91
|
+
OffsetPageable: () => OffsetPageable,
|
|
92
|
+
Order: () => Order,
|
|
93
|
+
Pageable: () => Pageable,
|
|
94
|
+
ParticipantConstants: () => ParticipantConstants,
|
|
95
|
+
Publish: () => Publish,
|
|
96
|
+
RpcError: () => RpcError,
|
|
97
|
+
Scope: () => Scope,
|
|
98
|
+
ScopeOptional: () => ScopeOptional,
|
|
99
|
+
ServerInfo: () => ServerInfo,
|
|
100
|
+
ServiceIdentifier: () => ServiceIdentifier,
|
|
101
|
+
ServiceRegistry: () => ServiceRegistry,
|
|
102
|
+
SessionCredentialsResolver: () => SessionCredentialsResolver,
|
|
103
|
+
SessionKeepAliveMode: () => SessionKeepAliveMode,
|
|
104
|
+
Sort: () => Sort,
|
|
105
|
+
TextEventFactory: () => TextEventFactory,
|
|
106
|
+
Version: () => Version,
|
|
107
|
+
Zone: () => Zone,
|
|
108
|
+
buildBrokerUrl: () => buildBrokerUrl,
|
|
109
|
+
buildServerUrl: () => buildServerUrl,
|
|
110
|
+
createCRI: () => createCRI,
|
|
111
|
+
declareServiceDefinitions: () => declareServiceDefinitions,
|
|
112
|
+
isAdvertised: () => isAdvertised,
|
|
113
|
+
receivesContext: () => receivesContext,
|
|
114
|
+
scopeOptionalMethodNames: () => scopeOptionalMethodNames,
|
|
115
|
+
validateLabel: () => validateLabel,
|
|
116
|
+
validateZone: () => validateZone
|
|
115
117
|
});
|
|
116
118
|
module.exports = __toCommonJS(exports_src);
|
|
117
119
|
|
|
@@ -128,44 +130,44 @@ function buildBrokerUrl(server) {
|
|
|
128
130
|
return buildServerUrl(server, "ws") + "/api/v1";
|
|
129
131
|
}
|
|
130
132
|
var SessionKeepAliveMode;
|
|
131
|
-
((
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
((SessionKeepAliveMode) => {
|
|
134
|
+
SessionKeepAliveMode["NONE"] = "NONE";
|
|
135
|
+
SessionKeepAliveMode["ACTIVITY"] = "ACTIVITY";
|
|
136
|
+
SessionKeepAliveMode["CONNECTION"] = "CONNECTION";
|
|
135
137
|
})(SessionKeepAliveMode ||= {});
|
|
136
138
|
// packages/core/src/api/event/IEventBus.ts
|
|
137
139
|
var EventConstants;
|
|
138
|
-
((
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
140
|
+
((EventConstants) => {
|
|
141
|
+
EventConstants["CONTENT_TYPE_HEADER"] = "content-type";
|
|
142
|
+
EventConstants["CONTENT_LENGTH_HEADER"] = "content-length";
|
|
143
|
+
EventConstants["REPLY_TO_HEADER"] = "reply-to";
|
|
144
|
+
EventConstants["SENDER_HEADER"] = "sender";
|
|
145
|
+
EventConstants["CONNECTED_INFO_HEADER"] = "connected-info";
|
|
146
|
+
EventConstants["SESSION_KEEP_ALIVE_HEADER"] = "session-keep-alive";
|
|
147
|
+
EventConstants["CORRELATION_ID_HEADER"] = "__correlation-id";
|
|
148
|
+
EventConstants["ORIGIN_CRI_HEADER"] = "__origin-cri";
|
|
149
|
+
EventConstants["ERROR_HEADER"] = "error";
|
|
150
|
+
EventConstants["COMPLETE_HEADER"] = "complete";
|
|
151
|
+
EventConstants["CONTROL_HEADER"] = "control";
|
|
152
|
+
EventConstants["CONTROL_VALUE_COMPLETE"] = "complete";
|
|
153
|
+
EventConstants["CONTROL_VALUE_CANCEL"] = "cancel";
|
|
154
|
+
EventConstants["CONTROL_VALUE_SUSPEND"] = "suspend";
|
|
155
|
+
EventConstants["CONTROL_VALUE_RESUME"] = "resume";
|
|
156
|
+
EventConstants["SERVICE_DESTINATION_PREFIX"] = "srv://";
|
|
157
|
+
EventConstants["SERVICE_DESTINATION_SCHEME"] = "srv";
|
|
158
|
+
EventConstants["STREAM_DESTINATION_PREFIX"] = "stream://";
|
|
159
|
+
EventConstants["STREAM_DESTINATION_SCHEME"] = "stream";
|
|
160
|
+
EventConstants["REPLY_DESTINATION_PREFIX"] = "reply://";
|
|
161
|
+
EventConstants["REPLY_DESTINATION_SCHEME"] = "reply";
|
|
162
|
+
EventConstants["CONTENT_JSON"] = "application/json";
|
|
163
|
+
EventConstants["CONTENT_TEXT"] = "text/plain";
|
|
164
|
+
EventConstants["CONTENT_OCTET_STREAM"] = "application/octet-stream";
|
|
165
|
+
EventConstants["TRACEPARENT_HEADER"] = "traceparent";
|
|
166
|
+
EventConstants["TRACESTATE_HEADER"] = "tracestate";
|
|
165
167
|
})(EventConstants ||= {});
|
|
166
168
|
|
|
167
169
|
// packages/core/src/internal/api/Logger.ts
|
|
168
|
-
var import_debug = __toESM(require("debug"));
|
|
170
|
+
var import_debug = __toESM(require("debug"), 1);
|
|
169
171
|
function createDebugLogger(namespace) {
|
|
170
172
|
const debugLogger = import_debug.default(namespace);
|
|
171
173
|
return {
|
|
@@ -180,7 +182,7 @@ function createDebugLogger(namespace) {
|
|
|
180
182
|
// packages/core/src/internal/api/StompConnectionManager.ts
|
|
181
183
|
var import_rx_stomp = require("@stomp/rx-stomp");
|
|
182
184
|
var import_stompjs = require("@stomp/stompjs");
|
|
183
|
-
var import_debug2 = __toESM(require("debug"));
|
|
185
|
+
var import_debug2 = __toESM(require("debug"), 1);
|
|
184
186
|
var import_rxjs = require("rxjs");
|
|
185
187
|
var import_operators = require("rxjs/operators");
|
|
186
188
|
var import_uuid = require("uuid");
|
|
@@ -251,6 +253,7 @@ class StompConnectionManager {
|
|
|
251
253
|
connectionAttempts = 0;
|
|
252
254
|
debugLogger = import_debug2.default("kinotic:stomp");
|
|
253
255
|
connectionEstablishedSubject = new import_rxjs.Subject;
|
|
256
|
+
connectionAttemptFailedSubject = new import_rxjs.Subject;
|
|
254
257
|
initialConnectionSuccessful = false;
|
|
255
258
|
rxStompHasConnected = false;
|
|
256
259
|
_replyToCri = null;
|
|
@@ -266,6 +269,9 @@ class StompConnectionManager {
|
|
|
266
269
|
get connectionEstablished() {
|
|
267
270
|
return this.connectionEstablishedSubject.asObservable();
|
|
268
271
|
}
|
|
272
|
+
get connectionAttemptFailed() {
|
|
273
|
+
return this.connectionAttemptFailedSubject.asObservable();
|
|
274
|
+
}
|
|
269
275
|
async activate(options) {
|
|
270
276
|
if (!options?.server?.host) {
|
|
271
277
|
throw new Error("No host provided");
|
|
@@ -327,7 +333,7 @@ class StompConnectionManager {
|
|
|
327
333
|
webSocketFactory: usesPreparedSocket ? takePreparedSocket : undefined,
|
|
328
334
|
beforeConnect: () => {
|
|
329
335
|
const attempt = this.prepareAttempt(activation, options, server, headerAuth);
|
|
330
|
-
const settled = () => new Promise((
|
|
336
|
+
const settled = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
331
337
|
activation.attempt = attempt.then(settled, settled);
|
|
332
338
|
return attempt;
|
|
333
339
|
}
|
|
@@ -338,12 +344,8 @@ class StompConnectionManager {
|
|
|
338
344
|
};
|
|
339
345
|
}
|
|
340
346
|
this.rxStomp.configure(stompConfig);
|
|
341
|
-
activation.own(this.rxStomp.webSocketErrors$.subscribe(
|
|
347
|
+
activation.own(this.rxStomp.webSocketErrors$.subscribe((value) => {
|
|
342
348
|
this.lastWebsocketError = value;
|
|
343
|
-
if (!activation.ended && options?.maxConnectionAttempts && this.connectionAttempts >= options.maxConnectionAttempts) {
|
|
344
|
-
this.maxConnectionAttemptsReached = true;
|
|
345
|
-
await this.failConnection(activation, new Error("Max number of reconnection attempts reached", { cause: value ?? undefined }));
|
|
346
|
-
}
|
|
347
349
|
}));
|
|
348
350
|
activation.own(this.rxStomp.stompErrors$.subscribe(async (frame) => {
|
|
349
351
|
const stompError = new Error(frame.headers["message"], { cause: frame });
|
|
@@ -380,8 +382,17 @@ class StompConnectionManager {
|
|
|
380
382
|
}));
|
|
381
383
|
let previousState = this.rxStomp.connectionState$.getValue();
|
|
382
384
|
activation.own(this.rxStomp.connectionState$.subscribe((state) => {
|
|
383
|
-
if (state === import_rx_stomp.RxStompState.CLOSED &&
|
|
384
|
-
|
|
385
|
+
if (state === import_rx_stomp.RxStompState.CLOSED && this.activation === activation) {
|
|
386
|
+
if (previousState === import_rx_stomp.RxStompState.OPEN) {
|
|
387
|
+
this.connectionEndedHandler?.(null);
|
|
388
|
+
} else if (previousState === import_rx_stomp.RxStompState.CONNECTING) {
|
|
389
|
+
if (options.maxConnectionAttempts && this.connectionAttempts >= options.maxConnectionAttempts) {
|
|
390
|
+
this.maxConnectionAttemptsReached = true;
|
|
391
|
+
this.failConnection(activation, new Error("Max number of reconnection attempts reached", { cause: this.lastWebsocketError ?? undefined }));
|
|
392
|
+
} else {
|
|
393
|
+
this.connectionAttemptFailedSubject.next();
|
|
394
|
+
}
|
|
395
|
+
}
|
|
385
396
|
}
|
|
386
397
|
previousState = state;
|
|
387
398
|
}));
|
|
@@ -407,16 +418,8 @@ class StompConnectionManager {
|
|
|
407
418
|
}
|
|
408
419
|
if (options?.maxConnectionAttempts) {
|
|
409
420
|
this.connectionAttempts++;
|
|
410
|
-
if (this.connectionAttempts > options.maxConnectionAttempts) {
|
|
411
|
-
this.maxConnectionAttemptsReached = true;
|
|
412
|
-
await this.failConnection(activation, new Error("Max number of reconnection attempts reached", { cause: this.lastWebsocketError ?? undefined }));
|
|
413
|
-
return;
|
|
414
|
-
} else {
|
|
415
|
-
await this.connectionJitterDelay(activation);
|
|
416
|
-
}
|
|
417
|
-
} else {
|
|
418
|
-
await this.connectionJitterDelay(activation);
|
|
419
421
|
}
|
|
422
|
+
await this.connectionJitterDelay(activation);
|
|
420
423
|
if (activation.ended) {
|
|
421
424
|
return;
|
|
422
425
|
}
|
|
@@ -591,6 +594,9 @@ class EventBus {
|
|
|
591
594
|
get connectionEstablished() {
|
|
592
595
|
return this.stompConnectionManager.connectionEstablished;
|
|
593
596
|
}
|
|
597
|
+
get connectionAttemptFailed() {
|
|
598
|
+
return this.stompConnectionManager.connectionAttemptFailed;
|
|
599
|
+
}
|
|
594
600
|
isConnectionActive() {
|
|
595
601
|
return this.stompConnectionManager.active;
|
|
596
602
|
}
|
|
@@ -922,7 +928,7 @@ class Util {
|
|
|
922
928
|
}
|
|
923
929
|
|
|
924
930
|
// packages/core/src/api/ServiceRegistry.ts
|
|
925
|
-
var import_debug3 = __toESM(require("debug"));
|
|
931
|
+
var import_debug3 = __toESM(require("debug"), 1);
|
|
926
932
|
|
|
927
933
|
// packages/core/src/api/event/DefaultCRI.ts
|
|
928
934
|
var ZONE_DELIMITER = "~";
|
|
@@ -1294,11 +1300,11 @@ function Publish(namespace, name, advertise = false) {
|
|
|
1294
1300
|
}
|
|
1295
1301
|
|
|
1296
1302
|
// packages/core/src/internal/api/ServiceInvocationSupervisor.ts
|
|
1297
|
-
var import_api2 = __toESM(require("@opentelemetry/api"));
|
|
1303
|
+
var import_api2 = __toESM(require("@opentelemetry/api"), 1);
|
|
1298
1304
|
// packages/core/package.json
|
|
1299
1305
|
var package_default = {
|
|
1300
1306
|
name: "@kinotic-ai/core",
|
|
1301
|
-
version: "5.0.0-beta.
|
|
1307
|
+
version: "5.0.0-beta.26",
|
|
1302
1308
|
type: "module",
|
|
1303
1309
|
files: [
|
|
1304
1310
|
"dist"
|
|
@@ -1722,7 +1728,7 @@ class ServiceInvocationSupervisor {
|
|
|
1722
1728
|
}
|
|
1723
1729
|
|
|
1724
1730
|
// packages/core/src/api/ServiceRegistry.ts
|
|
1725
|
-
var import_api3 = __toESM(require("@opentelemetry/api"));
|
|
1731
|
+
var import_api3 = __toESM(require("@opentelemetry/api"), 1);
|
|
1726
1732
|
var import_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
1727
1733
|
var import_operators4 = require("rxjs/operators");
|
|
1728
1734
|
class JsonEventFactory {
|
|
@@ -2171,15 +2177,15 @@ class CursorPageable extends Pageable {
|
|
|
2171
2177
|
}
|
|
2172
2178
|
// packages/core/src/api/crud/Sort.ts
|
|
2173
2179
|
var Direction;
|
|
2174
|
-
((
|
|
2175
|
-
|
|
2176
|
-
|
|
2180
|
+
((Direction) => {
|
|
2181
|
+
Direction["ASC"] = "ASC";
|
|
2182
|
+
Direction["DESC"] = "DESC";
|
|
2177
2183
|
})(Direction ||= {});
|
|
2178
2184
|
var NullHandling;
|
|
2179
|
-
((
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2185
|
+
((NullHandling) => {
|
|
2186
|
+
NullHandling["NATIVE"] = "NATIVE";
|
|
2187
|
+
NullHandling["NULLS_FIRST"] = "NULLS_FIRST";
|
|
2188
|
+
NullHandling["NULLS_LAST"] = "NULLS_LAST";
|
|
2183
2189
|
})(NullHandling ||= {});
|
|
2184
2190
|
|
|
2185
2191
|
class Order {
|
package/dist/index.d.cts
CHANGED
|
@@ -237,6 +237,13 @@ interface IEventBus {
|
|
|
237
237
|
*/
|
|
238
238
|
connectionEstablished: Observable<ConnectedInfo>;
|
|
239
239
|
/**
|
|
240
|
+
* Emits each time an attempt to connect fails before the server accepts the connection and the client
|
|
241
|
+
* will try again: the server could not be reached, or it closed the socket before answering. This
|
|
242
|
+
* covers the attempts of a pending {@link connect} as well as the reconnects after a connection ends.
|
|
243
|
+
* An attempt that ends the connection for good is reported by {@link connectionEnded} instead.
|
|
244
|
+
*/
|
|
245
|
+
connectionAttemptFailed: Observable<void>;
|
|
246
|
+
/**
|
|
240
247
|
* The {@link ServerInfo} used when connecting, if connected or null
|
|
241
248
|
*/
|
|
242
249
|
serverInfo: ServerInfo | null;
|
|
@@ -1332,6 +1339,7 @@ declare class EventBus implements IEventBus {
|
|
|
1332
1339
|
constructor();
|
|
1333
1340
|
get connectionEnded(): Observable3<Error | null>;
|
|
1334
1341
|
get connectionEstablished(): Observable3<ConnectedInfo>;
|
|
1342
|
+
get connectionAttemptFailed(): Observable3<void>;
|
|
1335
1343
|
isConnectionActive(): boolean;
|
|
1336
1344
|
isConnected(): boolean;
|
|
1337
1345
|
connect(options: ConnectOptions): Promise<ConnectedInfo>;
|
|
@@ -1473,4 +1481,4 @@ declare class ParticipantConstants {
|
|
|
1473
1481
|
/** The clientId the test server's TestSecurityService maps to the ANONYMOUS role in core package tests. */
|
|
1474
1482
|
static readonly CLI_PARTICIPANT_ID: string;
|
|
1475
1483
|
}
|
|
1476
|
-
export {
|
|
1484
|
+
export { AbstractIterablePage, AuthorizationException, BasicCredentialsResolver, BearerCredentialsResolver, CRI, ChainedCredentialsResolver, ConnectOptions, ConnectedInfo, Context, ContextInterceptor, CredentialsResolver, CrudServiceProxy, CrudServiceProxyFactory, CursorPageable, DataSourceUtils, DefaultCRI, Direction, EnvCredentialsResolver, Event, EventBus, EventConstants, FunctionalIterablePage, ICrudServiceProxy, ICrudServiceProxyFactory, IDataSource, IEditableDataSource, IEvent, IEventBus, IEventFactory, IKinotic, IParticipant, IServiceProxy, IServiceRegistry, IWebSocket, Identifiable, IterablePage, JsonEventFactory, Kinotic, KinoticPlugin, KinoticSingleton, NullHandling, OffsetPageable, Order, Page, Pageable, Participant, ParticipantConstants, Publish, ResolvedCredentials, RpcError, Scope, ScopeOptional, ServerInfo, ServiceContext, ServiceDirectoryEntry, ServiceIdentifier, ServiceRegistry, SessionCredentialsResolver, SessionKeepAliveMode, Sort, TextEventFactory, Version, WebSocketFactory, Zone, buildBrokerUrl, buildServerUrl, createCRI, declareServiceDefinitions, isAdvertised, receivesContext, scopeOptionalMethodNames, validateLabel, validateZone };
|
package/dist/index.d.ts
CHANGED
|
@@ -237,6 +237,13 @@ interface IEventBus {
|
|
|
237
237
|
*/
|
|
238
238
|
connectionEstablished: Observable<ConnectedInfo>;
|
|
239
239
|
/**
|
|
240
|
+
* Emits each time an attempt to connect fails before the server accepts the connection and the client
|
|
241
|
+
* will try again: the server could not be reached, or it closed the socket before answering. This
|
|
242
|
+
* covers the attempts of a pending {@link connect} as well as the reconnects after a connection ends.
|
|
243
|
+
* An attempt that ends the connection for good is reported by {@link connectionEnded} instead.
|
|
244
|
+
*/
|
|
245
|
+
connectionAttemptFailed: Observable<void>;
|
|
246
|
+
/**
|
|
240
247
|
* The {@link ServerInfo} used when connecting, if connected or null
|
|
241
248
|
*/
|
|
242
249
|
serverInfo: ServerInfo | null;
|
|
@@ -1332,6 +1339,7 @@ declare class EventBus implements IEventBus {
|
|
|
1332
1339
|
constructor();
|
|
1333
1340
|
get connectionEnded(): Observable3<Error | null>;
|
|
1334
1341
|
get connectionEstablished(): Observable3<ConnectedInfo>;
|
|
1342
|
+
get connectionAttemptFailed(): Observable3<void>;
|
|
1335
1343
|
isConnectionActive(): boolean;
|
|
1336
1344
|
isConnected(): boolean;
|
|
1337
1345
|
connect(options: ConnectOptions): Promise<ConnectedInfo>;
|
|
@@ -1473,4 +1481,4 @@ declare class ParticipantConstants {
|
|
|
1473
1481
|
/** The clientId the test server's TestSecurityService maps to the ANONYMOUS role in core package tests. */
|
|
1474
1482
|
static readonly CLI_PARTICIPANT_ID: string;
|
|
1475
1483
|
}
|
|
1476
|
-
export {
|
|
1484
|
+
export { AbstractIterablePage, AuthorizationException, BasicCredentialsResolver, BearerCredentialsResolver, CRI, ChainedCredentialsResolver, ConnectOptions, ConnectedInfo, Context, ContextInterceptor, CredentialsResolver, CrudServiceProxy, CrudServiceProxyFactory, CursorPageable, DataSourceUtils, DefaultCRI, Direction, EnvCredentialsResolver, Event, EventBus, EventConstants, FunctionalIterablePage, ICrudServiceProxy, ICrudServiceProxyFactory, IDataSource, IEditableDataSource, IEvent, IEventBus, IEventFactory, IKinotic, IParticipant, IServiceProxy, IServiceRegistry, IWebSocket, Identifiable, IterablePage, JsonEventFactory, Kinotic, KinoticPlugin, KinoticSingleton, NullHandling, OffsetPageable, Order, Page, Pageable, Participant, ParticipantConstants, Publish, ResolvedCredentials, RpcError, Scope, ScopeOptional, ServerInfo, ServiceContext, ServiceDirectoryEntry, ServiceIdentifier, ServiceRegistry, SessionCredentialsResolver, SessionKeepAliveMode, Sort, TextEventFactory, Version, WebSocketFactory, Zone, buildBrokerUrl, buildServerUrl, createCRI, declareServiceDefinitions, isAdvertised, receivesContext, scopeOptionalMethodNames, validateLabel, validateZone };
|
package/dist/index.js
CHANGED
|
@@ -11,40 +11,40 @@ function buildBrokerUrl(server) {
|
|
|
11
11
|
return buildServerUrl(server, "ws") + "/api/v1";
|
|
12
12
|
}
|
|
13
13
|
var SessionKeepAliveMode;
|
|
14
|
-
((
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
((SessionKeepAliveMode) => {
|
|
15
|
+
SessionKeepAliveMode["NONE"] = "NONE";
|
|
16
|
+
SessionKeepAliveMode["ACTIVITY"] = "ACTIVITY";
|
|
17
|
+
SessionKeepAliveMode["CONNECTION"] = "CONNECTION";
|
|
18
18
|
})(SessionKeepAliveMode ||= {});
|
|
19
19
|
// packages/core/src/api/event/IEventBus.ts
|
|
20
20
|
var EventConstants;
|
|
21
|
-
((
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
((EventConstants) => {
|
|
22
|
+
EventConstants["CONTENT_TYPE_HEADER"] = "content-type";
|
|
23
|
+
EventConstants["CONTENT_LENGTH_HEADER"] = "content-length";
|
|
24
|
+
EventConstants["REPLY_TO_HEADER"] = "reply-to";
|
|
25
|
+
EventConstants["SENDER_HEADER"] = "sender";
|
|
26
|
+
EventConstants["CONNECTED_INFO_HEADER"] = "connected-info";
|
|
27
|
+
EventConstants["SESSION_KEEP_ALIVE_HEADER"] = "session-keep-alive";
|
|
28
|
+
EventConstants["CORRELATION_ID_HEADER"] = "__correlation-id";
|
|
29
|
+
EventConstants["ORIGIN_CRI_HEADER"] = "__origin-cri";
|
|
30
|
+
EventConstants["ERROR_HEADER"] = "error";
|
|
31
|
+
EventConstants["COMPLETE_HEADER"] = "complete";
|
|
32
|
+
EventConstants["CONTROL_HEADER"] = "control";
|
|
33
|
+
EventConstants["CONTROL_VALUE_COMPLETE"] = "complete";
|
|
34
|
+
EventConstants["CONTROL_VALUE_CANCEL"] = "cancel";
|
|
35
|
+
EventConstants["CONTROL_VALUE_SUSPEND"] = "suspend";
|
|
36
|
+
EventConstants["CONTROL_VALUE_RESUME"] = "resume";
|
|
37
|
+
EventConstants["SERVICE_DESTINATION_PREFIX"] = "srv://";
|
|
38
|
+
EventConstants["SERVICE_DESTINATION_SCHEME"] = "srv";
|
|
39
|
+
EventConstants["STREAM_DESTINATION_PREFIX"] = "stream://";
|
|
40
|
+
EventConstants["STREAM_DESTINATION_SCHEME"] = "stream";
|
|
41
|
+
EventConstants["REPLY_DESTINATION_PREFIX"] = "reply://";
|
|
42
|
+
EventConstants["REPLY_DESTINATION_SCHEME"] = "reply";
|
|
43
|
+
EventConstants["CONTENT_JSON"] = "application/json";
|
|
44
|
+
EventConstants["CONTENT_TEXT"] = "text/plain";
|
|
45
|
+
EventConstants["CONTENT_OCTET_STREAM"] = "application/octet-stream";
|
|
46
|
+
EventConstants["TRACEPARENT_HEADER"] = "traceparent";
|
|
47
|
+
EventConstants["TRACESTATE_HEADER"] = "tracestate";
|
|
48
48
|
})(EventConstants ||= {});
|
|
49
49
|
|
|
50
50
|
// packages/core/src/internal/api/Logger.ts
|
|
@@ -134,6 +134,7 @@ class StompConnectionManager {
|
|
|
134
134
|
connectionAttempts = 0;
|
|
135
135
|
debugLogger = debug2("kinotic:stomp");
|
|
136
136
|
connectionEstablishedSubject = new Subject;
|
|
137
|
+
connectionAttemptFailedSubject = new Subject;
|
|
137
138
|
initialConnectionSuccessful = false;
|
|
138
139
|
rxStompHasConnected = false;
|
|
139
140
|
_replyToCri = null;
|
|
@@ -149,6 +150,9 @@ class StompConnectionManager {
|
|
|
149
150
|
get connectionEstablished() {
|
|
150
151
|
return this.connectionEstablishedSubject.asObservable();
|
|
151
152
|
}
|
|
153
|
+
get connectionAttemptFailed() {
|
|
154
|
+
return this.connectionAttemptFailedSubject.asObservable();
|
|
155
|
+
}
|
|
152
156
|
async activate(options) {
|
|
153
157
|
if (!options?.server?.host) {
|
|
154
158
|
throw new Error("No host provided");
|
|
@@ -210,7 +214,7 @@ class StompConnectionManager {
|
|
|
210
214
|
webSocketFactory: usesPreparedSocket ? takePreparedSocket : undefined,
|
|
211
215
|
beforeConnect: () => {
|
|
212
216
|
const attempt = this.prepareAttempt(activation, options, server, headerAuth);
|
|
213
|
-
const settled = () => new Promise((
|
|
217
|
+
const settled = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
214
218
|
activation.attempt = attempt.then(settled, settled);
|
|
215
219
|
return attempt;
|
|
216
220
|
}
|
|
@@ -221,12 +225,8 @@ class StompConnectionManager {
|
|
|
221
225
|
};
|
|
222
226
|
}
|
|
223
227
|
this.rxStomp.configure(stompConfig);
|
|
224
|
-
activation.own(this.rxStomp.webSocketErrors$.subscribe(
|
|
228
|
+
activation.own(this.rxStomp.webSocketErrors$.subscribe((value) => {
|
|
225
229
|
this.lastWebsocketError = value;
|
|
226
|
-
if (!activation.ended && options?.maxConnectionAttempts && this.connectionAttempts >= options.maxConnectionAttempts) {
|
|
227
|
-
this.maxConnectionAttemptsReached = true;
|
|
228
|
-
await this.failConnection(activation, new Error("Max number of reconnection attempts reached", { cause: value ?? undefined }));
|
|
229
|
-
}
|
|
230
230
|
}));
|
|
231
231
|
activation.own(this.rxStomp.stompErrors$.subscribe(async (frame) => {
|
|
232
232
|
const stompError = new Error(frame.headers["message"], { cause: frame });
|
|
@@ -263,8 +263,17 @@ class StompConnectionManager {
|
|
|
263
263
|
}));
|
|
264
264
|
let previousState = this.rxStomp.connectionState$.getValue();
|
|
265
265
|
activation.own(this.rxStomp.connectionState$.subscribe((state) => {
|
|
266
|
-
if (state === RxStompState.CLOSED &&
|
|
267
|
-
|
|
266
|
+
if (state === RxStompState.CLOSED && this.activation === activation) {
|
|
267
|
+
if (previousState === RxStompState.OPEN) {
|
|
268
|
+
this.connectionEndedHandler?.(null);
|
|
269
|
+
} else if (previousState === RxStompState.CONNECTING) {
|
|
270
|
+
if (options.maxConnectionAttempts && this.connectionAttempts >= options.maxConnectionAttempts) {
|
|
271
|
+
this.maxConnectionAttemptsReached = true;
|
|
272
|
+
this.failConnection(activation, new Error("Max number of reconnection attempts reached", { cause: this.lastWebsocketError ?? undefined }));
|
|
273
|
+
} else {
|
|
274
|
+
this.connectionAttemptFailedSubject.next();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
268
277
|
}
|
|
269
278
|
previousState = state;
|
|
270
279
|
}));
|
|
@@ -290,16 +299,8 @@ class StompConnectionManager {
|
|
|
290
299
|
}
|
|
291
300
|
if (options?.maxConnectionAttempts) {
|
|
292
301
|
this.connectionAttempts++;
|
|
293
|
-
if (this.connectionAttempts > options.maxConnectionAttempts) {
|
|
294
|
-
this.maxConnectionAttemptsReached = true;
|
|
295
|
-
await this.failConnection(activation, new Error("Max number of reconnection attempts reached", { cause: this.lastWebsocketError ?? undefined }));
|
|
296
|
-
return;
|
|
297
|
-
} else {
|
|
298
|
-
await this.connectionJitterDelay(activation);
|
|
299
|
-
}
|
|
300
|
-
} else {
|
|
301
|
-
await this.connectionJitterDelay(activation);
|
|
302
302
|
}
|
|
303
|
+
await this.connectionJitterDelay(activation);
|
|
303
304
|
if (activation.ended) {
|
|
304
305
|
return;
|
|
305
306
|
}
|
|
@@ -474,6 +475,9 @@ class EventBus {
|
|
|
474
475
|
get connectionEstablished() {
|
|
475
476
|
return this.stompConnectionManager.connectionEstablished;
|
|
476
477
|
}
|
|
478
|
+
get connectionAttemptFailed() {
|
|
479
|
+
return this.stompConnectionManager.connectionAttemptFailed;
|
|
480
|
+
}
|
|
477
481
|
isConnectionActive() {
|
|
478
482
|
return this.stompConnectionManager.active;
|
|
479
483
|
}
|
|
@@ -1181,7 +1185,7 @@ import opentelemetry, { context as context2, propagation as propagation2, trace,
|
|
|
1181
1185
|
// packages/core/package.json
|
|
1182
1186
|
var package_default = {
|
|
1183
1187
|
name: "@kinotic-ai/core",
|
|
1184
|
-
version: "5.0.0-beta.
|
|
1188
|
+
version: "5.0.0-beta.26",
|
|
1185
1189
|
type: "module",
|
|
1186
1190
|
files: [
|
|
1187
1191
|
"dist"
|
|
@@ -2057,15 +2061,15 @@ class CursorPageable extends Pageable {
|
|
|
2057
2061
|
}
|
|
2058
2062
|
// packages/core/src/api/crud/Sort.ts
|
|
2059
2063
|
var Direction;
|
|
2060
|
-
((
|
|
2061
|
-
|
|
2062
|
-
|
|
2064
|
+
((Direction) => {
|
|
2065
|
+
Direction["ASC"] = "ASC";
|
|
2066
|
+
Direction["DESC"] = "DESC";
|
|
2063
2067
|
})(Direction ||= {});
|
|
2064
2068
|
var NullHandling;
|
|
2065
|
-
((
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
+
((NullHandling) => {
|
|
2070
|
+
NullHandling["NATIVE"] = "NATIVE";
|
|
2071
|
+
NullHandling["NULLS_FIRST"] = "NULLS_FIRST";
|
|
2072
|
+
NullHandling["NULLS_LAST"] = "NULLS_LAST";
|
|
2069
2073
|
})(NullHandling ||= {});
|
|
2070
2074
|
|
|
2071
2075
|
class Order {
|
|
@@ -2110,52 +2114,52 @@ class ParticipantConstants {
|
|
|
2110
2114
|
static CLI_PARTICIPANT_ID = "-42-Kinotic-CLI-42-";
|
|
2111
2115
|
}
|
|
2112
2116
|
export {
|
|
2113
|
-
|
|
2114
|
-
validateLabel,
|
|
2115
|
-
scopeOptionalMethodNames,
|
|
2116
|
-
receivesContext,
|
|
2117
|
-
isAdvertised,
|
|
2118
|
-
declareServiceDefinitions,
|
|
2119
|
-
createCRI,
|
|
2120
|
-
buildServerUrl,
|
|
2121
|
-
buildBrokerUrl,
|
|
2122
|
-
Zone,
|
|
2123
|
-
Version,
|
|
2124
|
-
TextEventFactory,
|
|
2125
|
-
Sort,
|
|
2126
|
-
SessionKeepAliveMode,
|
|
2127
|
-
SessionCredentialsResolver,
|
|
2128
|
-
ServiceRegistry,
|
|
2129
|
-
ServiceIdentifier,
|
|
2130
|
-
ServerInfo,
|
|
2131
|
-
ScopeOptional,
|
|
2132
|
-
Scope,
|
|
2133
|
-
RpcError,
|
|
2134
|
-
Publish,
|
|
2135
|
-
ParticipantConstants,
|
|
2136
|
-
Pageable,
|
|
2137
|
-
Order,
|
|
2138
|
-
OffsetPageable,
|
|
2139
|
-
NullHandling,
|
|
2140
|
-
KinoticSingleton,
|
|
2141
|
-
Kinotic,
|
|
2142
|
-
JsonEventFactory,
|
|
2143
|
-
FunctionalIterablePage,
|
|
2144
|
-
EventConstants,
|
|
2145
|
-
EventBus,
|
|
2146
|
-
Event,
|
|
2147
|
-
EnvCredentialsResolver,
|
|
2148
|
-
Direction,
|
|
2149
|
-
DefaultCRI,
|
|
2150
|
-
DataSourceUtils,
|
|
2151
|
-
CursorPageable,
|
|
2152
|
-
CrudServiceProxyFactory,
|
|
2153
|
-
CrudServiceProxy,
|
|
2154
|
-
Context,
|
|
2155
|
-
ConnectedInfo,
|
|
2156
|
-
ChainedCredentialsResolver,
|
|
2157
|
-
BearerCredentialsResolver,
|
|
2158
|
-
BasicCredentialsResolver,
|
|
2117
|
+
AbstractIterablePage,
|
|
2159
2118
|
AuthorizationException,
|
|
2160
|
-
|
|
2119
|
+
BasicCredentialsResolver,
|
|
2120
|
+
BearerCredentialsResolver,
|
|
2121
|
+
ChainedCredentialsResolver,
|
|
2122
|
+
ConnectedInfo,
|
|
2123
|
+
Context,
|
|
2124
|
+
CrudServiceProxy,
|
|
2125
|
+
CrudServiceProxyFactory,
|
|
2126
|
+
CursorPageable,
|
|
2127
|
+
DataSourceUtils,
|
|
2128
|
+
DefaultCRI,
|
|
2129
|
+
Direction,
|
|
2130
|
+
EnvCredentialsResolver,
|
|
2131
|
+
Event,
|
|
2132
|
+
EventBus,
|
|
2133
|
+
EventConstants,
|
|
2134
|
+
FunctionalIterablePage,
|
|
2135
|
+
JsonEventFactory,
|
|
2136
|
+
Kinotic,
|
|
2137
|
+
KinoticSingleton,
|
|
2138
|
+
NullHandling,
|
|
2139
|
+
OffsetPageable,
|
|
2140
|
+
Order,
|
|
2141
|
+
Pageable,
|
|
2142
|
+
ParticipantConstants,
|
|
2143
|
+
Publish,
|
|
2144
|
+
RpcError,
|
|
2145
|
+
Scope,
|
|
2146
|
+
ScopeOptional,
|
|
2147
|
+
ServerInfo,
|
|
2148
|
+
ServiceIdentifier,
|
|
2149
|
+
ServiceRegistry,
|
|
2150
|
+
SessionCredentialsResolver,
|
|
2151
|
+
SessionKeepAliveMode,
|
|
2152
|
+
Sort,
|
|
2153
|
+
TextEventFactory,
|
|
2154
|
+
Version,
|
|
2155
|
+
Zone,
|
|
2156
|
+
buildBrokerUrl,
|
|
2157
|
+
buildServerUrl,
|
|
2158
|
+
createCRI,
|
|
2159
|
+
declareServiceDefinitions,
|
|
2160
|
+
isAdvertised,
|
|
2161
|
+
receivesContext,
|
|
2162
|
+
scopeOptionalMethodNames,
|
|
2163
|
+
validateLabel,
|
|
2164
|
+
validateZone
|
|
2161
2165
|
};
|
package/dist/node/index.cjs
CHANGED
|
@@ -19,13 +19,15 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
return cached;
|
|
20
20
|
}
|
|
21
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
24
|
+
for (let key of __getOwnPropNames(mod))
|
|
25
|
+
if (!__hasOwnProp.call(to, key))
|
|
26
|
+
__defProp(to, key, {
|
|
27
|
+
get: __accessProp.bind(mod, key),
|
|
28
|
+
enumerable: true
|
|
29
|
+
});
|
|
30
|
+
}
|
|
29
31
|
if (canCache)
|
|
30
32
|
cache.set(mod, to);
|
|
31
33
|
return to;
|