@mindignited/continuum-client 2.14.8 → 2.14.9
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/README.md +109 -6
- package/dist/continuum.cjs +2 -2
- package/dist/continuum.cjs.map +1 -1
- package/dist/continuum.js +130 -100
- package/dist/continuum.js.map +1 -1
- package/dist/src/api/Continuum.d.ts +3 -1
- package/dist/src/core/api/EventBus.d.ts +1 -0
- package/dist/src/core/api/IEventBus.d.ts +6 -0
- package/dist/src/core/api/ServiceRegistry.d.ts +5 -2
- package/dist/src/core/api/StompConnectionManager.d.ts +2 -1
- package/dist/src/internal/core/api/ServiceInvocationSupervisor.d.ts +7 -1
- package/package.json +19 -19
package/dist/continuum.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { RxStomp as
|
|
2
|
-
import { ReconnectionTimeMode as
|
|
3
|
-
import { v4 as
|
|
4
|
-
import
|
|
5
|
-
import b, { propagation as
|
|
1
|
+
import { RxStomp as k } from "@stomp/rx-stomp";
|
|
2
|
+
import { ReconnectionTimeMode as B } from "@stomp/stompjs";
|
|
3
|
+
import { v4 as m } from "uuid";
|
|
4
|
+
import I from "debug";
|
|
5
|
+
import b, { propagation as F, context as $, SpanKind as q, SpanStatusCode as Y } from "@opentelemetry/api";
|
|
6
6
|
import { Subject as A, firstValueFrom as U, Observable as V, throwError as j } from "rxjs";
|
|
7
7
|
import { map as R, multicast as J, filter as X, first as W } from "rxjs/operators";
|
|
8
|
-
import { Optional as
|
|
8
|
+
import { Optional as C } from "typescript-optional";
|
|
9
9
|
import "reflect-metadata";
|
|
10
10
|
import { ATTR_SERVER_ADDRESS as G, ATTR_SERVER_PORT as K } from "@opentelemetry/semantic-conventions";
|
|
11
11
|
class Le {
|
|
12
12
|
}
|
|
13
|
-
class
|
|
13
|
+
class N {
|
|
14
14
|
host;
|
|
15
15
|
port;
|
|
16
16
|
useSSL;
|
|
17
17
|
}
|
|
18
|
-
class Me extends
|
|
18
|
+
class Me extends N {
|
|
19
19
|
/**
|
|
20
20
|
* The headers to send during the connection to the continuum server.
|
|
21
21
|
* If a function is provided, it will be called to get the headers each time the connection is established.
|
|
@@ -34,9 +34,9 @@ class Me extends w {
|
|
|
34
34
|
*/
|
|
35
35
|
disableStickySession;
|
|
36
36
|
}
|
|
37
|
-
class
|
|
37
|
+
class v extends Error {
|
|
38
38
|
constructor(e) {
|
|
39
|
-
super(e), Object.setPrototypeOf(this,
|
|
39
|
+
super(e), Object.setPrototypeOf(this, v.prototype);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
var o = /* @__PURE__ */ ((s) => (s.CONTENT_TYPE_HEADER = "content-type", s.CONTENT_LENGTH_HEADER = "content-length", s.REPLY_TO_HEADER = "reply-to", s.REPLY_TO_ID_HEADER = "reply-to-id", s.SESSION_HEADER = "session", s.CONNECTED_INFO_HEADER = "connected-info", s.DISABLE_STICKY_SESSION_HEADER = "disable-sticky-session", s.CORRELATION_ID_HEADER = "__correlation-id", s.ERROR_HEADER = "error", s.COMPLETE_HEADER = "complete", s.CONTROL_HEADER = "control", s.CONTROL_VALUE_COMPLETE = "complete", s.CONTROL_VALUE_CANCEL = "cancel", s.CONTROL_VALUE_SUSPEND = "suspend", s.CONTROL_VALUE_RESUME = "resume", s.SERVICE_DESTINATION_PREFIX = "srv://", s.SERVICE_DESTINATION_SCHEME = "srv", s.STREAM_DESTINATION_PREFIX = "stream://", s.STREAM_DESTINATION_SCHEME = "stream", s.CONTENT_JSON = "application/json", s.CONTENT_TEXT = "text/plain", s.TRACEPARENT_HEADER = "traceparent", s.TRACESTATE_HEADER = "tracestate", s))(o || {});
|
|
@@ -53,9 +53,9 @@ class z {
|
|
|
53
53
|
JITTER_MAX = 5e3;
|
|
54
54
|
connectionAttempts = 0;
|
|
55
55
|
initialConnectionSuccessful = !1;
|
|
56
|
-
debugLogger =
|
|
57
|
-
replyToId =
|
|
58
|
-
|
|
56
|
+
debugLogger = I("continuum:stomp");
|
|
57
|
+
replyToId = m();
|
|
58
|
+
_replyToCri = o.SERVICE_DESTINATION_PREFIX + this.replyToId + ":" + m() + "@continuum.js.EventBus/replyHandler";
|
|
59
59
|
deactivationHandler = null;
|
|
60
60
|
/**
|
|
61
61
|
* @return true if this {@link StompConnectionManager} is actively trying to maintain a connection to the Stomp server, false if not.
|
|
@@ -63,6 +63,9 @@ class z {
|
|
|
63
63
|
get active() {
|
|
64
64
|
return !!this.rxStomp;
|
|
65
65
|
}
|
|
66
|
+
get replyToCri() {
|
|
67
|
+
return this._replyToCri;
|
|
68
|
+
}
|
|
66
69
|
/**
|
|
67
70
|
* return true if this {@link StompConnectionManager} is active and has a connection to the stomp server
|
|
68
71
|
*/
|
|
@@ -85,7 +88,7 @@ class z {
|
|
|
85
88
|
}
|
|
86
89
|
this.connectionAttempts = 0, this.initialConnectionSuccessful = !1, this.lastWebsocketError = null, this.maxConnectionAttemptsReached = !1;
|
|
87
90
|
const i = "ws" + (e.useSSL ? "s" : "") + "://" + e.host + (e.port ? ":" + e.port : "") + "/v1";
|
|
88
|
-
this.rxStomp = new
|
|
91
|
+
this.rxStomp = new k();
|
|
89
92
|
let n = typeof e.connectHeaders != "function" && e.connectHeaders != null ? e.connectHeaders : {};
|
|
90
93
|
const c = {
|
|
91
94
|
brokerURL: i,
|
|
@@ -99,7 +102,7 @@ class z {
|
|
|
99
102
|
for (const l in u)
|
|
100
103
|
n[l] = u[l];
|
|
101
104
|
}
|
|
102
|
-
if (e.disableStickySession && (n[o.DISABLE_STICKY_SESSION_HEADER] = "true"), n[o.REPLY_TO_ID_HEADER] ? this.replyToId = n[o.REPLY_TO_ID_HEADER] : n[o.REPLY_TO_ID_HEADER] = this.replyToId, e?.maxConnectionAttempts)
|
|
105
|
+
if (e.disableStickySession && (n[o.DISABLE_STICKY_SESSION_HEADER] = "true"), n[o.REPLY_TO_ID_HEADER] ? (this.replyToId = n[o.REPLY_TO_ID_HEADER], this._replyToCri = o.SERVICE_DESTINATION_PREFIX + this.replyToId + ":" + m() + "@continuum.js.EventBus/replyHandler") : n[o.REPLY_TO_ID_HEADER] = this.replyToId, e?.maxConnectionAttempts)
|
|
103
106
|
if (this.connectionAttempts++, this.connectionAttempts > e.maxConnectionAttempts) {
|
|
104
107
|
if (this.maxConnectionAttemptsReached = !0, await this.deactivate(), !this.initialConnectionSuccessful) {
|
|
105
108
|
let u = this.lastWebsocketError?.message ? this.lastWebsocketError?.message : "UNKNOWN";
|
|
@@ -113,7 +116,7 @@ class z {
|
|
|
113
116
|
};
|
|
114
117
|
this.debugLogger.enabled && (c.debug = (u) => {
|
|
115
118
|
this.debugLogger(u);
|
|
116
|
-
}), this.rxStomp.configure(c), this.rxStomp.stompClient.maxReconnectDelay = this.MAX_RECONNECT_DELAY, this.rxStomp.stompClient.reconnectTimeMode =
|
|
119
|
+
}), this.rxStomp.configure(c), this.rxStomp.stompClient.maxReconnectDelay = this.MAX_RECONNECT_DELAY, this.rxStomp.stompClient.reconnectTimeMode = B.EXPONENTIAL, this.rxStomp.webSocketErrors$.subscribe((u) => {
|
|
117
120
|
this.lastWebsocketError = u;
|
|
118
121
|
});
|
|
119
122
|
const a = this.rxStomp.connected$.subscribe(() => {
|
|
@@ -128,14 +131,14 @@ class z {
|
|
|
128
131
|
const d = JSON.parse(l);
|
|
129
132
|
if (e.disableStickySession)
|
|
130
133
|
if (typeof e.connectHeaders == "function") {
|
|
131
|
-
for (let
|
|
132
|
-
delete n[
|
|
134
|
+
for (let S in n)
|
|
135
|
+
delete n[S];
|
|
133
136
|
this.initialConnectionSuccessful || t(d);
|
|
134
137
|
} else typeof e.connectHeaders == "object" && (p.unsubscribe(), t(d));
|
|
135
138
|
else if (p.unsubscribe(), d.sessionId != null && d.replyToId != null) {
|
|
136
139
|
if (e.connectHeaders != null)
|
|
137
|
-
for (let
|
|
138
|
-
delete n[
|
|
140
|
+
for (let S in n)
|
|
141
|
+
delete n[S];
|
|
139
142
|
n[o.SESSION_HEADER] = d.sessionId, t(d);
|
|
140
143
|
} else
|
|
141
144
|
r("Server did not return proper data for successful login");
|
|
@@ -163,7 +166,7 @@ class g {
|
|
|
163
166
|
headers;
|
|
164
167
|
data;
|
|
165
168
|
constructor(e, t, r) {
|
|
166
|
-
this.cri = e, t !== void 0 ? this.headers = t : this.headers = /* @__PURE__ */ new Map(), this.data =
|
|
169
|
+
this.cri = e, t !== void 0 ? this.headers = t : this.headers = /* @__PURE__ */ new Map(), this.data = C.ofNullable(r);
|
|
167
170
|
}
|
|
168
171
|
getHeader(e) {
|
|
169
172
|
return this.headers.get(e);
|
|
@@ -179,7 +182,7 @@ class g {
|
|
|
179
182
|
}
|
|
180
183
|
setDataString(e) {
|
|
181
184
|
const t = new TextEncoder().encode(e);
|
|
182
|
-
this.data =
|
|
185
|
+
this.data = C.ofNonNull(t);
|
|
183
186
|
}
|
|
184
187
|
getDataString() {
|
|
185
188
|
let e = "";
|
|
@@ -199,7 +202,7 @@ class Z {
|
|
|
199
202
|
constructor() {
|
|
200
203
|
this.fatalErrors = this.errorSubject.pipe(R((e) => (this.disconnect().catch((t) => {
|
|
201
204
|
console && console.error("Error disconnecting from Stomp: " + t);
|
|
202
|
-
}), new
|
|
205
|
+
}), new v(e.headers.message)))), this.stompConnectionManager.deactivationHandler = () => {
|
|
203
206
|
this.cleanup();
|
|
204
207
|
};
|
|
205
208
|
}
|
|
@@ -215,7 +218,7 @@ class Z {
|
|
|
215
218
|
{
|
|
216
219
|
this.cleanup();
|
|
217
220
|
const t = await this.stompConnectionManager.activate(e);
|
|
218
|
-
return this.serverInfo = new
|
|
221
|
+
return this.serverInfo = new N(), this.serverInfo.host = e.host, this.serverInfo.port = e.port, this.serverInfo.useSSL = e.useSSL, this.replyToCri = this.stompConnectionManager.replyToCri, this.errorSubjectSubscription = this.stompConnectionManager.rxStomp?.stompErrors$.subscribe(this.errorSubject), t;
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
224
|
async disconnect(e) {
|
|
@@ -227,7 +230,7 @@ class Z {
|
|
|
227
230
|
for (const [i, n] of e.headers.entries())
|
|
228
231
|
t[i] = n;
|
|
229
232
|
const r = {};
|
|
230
|
-
|
|
233
|
+
F.inject($.active(), r), r.traceparent && (t[o.TRACEPARENT_HEADER] = r.traceparent), r.tracestate && (t[o.TRACESTATE_HEADER] = r.tracestate), this.stompConnectionManager.rxStomp.publish({
|
|
231
234
|
destination: e.cri,
|
|
232
235
|
headers: t,
|
|
233
236
|
binaryBody: e.data.orUndefined()
|
|
@@ -242,7 +245,7 @@ class Z {
|
|
|
242
245
|
return this.stompConnectionManager?.rxStomp ? new V((r) => {
|
|
243
246
|
this.requestRepliesObservable == null && (this.requestRepliesSubject = new A(), this.requestRepliesObservable = this._observe(this.replyToCri).pipe(J(this.requestRepliesSubject)), this.requestRepliesSubscription = this.requestRepliesObservable.connect());
|
|
244
247
|
let i = !1;
|
|
245
|
-
const n =
|
|
248
|
+
const n = m(), c = this.requestRepliesObservable.pipe(X((a) => a.headers.get(o.CORRELATION_ID_HEADER) === n)).subscribe({
|
|
246
249
|
next(a) {
|
|
247
250
|
if (a.hasHeader(o.CONTROL_HEADER))
|
|
248
251
|
if (a.headers.get(o.CONTROL_HEADER) === "complete")
|
|
@@ -266,6 +269,9 @@ class Z {
|
|
|
266
269
|
};
|
|
267
270
|
}) : j(() => this.createSendUnavailableError());
|
|
268
271
|
}
|
|
272
|
+
listen(e) {
|
|
273
|
+
return Promise.reject("Not implemented");
|
|
274
|
+
}
|
|
269
275
|
observe(e) {
|
|
270
276
|
return this._observe(e);
|
|
271
277
|
}
|
|
@@ -380,7 +386,7 @@ class E {
|
|
|
380
386
|
return t && (c += `${t}@`), c += r, i && (c += `/${i}`), n && (c += `#${n}`), c;
|
|
381
387
|
}
|
|
382
388
|
}
|
|
383
|
-
function
|
|
389
|
+
function w(...s) {
|
|
384
390
|
if (s.length === 1) return new E(s[0]);
|
|
385
391
|
if (s.length === 2) return new E(s[0], null, s[1], null, null);
|
|
386
392
|
if (s.length === 3) return new E(s[0], s[1], s[2], null, null);
|
|
@@ -400,7 +406,7 @@ class Q {
|
|
|
400
406
|
return t != null && t !== "" && t === "application/json";
|
|
401
407
|
}
|
|
402
408
|
}
|
|
403
|
-
class
|
|
409
|
+
class O {
|
|
404
410
|
static createReplyEvent(e, t, r) {
|
|
405
411
|
if (!e)
|
|
406
412
|
throw new Error("incomingHeaders cannot be null");
|
|
@@ -418,7 +424,7 @@ class I {
|
|
|
418
424
|
}
|
|
419
425
|
class ee {
|
|
420
426
|
convert(e, t) {
|
|
421
|
-
return
|
|
427
|
+
return O.createReplyEvent(
|
|
422
428
|
e,
|
|
423
429
|
/* @__PURE__ */ new Map([[o.CONTENT_TYPE_HEADER, "application/json"]]),
|
|
424
430
|
new TextEncoder().encode(JSON.stringify(t))
|
|
@@ -462,7 +468,7 @@ class re {
|
|
|
462
468
|
* @return the cri for this {@link ServiceIdentifier}
|
|
463
469
|
*/
|
|
464
470
|
cri() {
|
|
465
|
-
return this._cri == null && (this._cri =
|
|
471
|
+
return this._cri == null && (this._cri = w(
|
|
466
472
|
o.SERVICE_DESTINATION_SCHEME,
|
|
467
473
|
// scheme
|
|
468
474
|
this.scope || null,
|
|
@@ -476,34 +482,34 @@ class re {
|
|
|
476
482
|
)), this._cri;
|
|
477
483
|
}
|
|
478
484
|
}
|
|
479
|
-
const
|
|
485
|
+
const P = /* @__PURE__ */ Symbol("scope"), x = /* @__PURE__ */ Symbol("version"), _ = /* @__PURE__ */ Symbol("context");
|
|
480
486
|
function ke(s, e, t) {
|
|
481
|
-
Reflect.defineMetadata(
|
|
487
|
+
Reflect.defineMetadata(P, e, s);
|
|
482
488
|
}
|
|
483
489
|
function Be(s) {
|
|
484
490
|
if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9]+)?$/.test(s))
|
|
485
491
|
throw new Error(`Invalid semantic version: ${s}. Must follow X.Y.Z[-optional] format.`);
|
|
486
492
|
return function(e) {
|
|
487
|
-
Reflect.defineMetadata(
|
|
493
|
+
Reflect.defineMetadata(x, s, e);
|
|
488
494
|
};
|
|
489
495
|
}
|
|
490
|
-
function
|
|
496
|
+
function Fe() {
|
|
491
497
|
return function(s, e, t) {
|
|
492
|
-
const r = Reflect.getMetadata(
|
|
493
|
-
r.push(t), Reflect.defineMetadata(
|
|
498
|
+
const r = Reflect.getMetadata(_, s, e) || [];
|
|
499
|
+
r.push(t), Reflect.defineMetadata(_, r, s, e);
|
|
494
500
|
};
|
|
495
501
|
}
|
|
496
|
-
function
|
|
502
|
+
function $e(s, e) {
|
|
497
503
|
return function(t) {
|
|
498
|
-
const r = t, i = new re(s, e || t.name), n = Reflect.getMetadata(
|
|
504
|
+
const r = t, i = new re(s, e || t.name), n = Reflect.getMetadata(x, t);
|
|
499
505
|
n && (i.version = n);
|
|
500
506
|
const c = function(...a) {
|
|
501
|
-
const h = Reflect.construct(r, a), p = Reflect.getMetadata(
|
|
507
|
+
const h = Reflect.construct(r, a), p = Reflect.getMetadata(P, t.prototype);
|
|
502
508
|
if (p) {
|
|
503
509
|
const u = h[p];
|
|
504
510
|
i.scope = typeof u == "function" ? u.call(h) : u;
|
|
505
511
|
}
|
|
506
|
-
return
|
|
512
|
+
return D.serviceRegistry.register(i, h), h;
|
|
507
513
|
};
|
|
508
514
|
return c.prototype = r.prototype, c;
|
|
509
515
|
};
|
|
@@ -511,7 +517,7 @@ function Fe(s, e) {
|
|
|
511
517
|
class se {
|
|
512
518
|
log;
|
|
513
519
|
active = !1;
|
|
514
|
-
|
|
520
|
+
_eventBus;
|
|
515
521
|
interceptorProvider;
|
|
516
522
|
argumentResolver;
|
|
517
523
|
returnValueConverter;
|
|
@@ -522,19 +528,27 @@ class se {
|
|
|
522
528
|
constructor(e, t, r, i, n = {}) {
|
|
523
529
|
if (!e) throw new Error("ServiceIdentifier must not be null");
|
|
524
530
|
if (!t) throw new Error("Service instance must not be null");
|
|
525
|
-
if (!r) throw new Error("
|
|
531
|
+
if (!r) throw new Error("IEventBus must not be null");
|
|
526
532
|
if (!i) throw new Error("interceptorProvider must not be null");
|
|
527
|
-
this.serviceIdentifier = e, this.serviceInstance = t, this.
|
|
533
|
+
this.serviceIdentifier = e, this.serviceInstance = t, this._eventBus = r, this.interceptorProvider = i, this.log = n.logger || te("continuum:ServiceInvocationSupervisor"), this.argumentResolver = n.argumentResolver || new Q(), this.returnValueConverter = n.returnValueConverter || new ee(), this.methodMap = this.buildMethodMap(t);
|
|
528
534
|
}
|
|
529
535
|
isActive() {
|
|
530
536
|
return this.active;
|
|
531
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* The {@link IEventBus} that this supervisor uses to listen for service invocation events
|
|
540
|
+
* This can be changed at runtime, the supervisor will restart to use the new event bus
|
|
541
|
+
* @param eventBus the new IEventBus to use
|
|
542
|
+
*/
|
|
543
|
+
set eventBus(e) {
|
|
544
|
+
this.active ? (this.stop(), this._eventBus = e, this.start()) : this._eventBus = e;
|
|
545
|
+
}
|
|
532
546
|
start() {
|
|
533
547
|
if (this.active)
|
|
534
548
|
throw new Error("Service already started");
|
|
535
549
|
this.active = !0;
|
|
536
550
|
const e = this.serviceIdentifier.cri().baseResource();
|
|
537
|
-
this.methodSubscription = this.
|
|
551
|
+
this.methodSubscription = this._eventBus.observe(e).subscribe({
|
|
538
552
|
next: async (t) => {
|
|
539
553
|
await this.processEvent(t);
|
|
540
554
|
},
|
|
@@ -575,13 +589,13 @@ class se {
|
|
|
575
589
|
this.log.trace(`Processing control event for correlationId: ${t}`);
|
|
576
590
|
}
|
|
577
591
|
async processInvocationRequest(e) {
|
|
578
|
-
const t =
|
|
592
|
+
const t = w(e.cri).path();
|
|
579
593
|
if (!t)
|
|
580
594
|
throw new Error("The methodId must not be blank");
|
|
581
595
|
const r = this.methodMap[t];
|
|
582
596
|
if (!r)
|
|
583
597
|
throw new Error(`No method resolved for methodId ${t}`);
|
|
584
|
-
const i = t, n = this.argumentResolver.resolveArguments(e), c = Reflect.getMetadata(
|
|
598
|
+
const i = t, n = this.argumentResolver.resolveArguments(e), c = Reflect.getMetadata(_, this.serviceInstance, i) || [];
|
|
585
599
|
let a = {};
|
|
586
600
|
const h = this.interceptorProvider();
|
|
587
601
|
if (h)
|
|
@@ -608,10 +622,10 @@ class se {
|
|
|
608
622
|
}
|
|
609
623
|
processMethodInvocationResult(e, t) {
|
|
610
624
|
const r = this.returnValueConverter.convert(e.headers, t);
|
|
611
|
-
this.
|
|
625
|
+
this._eventBus.send(r);
|
|
612
626
|
}
|
|
613
627
|
handleException(e, t) {
|
|
614
|
-
const r =
|
|
628
|
+
const r = O.createReplyEvent(
|
|
615
629
|
e.headers,
|
|
616
630
|
/* @__PURE__ */ new Map([
|
|
617
631
|
[o.ERROR_HEADER, t.message || "Unknown error"],
|
|
@@ -619,14 +633,14 @@ class se {
|
|
|
619
633
|
]),
|
|
620
634
|
new TextEncoder().encode(JSON.stringify({ message: t.message }))
|
|
621
635
|
);
|
|
622
|
-
this.
|
|
636
|
+
this._eventBus.send(r);
|
|
623
637
|
}
|
|
624
638
|
validateReplyTo(e) {
|
|
625
639
|
const t = e.getHeader(o.REPLY_TO_HEADER);
|
|
626
640
|
return t ? t.trim() === "" ? (this.log.warn("Reply-to header must not be blank"), !1) : t.startsWith(`${o.SERVICE_DESTINATION_SCHEME}:`) ? !0 : (this.log.warn("Reply-to header must be a valid service destination"), !1) : (this.log.warn("No reply-to header found in event"), !1);
|
|
627
641
|
}
|
|
628
642
|
}
|
|
629
|
-
const ie = "2.14.
|
|
643
|
+
const ie = "2.14.9", ne = {
|
|
630
644
|
version: ie
|
|
631
645
|
};
|
|
632
646
|
class oe {
|
|
@@ -635,7 +649,7 @@ class oe {
|
|
|
635
649
|
return r.setHeader(o.CONTENT_TYPE_HEADER, o.CONTENT_JSON), t != null && r.setDataString(JSON.stringify(t)), r;
|
|
636
650
|
}
|
|
637
651
|
}
|
|
638
|
-
class
|
|
652
|
+
class qe {
|
|
639
653
|
create(e, t) {
|
|
640
654
|
const r = new g(e);
|
|
641
655
|
if (r.setHeader(o.CONTENT_TYPE_HEADER, o.CONTENT_TEXT), t != null) {
|
|
@@ -649,18 +663,28 @@ class Ye {
|
|
|
649
663
|
}
|
|
650
664
|
}
|
|
651
665
|
class ce {
|
|
652
|
-
|
|
666
|
+
_eventBus;
|
|
653
667
|
supervisors = /* @__PURE__ */ new Map();
|
|
654
668
|
contextInterceptor = null;
|
|
669
|
+
debugLogger = I("continuum:serviceRegistry");
|
|
655
670
|
constructor(e) {
|
|
656
|
-
this.
|
|
671
|
+
this._eventBus = e;
|
|
672
|
+
}
|
|
673
|
+
set eventBus(e) {
|
|
674
|
+
this._eventBus = e;
|
|
675
|
+
for (const t of this.supervisors.values())
|
|
676
|
+
t.eventBus = e;
|
|
677
|
+
}
|
|
678
|
+
get eventBus() {
|
|
679
|
+
return this._eventBus;
|
|
657
680
|
}
|
|
658
681
|
serviceProxy(e) {
|
|
659
|
-
return new ue(e, this
|
|
682
|
+
return new ue(e, this);
|
|
660
683
|
}
|
|
661
684
|
register(e, t) {
|
|
662
685
|
const r = e.cri().raw();
|
|
663
686
|
if (!this.supervisors.has(r)) {
|
|
687
|
+
this.debugLogger(`Registering service for CRI: ${r}`);
|
|
664
688
|
const i = new se(
|
|
665
689
|
e,
|
|
666
690
|
t,
|
|
@@ -672,7 +696,7 @@ class ce {
|
|
|
672
696
|
}
|
|
673
697
|
unRegister(e) {
|
|
674
698
|
const t = e.cri().raw(), r = this.supervisors.get(t);
|
|
675
|
-
r && (r.stop(), this.supervisors.delete(t));
|
|
699
|
+
r && (this.debugLogger(`Unregistering service for CRI: ${t}`), r.stop(), this.supervisors.delete(t));
|
|
676
700
|
}
|
|
677
701
|
registerContextInterceptor(e) {
|
|
678
702
|
this.contextInterceptor = e;
|
|
@@ -681,12 +705,12 @@ class ce {
|
|
|
681
705
|
const ae = new oe();
|
|
682
706
|
class ue {
|
|
683
707
|
serviceIdentifier;
|
|
684
|
-
|
|
708
|
+
serviceRegistry;
|
|
685
709
|
tracer;
|
|
686
710
|
constructor(e, t) {
|
|
687
711
|
if (typeof e > "u" || e.length === 0)
|
|
688
712
|
throw new Error("The serviceIdentifier provided must contain a value");
|
|
689
|
-
this.serviceIdentifier = e, this.
|
|
713
|
+
this.serviceIdentifier = e, this.serviceRegistry = t, this.tracer = b.trace.getTracer(
|
|
690
714
|
"continuum.client",
|
|
691
715
|
ne.version
|
|
692
716
|
);
|
|
@@ -695,12 +719,12 @@ class ue {
|
|
|
695
719
|
return this.tracer.startActiveSpan(
|
|
696
720
|
`${this.serviceIdentifier}/${e}`,
|
|
697
721
|
{
|
|
698
|
-
kind:
|
|
722
|
+
kind: q.CLIENT
|
|
699
723
|
},
|
|
700
724
|
async (n) => (r && n.setAttribute("continuum.scope", r), n.setAttribute("rpc.system", "continuum"), n.setAttribute("rpc.service", this.serviceIdentifier), n.setAttribute("rpc.method", e), this.__invokeStream(!1, e, t, r, i).pipe(W()).toPromise().then(
|
|
701
725
|
async (c) => (n.end(), c),
|
|
702
726
|
async (c) => {
|
|
703
|
-
throw n.recordException(c), n.setStatus({ code:
|
|
727
|
+
throw n.recordException(c), n.setStatus({ code: Y.ERROR }), n.end(), c;
|
|
704
728
|
}
|
|
705
729
|
))
|
|
706
730
|
);
|
|
@@ -712,7 +736,7 @@ class ue {
|
|
|
712
736
|
const c = o.SERVICE_DESTINATION_PREFIX + (i != null ? i + "@" : "") + this.serviceIdentifier + "/" + t;
|
|
713
737
|
let a = ae;
|
|
714
738
|
n ? a = n : f.getEventFactory() && (a = f.getEventFactory());
|
|
715
|
-
let h = this.eventBus;
|
|
739
|
+
let h = this.serviceRegistry.eventBus;
|
|
716
740
|
f.getContinuumInstance() && (h = f.getContinuumInstance().eventBus);
|
|
717
741
|
const p = b.trace.getActiveSpan();
|
|
718
742
|
p && (p.setAttribute(G, h.serverInfo?.host || "unknown"), p.setAttribute(K, h.serverInfo?.port || "unknown"));
|
|
@@ -730,7 +754,7 @@ class ue {
|
|
|
730
754
|
}));
|
|
731
755
|
}
|
|
732
756
|
}
|
|
733
|
-
class
|
|
757
|
+
class T {
|
|
734
758
|
pageable;
|
|
735
759
|
currentPage;
|
|
736
760
|
firstPage = !0;
|
|
@@ -775,7 +799,7 @@ class _ {
|
|
|
775
799
|
return this.currentPage.content;
|
|
776
800
|
}
|
|
777
801
|
}
|
|
778
|
-
class le extends
|
|
802
|
+
class le extends T {
|
|
779
803
|
crudServiceProxy;
|
|
780
804
|
constructor(e, t, r) {
|
|
781
805
|
super(e, t), this.crudServiceProxy = r;
|
|
@@ -784,7 +808,7 @@ class le extends _ {
|
|
|
784
808
|
return this.crudServiceProxy.findAllSinglePage(e);
|
|
785
809
|
}
|
|
786
810
|
}
|
|
787
|
-
class he extends
|
|
811
|
+
class he extends T {
|
|
788
812
|
searchText;
|
|
789
813
|
crudServiceProxy;
|
|
790
814
|
constructor(e, t, r, i) {
|
|
@@ -870,7 +894,7 @@ class fe {
|
|
|
870
894
|
/**
|
|
871
895
|
* The {@link IEventBus} that is used to communicate with the Continuum server
|
|
872
896
|
*/
|
|
873
|
-
|
|
897
|
+
_eventBus;
|
|
874
898
|
/**
|
|
875
899
|
* The {@link ServiceRegistry} that is used to manage the services that are available
|
|
876
900
|
*/
|
|
@@ -880,7 +904,13 @@ class fe {
|
|
|
880
904
|
*/
|
|
881
905
|
crudServiceProxyFactory;
|
|
882
906
|
constructor() {
|
|
883
|
-
this.
|
|
907
|
+
this._eventBus = new Z(), this.serviceRegistry = new ce(this._eventBus), this.crudServiceProxyFactory = new de(this.serviceRegistry);
|
|
908
|
+
}
|
|
909
|
+
get eventBus() {
|
|
910
|
+
return this._eventBus;
|
|
911
|
+
}
|
|
912
|
+
set eventBus(e) {
|
|
913
|
+
this._eventBus = e, this.serviceRegistry.eventBus = e;
|
|
884
914
|
}
|
|
885
915
|
/**
|
|
886
916
|
* Requests a connection to the given Stomp url
|
|
@@ -888,14 +918,14 @@ class fe {
|
|
|
888
918
|
* @return Promise containing the result of the initial connection attempt
|
|
889
919
|
*/
|
|
890
920
|
connect(e) {
|
|
891
|
-
return this.
|
|
921
|
+
return this._eventBus.connect(e);
|
|
892
922
|
}
|
|
893
923
|
/**
|
|
894
924
|
* Disconnects the client from the server
|
|
895
925
|
* This will clear any subscriptions and close the connection
|
|
896
926
|
*/
|
|
897
927
|
disconnect(e) {
|
|
898
|
-
return this.
|
|
928
|
+
return this._eventBus.disconnect(e);
|
|
899
929
|
}
|
|
900
930
|
/**
|
|
901
931
|
* Creates a new service proxy that can be used to access the desired service.
|
|
@@ -933,18 +963,18 @@ class fe {
|
|
|
933
963
|
return i;
|
|
934
964
|
}
|
|
935
965
|
}
|
|
936
|
-
const
|
|
966
|
+
const D = new fe();
|
|
937
967
|
var ge = /* @__PURE__ */ ((s) => (s.TRACE = "TRACE", s.DEBUG = "DEBUG", s.INFO = "INFO", s.WARN = "WARN", s.ERROR = "ERROR", s.FATAL = "FATAL", s.OFF = "OFF", s))(ge || {});
|
|
938
968
|
class y {
|
|
939
969
|
configuredLevel;
|
|
940
970
|
}
|
|
941
|
-
class
|
|
971
|
+
class ve extends y {
|
|
942
972
|
members = [];
|
|
943
973
|
}
|
|
944
|
-
class
|
|
974
|
+
class me extends y {
|
|
945
975
|
effectiveLevel;
|
|
946
976
|
}
|
|
947
|
-
class
|
|
977
|
+
class Ye {
|
|
948
978
|
levels = [];
|
|
949
979
|
loggerLevels = /* @__PURE__ */ new Map();
|
|
950
980
|
groups = /* @__PURE__ */ new Map();
|
|
@@ -952,7 +982,7 @@ class $e {
|
|
|
952
982
|
class Se {
|
|
953
983
|
serviceProxy;
|
|
954
984
|
constructor() {
|
|
955
|
-
this.serviceProxy =
|
|
985
|
+
this.serviceProxy = D.serviceProxy("org.kinotic.continuum.api.log.LogManager");
|
|
956
986
|
}
|
|
957
987
|
loggers(e) {
|
|
958
988
|
return this.serviceProxy.invoke("loggers", null, e);
|
|
@@ -960,21 +990,21 @@ class Se {
|
|
|
960
990
|
async loggerLevels(e, t) {
|
|
961
991
|
const r = await this.serviceProxy.invoke("loggerLevels", [t], e);
|
|
962
992
|
let i = null;
|
|
963
|
-
return r.hasOwnProperty("members") ? i = new
|
|
993
|
+
return r.hasOwnProperty("members") ? i = new ve() : r.hasOwnProperty("effectiveLevel") ? i = new me() : i = new y(), Object.assign(i, r), i;
|
|
964
994
|
}
|
|
965
995
|
configureLogLevel(e, t, r) {
|
|
966
996
|
return this.serviceProxy.invoke("configureLogLevel", [t, r], e);
|
|
967
997
|
}
|
|
968
998
|
}
|
|
969
999
|
const Ue = new Se();
|
|
970
|
-
class
|
|
1000
|
+
class H extends v {
|
|
971
1001
|
constructor(e) {
|
|
972
|
-
super(e), Object.setPrototypeOf(this,
|
|
1002
|
+
super(e), Object.setPrototypeOf(this, H.prototype);
|
|
973
1003
|
}
|
|
974
1004
|
}
|
|
975
|
-
class
|
|
1005
|
+
class L extends v {
|
|
976
1006
|
constructor(e) {
|
|
977
|
-
super(e), Object.setPrototypeOf(this,
|
|
1007
|
+
super(e), Object.setPrototypeOf(this, L.prototype);
|
|
978
1008
|
}
|
|
979
1009
|
}
|
|
980
1010
|
class Ve {
|
|
@@ -1011,7 +1041,7 @@ class Xe {
|
|
|
1011
1041
|
return this.value !== null && this.value !== void 0;
|
|
1012
1042
|
}
|
|
1013
1043
|
}
|
|
1014
|
-
class We extends
|
|
1044
|
+
class We extends T {
|
|
1015
1045
|
pageFunction;
|
|
1016
1046
|
constructor(e, t, r) {
|
|
1017
1047
|
super(e, t), this.pageFunction = r;
|
|
@@ -1025,7 +1055,7 @@ class Ge {
|
|
|
1025
1055
|
return "create" in e;
|
|
1026
1056
|
}
|
|
1027
1057
|
}
|
|
1028
|
-
class
|
|
1058
|
+
class M {
|
|
1029
1059
|
/**
|
|
1030
1060
|
* Returns the sorting parameters (optional).
|
|
1031
1061
|
*/
|
|
@@ -1041,7 +1071,7 @@ class L {
|
|
|
1041
1071
|
* @param sort the sorting parameters (optional).
|
|
1042
1072
|
*/
|
|
1043
1073
|
static create(e, t, r) {
|
|
1044
|
-
return new
|
|
1074
|
+
return new _e(e, t, r);
|
|
1045
1075
|
}
|
|
1046
1076
|
/**
|
|
1047
1077
|
* Creates a {@link Pageable} that uses Cursor based pagination.
|
|
@@ -1050,10 +1080,10 @@ class L {
|
|
|
1050
1080
|
* @param sort the sorting parameters (optional).
|
|
1051
1081
|
*/
|
|
1052
1082
|
static createWithCursor(e, t, r) {
|
|
1053
|
-
return new
|
|
1083
|
+
return new Te(e, t, r);
|
|
1054
1084
|
}
|
|
1055
1085
|
}
|
|
1056
|
-
class
|
|
1086
|
+
class _e extends M {
|
|
1057
1087
|
/**
|
|
1058
1088
|
* Returns the page to be returned.
|
|
1059
1089
|
*/
|
|
@@ -1068,7 +1098,7 @@ class Te extends L {
|
|
|
1068
1098
|
super(), this.pageNumber = e, this.pageSize = t, this.sort = r;
|
|
1069
1099
|
}
|
|
1070
1100
|
}
|
|
1071
|
-
class
|
|
1101
|
+
class Te extends M {
|
|
1072
1102
|
/**
|
|
1073
1103
|
* The cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
1074
1104
|
*/
|
|
@@ -1108,21 +1138,21 @@ class ze {
|
|
|
1108
1138
|
orders = [];
|
|
1109
1139
|
}
|
|
1110
1140
|
export {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1141
|
+
T as AbstractIterablePage,
|
|
1142
|
+
H as AuthenticationError,
|
|
1143
|
+
L as AuthorizationError,
|
|
1144
|
+
_ as CONTEXT_METADATA_KEY,
|
|
1115
1145
|
Le as ConnectHeaders,
|
|
1116
1146
|
Ve as ConnectedInfo,
|
|
1117
1147
|
Me as ConnectionInfo,
|
|
1118
|
-
|
|
1119
|
-
|
|
1148
|
+
Fe as Context,
|
|
1149
|
+
D as Continuum,
|
|
1120
1150
|
f as ContinuumContextStack,
|
|
1121
|
-
|
|
1151
|
+
v as ContinuumError,
|
|
1122
1152
|
fe as ContinuumSingleton,
|
|
1123
1153
|
pe as CrudServiceProxy,
|
|
1124
1154
|
de as CrudServiceProxyFactory,
|
|
1125
|
-
|
|
1155
|
+
Te as CursorPageable,
|
|
1126
1156
|
Ge as DataSourceUtils,
|
|
1127
1157
|
E as DefaultCRI,
|
|
1128
1158
|
ye as Direction,
|
|
@@ -1130,29 +1160,29 @@ export {
|
|
|
1130
1160
|
Z as EventBus,
|
|
1131
1161
|
o as EventConstants,
|
|
1132
1162
|
We as FunctionalIterablePage,
|
|
1133
|
-
|
|
1163
|
+
ve as GroupLoggerLevelsDescriptor,
|
|
1134
1164
|
oe as JsonEventFactory,
|
|
1135
1165
|
ge as LogLevel,
|
|
1136
1166
|
Se as LogManager,
|
|
1137
1167
|
y as LoggerLevelsDescriptor,
|
|
1138
|
-
|
|
1168
|
+
Ye as LoggersDescriptor,
|
|
1139
1169
|
be as NullHandling,
|
|
1140
|
-
|
|
1170
|
+
_e as OffsetPageable,
|
|
1141
1171
|
Ke as Order,
|
|
1142
|
-
|
|
1172
|
+
M as Pageable,
|
|
1143
1173
|
je as Participant,
|
|
1144
1174
|
Je as ParticipantConstants,
|
|
1145
|
-
|
|
1175
|
+
$e as Publish,
|
|
1146
1176
|
ke as Scope,
|
|
1147
|
-
|
|
1177
|
+
N as ServerInfo,
|
|
1148
1178
|
ce as ServiceRegistry,
|
|
1149
|
-
|
|
1179
|
+
me as SingleLoggerLevelsDescriptor,
|
|
1150
1180
|
ze as Sort,
|
|
1151
1181
|
Xe as StreamData,
|
|
1152
1182
|
Re as StreamOperation,
|
|
1153
|
-
|
|
1183
|
+
qe as TextEventFactory,
|
|
1154
1184
|
Be as Version,
|
|
1155
|
-
|
|
1185
|
+
w as createCRI,
|
|
1156
1186
|
Ue as logManager
|
|
1157
1187
|
};
|
|
1158
1188
|
//# sourceMappingURL=continuum.js.map
|