@base44-preview/sdk 0.8.27-pr.171.bb56537 → 0.8.28-pr.173.b39e4d0

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.
@@ -128,32 +128,28 @@ export interface AuthModule {
128
128
  /**
129
129
  * Updates the current authenticated user's information.
130
130
  *
131
- * Only the fields included in the data object will be updated.
132
- * Commonly updated fields include `full_name` and custom profile fields.
131
+ * You can update `role` and any [custom fields](/developers/backend/resources/entities/user-schema#custom-fields) defined in your
132
+ * User entity schema.
133
+ * The `role` value must be either `'user'` or `'admin'`.
134
+ * <Note>
135
+ * The following fields are read-only and can't be changed with this method:
136
+ * `id`, `email`, `full_name`, `created_date`, `updated_date`, and `created_by`.
137
+ * </Note>
133
138
  *
134
139
  * @param data - Object containing the fields to update.
135
140
  * @returns Promise resolving to the updated user data.
136
141
  *
137
142
  * @example
138
143
  * ```typescript
139
- * // Update specific fields
140
- * const updatedUser = await base44.auth.updateMe({
141
- * full_name: 'John Doe'
142
- * });
143
- * console.log(`Updated user: ${updatedUser.full_name}`);
144
- * ```
145
- *
146
- * @example
147
- * ```typescript
148
- * // Update custom fields defined in your User entity
144
+ * // Update role and custom fields defined in your User entity
149
145
  * await base44.auth.updateMe({
146
+ * role: 'admin',
150
147
  * bio: 'Software developer',
151
- * phone: '+1234567890',
152
148
  * preferences: { theme: 'dark' }
153
149
  * });
154
150
  * ```
155
151
  */
156
- updateMe(data: Partial<Omit<User, "id" | "created_date" | "updated_date">>): Promise<User>;
152
+ updateMe(data: Record<string, any>): Promise<User>;
157
153
  /**
158
154
  * Redirects the user to the app's login page.
159
155
  *
@@ -88,7 +88,8 @@ export function RoomsSocket({ config }) {
88
88
  return (_a = handlers.update_model) === null || _a === void 0 ? void 0 : _a.call(handlers, { room, data: dataStr });
89
89
  }
90
90
  function getListeners(room) {
91
- return roomsToListeners[room];
91
+ var _a;
92
+ return (_a = roomsToListeners[room]) !== null && _a !== void 0 ? _a : [];
92
93
  }
93
94
  const subscribeToRoom = (room, handlers) => {
94
95
  if (!roomsToListeners[room]) {
@@ -96,12 +97,18 @@ export function RoomsSocket({ config }) {
96
97
  roomsToListeners[room] = [];
97
98
  }
98
99
  roomsToListeners[room].push(handlers);
100
+ let unsubscribed = false;
99
101
  return () => {
100
102
  var _a, _b;
103
+ if (unsubscribed) {
104
+ return;
105
+ }
106
+ unsubscribed = true;
101
107
  roomsToListeners[room] =
102
108
  (_b = (_a = roomsToListeners[room]) === null || _a === void 0 ? void 0 : _a.filter((listener) => listener !== handlers)) !== null && _b !== void 0 ? _b : [];
103
109
  if (roomsToListeners[room].length === 0) {
104
110
  leaveRoom(room);
111
+ delete roomsToListeners[room];
105
112
  }
106
113
  };
107
114
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.27-pr.171.bb56537",
3
+ "version": "0.8.28-pr.173.b39e4d0",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",