@base44-preview/sdk 0.8.13-pr.58.430c2b6 → 0.8.13-pr.58.51dd5dd

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.
@@ -120,7 +120,7 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
120
120
  });
121
121
  },
122
122
  // Subscribe to realtime updates
123
- async subscribe(callback) {
123
+ subscribe(callback) {
124
124
  const room = `entities:${appId}:${entityName}`;
125
125
  // Get the socket and subscribe to the room
126
126
  const socket = getSocket();
@@ -130,7 +130,12 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
130
130
  if (!event) {
131
131
  return;
132
132
  }
133
- callback(event);
133
+ try {
134
+ callback(event);
135
+ }
136
+ catch (error) {
137
+ console.error("[Base44 SDK] Subscription callback error:", error);
138
+ }
134
139
  },
135
140
  });
136
141
  return unsubscribe;
@@ -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 Promise resolving to an unsubscribe function to stop listening.
276
+ * @returns Unsubscribe function to stop listening.
277
277
  *
278
278
  * @example
279
279
  * ```typescript
280
280
  * // Subscribe to all Task changes
281
- * const unsubscribe = await base44.entities.Task.subscribe((event) => {
281
+ * const unsubscribe = 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): Promise<Subscription>;
289
+ subscribe(callback: RealtimeCallback): 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.430c2b6",
3
+ "version": "0.8.13-pr.58.51dd5dd",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",