@mindignited/continuum-client 3.0.0-beta.0 → 3.0.0-beta.2
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.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RxStomp as k } from "@stomp/rx-stomp";
|
|
2
2
|
import { ReconnectionTimeMode as B } from "@stomp/stompjs";
|
|
3
3
|
import { v4 as S } from "uuid";
|
|
4
|
-
import
|
|
5
|
-
import b, { propagation as
|
|
6
|
-
import { Subject as A, firstValueFrom as
|
|
4
|
+
import C from "debug";
|
|
5
|
+
import b, { propagation as $, context as q, SpanKind as F, SpanStatusCode as U } from "@opentelemetry/api";
|
|
6
|
+
import { Subject as A, firstValueFrom as Y, 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 N } 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 {
|
|
@@ -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,7 +53,7 @@ class z {
|
|
|
53
53
|
JITTER_MAX = 5e3;
|
|
54
54
|
connectionAttempts = 0;
|
|
55
55
|
initialConnectionSuccessful = !1;
|
|
56
|
-
debugLogger =
|
|
56
|
+
debugLogger = C("continuum:stomp");
|
|
57
57
|
replyToId = S();
|
|
58
58
|
replyToCri = o.SERVICE_DESTINATION_PREFIX + this.replyToId + ":" + S() + "@continuum.js.EventBus/replyHandler";
|
|
59
59
|
deactivationHandler = null;
|
|
@@ -158,12 +158,12 @@ class z {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
class
|
|
161
|
+
class g {
|
|
162
162
|
cri;
|
|
163
163
|
headers;
|
|
164
164
|
data;
|
|
165
165
|
constructor(e, t, r) {
|
|
166
|
-
this.cri = e, t !== void 0 ? this.headers = t : this.headers = /* @__PURE__ */ new Map(), this.data =
|
|
166
|
+
this.cri = e, t !== void 0 ? this.headers = t : this.headers = /* @__PURE__ */ new Map(), this.data = N.ofNullable(r);
|
|
167
167
|
}
|
|
168
168
|
getHeader(e) {
|
|
169
169
|
return this.headers.get(e);
|
|
@@ -179,7 +179,7 @@ class v {
|
|
|
179
179
|
}
|
|
180
180
|
setDataString(e) {
|
|
181
181
|
const t = new TextEncoder().encode(e);
|
|
182
|
-
this.data =
|
|
182
|
+
this.data = N.ofNonNull(t);
|
|
183
183
|
}
|
|
184
184
|
getDataString() {
|
|
185
185
|
let e = "";
|
|
@@ -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 v(e.headers.message)))), this.stompConnectionManager.deactivationHandler = () => {
|
|
203
203
|
this.cleanup();
|
|
204
204
|
};
|
|
205
205
|
}
|
|
@@ -227,7 +227,7 @@ class Z {
|
|
|
227
227
|
for (const [i, n] of e.headers.entries())
|
|
228
228
|
t[i] = n;
|
|
229
229
|
const r = {};
|
|
230
|
-
|
|
230
|
+
$.inject(q.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,
|
|
232
232
|
headers: t,
|
|
233
233
|
binaryBody: e.data.orUndefined()
|
|
@@ -236,10 +236,10 @@ class Z {
|
|
|
236
236
|
throw this.createSendUnavailableError();
|
|
237
237
|
}
|
|
238
238
|
request(e) {
|
|
239
|
-
return
|
|
239
|
+
return Y(this.requestStream(e, !1));
|
|
240
240
|
}
|
|
241
241
|
requestStream(e, t = !0) {
|
|
242
|
-
return this.stompConnectionManager?.rxStomp ? new
|
|
242
|
+
return this.stompConnectionManager?.rxStomp ? new V((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
244
|
let i = !1;
|
|
245
245
|
const n = S(), c = this.requestRepliesObservable.pipe(X((a) => a.headers.get(o.CORRELATION_ID_HEADER) === n)).subscribe({
|
|
@@ -260,11 +260,11 @@ class Z {
|
|
|
260
260
|
});
|
|
261
261
|
return r.add(c), e.setHeader(o.REPLY_TO_HEADER, this.replyToCri), e.setHeader(o.CORRELATION_ID_HEADER, n), this.send(e), () => {
|
|
262
262
|
if (t && !i) {
|
|
263
|
-
const a = new
|
|
263
|
+
const a = new g(e.cri);
|
|
264
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
|
+
}) : j(() => this.createSendUnavailableError());
|
|
268
268
|
}
|
|
269
269
|
listen(e) {
|
|
270
270
|
return Promise.reject("Not implemented");
|
|
@@ -289,13 +289,15 @@ class Z {
|
|
|
289
289
|
* @return the cold {@link Observable<IEvent>} for the given destination
|
|
290
290
|
*/
|
|
291
291
|
_observe(e) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
292
|
+
if (this.stompConnectionManager?.rxStomp)
|
|
293
|
+
return this.stompConnectionManager.rxStomp.watch(e).pipe(R((t) => {
|
|
294
|
+
const r = /* @__PURE__ */ new Map();
|
|
295
|
+
let i = "";
|
|
296
|
+
for (const n of Object.keys(t.headers))
|
|
297
|
+
n === "destination" ? i = t.headers[n] : r.set(n, t.headers[n]);
|
|
298
|
+
return new g(i, r, t.binaryBody);
|
|
299
|
+
}));
|
|
300
|
+
throw this.createSendUnavailableError();
|
|
299
301
|
}
|
|
300
302
|
}
|
|
301
303
|
class E {
|
|
@@ -414,7 +416,7 @@ class O {
|
|
|
414
416
|
if (t)
|
|
415
417
|
for (const [c, a] of t)
|
|
416
418
|
n.set(c, a);
|
|
417
|
-
return new
|
|
419
|
+
return new g(i, n, r || void 0);
|
|
418
420
|
}
|
|
419
421
|
}
|
|
420
422
|
class ee {
|
|
@@ -488,13 +490,13 @@ function Be(s) {
|
|
|
488
490
|
Reflect.defineMetadata(x, s, e);
|
|
489
491
|
};
|
|
490
492
|
}
|
|
491
|
-
function
|
|
493
|
+
function $e() {
|
|
492
494
|
return function(s, e, t) {
|
|
493
495
|
const r = Reflect.getMetadata(_, s, e) || [];
|
|
494
496
|
r.push(t), Reflect.defineMetadata(_, r, s, e);
|
|
495
497
|
};
|
|
496
498
|
}
|
|
497
|
-
function
|
|
499
|
+
function qe(s, e) {
|
|
498
500
|
return function(t) {
|
|
499
501
|
const r = t, i = new re(s, e || t.name), n = Reflect.getMetadata(x, t);
|
|
500
502
|
n && (i.version = n);
|
|
@@ -635,18 +637,18 @@ class se {
|
|
|
635
637
|
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);
|
|
636
638
|
}
|
|
637
639
|
}
|
|
638
|
-
const ie = "3.0.0-beta.
|
|
640
|
+
const ie = "3.0.0-beta.2", ne = {
|
|
639
641
|
version: ie
|
|
640
642
|
};
|
|
641
643
|
class oe {
|
|
642
644
|
create(e, t) {
|
|
643
|
-
const r = new
|
|
645
|
+
const r = new g(e);
|
|
644
646
|
return r.setHeader(o.CONTENT_TYPE_HEADER, o.CONTENT_JSON), t != null && r.setDataString(JSON.stringify(t)), r;
|
|
645
647
|
}
|
|
646
648
|
}
|
|
647
|
-
class
|
|
649
|
+
class Fe {
|
|
648
650
|
create(e, t) {
|
|
649
|
-
const r = new
|
|
651
|
+
const r = new g(e);
|
|
650
652
|
if (r.setHeader(o.CONTENT_TYPE_HEADER, o.CONTENT_TEXT), t != null) {
|
|
651
653
|
let i = "", n = 0;
|
|
652
654
|
for (const c of t)
|
|
@@ -661,6 +663,7 @@ class ce {
|
|
|
661
663
|
_eventBus;
|
|
662
664
|
supervisors = /* @__PURE__ */ new Map();
|
|
663
665
|
contextInterceptor = null;
|
|
666
|
+
debugLogger = C("continuum:serviceRegistry");
|
|
664
667
|
constructor(e) {
|
|
665
668
|
this._eventBus = e;
|
|
666
669
|
}
|
|
@@ -678,6 +681,7 @@ class ce {
|
|
|
678
681
|
register(e, t) {
|
|
679
682
|
const r = e.cri().raw();
|
|
680
683
|
if (!this.supervisors.has(r)) {
|
|
684
|
+
this.debugLogger(`Registering service for CRI: ${r}`);
|
|
681
685
|
const i = new se(
|
|
682
686
|
e,
|
|
683
687
|
t,
|
|
@@ -689,7 +693,7 @@ class ce {
|
|
|
689
693
|
}
|
|
690
694
|
unRegister(e) {
|
|
691
695
|
const t = e.cri().raw(), r = this.supervisors.get(t);
|
|
692
|
-
r && (r.stop(), this.supervisors.delete(t));
|
|
696
|
+
r && (this.debugLogger(`Unregistering service for CRI: ${t}`), r.stop(), this.supervisors.delete(t));
|
|
693
697
|
}
|
|
694
698
|
registerContextInterceptor(e) {
|
|
695
699
|
this.contextInterceptor = e;
|
|
@@ -712,12 +716,12 @@ class ue {
|
|
|
712
716
|
return this.tracer.startActiveSpan(
|
|
713
717
|
`${this.serviceIdentifier}/${e}`,
|
|
714
718
|
{
|
|
715
|
-
kind:
|
|
719
|
+
kind: F.CLIENT
|
|
716
720
|
},
|
|
717
721
|
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
722
|
async (c) => (n.end(), c),
|
|
719
723
|
async (c) => {
|
|
720
|
-
throw n.recordException(c), n.setStatus({ code:
|
|
724
|
+
throw n.recordException(c), n.setStatus({ code: U.ERROR }), n.end(), c;
|
|
721
725
|
}
|
|
722
726
|
))
|
|
723
727
|
);
|
|
@@ -747,7 +751,7 @@ class ue {
|
|
|
747
751
|
}));
|
|
748
752
|
}
|
|
749
753
|
}
|
|
750
|
-
class
|
|
754
|
+
class y {
|
|
751
755
|
pageable;
|
|
752
756
|
currentPage;
|
|
753
757
|
firstPage = !0;
|
|
@@ -792,7 +796,7 @@ class T {
|
|
|
792
796
|
return this.currentPage.content;
|
|
793
797
|
}
|
|
794
798
|
}
|
|
795
|
-
class le extends
|
|
799
|
+
class le extends y {
|
|
796
800
|
crudServiceProxy;
|
|
797
801
|
constructor(e, t, r) {
|
|
798
802
|
super(e, t), this.crudServiceProxy = r;
|
|
@@ -801,7 +805,7 @@ class le extends T {
|
|
|
801
805
|
return this.crudServiceProxy.findAllSinglePage(e);
|
|
802
806
|
}
|
|
803
807
|
}
|
|
804
|
-
class he extends
|
|
808
|
+
class he extends y {
|
|
805
809
|
searchText;
|
|
806
810
|
crudServiceProxy;
|
|
807
811
|
constructor(e, t, r, i) {
|
|
@@ -957,14 +961,14 @@ class fe {
|
|
|
957
961
|
}
|
|
958
962
|
}
|
|
959
963
|
const D = new fe();
|
|
960
|
-
var
|
|
961
|
-
class
|
|
964
|
+
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 || {});
|
|
965
|
+
class T {
|
|
962
966
|
configuredLevel;
|
|
963
967
|
}
|
|
964
|
-
class
|
|
968
|
+
class ve extends T {
|
|
965
969
|
members = [];
|
|
966
970
|
}
|
|
967
|
-
class me extends
|
|
971
|
+
class me extends T {
|
|
968
972
|
effectiveLevel;
|
|
969
973
|
}
|
|
970
974
|
class Ue {
|
|
@@ -983,19 +987,19 @@ class Se {
|
|
|
983
987
|
async loggerLevels(e, t) {
|
|
984
988
|
const r = await this.serviceProxy.invoke("loggerLevels", [t], e);
|
|
985
989
|
let i = null;
|
|
986
|
-
return r.hasOwnProperty("members") ? i = new
|
|
990
|
+
return r.hasOwnProperty("members") ? i = new ve() : r.hasOwnProperty("effectiveLevel") ? i = new me() : i = new T(), Object.assign(i, r), i;
|
|
987
991
|
}
|
|
988
992
|
configureLogLevel(e, t, r) {
|
|
989
993
|
return this.serviceProxy.invoke("configureLogLevel", [t, r], e);
|
|
990
994
|
}
|
|
991
995
|
}
|
|
992
996
|
const Ye = new Se();
|
|
993
|
-
class H extends
|
|
997
|
+
class H extends v {
|
|
994
998
|
constructor(e) {
|
|
995
999
|
super(e), Object.setPrototypeOf(this, H.prototype);
|
|
996
1000
|
}
|
|
997
1001
|
}
|
|
998
|
-
class L extends
|
|
1002
|
+
class L extends v {
|
|
999
1003
|
constructor(e) {
|
|
1000
1004
|
super(e), Object.setPrototypeOf(this, L.prototype);
|
|
1001
1005
|
}
|
|
@@ -1034,7 +1038,7 @@ class Xe {
|
|
|
1034
1038
|
return this.value !== null && this.value !== void 0;
|
|
1035
1039
|
}
|
|
1036
1040
|
}
|
|
1037
|
-
class We extends
|
|
1041
|
+
class We extends y {
|
|
1038
1042
|
pageFunction;
|
|
1039
1043
|
constructor(e, t, r) {
|
|
1040
1044
|
super(e, t), this.pageFunction = r;
|
|
@@ -1073,7 +1077,7 @@ class M {
|
|
|
1073
1077
|
* @param sort the sorting parameters (optional).
|
|
1074
1078
|
*/
|
|
1075
1079
|
static createWithCursor(e, t, r) {
|
|
1076
|
-
return new
|
|
1080
|
+
return new ye(e, t, r);
|
|
1077
1081
|
}
|
|
1078
1082
|
}
|
|
1079
1083
|
class _e extends M {
|
|
@@ -1091,7 +1095,7 @@ class _e extends M {
|
|
|
1091
1095
|
super(), this.pageNumber = e, this.pageSize = t, this.sort = r;
|
|
1092
1096
|
}
|
|
1093
1097
|
}
|
|
1094
|
-
class
|
|
1098
|
+
class ye extends M {
|
|
1095
1099
|
/**
|
|
1096
1100
|
* The cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
1097
1101
|
*/
|
|
@@ -1106,7 +1110,7 @@ class Te extends M {
|
|
|
1106
1110
|
super(), this.cursor = e, this.pageSize = t, this.sort = r;
|
|
1107
1111
|
}
|
|
1108
1112
|
}
|
|
1109
|
-
var
|
|
1113
|
+
var Te = /* @__PURE__ */ ((s) => (s.ASC = "ASC", s.DESC = "DESC", s))(Te || {}), be = /* @__PURE__ */ ((s) => (s.NATIVE = "NATIVE", s.NULLS_FIRST = "NULLS_FIRST", s.NULLS_LAST = "NULLS_LAST", s))(be || {});
|
|
1110
1114
|
class Ke {
|
|
1111
1115
|
property;
|
|
1112
1116
|
direction = "ASC";
|
|
@@ -1131,33 +1135,33 @@ class ze {
|
|
|
1131
1135
|
orders = [];
|
|
1132
1136
|
}
|
|
1133
1137
|
export {
|
|
1134
|
-
|
|
1138
|
+
y as AbstractIterablePage,
|
|
1135
1139
|
H as AuthenticationError,
|
|
1136
1140
|
L as AuthorizationError,
|
|
1137
1141
|
_ as CONTEXT_METADATA_KEY,
|
|
1138
1142
|
Le as ConnectHeaders,
|
|
1139
1143
|
Ve as ConnectedInfo,
|
|
1140
1144
|
Me as ConnectionInfo,
|
|
1141
|
-
|
|
1145
|
+
$e as Context,
|
|
1142
1146
|
D as Continuum,
|
|
1143
1147
|
f as ContinuumContextStack,
|
|
1144
|
-
|
|
1148
|
+
v as ContinuumError,
|
|
1145
1149
|
fe as ContinuumSingleton,
|
|
1146
1150
|
pe as CrudServiceProxy,
|
|
1147
1151
|
de as CrudServiceProxyFactory,
|
|
1148
|
-
|
|
1152
|
+
ye as CursorPageable,
|
|
1149
1153
|
Ge as DataSourceUtils,
|
|
1150
1154
|
E as DefaultCRI,
|
|
1151
|
-
|
|
1152
|
-
|
|
1155
|
+
Te as Direction,
|
|
1156
|
+
g as Event,
|
|
1153
1157
|
Z as EventBus,
|
|
1154
1158
|
o as EventConstants,
|
|
1155
1159
|
We as FunctionalIterablePage,
|
|
1156
|
-
|
|
1160
|
+
ve as GroupLoggerLevelsDescriptor,
|
|
1157
1161
|
oe as JsonEventFactory,
|
|
1158
|
-
|
|
1162
|
+
ge as LogLevel,
|
|
1159
1163
|
Se as LogManager,
|
|
1160
|
-
|
|
1164
|
+
T as LoggerLevelsDescriptor,
|
|
1161
1165
|
Ue as LoggersDescriptor,
|
|
1162
1166
|
be as NullHandling,
|
|
1163
1167
|
_e as OffsetPageable,
|
|
@@ -1165,7 +1169,7 @@ export {
|
|
|
1165
1169
|
M as Pageable,
|
|
1166
1170
|
je as Participant,
|
|
1167
1171
|
Je as ParticipantConstants,
|
|
1168
|
-
|
|
1172
|
+
qe as Publish,
|
|
1169
1173
|
ke as Scope,
|
|
1170
1174
|
w as ServerInfo,
|
|
1171
1175
|
ce as ServiceRegistry,
|
|
@@ -1173,7 +1177,7 @@ export {
|
|
|
1173
1177
|
ze as Sort,
|
|
1174
1178
|
Xe as StreamData,
|
|
1175
1179
|
Re as StreamOperation,
|
|
1176
|
-
|
|
1180
|
+
Fe as TextEventFactory,
|
|
1177
1181
|
Be as Version,
|
|
1178
1182
|
I as createCRI,
|
|
1179
1183
|
Ye as logManager
|