@base44-preview/sdk 0.8.52-pr.286.df125d1 → 0.8.52-pr.286.eca3007

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.
@@ -1,2 +1,2 @@
1
1
  /** Server refusals and client transport/processing failures. */
2
- export type PlatformSocketErrorCode = "connection_denied" | "connection_failed" | "session_unavailable" | "session_replaced" | "access_denied" | "access_revoked" | "snapshot_unavailable" | "subscription_limit" | "delivery_overflow" | "protocol_error" | "handler_failed" | "client_closed";
2
+ export type PlatformSocketErrorCode = "connection_denied" | "connection_failed" | "session_unavailable" | "session_revoked" | "session_replaced" | "access_denied" | "access_revoked" | "snapshot_unavailable" | "subscription_limit" | "delivery_overflow" | "protocol_error" | "handler_failed" | "client_closed";
@@ -36,7 +36,7 @@ export class BuilderSocket {
36
36
  if (ending === "session_expired")
37
37
  this.socket.connect(); // Renew through getSessionToken.
38
38
  else
39
- this.connectionError(new PlatformSocketError(ending === "session_replaced" ? "session_replaced" : "connection_failed"));
39
+ this.connectionError(new PlatformSocketError(ending !== null && ending !== void 0 ? ending : "connection_failed"));
40
40
  });
41
41
  this.socket.on("connect_error", (error) => this.refused(error));
42
42
  this.socket.io.on("reconnect_failed", () => this.connectionError(new PlatformSocketError("connection_failed")));
@@ -208,11 +208,14 @@ export class BuilderSocket {
208
208
  sessionEnded(raw) {
209
209
  try {
210
210
  const reason = object(object(raw).data).reason;
211
- if (reason !== "expired" && reason !== "replaced")
211
+ const ending = reason === "expired" ? "session_expired"
212
+ : reason === "revoked" ? "session_revoked"
213
+ : reason === "replaced" ? "session_replaced" : undefined;
214
+ if (!ending)
212
215
  throw new Error("Unknown reason");
213
216
  // The server disconnects next; the disconnect handler renews or stops.
214
217
  this.token = undefined;
215
- this.ending = reason === "expired" ? "session_expired" : "session_replaced";
218
+ this.ending = ending;
216
219
  }
217
220
  catch (_a) {
218
221
  this.protocolError(raw);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.52-pr.286.df125d1",
3
+ "version": "0.8.52-pr.286.eca3007",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",