@base44-preview/sdk 0.8.13-pr.58.3a4abcb → 0.8.13-pr.58.430c2b6

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,6 +1,6 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { EntitiesModule } from "./entities.types";
3
- import { RoomsSocket } from "../utils/socket-utils";
3
+ import { RoomsSocket } from "../utils/socket-utils.js";
4
4
  /**
5
5
  * Configuration for the entities module.
6
6
  * @internal
@@ -39,7 +39,8 @@ function parseRealtimeMessage(dataStr) {
39
39
  timestamp: parsed.timestamp || new Date().toISOString(),
40
40
  };
41
41
  }
42
- catch (_b) {
42
+ catch (error) {
43
+ console.warn("[Base44 SDK] Failed to parse realtime message:", error);
43
44
  return null;
44
45
  }
45
46
  }
@@ -119,7 +120,7 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
119
120
  });
120
121
  },
121
122
  // Subscribe to realtime updates
122
- subscribe(callback) {
123
+ async subscribe(callback) {
123
124
  const room = `entities:${appId}:${entityName}`;
124
125
  // Get the socket and subscribe to the room
125
126
  const socket = getSocket();
@@ -273,12 +273,12 @@ export interface EntityHandler {
273
273
  * Receives notifications whenever any record is created, updated, or deleted.
274
274
  *
275
275
  * @param callback - Function called when an entity changes.
276
- * @returns Unsubscribe function to stop listening.
276
+ * @returns Promise resolving to an unsubscribe function to stop listening.
277
277
  *
278
278
  * @example
279
279
  * ```typescript
280
280
  * // Subscribe to all Task changes
281
- * const unsubscribe = base44.entities.Task.subscribe((event) => {
281
+ * const unsubscribe = await base44.entities.Task.subscribe((event) => {
282
282
  * console.log(`Task ${event.id} was ${event.type}d:`, event.data);
283
283
  * });
284
284
  *
@@ -286,7 +286,7 @@ export interface EntityHandler {
286
286
  * unsubscribe();
287
287
  * ```
288
288
  */
289
- subscribe(callback: RealtimeCallback): Subscription;
289
+ subscribe(callback: RealtimeCallback): Promise<Subscription>;
290
290
  }
291
291
  /**
292
292
  * Entities module for managing app data.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.13-pr.58.3a4abcb",
3
+ "version": "0.8.13-pr.58.430c2b6",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",