@insforge/sdk 1.0.5-dev.0 → 1.0.5-dev.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/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -658,8 +658,7 @@ declare class Realtime {
|
|
|
658
658
|
private connectPromise;
|
|
659
659
|
private subscribedChannels;
|
|
660
660
|
private eventListeners;
|
|
661
|
-
|
|
662
|
-
constructor(baseUrl: string, tokenManager: TokenManager, anonKey?: string);
|
|
661
|
+
constructor(baseUrl: string, tokenManager: TokenManager);
|
|
663
662
|
private notifyListeners;
|
|
664
663
|
/**
|
|
665
664
|
* Connect to the realtime server
|
package/dist/index.d.ts
CHANGED
|
@@ -658,8 +658,7 @@ declare class Realtime {
|
|
|
658
658
|
private connectPromise;
|
|
659
659
|
private subscribedChannels;
|
|
660
660
|
private eventListeners;
|
|
661
|
-
|
|
662
|
-
constructor(baseUrl: string, tokenManager: TokenManager, anonKey?: string);
|
|
661
|
+
constructor(baseUrl: string, tokenManager: TokenManager);
|
|
663
662
|
private notifyListeners;
|
|
664
663
|
/**
|
|
665
664
|
* Connect to the realtime server
|
package/dist/index.js
CHANGED
|
@@ -705,6 +705,13 @@ var Auth = class {
|
|
|
705
705
|
"/api/auth/profiles/current",
|
|
706
706
|
{ profile }
|
|
707
707
|
);
|
|
708
|
+
const currentUser = this.tokenManager.getUser();
|
|
709
|
+
if (currentUser && response.profile !== void 0) {
|
|
710
|
+
this.tokenManager.setUser({
|
|
711
|
+
...currentUser,
|
|
712
|
+
profile: response.profile
|
|
713
|
+
});
|
|
714
|
+
}
|
|
708
715
|
return {
|
|
709
716
|
data: response,
|
|
710
717
|
error: null
|
|
@@ -1500,14 +1507,13 @@ var Functions = class {
|
|
|
1500
1507
|
var import_socket = require("socket.io-client");
|
|
1501
1508
|
var CONNECT_TIMEOUT = 1e4;
|
|
1502
1509
|
var Realtime = class {
|
|
1503
|
-
constructor(baseUrl, tokenManager
|
|
1510
|
+
constructor(baseUrl, tokenManager) {
|
|
1504
1511
|
this.socket = null;
|
|
1505
1512
|
this.connectPromise = null;
|
|
1506
1513
|
this.subscribedChannels = /* @__PURE__ */ new Set();
|
|
1507
1514
|
this.eventListeners = /* @__PURE__ */ new Map();
|
|
1508
1515
|
this.baseUrl = baseUrl;
|
|
1509
1516
|
this.tokenManager = tokenManager;
|
|
1510
|
-
this.anonKey = anonKey;
|
|
1511
1517
|
}
|
|
1512
1518
|
notifyListeners(event, payload) {
|
|
1513
1519
|
const listeners = this.eventListeners.get(event);
|
|
@@ -1533,7 +1539,7 @@ var Realtime = class {
|
|
|
1533
1539
|
}
|
|
1534
1540
|
this.connectPromise = new Promise((resolve, reject) => {
|
|
1535
1541
|
const session = this.tokenManager.getSession();
|
|
1536
|
-
const token = session?.accessToken
|
|
1542
|
+
const token = session?.accessToken;
|
|
1537
1543
|
this.socket = (0, import_socket.io)(this.baseUrl, {
|
|
1538
1544
|
transports: ["websocket"],
|
|
1539
1545
|
auth: token ? { token } : void 0
|
|
@@ -1775,7 +1781,7 @@ var InsForgeClient = class {
|
|
|
1775
1781
|
this.storage = new Storage(this.http);
|
|
1776
1782
|
this.ai = new AI(this.http);
|
|
1777
1783
|
this.functions = new Functions(this.http);
|
|
1778
|
-
this.realtime = new Realtime(this.http.baseUrl, this.tokenManager
|
|
1784
|
+
this.realtime = new Realtime(this.http.baseUrl, this.tokenManager);
|
|
1779
1785
|
this.emails = new Emails(this.http);
|
|
1780
1786
|
}
|
|
1781
1787
|
/**
|