@mindignited/continuum-client 3.0.0-beta.1 → 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,21 +1,21 @@
1
- import { RxStomp as B } from "@stomp/rx-stomp";
2
- import { ReconnectionTimeMode as $ } from "@stomp/stompjs";
1
+ import { RxStomp as k } from "@stomp/rx-stomp";
2
+ import { ReconnectionTimeMode as B } from "@stomp/stompjs";
3
3
  import { v4 as S } from "uuid";
4
- import w from "debug";
5
- import b, { propagation as q, context as F, SpanKind as U, SpanStatusCode as Y } from "@opentelemetry/api";
6
- import { Subject as A, firstValueFrom as V, Observable as j, throwError as N } from "rxjs";
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 C } from "typescript-optional";
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 {
12
12
  }
13
- class I {
13
+ class w {
14
14
  host;
15
15
  port;
16
16
  useSSL;
17
17
  }
18
- class Me extends I {
18
+ class Me extends w {
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.
@@ -53,7 +53,7 @@ class z {
53
53
  JITTER_MAX = 5e3;
54
54
  connectionAttempts = 0;
55
55
  initialConnectionSuccessful = !1;
56
- debugLogger = w("continuum:stomp");
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;
@@ -85,7 +85,7 @@ class z {
85
85
  }
86
86
  this.connectionAttempts = 0, this.initialConnectionSuccessful = !1, this.lastWebsocketError = null, this.maxConnectionAttemptsReached = !1;
87
87
  const i = "ws" + (e.useSSL ? "s" : "") + "://" + e.host + (e.port ? ":" + e.port : "") + "/v1";
88
- this.rxStomp = new B();
88
+ this.rxStomp = new k();
89
89
  let n = typeof e.connectHeaders != "function" && e.connectHeaders != null ? e.connectHeaders : {};
90
90
  const c = {
91
91
  brokerURL: i,
@@ -113,7 +113,7 @@ class z {
113
113
  };
114
114
  this.debugLogger.enabled && (c.debug = (u) => {
115
115
  this.debugLogger(u);
116
- }), this.rxStomp.configure(c), this.rxStomp.stompClient.maxReconnectDelay = this.MAX_RECONNECT_DELAY, this.rxStomp.stompClient.reconnectTimeMode = $.EXPONENTIAL, this.rxStomp.webSocketErrors$.subscribe((u) => {
116
+ }), this.rxStomp.configure(c), this.rxStomp.stompClient.maxReconnectDelay = this.MAX_RECONNECT_DELAY, this.rxStomp.stompClient.reconnectTimeMode = B.EXPONENTIAL, this.rxStomp.webSocketErrors$.subscribe((u) => {
117
117
  this.lastWebsocketError = u;
118
118
  });
119
119
  const a = this.rxStomp.connected$.subscribe(() => {
@@ -163,7 +163,7 @@ class g {
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 = C.ofNullable(r);
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 g {
179
179
  }
180
180
  setDataString(e) {
181
181
  const t = new TextEncoder().encode(e);
182
- this.data = C.ofNonNull(t);
182
+ this.data = N.ofNonNull(t);
183
183
  }
184
184
  getDataString() {
185
185
  let e = "";
@@ -215,7 +215,7 @@ class Z {
215
215
  {
216
216
  this.cleanup();
217
217
  const t = await this.stompConnectionManager.activate(e);
218
- return this.serverInfo = new I(), 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;
218
+ return this.serverInfo = new w(), 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
219
  }
220
220
  }
221
221
  async disconnect(e) {
@@ -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
- q.inject(F.active(), r), r.traceparent && (t[o.TRACEPARENT_HEADER] = r.traceparent), r.tracestate && (t[o.TRACESTATE_HEADER] = r.tracestate), this.stompConnectionManager.rxStomp.publish({
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 V(this.requestStream(e, !1));
239
+ return Y(this.requestStream(e, !1));
240
240
  }
241
241
  requestStream(e, t = !0) {
242
- return this.stompConnectionManager?.rxStomp ? new j((r) => {
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({
@@ -264,7 +264,7 @@ class Z {
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
- }) : N(() => this.createSendUnavailableError());
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
- return this.stompConnectionManager?.rxStomp ? this.stompConnectionManager.rxStomp.watch(e).pipe(R((t) => {
293
- const r = /* @__PURE__ */ new Map();
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 g(i, r, t.binaryBody);
298
- })) : N(() => this.createSendUnavailableError());
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 {
@@ -381,7 +383,7 @@ class E {
381
383
  return t && (c += `${t}@`), c += r, i && (c += `/${i}`), n && (c += `#${n}`), c;
382
384
  }
383
385
  }
384
- function O(...s) {
386
+ function I(...s) {
385
387
  if (s.length === 1) return new E(s[0]);
386
388
  if (s.length === 2) return new E(s[0], null, s[1], null, null);
387
389
  if (s.length === 3) return new E(s[0], s[1], s[2], null, null);
@@ -401,7 +403,7 @@ class Q {
401
403
  return t != null && t !== "" && t === "application/json";
402
404
  }
403
405
  }
404
- class P {
406
+ class O {
405
407
  static createReplyEvent(e, t, r) {
406
408
  if (!e)
407
409
  throw new Error("incomingHeaders cannot be null");
@@ -419,7 +421,7 @@ class P {
419
421
  }
420
422
  class ee {
421
423
  convert(e, t) {
422
- return P.createReplyEvent(
424
+ return O.createReplyEvent(
423
425
  e,
424
426
  /* @__PURE__ */ new Map([[o.CONTENT_TYPE_HEADER, "application/json"]]),
425
427
  new TextEncoder().encode(JSON.stringify(t))
@@ -463,7 +465,7 @@ class re {
463
465
  * @return the cri for this {@link ServiceIdentifier}
464
466
  */
465
467
  cri() {
466
- return this._cri == null && (this._cri = O(
468
+ return this._cri == null && (this._cri = I(
467
469
  o.SERVICE_DESTINATION_SCHEME,
468
470
  // scheme
469
471
  this.scope || null,
@@ -477,15 +479,15 @@ class re {
477
479
  )), this._cri;
478
480
  }
479
481
  }
480
- const x = /* @__PURE__ */ Symbol("scope"), D = /* @__PURE__ */ Symbol("version"), _ = /* @__PURE__ */ Symbol("context");
482
+ const P = /* @__PURE__ */ Symbol("scope"), x = /* @__PURE__ */ Symbol("version"), _ = /* @__PURE__ */ Symbol("context");
481
483
  function ke(s, e, t) {
482
- Reflect.defineMetadata(x, e, s);
484
+ Reflect.defineMetadata(P, e, s);
483
485
  }
484
486
  function Be(s) {
485
487
  if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9]+)?$/.test(s))
486
488
  throw new Error(`Invalid semantic version: ${s}. Must follow X.Y.Z[-optional] format.`);
487
489
  return function(e) {
488
- Reflect.defineMetadata(D, s, e);
490
+ Reflect.defineMetadata(x, s, e);
489
491
  };
490
492
  }
491
493
  function $e() {
@@ -496,15 +498,15 @@ function $e() {
496
498
  }
497
499
  function qe(s, e) {
498
500
  return function(t) {
499
- const r = t, i = new re(s, e || t.name), n = Reflect.getMetadata(D, t);
501
+ const r = t, i = new re(s, e || t.name), n = Reflect.getMetadata(x, t);
500
502
  n && (i.version = n);
501
503
  const c = function(...a) {
502
- const h = Reflect.construct(r, a), p = Reflect.getMetadata(x, t.prototype);
504
+ const h = Reflect.construct(r, a), p = Reflect.getMetadata(P, t.prototype);
503
505
  if (p) {
504
506
  const u = h[p];
505
507
  i.scope = typeof u == "function" ? u.call(h) : u;
506
508
  }
507
- return H.serviceRegistry.register(i, h), h;
509
+ return D.serviceRegistry.register(i, h), h;
508
510
  };
509
511
  return c.prototype = r.prototype, c;
510
512
  };
@@ -584,7 +586,7 @@ class se {
584
586
  this.log.trace(`Processing control event for correlationId: ${t}`);
585
587
  }
586
588
  async processInvocationRequest(e) {
587
- const t = O(e.cri).path();
589
+ const t = I(e.cri).path();
588
590
  if (!t)
589
591
  throw new Error("The methodId must not be blank");
590
592
  const r = this.methodMap[t];
@@ -620,7 +622,7 @@ class se {
620
622
  this._eventBus.send(r);
621
623
  }
622
624
  handleException(e, t) {
623
- const r = P.createReplyEvent(
625
+ const r = O.createReplyEvent(
624
626
  e.headers,
625
627
  /* @__PURE__ */ new Map([
626
628
  [o.ERROR_HEADER, t.message || "Unknown error"],
@@ -635,7 +637,7 @@ 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.1", ne = {
640
+ const ie = "3.0.0-beta.2", ne = {
639
641
  version: ie
640
642
  };
641
643
  class oe {
@@ -661,7 +663,7 @@ class ce {
661
663
  _eventBus;
662
664
  supervisors = /* @__PURE__ */ new Map();
663
665
  contextInterceptor = null;
664
- debugLogger = w("continuum:serviceRegistry");
666
+ debugLogger = C("continuum:serviceRegistry");
665
667
  constructor(e) {
666
668
  this._eventBus = e;
667
669
  }
@@ -714,12 +716,12 @@ class ue {
714
716
  return this.tracer.startActiveSpan(
715
717
  `${this.serviceIdentifier}/${e}`,
716
718
  {
717
- kind: U.CLIENT
719
+ kind: F.CLIENT
718
720
  },
719
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(
720
722
  async (c) => (n.end(), c),
721
723
  async (c) => {
722
- throw n.recordException(c), n.setStatus({ code: Y.ERROR }), n.end(), c;
724
+ throw n.recordException(c), n.setStatus({ code: U.ERROR }), n.end(), c;
723
725
  }
724
726
  ))
725
727
  );
@@ -958,7 +960,7 @@ class fe {
958
960
  return i;
959
961
  }
960
962
  }
961
- const H = new fe();
963
+ const D = new fe();
962
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 || {});
963
965
  class T {
964
966
  configuredLevel;
@@ -977,7 +979,7 @@ class Ue {
977
979
  class Se {
978
980
  serviceProxy;
979
981
  constructor() {
980
- this.serviceProxy = H.serviceProxy("org.kinotic.continuum.api.log.LogManager");
982
+ this.serviceProxy = D.serviceProxy("org.kinotic.continuum.api.log.LogManager");
981
983
  }
982
984
  loggers(e) {
983
985
  return this.serviceProxy.invoke("loggers", null, e);
@@ -992,14 +994,14 @@ class Se {
992
994
  }
993
995
  }
994
996
  const Ye = new Se();
995
- class L extends v {
997
+ class H extends v {
996
998
  constructor(e) {
997
- super(e), Object.setPrototypeOf(this, L.prototype);
999
+ super(e), Object.setPrototypeOf(this, H.prototype);
998
1000
  }
999
1001
  }
1000
- class M extends v {
1002
+ class L extends v {
1001
1003
  constructor(e) {
1002
- super(e), Object.setPrototypeOf(this, M.prototype);
1004
+ super(e), Object.setPrototypeOf(this, L.prototype);
1003
1005
  }
1004
1006
  }
1005
1007
  class Ve {
@@ -1050,7 +1052,7 @@ class Ge {
1050
1052
  return "create" in e;
1051
1053
  }
1052
1054
  }
1053
- class k {
1055
+ class M {
1054
1056
  /**
1055
1057
  * Returns the sorting parameters (optional).
1056
1058
  */
@@ -1078,7 +1080,7 @@ class k {
1078
1080
  return new ye(e, t, r);
1079
1081
  }
1080
1082
  }
1081
- class _e extends k {
1083
+ class _e extends M {
1082
1084
  /**
1083
1085
  * Returns the page to be returned.
1084
1086
  */
@@ -1093,7 +1095,7 @@ class _e extends k {
1093
1095
  super(), this.pageNumber = e, this.pageSize = t, this.sort = r;
1094
1096
  }
1095
1097
  }
1096
- class ye extends k {
1098
+ class ye extends M {
1097
1099
  /**
1098
1100
  * The cursor to be used for subsequent retrieval of data, or null if this is the first page.
1099
1101
  */
@@ -1134,14 +1136,14 @@ class ze {
1134
1136
  }
1135
1137
  export {
1136
1138
  y as AbstractIterablePage,
1137
- L as AuthenticationError,
1138
- M as AuthorizationError,
1139
+ H as AuthenticationError,
1140
+ L as AuthorizationError,
1139
1141
  _ as CONTEXT_METADATA_KEY,
1140
1142
  Le as ConnectHeaders,
1141
1143
  Ve as ConnectedInfo,
1142
1144
  Me as ConnectionInfo,
1143
1145
  $e as Context,
1144
- H as Continuum,
1146
+ D as Continuum,
1145
1147
  f as ContinuumContextStack,
1146
1148
  v as ContinuumError,
1147
1149
  fe as ContinuumSingleton,
@@ -1164,12 +1166,12 @@ export {
1164
1166
  be as NullHandling,
1165
1167
  _e as OffsetPageable,
1166
1168
  Ke as Order,
1167
- k as Pageable,
1169
+ M as Pageable,
1168
1170
  je as Participant,
1169
1171
  Je as ParticipantConstants,
1170
1172
  qe as Publish,
1171
1173
  ke as Scope,
1172
- I as ServerInfo,
1174
+ w as ServerInfo,
1173
1175
  ce as ServiceRegistry,
1174
1176
  me as SingleLoggerLevelsDescriptor,
1175
1177
  ze as Sort,
@@ -1177,7 +1179,7 @@ export {
1177
1179
  Re as StreamOperation,
1178
1180
  Fe as TextEventFactory,
1179
1181
  Be as Version,
1180
- O as createCRI,
1182
+ I as createCRI,
1181
1183
  Ye as logManager
1182
1184
  };
1183
1185
  //# sourceMappingURL=continuum.js.map