@vitia.ai/secure-api-client-vue 0.1.2 → 0.1.4

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/index.mjs CHANGED
@@ -2742,22 +2742,22 @@ class Ms {
2742
2742
  if (!(this.ws && (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING))) {
2743
2743
  if (this._connectPromise) return this._connectPromise;
2744
2744
  this._connectPromise = (async () => {
2745
- const { url: t } = await this.client.get("/url/notifications");
2746
- this.ws = new WebSocket(t), this.ws.onopen = () => {
2745
+ const { ans: t } = await this.client.get("/url/notifications"), { url: r } = t.data[0];
2746
+ this.ws = new WebSocket(r), this.ws.onopen = () => {
2747
2747
  this._reconnectAttempt = 0, console.log("Notifications connected");
2748
- }, this.ws.onmessage = async (r) => {
2748
+ }, this.ws.onmessage = async (s) => {
2749
2749
  try {
2750
- const s = JSON.parse(r.data), i = await this.client.decryptAndVerify(s), o = this.subscriptions.request[i == null ? void 0 : i.correlation_id];
2751
- o && Object.values(o).length > 0 && Object.values(o).forEach((u) => u(i));
2752
- const c = this.subscriptions.status[i == null ? void 0 : i.status];
2753
- c && Object.values(c).length > 0 && Object.values(c).forEach((u) => u(i));
2754
- const a = this.subscriptions.topic[i == null ? void 0 : i.topic];
2755
- a && Object.values(a).length > 0 && Object.values(a).forEach((u) => u(i)), Object.values(this.listeners).forEach((u) => u(i));
2756
- } catch (s) {
2757
- console.warn("Failed to process notification:", s);
2750
+ const i = JSON.parse(s.data), o = await this.client.decryptAndVerify(i), c = this.subscriptions.request[o == null ? void 0 : o.correlation_id];
2751
+ c && Object.values(c).length > 0 && Object.values(c).forEach((f) => f(o));
2752
+ const a = this.subscriptions.status[o == null ? void 0 : o.status];
2753
+ a && Object.values(a).length > 0 && Object.values(a).forEach((f) => f(o));
2754
+ const u = this.subscriptions.topic[o == null ? void 0 : o.topic];
2755
+ u && Object.values(u).length > 0 && Object.values(u).forEach((f) => f(o)), Object.values(this.listeners).forEach((f) => f(o));
2756
+ } catch (i) {
2757
+ console.warn("Failed to process notification:", i);
2758
2758
  }
2759
- }, this.ws.onerror = (r) => {
2760
- console.error("Notifications error", r);
2759
+ }, this.ws.onerror = (s) => {
2760
+ console.error("Notifications error", s);
2761
2761
  }, this.ws.onclose = () => {
2762
2762
  this.scheduleReconnect(), console.log("Notifications closed");
2763
2763
  };
@@ -2968,7 +2968,7 @@ ${c}`, l = await Hs(i, new TextEncoder().encode(h)), g = ne(l), w = new Headers(
2968
2968
  await this.post("/handshake/extend", {}).then(async (e) => {
2969
2969
  var t;
2970
2970
  e && (e.session_id !== ((t = this.session) == null ? void 0 : t.sessionId) ? await this.handshake() : this.updateSession({
2971
- sessionExpiresAt: e.session_expires_at
2971
+ sessionExpiresAt: e.data[0].session_expires_at
2972
2972
  }));
2973
2973
  }).catch(async (e) => {
2974
2974
  await this.handshake();
@@ -3015,7 +3015,7 @@ ${c}`, l = await Hs(i, new TextEncoder().encode(h)), g = ne(l), w = new Headers(
3015
3015
  token_type: i,
3016
3016
  expires_at: o,
3017
3017
  refresh_token: c
3018
- } = r;
3018
+ } = r.data[0];
3019
3019
  return s && this.updateSession({ accessToken: s }), i && this.updateSession({ tokenType: i }), o && this.updateSession({ expiresAt: o }), c && this.updateSession({ refreshToken: c }), {
3020
3020
  accessToken: s,
3021
3021
  tokenType: i,