@mindignited/continuum-client 2.14.7 → 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 +183 -151
- 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 +1 -1
package/dist/continuum.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { RxStomp as k } from "@stomp/rx-stomp";
|
|
2
2
|
import { ReconnectionTimeMode as B } from "@stomp/stompjs";
|
|
3
|
-
import { v4 as
|
|
4
|
-
import
|
|
5
|
-
import b, { propagation as F, context as $, SpanKind as
|
|
6
|
-
import { Subject as A, firstValueFrom as
|
|
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
|
+
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
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
|
*/
|
|
@@ -84,12 +87,12 @@ class z {
|
|
|
84
87
|
return;
|
|
85
88
|
}
|
|
86
89
|
this.connectionAttempts = 0, this.initialConnectionSuccessful = !1, this.lastWebsocketError = null, this.maxConnectionAttemptsReached = !1;
|
|
87
|
-
const
|
|
90
|
+
const i = "ws" + (e.useSSL ? "s" : "") + "://" + e.host + (e.port ? ":" + e.port : "") + "/v1";
|
|
88
91
|
this.rxStomp = new k();
|
|
89
|
-
let
|
|
92
|
+
let n = typeof e.connectHeaders != "function" && e.connectHeaders != null ? e.connectHeaders : {};
|
|
90
93
|
const c = {
|
|
91
|
-
brokerURL:
|
|
92
|
-
connectHeaders:
|
|
94
|
+
brokerURL: i,
|
|
95
|
+
connectHeaders: n,
|
|
93
96
|
heartbeatIncoming: 12e4,
|
|
94
97
|
heartbeatOutgoing: 3e4,
|
|
95
98
|
reconnectDelay: this.INITIAL_RECONNECT_DELAY,
|
|
@@ -97,9 +100,9 @@ class z {
|
|
|
97
100
|
if (typeof e.connectHeaders == "function") {
|
|
98
101
|
const u = await e.connectHeaders();
|
|
99
102
|
for (const l in u)
|
|
100
|
-
|
|
103
|
+
n[l] = u[l];
|
|
101
104
|
}
|
|
102
|
-
if (e.disableStickySession && (
|
|
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";
|
|
@@ -128,15 +131,15 @@ 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
|
|
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
|
|
139
|
-
|
|
140
|
+
for (let S in n)
|
|
141
|
+
delete n[S];
|
|
142
|
+
n[o.SESSION_HEADER] = d.sessionId, t(d);
|
|
140
143
|
} else
|
|
141
144
|
r("Server did not return proper data for successful login");
|
|
142
145
|
} else
|
|
@@ -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) {
|
|
@@ -224,8 +227,8 @@ class Z {
|
|
|
224
227
|
send(e) {
|
|
225
228
|
if (this.stompConnectionManager.rxStomp) {
|
|
226
229
|
const t = {};
|
|
227
|
-
for (const [
|
|
228
|
-
t[
|
|
230
|
+
for (const [i, n] of e.headers.entries())
|
|
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,
|
|
@@ -236,20 +239,20 @@ class Z {
|
|
|
236
239
|
throw this.createSendUnavailableError();
|
|
237
240
|
}
|
|
238
241
|
request(e) {
|
|
239
|
-
return
|
|
242
|
+
return U(this.requestStream(e, !1));
|
|
240
243
|
}
|
|
241
244
|
requestStream(e, t = !0) {
|
|
242
|
-
return this.stompConnectionManager?.rxStomp ? new
|
|
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
|
-
let
|
|
245
|
-
const
|
|
247
|
+
let i = !1;
|
|
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")
|
|
249
|
-
|
|
252
|
+
i = !0, r.complete();
|
|
250
253
|
else
|
|
251
254
|
throw new Error("Control Header " + a.headers.get(o.CONTROL_HEADER) + " is not supported");
|
|
252
|
-
else a.hasHeader(o.ERROR_HEADER) ? (
|
|
255
|
+
else a.hasHeader(o.ERROR_HEADER) ? (i = !0, r.error(new Error(a.getHeader(o.ERROR_HEADER)))) : r.next(a);
|
|
253
256
|
},
|
|
254
257
|
error(a) {
|
|
255
258
|
r.error(a);
|
|
@@ -258,13 +261,16 @@ class Z {
|
|
|
258
261
|
r.complete();
|
|
259
262
|
}
|
|
260
263
|
});
|
|
261
|
-
return r.add(c), e.setHeader(o.REPLY_TO_HEADER, this.replyToCri), e.setHeader(o.CORRELATION_ID_HEADER,
|
|
262
|
-
if (t && !
|
|
264
|
+
return r.add(c), e.setHeader(o.REPLY_TO_HEADER, this.replyToCri), e.setHeader(o.CORRELATION_ID_HEADER, n), this.send(e), () => {
|
|
265
|
+
if (t && !i) {
|
|
263
266
|
const a = new g(e.cri);
|
|
264
|
-
a.setHeader(o.CONTROL_HEADER, o.CONTROL_VALUE_CANCEL), a.setHeader(o.CORRELATION_ID_HEADER,
|
|
267
|
+
a.setHeader(o.CONTROL_HEADER, o.CONTROL_VALUE_CANCEL), a.setHeader(o.CORRELATION_ID_HEADER, n), this.send(a);
|
|
265
268
|
}
|
|
266
269
|
};
|
|
267
|
-
}) :
|
|
270
|
+
}) : j(() => this.createSendUnavailableError());
|
|
271
|
+
}
|
|
272
|
+
listen(e) {
|
|
273
|
+
return Promise.reject("Not implemented");
|
|
268
274
|
}
|
|
269
275
|
observe(e) {
|
|
270
276
|
return this._observe(e);
|
|
@@ -286,13 +292,15 @@ class Z {
|
|
|
286
292
|
* @return the cold {@link Observable<IEvent>} for the given destination
|
|
287
293
|
*/
|
|
288
294
|
_observe(e) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
295
|
+
if (this.stompConnectionManager?.rxStomp)
|
|
296
|
+
return this.stompConnectionManager.rxStomp.watch(e).pipe(R((t) => {
|
|
297
|
+
const r = /* @__PURE__ */ new Map();
|
|
298
|
+
let i = "";
|
|
299
|
+
for (const n of Object.keys(t.headers))
|
|
300
|
+
n === "destination" ? i = t.headers[n] : r.set(n, t.headers[n]);
|
|
301
|
+
return new g(i, r, t.binaryBody);
|
|
302
|
+
}));
|
|
303
|
+
throw this.createSendUnavailableError();
|
|
296
304
|
}
|
|
297
305
|
}
|
|
298
306
|
class E {
|
|
@@ -310,8 +318,8 @@ class E {
|
|
|
310
318
|
const r = E.parseRaw(t);
|
|
311
319
|
this._scheme = r.scheme, this._scope = r.scope, this._resourceName = r.resourceName, this._path = r.path, this._version = r.version, this._raw = t;
|
|
312
320
|
} else if (e.length === 5) {
|
|
313
|
-
const [t, r,
|
|
314
|
-
this._scheme = t, this._scope = r, this._resourceName =
|
|
321
|
+
const [t, r, i, n, c] = e;
|
|
322
|
+
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
323
|
} else
|
|
316
324
|
throw new Error("Invalid constructor arguments for DefaultCRI");
|
|
317
325
|
if (!this._scheme || !this._resourceName)
|
|
@@ -363,22 +371,22 @@ class E {
|
|
|
363
371
|
const t = /^([^:]+):\/\/(?:([^@]+)@)?([^\/#]+)(\/[^#]*)?(?:#(.+))?$/, r = e.match(t);
|
|
364
372
|
if (!r)
|
|
365
373
|
throw new Error(`Invalid CRI format: ${e}`);
|
|
366
|
-
const [,
|
|
374
|
+
const [, i, n, c, a, h] = r;
|
|
367
375
|
return {
|
|
368
|
-
scheme:
|
|
369
|
-
scope:
|
|
376
|
+
scheme: i,
|
|
377
|
+
scope: n || null,
|
|
370
378
|
resourceName: c,
|
|
371
379
|
path: a ? a.substring(1) : null,
|
|
372
380
|
version: h || null
|
|
373
381
|
};
|
|
374
382
|
}
|
|
375
383
|
// Helper to build a raw CRI string
|
|
376
|
-
static buildRaw(e, t, r,
|
|
384
|
+
static buildRaw(e, t, r, i, n) {
|
|
377
385
|
let c = `${e}://`;
|
|
378
|
-
return t && (c += `${t}@`), c += r,
|
|
386
|
+
return t && (c += `${t}@`), c += r, i && (c += `/${i}`), n && (c += `#${n}`), c;
|
|
379
387
|
}
|
|
380
388
|
}
|
|
381
|
-
function
|
|
389
|
+
function w(...s) {
|
|
382
390
|
if (s.length === 1) return new E(s[0]);
|
|
383
391
|
if (s.length === 2) return new E(s[0], null, s[1], null, null);
|
|
384
392
|
if (s.length === 3) return new E(s[0], s[1], s[2], null, null);
|
|
@@ -402,16 +410,16 @@ class O {
|
|
|
402
410
|
static createReplyEvent(e, t, r) {
|
|
403
411
|
if (!e)
|
|
404
412
|
throw new Error("incomingHeaders cannot be null");
|
|
405
|
-
const
|
|
406
|
-
if (!
|
|
413
|
+
const i = e.get(o.REPLY_TO_HEADER);
|
|
414
|
+
if (!i || i.trim() === "")
|
|
407
415
|
throw new Error("No reply-to header found, cannot create outgoing message");
|
|
408
|
-
const
|
|
416
|
+
const n = /* @__PURE__ */ new Map();
|
|
409
417
|
for (const [c, a] of e)
|
|
410
|
-
c.startsWith("__") &&
|
|
418
|
+
c.startsWith("__") && n.set(c, a);
|
|
411
419
|
if (t)
|
|
412
420
|
for (const [c, a] of t)
|
|
413
|
-
|
|
414
|
-
return new g(
|
|
421
|
+
n.set(c, a);
|
|
422
|
+
return new g(i, n, r || void 0);
|
|
415
423
|
}
|
|
416
424
|
}
|
|
417
425
|
class ee {
|
|
@@ -460,7 +468,7 @@ class re {
|
|
|
460
468
|
* @return the cri for this {@link ServiceIdentifier}
|
|
461
469
|
*/
|
|
462
470
|
cri() {
|
|
463
|
-
return this._cri == null && (this._cri =
|
|
471
|
+
return this._cri == null && (this._cri = w(
|
|
464
472
|
o.SERVICE_DESTINATION_SCHEME,
|
|
465
473
|
// scheme
|
|
466
474
|
this.scope || null,
|
|
@@ -474,7 +482,7 @@ class re {
|
|
|
474
482
|
)), this._cri;
|
|
475
483
|
}
|
|
476
484
|
}
|
|
477
|
-
const P = /* @__PURE__ */ Symbol("scope"), x = /* @__PURE__ */ Symbol("version"),
|
|
485
|
+
const P = /* @__PURE__ */ Symbol("scope"), x = /* @__PURE__ */ Symbol("version"), _ = /* @__PURE__ */ Symbol("context");
|
|
478
486
|
function ke(s, e, t) {
|
|
479
487
|
Reflect.defineMetadata(P, e, s);
|
|
480
488
|
}
|
|
@@ -485,23 +493,23 @@ function Be(s) {
|
|
|
485
493
|
Reflect.defineMetadata(x, s, e);
|
|
486
494
|
};
|
|
487
495
|
}
|
|
488
|
-
function
|
|
496
|
+
function Fe() {
|
|
489
497
|
return function(s, e, t) {
|
|
490
|
-
const r = Reflect.getMetadata(
|
|
491
|
-
r.push(t), Reflect.defineMetadata(
|
|
498
|
+
const r = Reflect.getMetadata(_, s, e) || [];
|
|
499
|
+
r.push(t), Reflect.defineMetadata(_, r, s, e);
|
|
492
500
|
};
|
|
493
501
|
}
|
|
494
|
-
function
|
|
502
|
+
function $e(s, e) {
|
|
495
503
|
return function(t) {
|
|
496
|
-
const r = t,
|
|
497
|
-
|
|
504
|
+
const r = t, i = new re(s, e || t.name), n = Reflect.getMetadata(x, t);
|
|
505
|
+
n && (i.version = n);
|
|
498
506
|
const c = function(...a) {
|
|
499
507
|
const h = Reflect.construct(r, a), p = Reflect.getMetadata(P, t.prototype);
|
|
500
508
|
if (p) {
|
|
501
509
|
const u = h[p];
|
|
502
|
-
|
|
510
|
+
i.scope = typeof u == "function" ? u.call(h) : u;
|
|
503
511
|
}
|
|
504
|
-
return D.serviceRegistry.register(
|
|
512
|
+
return D.serviceRegistry.register(i, h), h;
|
|
505
513
|
};
|
|
506
514
|
return c.prototype = r.prototype, c;
|
|
507
515
|
};
|
|
@@ -509,7 +517,7 @@ function Fe(s, e) {
|
|
|
509
517
|
class se {
|
|
510
518
|
log;
|
|
511
519
|
active = !1;
|
|
512
|
-
|
|
520
|
+
_eventBus;
|
|
513
521
|
interceptorProvider;
|
|
514
522
|
argumentResolver;
|
|
515
523
|
returnValueConverter;
|
|
@@ -517,22 +525,30 @@ class se {
|
|
|
517
525
|
serviceInstance;
|
|
518
526
|
methodSubscription = null;
|
|
519
527
|
methodMap;
|
|
520
|
-
constructor(e, t, r,
|
|
528
|
+
constructor(e, t, r, i, n = {}) {
|
|
521
529
|
if (!e) throw new Error("ServiceIdentifier must not be null");
|
|
522
530
|
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.
|
|
531
|
+
if (!r) throw new Error("IEventBus must not be null");
|
|
532
|
+
if (!i) throw new Error("interceptorProvider must not be null");
|
|
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);
|
|
526
534
|
}
|
|
527
535
|
isActive() {
|
|
528
536
|
return this.active;
|
|
529
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
|
+
}
|
|
530
546
|
start() {
|
|
531
547
|
if (this.active)
|
|
532
548
|
throw new Error("Service already started");
|
|
533
549
|
this.active = !0;
|
|
534
550
|
const e = this.serviceIdentifier.cri().baseResource();
|
|
535
|
-
this.methodSubscription = this.
|
|
551
|
+
this.methodSubscription = this._eventBus.observe(e).subscribe({
|
|
536
552
|
next: async (t) => {
|
|
537
553
|
await this.processEvent(t);
|
|
538
554
|
},
|
|
@@ -552,8 +568,8 @@ class se {
|
|
|
552
568
|
buildMethodMap(e) {
|
|
553
569
|
const t = {};
|
|
554
570
|
for (const r of Object.getOwnPropertyNames(Object.getPrototypeOf(e))) {
|
|
555
|
-
const
|
|
556
|
-
typeof
|
|
571
|
+
const i = e[r];
|
|
572
|
+
typeof i == "function" && r !== "constructor" && (t[r] = i.bind(e));
|
|
557
573
|
}
|
|
558
574
|
return t;
|
|
559
575
|
}
|
|
@@ -573,13 +589,13 @@ class se {
|
|
|
573
589
|
this.log.trace(`Processing control event for correlationId: ${t}`);
|
|
574
590
|
}
|
|
575
591
|
async processInvocationRequest(e) {
|
|
576
|
-
const t =
|
|
592
|
+
const t = w(e.cri).path();
|
|
577
593
|
if (!t)
|
|
578
594
|
throw new Error("The methodId must not be blank");
|
|
579
595
|
const r = this.methodMap[t];
|
|
580
596
|
if (!r)
|
|
581
597
|
throw new Error(`No method resolved for methodId ${t}`);
|
|
582
|
-
const
|
|
598
|
+
const i = t, n = this.argumentResolver.resolveArguments(e), c = Reflect.getMetadata(_, this.serviceInstance, i) || [];
|
|
583
599
|
let a = {};
|
|
584
600
|
const h = this.interceptorProvider();
|
|
585
601
|
if (h)
|
|
@@ -590,13 +606,13 @@ class se {
|
|
|
590
606
|
return;
|
|
591
607
|
}
|
|
592
608
|
for (const l of c)
|
|
593
|
-
|
|
609
|
+
n[l] = a;
|
|
594
610
|
const p = r.length;
|
|
595
|
-
if (
|
|
596
|
-
throw new Error(`Argument count mismatch for method ${t}: expected ${p}, got ${
|
|
611
|
+
if (n.length !== p)
|
|
612
|
+
throw new Error(`Argument count mismatch for method ${t}: expected ${p}, got ${n.length}`);
|
|
597
613
|
let u;
|
|
598
614
|
try {
|
|
599
|
-
u = r(...
|
|
615
|
+
u = r(...n), u instanceof Promise ? u.then(
|
|
600
616
|
(l) => this.processMethodInvocationResult(e, l),
|
|
601
617
|
(l) => this.handleException(e, l)
|
|
602
618
|
) : this.processMethodInvocationResult(e, u);
|
|
@@ -606,7 +622,7 @@ class se {
|
|
|
606
622
|
}
|
|
607
623
|
processMethodInvocationResult(e, t) {
|
|
608
624
|
const r = this.returnValueConverter.convert(e.headers, t);
|
|
609
|
-
this.
|
|
625
|
+
this._eventBus.send(r);
|
|
610
626
|
}
|
|
611
627
|
handleException(e, t) {
|
|
612
628
|
const r = O.createReplyEvent(
|
|
@@ -617,15 +633,15 @@ class se {
|
|
|
617
633
|
]),
|
|
618
634
|
new TextEncoder().encode(JSON.stringify({ message: t.message }))
|
|
619
635
|
);
|
|
620
|
-
this.
|
|
636
|
+
this._eventBus.send(r);
|
|
621
637
|
}
|
|
622
638
|
validateReplyTo(e) {
|
|
623
639
|
const t = e.getHeader(o.REPLY_TO_HEADER);
|
|
624
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);
|
|
625
641
|
}
|
|
626
642
|
}
|
|
627
|
-
const
|
|
628
|
-
version:
|
|
643
|
+
const ie = "2.14.9", ne = {
|
|
644
|
+
version: ie
|
|
629
645
|
};
|
|
630
646
|
class oe {
|
|
631
647
|
create(e, t) {
|
|
@@ -633,44 +649,54 @@ class oe {
|
|
|
633
649
|
return r.setHeader(o.CONTENT_TYPE_HEADER, o.CONTENT_JSON), t != null && r.setDataString(JSON.stringify(t)), r;
|
|
634
650
|
}
|
|
635
651
|
}
|
|
636
|
-
class
|
|
652
|
+
class qe {
|
|
637
653
|
create(e, t) {
|
|
638
654
|
const r = new g(e);
|
|
639
655
|
if (r.setHeader(o.CONTENT_TYPE_HEADER, o.CONTENT_TEXT), t != null) {
|
|
640
|
-
let
|
|
656
|
+
let i = "", n = 0;
|
|
641
657
|
for (const c of t)
|
|
642
|
-
|
|
643
|
-
`),
|
|
644
|
-
|
|
658
|
+
n > 0 && (i = i + `
|
|
659
|
+
`), i = i + c, n++;
|
|
660
|
+
i.length > 0 && r.setDataString(i);
|
|
645
661
|
}
|
|
646
662
|
return r;
|
|
647
663
|
}
|
|
648
664
|
}
|
|
649
665
|
class ce {
|
|
650
|
-
|
|
666
|
+
_eventBus;
|
|
651
667
|
supervisors = /* @__PURE__ */ new Map();
|
|
652
668
|
contextInterceptor = null;
|
|
669
|
+
debugLogger = I("continuum:serviceRegistry");
|
|
653
670
|
constructor(e) {
|
|
654
|
-
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;
|
|
655
680
|
}
|
|
656
681
|
serviceProxy(e) {
|
|
657
|
-
return new ue(e, this
|
|
682
|
+
return new ue(e, this);
|
|
658
683
|
}
|
|
659
684
|
register(e, t) {
|
|
660
685
|
const r = e.cri().raw();
|
|
661
686
|
if (!this.supervisors.has(r)) {
|
|
662
|
-
|
|
687
|
+
this.debugLogger(`Registering service for CRI: ${r}`);
|
|
688
|
+
const i = new se(
|
|
663
689
|
e,
|
|
664
690
|
t,
|
|
665
691
|
this.eventBus,
|
|
666
692
|
() => this.contextInterceptor
|
|
667
693
|
);
|
|
668
|
-
this.supervisors.set(r,
|
|
694
|
+
this.supervisors.set(r, i), i.start();
|
|
669
695
|
}
|
|
670
696
|
}
|
|
671
697
|
unRegister(e) {
|
|
672
698
|
const t = e.cri().raw(), r = this.supervisors.get(t);
|
|
673
|
-
r && (r.stop(), this.supervisors.delete(t));
|
|
699
|
+
r && (this.debugLogger(`Unregistering service for CRI: ${t}`), r.stop(), this.supervisors.delete(t));
|
|
674
700
|
}
|
|
675
701
|
registerContextInterceptor(e) {
|
|
676
702
|
this.contextInterceptor = e;
|
|
@@ -679,38 +705,38 @@ class ce {
|
|
|
679
705
|
const ae = new oe();
|
|
680
706
|
class ue {
|
|
681
707
|
serviceIdentifier;
|
|
682
|
-
|
|
708
|
+
serviceRegistry;
|
|
683
709
|
tracer;
|
|
684
710
|
constructor(e, t) {
|
|
685
711
|
if (typeof e > "u" || e.length === 0)
|
|
686
712
|
throw new Error("The serviceIdentifier provided must contain a value");
|
|
687
|
-
this.serviceIdentifier = e, this.
|
|
713
|
+
this.serviceIdentifier = e, this.serviceRegistry = t, this.tracer = b.trace.getTracer(
|
|
688
714
|
"continuum.client",
|
|
689
|
-
|
|
715
|
+
ne.version
|
|
690
716
|
);
|
|
691
717
|
}
|
|
692
|
-
invoke(e, t, r,
|
|
718
|
+
invoke(e, t, r, i) {
|
|
693
719
|
return this.tracer.startActiveSpan(
|
|
694
720
|
`${this.serviceIdentifier}/${e}`,
|
|
695
721
|
{
|
|
696
|
-
kind:
|
|
722
|
+
kind: q.CLIENT
|
|
697
723
|
},
|
|
698
|
-
async (
|
|
699
|
-
async (c) => (
|
|
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(
|
|
725
|
+
async (c) => (n.end(), c),
|
|
700
726
|
async (c) => {
|
|
701
|
-
throw
|
|
727
|
+
throw n.recordException(c), n.setStatus({ code: Y.ERROR }), n.end(), c;
|
|
702
728
|
}
|
|
703
729
|
))
|
|
704
730
|
);
|
|
705
731
|
}
|
|
706
|
-
invokeStream(e, t, r,
|
|
707
|
-
return this.__invokeStream(!0, e, t, r,
|
|
732
|
+
invokeStream(e, t, r, i) {
|
|
733
|
+
return this.__invokeStream(!0, e, t, r, i);
|
|
708
734
|
}
|
|
709
|
-
__invokeStream(e, t, r,
|
|
710
|
-
const c = o.SERVICE_DESTINATION_PREFIX + (
|
|
735
|
+
__invokeStream(e, t, r, i, n) {
|
|
736
|
+
const c = o.SERVICE_DESTINATION_PREFIX + (i != null ? i + "@" : "") + this.serviceIdentifier + "/" + t;
|
|
711
737
|
let a = ae;
|
|
712
|
-
|
|
713
|
-
let h = this.eventBus;
|
|
738
|
+
n ? a = n : f.getEventFactory() && (a = f.getEventFactory());
|
|
739
|
+
let h = this.serviceRegistry.eventBus;
|
|
714
740
|
f.getContinuumInstance() && (h = f.getContinuumInstance().eventBus);
|
|
715
741
|
const p = b.trace.getActiveSpan();
|
|
716
742
|
p && (p.setAttribute(G, h.serverInfo?.host || "unknown"), p.setAttribute(K, h.serverInfo?.port || "unknown"));
|
|
@@ -728,7 +754,7 @@ class ue {
|
|
|
728
754
|
}));
|
|
729
755
|
}
|
|
730
756
|
}
|
|
731
|
-
class
|
|
757
|
+
class T {
|
|
732
758
|
pageable;
|
|
733
759
|
currentPage;
|
|
734
760
|
firstPage = !0;
|
|
@@ -773,7 +799,7 @@ class _ {
|
|
|
773
799
|
return this.currentPage.content;
|
|
774
800
|
}
|
|
775
801
|
}
|
|
776
|
-
class le extends
|
|
802
|
+
class le extends T {
|
|
777
803
|
crudServiceProxy;
|
|
778
804
|
constructor(e, t, r) {
|
|
779
805
|
super(e, t), this.crudServiceProxy = r;
|
|
@@ -782,11 +808,11 @@ class le extends _ {
|
|
|
782
808
|
return this.crudServiceProxy.findAllSinglePage(e);
|
|
783
809
|
}
|
|
784
810
|
}
|
|
785
|
-
class he extends
|
|
811
|
+
class he extends T {
|
|
786
812
|
searchText;
|
|
787
813
|
crudServiceProxy;
|
|
788
|
-
constructor(e, t, r,
|
|
789
|
-
super(e, t), this.searchText = r, this.crudServiceProxy =
|
|
814
|
+
constructor(e, t, r, i) {
|
|
815
|
+
super(e, t), this.searchText = r, this.crudServiceProxy = i;
|
|
790
816
|
}
|
|
791
817
|
findNext(e) {
|
|
792
818
|
return this.crudServiceProxy.searchSinglePage(this.searchText, e);
|
|
@@ -868,7 +894,7 @@ class fe {
|
|
|
868
894
|
/**
|
|
869
895
|
* The {@link IEventBus} that is used to communicate with the Continuum server
|
|
870
896
|
*/
|
|
871
|
-
|
|
897
|
+
_eventBus;
|
|
872
898
|
/**
|
|
873
899
|
* The {@link ServiceRegistry} that is used to manage the services that are available
|
|
874
900
|
*/
|
|
@@ -878,7 +904,13 @@ class fe {
|
|
|
878
904
|
*/
|
|
879
905
|
crudServiceProxyFactory;
|
|
880
906
|
constructor() {
|
|
881
|
-
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;
|
|
882
914
|
}
|
|
883
915
|
/**
|
|
884
916
|
* Requests a connection to the given Stomp url
|
|
@@ -886,14 +918,14 @@ class fe {
|
|
|
886
918
|
* @return Promise containing the result of the initial connection attempt
|
|
887
919
|
*/
|
|
888
920
|
connect(e) {
|
|
889
|
-
return this.
|
|
921
|
+
return this._eventBus.connect(e);
|
|
890
922
|
}
|
|
891
923
|
/**
|
|
892
924
|
* Disconnects the client from the server
|
|
893
925
|
* This will clear any subscriptions and close the connection
|
|
894
926
|
*/
|
|
895
927
|
disconnect(e) {
|
|
896
|
-
return this.
|
|
928
|
+
return this._eventBus.disconnect(e);
|
|
897
929
|
}
|
|
898
930
|
/**
|
|
899
931
|
* Creates a new service proxy that can be used to access the desired service.
|
|
@@ -922,13 +954,13 @@ class fe {
|
|
|
922
954
|
async execute(e, t) {
|
|
923
955
|
const r = f;
|
|
924
956
|
r.push({ instance: this, eventFactory: t });
|
|
925
|
-
let
|
|
957
|
+
let i;
|
|
926
958
|
try {
|
|
927
|
-
|
|
959
|
+
i = await e();
|
|
928
960
|
} finally {
|
|
929
961
|
r.pop();
|
|
930
962
|
}
|
|
931
|
-
return
|
|
963
|
+
return i;
|
|
932
964
|
}
|
|
933
965
|
}
|
|
934
966
|
const D = new fe();
|
|
@@ -936,13 +968,13 @@ var ge = /* @__PURE__ */ ((s) => (s.TRACE = "TRACE", s.DEBUG = "DEBUG", s.INFO =
|
|
|
936
968
|
class y {
|
|
937
969
|
configuredLevel;
|
|
938
970
|
}
|
|
939
|
-
class
|
|
971
|
+
class ve extends y {
|
|
940
972
|
members = [];
|
|
941
973
|
}
|
|
942
|
-
class
|
|
974
|
+
class me extends y {
|
|
943
975
|
effectiveLevel;
|
|
944
976
|
}
|
|
945
|
-
class
|
|
977
|
+
class Ye {
|
|
946
978
|
levels = [];
|
|
947
979
|
loggerLevels = /* @__PURE__ */ new Map();
|
|
948
980
|
groups = /* @__PURE__ */ new Map();
|
|
@@ -957,20 +989,20 @@ class Se {
|
|
|
957
989
|
}
|
|
958
990
|
async loggerLevels(e, t) {
|
|
959
991
|
const r = await this.serviceProxy.invoke("loggerLevels", [t], e);
|
|
960
|
-
let
|
|
961
|
-
return r.hasOwnProperty("members") ?
|
|
992
|
+
let i = null;
|
|
993
|
+
return r.hasOwnProperty("members") ? i = new ve() : r.hasOwnProperty("effectiveLevel") ? i = new me() : i = new y(), Object.assign(i, r), i;
|
|
962
994
|
}
|
|
963
995
|
configureLogLevel(e, t, r) {
|
|
964
996
|
return this.serviceProxy.invoke("configureLogLevel", [t, r], e);
|
|
965
997
|
}
|
|
966
998
|
}
|
|
967
|
-
const
|
|
968
|
-
class H extends
|
|
999
|
+
const Ue = new Se();
|
|
1000
|
+
class H extends v {
|
|
969
1001
|
constructor(e) {
|
|
970
1002
|
super(e), Object.setPrototypeOf(this, H.prototype);
|
|
971
1003
|
}
|
|
972
1004
|
}
|
|
973
|
-
class L extends
|
|
1005
|
+
class L extends v {
|
|
974
1006
|
constructor(e) {
|
|
975
1007
|
super(e), Object.setPrototypeOf(this, L.prototype);
|
|
976
1008
|
}
|
|
@@ -985,8 +1017,8 @@ class je {
|
|
|
985
1017
|
tenantId;
|
|
986
1018
|
metadata;
|
|
987
1019
|
roles;
|
|
988
|
-
constructor(e, t, r,
|
|
989
|
-
this.id = e, this.tenantId = t, this.metadata = r || /* @__PURE__ */ new Map(), this.roles =
|
|
1020
|
+
constructor(e, t, r, i) {
|
|
1021
|
+
this.id = e, this.tenantId = t, this.metadata = r || /* @__PURE__ */ new Map(), this.roles = i || [];
|
|
990
1022
|
}
|
|
991
1023
|
}
|
|
992
1024
|
class Je {
|
|
@@ -1009,7 +1041,7 @@ class Xe {
|
|
|
1009
1041
|
return this.value !== null && this.value !== void 0;
|
|
1010
1042
|
}
|
|
1011
1043
|
}
|
|
1012
|
-
class We extends
|
|
1044
|
+
class We extends T {
|
|
1013
1045
|
pageFunction;
|
|
1014
1046
|
constructor(e, t, r) {
|
|
1015
1047
|
super(e, t), this.pageFunction = r;
|
|
@@ -1039,7 +1071,7 @@ class M {
|
|
|
1039
1071
|
* @param sort the sorting parameters (optional).
|
|
1040
1072
|
*/
|
|
1041
1073
|
static create(e, t, r) {
|
|
1042
|
-
return new
|
|
1074
|
+
return new _e(e, t, r);
|
|
1043
1075
|
}
|
|
1044
1076
|
/**
|
|
1045
1077
|
* Creates a {@link Pageable} that uses Cursor based pagination.
|
|
@@ -1048,10 +1080,10 @@ class M {
|
|
|
1048
1080
|
* @param sort the sorting parameters (optional).
|
|
1049
1081
|
*/
|
|
1050
1082
|
static createWithCursor(e, t, r) {
|
|
1051
|
-
return new
|
|
1083
|
+
return new Te(e, t, r);
|
|
1052
1084
|
}
|
|
1053
1085
|
}
|
|
1054
|
-
class
|
|
1086
|
+
class _e extends M {
|
|
1055
1087
|
/**
|
|
1056
1088
|
* Returns the page to be returned.
|
|
1057
1089
|
*/
|
|
@@ -1066,7 +1098,7 @@ class Te extends M {
|
|
|
1066
1098
|
super(), this.pageNumber = e, this.pageSize = t, this.sort = r;
|
|
1067
1099
|
}
|
|
1068
1100
|
}
|
|
1069
|
-
class
|
|
1101
|
+
class Te extends M {
|
|
1070
1102
|
/**
|
|
1071
1103
|
* The cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
1072
1104
|
*/
|
|
@@ -1106,21 +1138,21 @@ class ze {
|
|
|
1106
1138
|
orders = [];
|
|
1107
1139
|
}
|
|
1108
1140
|
export {
|
|
1109
|
-
|
|
1141
|
+
T as AbstractIterablePage,
|
|
1110
1142
|
H as AuthenticationError,
|
|
1111
1143
|
L as AuthorizationError,
|
|
1112
|
-
|
|
1144
|
+
_ as CONTEXT_METADATA_KEY,
|
|
1113
1145
|
Le as ConnectHeaders,
|
|
1114
1146
|
Ve as ConnectedInfo,
|
|
1115
1147
|
Me as ConnectionInfo,
|
|
1116
|
-
|
|
1148
|
+
Fe as Context,
|
|
1117
1149
|
D as Continuum,
|
|
1118
1150
|
f as ContinuumContextStack,
|
|
1119
|
-
|
|
1151
|
+
v as ContinuumError,
|
|
1120
1152
|
fe as ContinuumSingleton,
|
|
1121
1153
|
pe as CrudServiceProxy,
|
|
1122
1154
|
de as CrudServiceProxyFactory,
|
|
1123
|
-
|
|
1155
|
+
Te as CursorPageable,
|
|
1124
1156
|
Ge as DataSourceUtils,
|
|
1125
1157
|
E as DefaultCRI,
|
|
1126
1158
|
ye as Direction,
|
|
@@ -1128,29 +1160,29 @@ export {
|
|
|
1128
1160
|
Z as EventBus,
|
|
1129
1161
|
o as EventConstants,
|
|
1130
1162
|
We as FunctionalIterablePage,
|
|
1131
|
-
|
|
1163
|
+
ve as GroupLoggerLevelsDescriptor,
|
|
1132
1164
|
oe as JsonEventFactory,
|
|
1133
1165
|
ge as LogLevel,
|
|
1134
1166
|
Se as LogManager,
|
|
1135
1167
|
y as LoggerLevelsDescriptor,
|
|
1136
|
-
|
|
1168
|
+
Ye as LoggersDescriptor,
|
|
1137
1169
|
be as NullHandling,
|
|
1138
|
-
|
|
1170
|
+
_e as OffsetPageable,
|
|
1139
1171
|
Ke as Order,
|
|
1140
1172
|
M as Pageable,
|
|
1141
1173
|
je as Participant,
|
|
1142
1174
|
Je as ParticipantConstants,
|
|
1143
|
-
|
|
1175
|
+
$e as Publish,
|
|
1144
1176
|
ke as Scope,
|
|
1145
|
-
|
|
1177
|
+
N as ServerInfo,
|
|
1146
1178
|
ce as ServiceRegistry,
|
|
1147
|
-
|
|
1179
|
+
me as SingleLoggerLevelsDescriptor,
|
|
1148
1180
|
ze as Sort,
|
|
1149
1181
|
Xe as StreamData,
|
|
1150
1182
|
Re as StreamOperation,
|
|
1151
|
-
|
|
1183
|
+
qe as TextEventFactory,
|
|
1152
1184
|
Be as Version,
|
|
1153
|
-
|
|
1154
|
-
|
|
1185
|
+
w as createCRI,
|
|
1186
|
+
Ue as logManager
|
|
1155
1187
|
};
|
|
1156
1188
|
//# sourceMappingURL=continuum.js.map
|