@mindignited/continuum-client 2.14.7 → 3.0.0-beta.0
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/continuum.cjs +2 -2
- package/dist/continuum.cjs.map +1 -1
- package/dist/continuum.js +150 -125
- 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 +4 -2
- package/dist/src/internal/core/api/ServiceInvocationSupervisor.d.ts +7 -1
- package/package.json +1 -1
package/dist/continuum.js
CHANGED
|
@@ -34,9 +34,9 @@ class Me extends w {
|
|
|
34
34
|
*/
|
|
35
35
|
disableStickySession;
|
|
36
36
|
}
|
|
37
|
-
class
|
|
37
|
+
class g extends Error {
|
|
38
38
|
constructor(e) {
|
|
39
|
-
super(e), Object.setPrototypeOf(this,
|
|
39
|
+
super(e), Object.setPrototypeOf(this, g.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 || {});
|
|
@@ -84,12 +84,12 @@ class z {
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
this.connectionAttempts = 0, this.initialConnectionSuccessful = !1, this.lastWebsocketError = null, this.maxConnectionAttemptsReached = !1;
|
|
87
|
-
const
|
|
87
|
+
const i = "ws" + (e.useSSL ? "s" : "") + "://" + e.host + (e.port ? ":" + e.port : "") + "/v1";
|
|
88
88
|
this.rxStomp = new k();
|
|
89
|
-
let
|
|
89
|
+
let n = typeof e.connectHeaders != "function" && e.connectHeaders != null ? e.connectHeaders : {};
|
|
90
90
|
const c = {
|
|
91
|
-
brokerURL:
|
|
92
|
-
connectHeaders:
|
|
91
|
+
brokerURL: i,
|
|
92
|
+
connectHeaders: n,
|
|
93
93
|
heartbeatIncoming: 12e4,
|
|
94
94
|
heartbeatOutgoing: 3e4,
|
|
95
95
|
reconnectDelay: this.INITIAL_RECONNECT_DELAY,
|
|
@@ -97,9 +97,9 @@ class z {
|
|
|
97
97
|
if (typeof e.connectHeaders == "function") {
|
|
98
98
|
const u = await e.connectHeaders();
|
|
99
99
|
for (const l in u)
|
|
100
|
-
|
|
100
|
+
n[l] = u[l];
|
|
101
101
|
}
|
|
102
|
-
if (e.disableStickySession && (
|
|
102
|
+
if (e.disableStickySession && (n[o.DISABLE_STICKY_SESSION_HEADER] = "true"), n[o.REPLY_TO_ID_HEADER] = this.replyToId, e?.maxConnectionAttempts)
|
|
103
103
|
if (this.connectionAttempts++, this.connectionAttempts > e.maxConnectionAttempts) {
|
|
104
104
|
if (this.maxConnectionAttemptsReached = !0, await this.deactivate(), !this.initialConnectionSuccessful) {
|
|
105
105
|
let u = this.lastWebsocketError?.message ? this.lastWebsocketError?.message : "UNKNOWN";
|
|
@@ -128,15 +128,15 @@ class z {
|
|
|
128
128
|
const d = JSON.parse(l);
|
|
129
129
|
if (e.disableStickySession)
|
|
130
130
|
if (typeof e.connectHeaders == "function") {
|
|
131
|
-
for (let
|
|
132
|
-
delete
|
|
131
|
+
for (let m in n)
|
|
132
|
+
delete n[m];
|
|
133
133
|
this.initialConnectionSuccessful || t(d);
|
|
134
134
|
} else typeof e.connectHeaders == "object" && (p.unsubscribe(), t(d));
|
|
135
135
|
else if (p.unsubscribe(), d.sessionId != null && d.replyToId != null) {
|
|
136
136
|
if (e.connectHeaders != null)
|
|
137
|
-
for (let
|
|
138
|
-
delete
|
|
139
|
-
|
|
137
|
+
for (let m in n)
|
|
138
|
+
delete n[m];
|
|
139
|
+
n[o.SESSION_HEADER] = d.sessionId, t(d);
|
|
140
140
|
} else
|
|
141
141
|
r("Server did not return proper data for successful login");
|
|
142
142
|
} else
|
|
@@ -158,7 +158,7 @@ class z {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
class
|
|
161
|
+
class v {
|
|
162
162
|
cri;
|
|
163
163
|
headers;
|
|
164
164
|
data;
|
|
@@ -199,7 +199,7 @@ class Z {
|
|
|
199
199
|
constructor() {
|
|
200
200
|
this.fatalErrors = this.errorSubject.pipe(R((e) => (this.disconnect().catch((t) => {
|
|
201
201
|
console && console.error("Error disconnecting from Stomp: " + t);
|
|
202
|
-
}), new
|
|
202
|
+
}), new g(e.headers.message)))), this.stompConnectionManager.deactivationHandler = () => {
|
|
203
203
|
this.cleanup();
|
|
204
204
|
};
|
|
205
205
|
}
|
|
@@ -224,8 +224,8 @@ class Z {
|
|
|
224
224
|
send(e) {
|
|
225
225
|
if (this.stompConnectionManager.rxStomp) {
|
|
226
226
|
const t = {};
|
|
227
|
-
for (const [
|
|
228
|
-
t[
|
|
227
|
+
for (const [i, n] of e.headers.entries())
|
|
228
|
+
t[i] = n;
|
|
229
229
|
const r = {};
|
|
230
230
|
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
231
|
destination: e.cri,
|
|
@@ -241,15 +241,15 @@ class Z {
|
|
|
241
241
|
requestStream(e, t = !0) {
|
|
242
242
|
return this.stompConnectionManager?.rxStomp ? new j((r) => {
|
|
243
243
|
this.requestRepliesObservable == null && (this.requestRepliesSubject = new A(), this.requestRepliesObservable = this._observe(this.replyToCri).pipe(J(this.requestRepliesSubject)), this.requestRepliesSubscription = this.requestRepliesObservable.connect());
|
|
244
|
-
let
|
|
245
|
-
const
|
|
244
|
+
let i = !1;
|
|
245
|
+
const n = S(), c = this.requestRepliesObservable.pipe(X((a) => a.headers.get(o.CORRELATION_ID_HEADER) === n)).subscribe({
|
|
246
246
|
next(a) {
|
|
247
247
|
if (a.hasHeader(o.CONTROL_HEADER))
|
|
248
248
|
if (a.headers.get(o.CONTROL_HEADER) === "complete")
|
|
249
|
-
|
|
249
|
+
i = !0, r.complete();
|
|
250
250
|
else
|
|
251
251
|
throw new Error("Control Header " + a.headers.get(o.CONTROL_HEADER) + " is not supported");
|
|
252
|
-
else a.hasHeader(o.ERROR_HEADER) ? (
|
|
252
|
+
else a.hasHeader(o.ERROR_HEADER) ? (i = !0, r.error(new Error(a.getHeader(o.ERROR_HEADER)))) : r.next(a);
|
|
253
253
|
},
|
|
254
254
|
error(a) {
|
|
255
255
|
r.error(a);
|
|
@@ -258,14 +258,17 @@ class Z {
|
|
|
258
258
|
r.complete();
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
|
-
return r.add(c), e.setHeader(o.REPLY_TO_HEADER, this.replyToCri), e.setHeader(o.CORRELATION_ID_HEADER,
|
|
262
|
-
if (t && !
|
|
263
|
-
const a = new
|
|
264
|
-
a.setHeader(o.CONTROL_HEADER, o.CONTROL_VALUE_CANCEL), a.setHeader(o.CORRELATION_ID_HEADER,
|
|
261
|
+
return r.add(c), e.setHeader(o.REPLY_TO_HEADER, this.replyToCri), e.setHeader(o.CORRELATION_ID_HEADER, n), this.send(e), () => {
|
|
262
|
+
if (t && !i) {
|
|
263
|
+
const a = new v(e.cri);
|
|
264
|
+
a.setHeader(o.CONTROL_HEADER, o.CONTROL_VALUE_CANCEL), a.setHeader(o.CORRELATION_ID_HEADER, n), this.send(a);
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
}) : N(() => this.createSendUnavailableError());
|
|
268
268
|
}
|
|
269
|
+
listen(e) {
|
|
270
|
+
return Promise.reject("Not implemented");
|
|
271
|
+
}
|
|
269
272
|
observe(e) {
|
|
270
273
|
return this._observe(e);
|
|
271
274
|
}
|
|
@@ -288,10 +291,10 @@ class Z {
|
|
|
288
291
|
_observe(e) {
|
|
289
292
|
return this.stompConnectionManager?.rxStomp ? this.stompConnectionManager.rxStomp.watch(e).pipe(R((t) => {
|
|
290
293
|
const r = /* @__PURE__ */ new Map();
|
|
291
|
-
let
|
|
292
|
-
for (const
|
|
293
|
-
|
|
294
|
-
return new
|
|
294
|
+
let i = "";
|
|
295
|
+
for (const n of Object.keys(t.headers))
|
|
296
|
+
n === "destination" ? i = t.headers[n] : r.set(n, t.headers[n]);
|
|
297
|
+
return new v(i, r, t.binaryBody);
|
|
295
298
|
})) : N(() => this.createSendUnavailableError());
|
|
296
299
|
}
|
|
297
300
|
}
|
|
@@ -310,8 +313,8 @@ class E {
|
|
|
310
313
|
const r = E.parseRaw(t);
|
|
311
314
|
this._scheme = r.scheme, this._scope = r.scope, this._resourceName = r.resourceName, this._path = r.path, this._version = r.version, this._raw = t;
|
|
312
315
|
} else if (e.length === 5) {
|
|
313
|
-
const [t, r,
|
|
314
|
-
this._scheme = t, this._scope = r, this._resourceName =
|
|
316
|
+
const [t, r, i, n, c] = e;
|
|
317
|
+
this._scheme = t, this._scope = r, this._resourceName = i, this._path = n, this._version = c, this._raw = E.buildRaw(t, r, i, n, c);
|
|
315
318
|
} else
|
|
316
319
|
throw new Error("Invalid constructor arguments for DefaultCRI");
|
|
317
320
|
if (!this._scheme || !this._resourceName)
|
|
@@ -363,19 +366,19 @@ class E {
|
|
|
363
366
|
const t = /^([^:]+):\/\/(?:([^@]+)@)?([^\/#]+)(\/[^#]*)?(?:#(.+))?$/, r = e.match(t);
|
|
364
367
|
if (!r)
|
|
365
368
|
throw new Error(`Invalid CRI format: ${e}`);
|
|
366
|
-
const [,
|
|
369
|
+
const [, i, n, c, a, h] = r;
|
|
367
370
|
return {
|
|
368
|
-
scheme:
|
|
369
|
-
scope:
|
|
371
|
+
scheme: i,
|
|
372
|
+
scope: n || null,
|
|
370
373
|
resourceName: c,
|
|
371
374
|
path: a ? a.substring(1) : null,
|
|
372
375
|
version: h || null
|
|
373
376
|
};
|
|
374
377
|
}
|
|
375
378
|
// Helper to build a raw CRI string
|
|
376
|
-
static buildRaw(e, t, r,
|
|
379
|
+
static buildRaw(e, t, r, i, n) {
|
|
377
380
|
let c = `${e}://`;
|
|
378
|
-
return t && (c += `${t}@`), c += r,
|
|
381
|
+
return t && (c += `${t}@`), c += r, i && (c += `/${i}`), n && (c += `#${n}`), c;
|
|
379
382
|
}
|
|
380
383
|
}
|
|
381
384
|
function I(...s) {
|
|
@@ -402,16 +405,16 @@ class O {
|
|
|
402
405
|
static createReplyEvent(e, t, r) {
|
|
403
406
|
if (!e)
|
|
404
407
|
throw new Error("incomingHeaders cannot be null");
|
|
405
|
-
const
|
|
406
|
-
if (!
|
|
408
|
+
const i = e.get(o.REPLY_TO_HEADER);
|
|
409
|
+
if (!i || i.trim() === "")
|
|
407
410
|
throw new Error("No reply-to header found, cannot create outgoing message");
|
|
408
|
-
const
|
|
411
|
+
const n = /* @__PURE__ */ new Map();
|
|
409
412
|
for (const [c, a] of e)
|
|
410
|
-
c.startsWith("__") &&
|
|
413
|
+
c.startsWith("__") && n.set(c, a);
|
|
411
414
|
if (t)
|
|
412
415
|
for (const [c, a] of t)
|
|
413
|
-
|
|
414
|
-
return new
|
|
416
|
+
n.set(c, a);
|
|
417
|
+
return new v(i, n, r || void 0);
|
|
415
418
|
}
|
|
416
419
|
}
|
|
417
420
|
class ee {
|
|
@@ -474,7 +477,7 @@ class re {
|
|
|
474
477
|
)), this._cri;
|
|
475
478
|
}
|
|
476
479
|
}
|
|
477
|
-
const P = /* @__PURE__ */ Symbol("scope"), x = /* @__PURE__ */ Symbol("version"),
|
|
480
|
+
const P = /* @__PURE__ */ Symbol("scope"), x = /* @__PURE__ */ Symbol("version"), _ = /* @__PURE__ */ Symbol("context");
|
|
478
481
|
function ke(s, e, t) {
|
|
479
482
|
Reflect.defineMetadata(P, e, s);
|
|
480
483
|
}
|
|
@@ -487,21 +490,21 @@ function Be(s) {
|
|
|
487
490
|
}
|
|
488
491
|
function qe() {
|
|
489
492
|
return function(s, e, t) {
|
|
490
|
-
const r = Reflect.getMetadata(
|
|
491
|
-
r.push(t), Reflect.defineMetadata(
|
|
493
|
+
const r = Reflect.getMetadata(_, s, e) || [];
|
|
494
|
+
r.push(t), Reflect.defineMetadata(_, r, s, e);
|
|
492
495
|
};
|
|
493
496
|
}
|
|
494
497
|
function Fe(s, e) {
|
|
495
498
|
return function(t) {
|
|
496
|
-
const r = t,
|
|
497
|
-
|
|
499
|
+
const r = t, i = new re(s, e || t.name), n = Reflect.getMetadata(x, t);
|
|
500
|
+
n && (i.version = n);
|
|
498
501
|
const c = function(...a) {
|
|
499
502
|
const h = Reflect.construct(r, a), p = Reflect.getMetadata(P, t.prototype);
|
|
500
503
|
if (p) {
|
|
501
504
|
const u = h[p];
|
|
502
|
-
|
|
505
|
+
i.scope = typeof u == "function" ? u.call(h) : u;
|
|
503
506
|
}
|
|
504
|
-
return D.serviceRegistry.register(
|
|
507
|
+
return D.serviceRegistry.register(i, h), h;
|
|
505
508
|
};
|
|
506
509
|
return c.prototype = r.prototype, c;
|
|
507
510
|
};
|
|
@@ -509,7 +512,7 @@ function Fe(s, e) {
|
|
|
509
512
|
class se {
|
|
510
513
|
log;
|
|
511
514
|
active = !1;
|
|
512
|
-
|
|
515
|
+
_eventBus;
|
|
513
516
|
interceptorProvider;
|
|
514
517
|
argumentResolver;
|
|
515
518
|
returnValueConverter;
|
|
@@ -517,22 +520,30 @@ class se {
|
|
|
517
520
|
serviceInstance;
|
|
518
521
|
methodSubscription = null;
|
|
519
522
|
methodMap;
|
|
520
|
-
constructor(e, t, r,
|
|
523
|
+
constructor(e, t, r, i, n = {}) {
|
|
521
524
|
if (!e) throw new Error("ServiceIdentifier must not be null");
|
|
522
525
|
if (!t) throw new Error("Service instance must not be null");
|
|
523
|
-
if (!r) throw new Error("
|
|
524
|
-
if (!
|
|
525
|
-
this.serviceIdentifier = e, this.serviceInstance = t, this.
|
|
526
|
+
if (!r) throw new Error("IEventBus must not be null");
|
|
527
|
+
if (!i) throw new Error("interceptorProvider must not be null");
|
|
528
|
+
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);
|
|
526
529
|
}
|
|
527
530
|
isActive() {
|
|
528
531
|
return this.active;
|
|
529
532
|
}
|
|
533
|
+
/**
|
|
534
|
+
* The {@link IEventBus} that this supervisor uses to listen for service invocation events
|
|
535
|
+
* This can be changed at runtime, the supervisor will restart to use the new event bus
|
|
536
|
+
* @param eventBus the new IEventBus to use
|
|
537
|
+
*/
|
|
538
|
+
set eventBus(e) {
|
|
539
|
+
this.active ? (this.stop(), this._eventBus = e, this.start()) : this._eventBus = e;
|
|
540
|
+
}
|
|
530
541
|
start() {
|
|
531
542
|
if (this.active)
|
|
532
543
|
throw new Error("Service already started");
|
|
533
544
|
this.active = !0;
|
|
534
545
|
const e = this.serviceIdentifier.cri().baseResource();
|
|
535
|
-
this.methodSubscription = this.
|
|
546
|
+
this.methodSubscription = this._eventBus.observe(e).subscribe({
|
|
536
547
|
next: async (t) => {
|
|
537
548
|
await this.processEvent(t);
|
|
538
549
|
},
|
|
@@ -552,8 +563,8 @@ class se {
|
|
|
552
563
|
buildMethodMap(e) {
|
|
553
564
|
const t = {};
|
|
554
565
|
for (const r of Object.getOwnPropertyNames(Object.getPrototypeOf(e))) {
|
|
555
|
-
const
|
|
556
|
-
typeof
|
|
566
|
+
const i = e[r];
|
|
567
|
+
typeof i == "function" && r !== "constructor" && (t[r] = i.bind(e));
|
|
557
568
|
}
|
|
558
569
|
return t;
|
|
559
570
|
}
|
|
@@ -579,7 +590,7 @@ class se {
|
|
|
579
590
|
const r = this.methodMap[t];
|
|
580
591
|
if (!r)
|
|
581
592
|
throw new Error(`No method resolved for methodId ${t}`);
|
|
582
|
-
const
|
|
593
|
+
const i = t, n = this.argumentResolver.resolveArguments(e), c = Reflect.getMetadata(_, this.serviceInstance, i) || [];
|
|
583
594
|
let a = {};
|
|
584
595
|
const h = this.interceptorProvider();
|
|
585
596
|
if (h)
|
|
@@ -590,13 +601,13 @@ class se {
|
|
|
590
601
|
return;
|
|
591
602
|
}
|
|
592
603
|
for (const l of c)
|
|
593
|
-
|
|
604
|
+
n[l] = a;
|
|
594
605
|
const p = r.length;
|
|
595
|
-
if (
|
|
596
|
-
throw new Error(`Argument count mismatch for method ${t}: expected ${p}, got ${
|
|
606
|
+
if (n.length !== p)
|
|
607
|
+
throw new Error(`Argument count mismatch for method ${t}: expected ${p}, got ${n.length}`);
|
|
597
608
|
let u;
|
|
598
609
|
try {
|
|
599
|
-
u = r(...
|
|
610
|
+
u = r(...n), u instanceof Promise ? u.then(
|
|
600
611
|
(l) => this.processMethodInvocationResult(e, l),
|
|
601
612
|
(l) => this.handleException(e, l)
|
|
602
613
|
) : this.processMethodInvocationResult(e, u);
|
|
@@ -606,7 +617,7 @@ class se {
|
|
|
606
617
|
}
|
|
607
618
|
processMethodInvocationResult(e, t) {
|
|
608
619
|
const r = this.returnValueConverter.convert(e.headers, t);
|
|
609
|
-
this.
|
|
620
|
+
this._eventBus.send(r);
|
|
610
621
|
}
|
|
611
622
|
handleException(e, t) {
|
|
612
623
|
const r = O.createReplyEvent(
|
|
@@ -617,55 +628,63 @@ class se {
|
|
|
617
628
|
]),
|
|
618
629
|
new TextEncoder().encode(JSON.stringify({ message: t.message }))
|
|
619
630
|
);
|
|
620
|
-
this.
|
|
631
|
+
this._eventBus.send(r);
|
|
621
632
|
}
|
|
622
633
|
validateReplyTo(e) {
|
|
623
634
|
const t = e.getHeader(o.REPLY_TO_HEADER);
|
|
624
635
|
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);
|
|
625
636
|
}
|
|
626
637
|
}
|
|
627
|
-
const
|
|
628
|
-
version:
|
|
638
|
+
const ie = "3.0.0-beta.0", ne = {
|
|
639
|
+
version: ie
|
|
629
640
|
};
|
|
630
641
|
class oe {
|
|
631
642
|
create(e, t) {
|
|
632
|
-
const r = new
|
|
643
|
+
const r = new v(e);
|
|
633
644
|
return r.setHeader(o.CONTENT_TYPE_HEADER, o.CONTENT_JSON), t != null && r.setDataString(JSON.stringify(t)), r;
|
|
634
645
|
}
|
|
635
646
|
}
|
|
636
647
|
class $e {
|
|
637
648
|
create(e, t) {
|
|
638
|
-
const r = new
|
|
649
|
+
const r = new v(e);
|
|
639
650
|
if (r.setHeader(o.CONTENT_TYPE_HEADER, o.CONTENT_TEXT), t != null) {
|
|
640
|
-
let
|
|
651
|
+
let i = "", n = 0;
|
|
641
652
|
for (const c of t)
|
|
642
|
-
|
|
643
|
-
`),
|
|
644
|
-
|
|
653
|
+
n > 0 && (i = i + `
|
|
654
|
+
`), i = i + c, n++;
|
|
655
|
+
i.length > 0 && r.setDataString(i);
|
|
645
656
|
}
|
|
646
657
|
return r;
|
|
647
658
|
}
|
|
648
659
|
}
|
|
649
660
|
class ce {
|
|
650
|
-
|
|
661
|
+
_eventBus;
|
|
651
662
|
supervisors = /* @__PURE__ */ new Map();
|
|
652
663
|
contextInterceptor = null;
|
|
653
664
|
constructor(e) {
|
|
654
|
-
this.
|
|
665
|
+
this._eventBus = e;
|
|
666
|
+
}
|
|
667
|
+
set eventBus(e) {
|
|
668
|
+
this._eventBus = e;
|
|
669
|
+
for (const t of this.supervisors.values())
|
|
670
|
+
t.eventBus = e;
|
|
671
|
+
}
|
|
672
|
+
get eventBus() {
|
|
673
|
+
return this._eventBus;
|
|
655
674
|
}
|
|
656
675
|
serviceProxy(e) {
|
|
657
|
-
return new ue(e, this
|
|
676
|
+
return new ue(e, this);
|
|
658
677
|
}
|
|
659
678
|
register(e, t) {
|
|
660
679
|
const r = e.cri().raw();
|
|
661
680
|
if (!this.supervisors.has(r)) {
|
|
662
|
-
const
|
|
681
|
+
const i = new se(
|
|
663
682
|
e,
|
|
664
683
|
t,
|
|
665
684
|
this.eventBus,
|
|
666
685
|
() => this.contextInterceptor
|
|
667
686
|
);
|
|
668
|
-
this.supervisors.set(r,
|
|
687
|
+
this.supervisors.set(r, i), i.start();
|
|
669
688
|
}
|
|
670
689
|
}
|
|
671
690
|
unRegister(e) {
|
|
@@ -679,38 +698,38 @@ class ce {
|
|
|
679
698
|
const ae = new oe();
|
|
680
699
|
class ue {
|
|
681
700
|
serviceIdentifier;
|
|
682
|
-
|
|
701
|
+
serviceRegistry;
|
|
683
702
|
tracer;
|
|
684
703
|
constructor(e, t) {
|
|
685
704
|
if (typeof e > "u" || e.length === 0)
|
|
686
705
|
throw new Error("The serviceIdentifier provided must contain a value");
|
|
687
|
-
this.serviceIdentifier = e, this.
|
|
706
|
+
this.serviceIdentifier = e, this.serviceRegistry = t, this.tracer = b.trace.getTracer(
|
|
688
707
|
"continuum.client",
|
|
689
|
-
|
|
708
|
+
ne.version
|
|
690
709
|
);
|
|
691
710
|
}
|
|
692
|
-
invoke(e, t, r,
|
|
711
|
+
invoke(e, t, r, i) {
|
|
693
712
|
return this.tracer.startActiveSpan(
|
|
694
713
|
`${this.serviceIdentifier}/${e}`,
|
|
695
714
|
{
|
|
696
715
|
kind: U.CLIENT
|
|
697
716
|
},
|
|
698
|
-
async (
|
|
699
|
-
async (c) => (
|
|
717
|
+
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(
|
|
718
|
+
async (c) => (n.end(), c),
|
|
700
719
|
async (c) => {
|
|
701
|
-
throw
|
|
720
|
+
throw n.recordException(c), n.setStatus({ code: Y.ERROR }), n.end(), c;
|
|
702
721
|
}
|
|
703
722
|
))
|
|
704
723
|
);
|
|
705
724
|
}
|
|
706
|
-
invokeStream(e, t, r,
|
|
707
|
-
return this.__invokeStream(!0, e, t, r,
|
|
725
|
+
invokeStream(e, t, r, i) {
|
|
726
|
+
return this.__invokeStream(!0, e, t, r, i);
|
|
708
727
|
}
|
|
709
|
-
__invokeStream(e, t, r,
|
|
710
|
-
const c = o.SERVICE_DESTINATION_PREFIX + (
|
|
728
|
+
__invokeStream(e, t, r, i, n) {
|
|
729
|
+
const c = o.SERVICE_DESTINATION_PREFIX + (i != null ? i + "@" : "") + this.serviceIdentifier + "/" + t;
|
|
711
730
|
let a = ae;
|
|
712
|
-
|
|
713
|
-
let h = this.eventBus;
|
|
731
|
+
n ? a = n : f.getEventFactory() && (a = f.getEventFactory());
|
|
732
|
+
let h = this.serviceRegistry.eventBus;
|
|
714
733
|
f.getContinuumInstance() && (h = f.getContinuumInstance().eventBus);
|
|
715
734
|
const p = b.trace.getActiveSpan();
|
|
716
735
|
p && (p.setAttribute(G, h.serverInfo?.host || "unknown"), p.setAttribute(K, h.serverInfo?.port || "unknown"));
|
|
@@ -728,7 +747,7 @@ class ue {
|
|
|
728
747
|
}));
|
|
729
748
|
}
|
|
730
749
|
}
|
|
731
|
-
class
|
|
750
|
+
class T {
|
|
732
751
|
pageable;
|
|
733
752
|
currentPage;
|
|
734
753
|
firstPage = !0;
|
|
@@ -773,7 +792,7 @@ class _ {
|
|
|
773
792
|
return this.currentPage.content;
|
|
774
793
|
}
|
|
775
794
|
}
|
|
776
|
-
class le extends
|
|
795
|
+
class le extends T {
|
|
777
796
|
crudServiceProxy;
|
|
778
797
|
constructor(e, t, r) {
|
|
779
798
|
super(e, t), this.crudServiceProxy = r;
|
|
@@ -782,11 +801,11 @@ class le extends _ {
|
|
|
782
801
|
return this.crudServiceProxy.findAllSinglePage(e);
|
|
783
802
|
}
|
|
784
803
|
}
|
|
785
|
-
class he extends
|
|
804
|
+
class he extends T {
|
|
786
805
|
searchText;
|
|
787
806
|
crudServiceProxy;
|
|
788
|
-
constructor(e, t, r,
|
|
789
|
-
super(e, t), this.searchText = r, this.crudServiceProxy =
|
|
807
|
+
constructor(e, t, r, i) {
|
|
808
|
+
super(e, t), this.searchText = r, this.crudServiceProxy = i;
|
|
790
809
|
}
|
|
791
810
|
findNext(e) {
|
|
792
811
|
return this.crudServiceProxy.searchSinglePage(this.searchText, e);
|
|
@@ -868,7 +887,7 @@ class fe {
|
|
|
868
887
|
/**
|
|
869
888
|
* The {@link IEventBus} that is used to communicate with the Continuum server
|
|
870
889
|
*/
|
|
871
|
-
|
|
890
|
+
_eventBus;
|
|
872
891
|
/**
|
|
873
892
|
* The {@link ServiceRegistry} that is used to manage the services that are available
|
|
874
893
|
*/
|
|
@@ -878,7 +897,13 @@ class fe {
|
|
|
878
897
|
*/
|
|
879
898
|
crudServiceProxyFactory;
|
|
880
899
|
constructor() {
|
|
881
|
-
this.
|
|
900
|
+
this._eventBus = new Z(), this.serviceRegistry = new ce(this._eventBus), this.crudServiceProxyFactory = new de(this.serviceRegistry);
|
|
901
|
+
}
|
|
902
|
+
get eventBus() {
|
|
903
|
+
return this._eventBus;
|
|
904
|
+
}
|
|
905
|
+
set eventBus(e) {
|
|
906
|
+
this._eventBus = e, this.serviceRegistry.eventBus = e;
|
|
882
907
|
}
|
|
883
908
|
/**
|
|
884
909
|
* Requests a connection to the given Stomp url
|
|
@@ -886,14 +911,14 @@ class fe {
|
|
|
886
911
|
* @return Promise containing the result of the initial connection attempt
|
|
887
912
|
*/
|
|
888
913
|
connect(e) {
|
|
889
|
-
return this.
|
|
914
|
+
return this._eventBus.connect(e);
|
|
890
915
|
}
|
|
891
916
|
/**
|
|
892
917
|
* Disconnects the client from the server
|
|
893
918
|
* This will clear any subscriptions and close the connection
|
|
894
919
|
*/
|
|
895
920
|
disconnect(e) {
|
|
896
|
-
return this.
|
|
921
|
+
return this._eventBus.disconnect(e);
|
|
897
922
|
}
|
|
898
923
|
/**
|
|
899
924
|
* Creates a new service proxy that can be used to access the desired service.
|
|
@@ -922,24 +947,24 @@ class fe {
|
|
|
922
947
|
async execute(e, t) {
|
|
923
948
|
const r = f;
|
|
924
949
|
r.push({ instance: this, eventFactory: t });
|
|
925
|
-
let
|
|
950
|
+
let i;
|
|
926
951
|
try {
|
|
927
|
-
|
|
952
|
+
i = await e();
|
|
928
953
|
} finally {
|
|
929
954
|
r.pop();
|
|
930
955
|
}
|
|
931
|
-
return
|
|
956
|
+
return i;
|
|
932
957
|
}
|
|
933
958
|
}
|
|
934
959
|
const D = new fe();
|
|
935
|
-
var
|
|
960
|
+
var ve = /* @__PURE__ */ ((s) => (s.TRACE = "TRACE", s.DEBUG = "DEBUG", s.INFO = "INFO", s.WARN = "WARN", s.ERROR = "ERROR", s.FATAL = "FATAL", s.OFF = "OFF", s))(ve || {});
|
|
936
961
|
class y {
|
|
937
962
|
configuredLevel;
|
|
938
963
|
}
|
|
939
|
-
class
|
|
964
|
+
class ge extends y {
|
|
940
965
|
members = [];
|
|
941
966
|
}
|
|
942
|
-
class
|
|
967
|
+
class me extends y {
|
|
943
968
|
effectiveLevel;
|
|
944
969
|
}
|
|
945
970
|
class Ue {
|
|
@@ -957,20 +982,20 @@ class Se {
|
|
|
957
982
|
}
|
|
958
983
|
async loggerLevels(e, t) {
|
|
959
984
|
const r = await this.serviceProxy.invoke("loggerLevels", [t], e);
|
|
960
|
-
let
|
|
961
|
-
return r.hasOwnProperty("members") ?
|
|
985
|
+
let i = null;
|
|
986
|
+
return r.hasOwnProperty("members") ? i = new ge() : r.hasOwnProperty("effectiveLevel") ? i = new me() : i = new y(), Object.assign(i, r), i;
|
|
962
987
|
}
|
|
963
988
|
configureLogLevel(e, t, r) {
|
|
964
989
|
return this.serviceProxy.invoke("configureLogLevel", [t, r], e);
|
|
965
990
|
}
|
|
966
991
|
}
|
|
967
992
|
const Ye = new Se();
|
|
968
|
-
class H extends
|
|
993
|
+
class H extends g {
|
|
969
994
|
constructor(e) {
|
|
970
995
|
super(e), Object.setPrototypeOf(this, H.prototype);
|
|
971
996
|
}
|
|
972
997
|
}
|
|
973
|
-
class L extends
|
|
998
|
+
class L extends g {
|
|
974
999
|
constructor(e) {
|
|
975
1000
|
super(e), Object.setPrototypeOf(this, L.prototype);
|
|
976
1001
|
}
|
|
@@ -985,8 +1010,8 @@ class je {
|
|
|
985
1010
|
tenantId;
|
|
986
1011
|
metadata;
|
|
987
1012
|
roles;
|
|
988
|
-
constructor(e, t, r,
|
|
989
|
-
this.id = e, this.tenantId = t, this.metadata = r || /* @__PURE__ */ new Map(), this.roles =
|
|
1013
|
+
constructor(e, t, r, i) {
|
|
1014
|
+
this.id = e, this.tenantId = t, this.metadata = r || /* @__PURE__ */ new Map(), this.roles = i || [];
|
|
990
1015
|
}
|
|
991
1016
|
}
|
|
992
1017
|
class Je {
|
|
@@ -1009,7 +1034,7 @@ class Xe {
|
|
|
1009
1034
|
return this.value !== null && this.value !== void 0;
|
|
1010
1035
|
}
|
|
1011
1036
|
}
|
|
1012
|
-
class We extends
|
|
1037
|
+
class We extends T {
|
|
1013
1038
|
pageFunction;
|
|
1014
1039
|
constructor(e, t, r) {
|
|
1015
1040
|
super(e, t), this.pageFunction = r;
|
|
@@ -1039,7 +1064,7 @@ class M {
|
|
|
1039
1064
|
* @param sort the sorting parameters (optional).
|
|
1040
1065
|
*/
|
|
1041
1066
|
static create(e, t, r) {
|
|
1042
|
-
return new
|
|
1067
|
+
return new _e(e, t, r);
|
|
1043
1068
|
}
|
|
1044
1069
|
/**
|
|
1045
1070
|
* Creates a {@link Pageable} that uses Cursor based pagination.
|
|
@@ -1048,10 +1073,10 @@ class M {
|
|
|
1048
1073
|
* @param sort the sorting parameters (optional).
|
|
1049
1074
|
*/
|
|
1050
1075
|
static createWithCursor(e, t, r) {
|
|
1051
|
-
return new
|
|
1076
|
+
return new Te(e, t, r);
|
|
1052
1077
|
}
|
|
1053
1078
|
}
|
|
1054
|
-
class
|
|
1079
|
+
class _e extends M {
|
|
1055
1080
|
/**
|
|
1056
1081
|
* Returns the page to be returned.
|
|
1057
1082
|
*/
|
|
@@ -1066,7 +1091,7 @@ class Te extends M {
|
|
|
1066
1091
|
super(), this.pageNumber = e, this.pageSize = t, this.sort = r;
|
|
1067
1092
|
}
|
|
1068
1093
|
}
|
|
1069
|
-
class
|
|
1094
|
+
class Te extends M {
|
|
1070
1095
|
/**
|
|
1071
1096
|
* The cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
1072
1097
|
*/
|
|
@@ -1106,36 +1131,36 @@ class ze {
|
|
|
1106
1131
|
orders = [];
|
|
1107
1132
|
}
|
|
1108
1133
|
export {
|
|
1109
|
-
|
|
1134
|
+
T as AbstractIterablePage,
|
|
1110
1135
|
H as AuthenticationError,
|
|
1111
1136
|
L as AuthorizationError,
|
|
1112
|
-
|
|
1137
|
+
_ as CONTEXT_METADATA_KEY,
|
|
1113
1138
|
Le as ConnectHeaders,
|
|
1114
1139
|
Ve as ConnectedInfo,
|
|
1115
1140
|
Me as ConnectionInfo,
|
|
1116
1141
|
qe as Context,
|
|
1117
1142
|
D as Continuum,
|
|
1118
1143
|
f as ContinuumContextStack,
|
|
1119
|
-
|
|
1144
|
+
g as ContinuumError,
|
|
1120
1145
|
fe as ContinuumSingleton,
|
|
1121
1146
|
pe as CrudServiceProxy,
|
|
1122
1147
|
de as CrudServiceProxyFactory,
|
|
1123
|
-
|
|
1148
|
+
Te as CursorPageable,
|
|
1124
1149
|
Ge as DataSourceUtils,
|
|
1125
1150
|
E as DefaultCRI,
|
|
1126
1151
|
ye as Direction,
|
|
1127
|
-
|
|
1152
|
+
v as Event,
|
|
1128
1153
|
Z as EventBus,
|
|
1129
1154
|
o as EventConstants,
|
|
1130
1155
|
We as FunctionalIterablePage,
|
|
1131
|
-
|
|
1156
|
+
ge as GroupLoggerLevelsDescriptor,
|
|
1132
1157
|
oe as JsonEventFactory,
|
|
1133
|
-
|
|
1158
|
+
ve as LogLevel,
|
|
1134
1159
|
Se as LogManager,
|
|
1135
1160
|
y as LoggerLevelsDescriptor,
|
|
1136
1161
|
Ue as LoggersDescriptor,
|
|
1137
1162
|
be as NullHandling,
|
|
1138
|
-
|
|
1163
|
+
_e as OffsetPageable,
|
|
1139
1164
|
Ke as Order,
|
|
1140
1165
|
M as Pageable,
|
|
1141
1166
|
je as Participant,
|
|
@@ -1144,7 +1169,7 @@ export {
|
|
|
1144
1169
|
ke as Scope,
|
|
1145
1170
|
w as ServerInfo,
|
|
1146
1171
|
ce as ServiceRegistry,
|
|
1147
|
-
|
|
1172
|
+
me as SingleLoggerLevelsDescriptor,
|
|
1148
1173
|
ze as Sort,
|
|
1149
1174
|
Xe as StreamData,
|
|
1150
1175
|
Re as StreamOperation,
|