@superatomai/sdk-web 0.0.10 → 0.0.11

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.cjs CHANGED
@@ -559,9 +559,11 @@ var BookmarkDataSchema = zod.z.object({
559
559
  updated_at: zod.z.string().optional()
560
560
  });
561
561
  var BookmarksRequestPayloadSchema = zod.z.object({
562
- operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne"]),
562
+ operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "getByUser", "getByThread"]),
563
563
  data: zod.z.object({
564
564
  id: zod.z.number().optional(),
565
+ userId: zod.z.number().optional(),
566
+ threadId: zod.z.string().optional(),
565
567
  uiblock: zod.z.any().optional()
566
568
  }).optional()
567
569
  });
@@ -625,6 +627,8 @@ __export(services_exports, {
625
627
  getAllReports: () => getAllReports,
626
628
  getAllUsers: () => getAllUsers,
627
629
  getBookmark: () => getBookmark,
630
+ getBookmarksByThread: () => getBookmarksByThread,
631
+ getBookmarksByUser: () => getBookmarksByUser,
628
632
  getComponentSuggestions: () => getComponentSuggestions,
629
633
  getDashboard: () => getDashboard,
630
634
  getReport: () => getReport,
@@ -1223,7 +1227,7 @@ async function getReport(client, reportId, timeout) {
1223
1227
  }
1224
1228
 
1225
1229
  // src/services/bookmarks/index.ts
1226
- async function createBookmark(client, uiblock, timeout) {
1230
+ async function createBookmark(client, userId, uiblock, threadId, timeout) {
1227
1231
  const messageId = `bookmarks_create_${Date.now()}`;
1228
1232
  const message = BookmarksRequestMessageSchema.parse({
1229
1233
  id: messageId,
@@ -1233,6 +1237,8 @@ async function createBookmark(client, uiblock, timeout) {
1233
1237
  payload: {
1234
1238
  operation: "create",
1235
1239
  data: {
1240
+ userId,
1241
+ threadId,
1236
1242
  uiblock
1237
1243
  }
1238
1244
  }
@@ -1337,6 +1343,55 @@ async function getBookmark(client, id, timeout) {
1337
1343
  message: payload.message
1338
1344
  };
1339
1345
  }
1346
+ async function getBookmarksByUser(client, userId, threadId, timeout) {
1347
+ const messageId = `bookmarks_getbyuser_${Date.now()}`;
1348
+ const message = BookmarksRequestMessageSchema.parse({
1349
+ id: messageId,
1350
+ type: "BOOKMARKS",
1351
+ from: { type: client.type },
1352
+ to: { type: "data-agent" },
1353
+ payload: {
1354
+ operation: "getByUser",
1355
+ data: {
1356
+ userId,
1357
+ threadId
1358
+ }
1359
+ }
1360
+ });
1361
+ const response = await client.sendWithResponse(message, timeout);
1362
+ const payload = response.payload;
1363
+ return {
1364
+ success: payload.success,
1365
+ error: payload.error,
1366
+ data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
1367
+ count: payload.count,
1368
+ message: payload.message
1369
+ };
1370
+ }
1371
+ async function getBookmarksByThread(client, threadId, timeout) {
1372
+ const messageId = `bookmarks_getbythread_${Date.now()}`;
1373
+ const message = BookmarksRequestMessageSchema.parse({
1374
+ id: messageId,
1375
+ type: "BOOKMARKS",
1376
+ from: { type: client.type },
1377
+ to: { type: "data-agent" },
1378
+ payload: {
1379
+ operation: "getByThread",
1380
+ data: {
1381
+ threadId
1382
+ }
1383
+ }
1384
+ });
1385
+ const response = await client.sendWithResponse(message, timeout);
1386
+ const payload = response.payload;
1387
+ return {
1388
+ success: payload.success,
1389
+ error: payload.error,
1390
+ data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
1391
+ count: payload.count,
1392
+ message: payload.message
1393
+ };
1394
+ }
1340
1395
 
1341
1396
  // src/services/actions.ts
1342
1397
  async function getActions(client, options) {
@@ -1784,9 +1839,9 @@ var SuperatomClient = class {
1784
1839
  * Create a new bookmark
1785
1840
  * Delegates to bookmarks service
1786
1841
  */
1787
- async createBookmark(uiblock, timeout) {
1788
- this.log("info", "Creating bookmark");
1789
- return createBookmark(this, uiblock, timeout);
1842
+ async createBookmark(userId, uiblock, threadId, timeout) {
1843
+ this.log("info", "Creating bookmark for user:", userId);
1844
+ return createBookmark(this, userId, uiblock, threadId, timeout);
1790
1845
  }
1791
1846
  /**
1792
1847
  * Update an existing bookmark
@@ -1820,6 +1875,22 @@ var SuperatomClient = class {
1820
1875
  this.log("info", "Fetching bookmark:", id);
1821
1876
  return getBookmark(this, id, timeout);
1822
1877
  }
1878
+ /**
1879
+ * Get bookmarks by user ID (and optionally by thread ID)
1880
+ * Delegates to bookmarks service
1881
+ */
1882
+ async getBookmarksByUser(userId, threadId, timeout) {
1883
+ this.log("info", "Fetching bookmarks for user:", userId);
1884
+ return getBookmarksByUser(this, userId, threadId, timeout);
1885
+ }
1886
+ /**
1887
+ * Get bookmarks by thread ID
1888
+ * Delegates to bookmarks service
1889
+ */
1890
+ async getBookmarksByThread(threadId, timeout) {
1891
+ this.log("info", "Fetching bookmarks for thread:", threadId);
1892
+ return getBookmarksByThread(this, threadId, timeout);
1893
+ }
1823
1894
  // ==================== Report Management Methods ====================
1824
1895
  // These methods delegate to report service for admin report CRUD operations
1825
1896
  /**