@superatomai/sdk-web 0.0.9 → 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
@@ -551,6 +551,46 @@ zod.z.object({
551
551
  to: MessageParticipantSchema.optional(),
552
552
  payload: ReportsResponsePayloadSchema
553
553
  });
554
+ var BookmarkDataSchema = zod.z.object({
555
+ id: zod.z.number().optional(),
556
+ uiblock: zod.z.any(),
557
+ // JSON object
558
+ created_at: zod.z.string().optional(),
559
+ updated_at: zod.z.string().optional()
560
+ });
561
+ var BookmarksRequestPayloadSchema = zod.z.object({
562
+ operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "getByUser", "getByThread"]),
563
+ data: zod.z.object({
564
+ id: zod.z.number().optional(),
565
+ userId: zod.z.number().optional(),
566
+ threadId: zod.z.string().optional(),
567
+ uiblock: zod.z.any().optional()
568
+ }).optional()
569
+ });
570
+ var BookmarksRequestMessageSchema = zod.z.object({
571
+ id: zod.z.string(),
572
+ type: zod.z.literal("BOOKMARKS"),
573
+ from: MessageParticipantSchema,
574
+ to: MessageParticipantSchema.optional(),
575
+ payload: BookmarksRequestPayloadSchema
576
+ });
577
+ var BookmarksResponsePayloadSchema = zod.z.object({
578
+ success: zod.z.boolean(),
579
+ error: zod.z.string().optional(),
580
+ data: zod.z.union([
581
+ BookmarkDataSchema,
582
+ zod.z.array(BookmarkDataSchema)
583
+ ]).optional(),
584
+ count: zod.z.number().optional(),
585
+ message: zod.z.string().optional()
586
+ });
587
+ zod.z.object({
588
+ id: zod.z.string(),
589
+ type: zod.z.literal("BOOKMARKS_RES"),
590
+ from: MessageParticipantSchema,
591
+ to: MessageParticipantSchema.optional(),
592
+ payload: BookmarksResponsePayloadSchema
593
+ });
554
594
  var ClientConfigSchema = zod.z.object({
555
595
  userId: zod.z.string(),
556
596
  projectId: zod.z.string(),
@@ -573,16 +613,22 @@ __export(services_exports, {
573
613
  QuerySpecSchema: () => QuerySpecSchema,
574
614
  UIComponentSchema: () => UIComponentSchema,
575
615
  UIElementSchema: () => UIElementSchema,
616
+ createBookmark: () => createBookmark,
576
617
  createDashboard: () => createDashboard,
577
618
  createReport: () => createReport,
578
619
  createUser: () => createUser,
620
+ deleteBookmark: () => deleteBookmark,
579
621
  deleteDashboard: () => deleteDashboard,
580
622
  deleteReport: () => deleteReport,
581
623
  deleteUser: () => deleteUser,
582
624
  getActions: () => getActions,
625
+ getAllBookmarks: () => getAllBookmarks,
583
626
  getAllDashboards: () => getAllDashboards,
584
627
  getAllReports: () => getAllReports,
585
628
  getAllUsers: () => getAllUsers,
629
+ getBookmark: () => getBookmark,
630
+ getBookmarksByThread: () => getBookmarksByThread,
631
+ getBookmarksByUser: () => getBookmarksByUser,
586
632
  getComponentSuggestions: () => getComponentSuggestions,
587
633
  getDashboard: () => getDashboard,
588
634
  getReport: () => getReport,
@@ -594,6 +640,7 @@ __export(services_exports, {
594
640
  sendComponents: () => sendComponents,
595
641
  sendUserPromptRequest: () => sendUserPromptRequest,
596
642
  sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
643
+ updateBookmark: () => updateBookmark,
597
644
  updateDashboard: () => updateDashboard,
598
645
  updateReport: () => updateReport,
599
646
  updateUser: () => updateUser
@@ -1179,6 +1226,173 @@ async function getReport(client, reportId, timeout) {
1179
1226
  };
1180
1227
  }
1181
1228
 
1229
+ // src/services/bookmarks/index.ts
1230
+ async function createBookmark(client, userId, uiblock, threadId, timeout) {
1231
+ const messageId = `bookmarks_create_${Date.now()}`;
1232
+ const message = BookmarksRequestMessageSchema.parse({
1233
+ id: messageId,
1234
+ type: "BOOKMARKS",
1235
+ from: { type: client.type },
1236
+ to: { type: "data-agent" },
1237
+ payload: {
1238
+ operation: "create",
1239
+ data: {
1240
+ userId,
1241
+ threadId,
1242
+ uiblock
1243
+ }
1244
+ }
1245
+ });
1246
+ const response = await client.sendWithResponse(message, timeout);
1247
+ const payload = response.payload;
1248
+ return {
1249
+ success: payload.success,
1250
+ error: payload.error,
1251
+ message: payload.message,
1252
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
1253
+ };
1254
+ }
1255
+ async function updateBookmark(client, id, uiblock, timeout) {
1256
+ const messageId = `bookmarks_update_${Date.now()}`;
1257
+ const message = BookmarksRequestMessageSchema.parse({
1258
+ id: messageId,
1259
+ type: "BOOKMARKS",
1260
+ from: { type: client.type },
1261
+ to: { type: "data-agent" },
1262
+ payload: {
1263
+ operation: "update",
1264
+ data: {
1265
+ id,
1266
+ uiblock
1267
+ }
1268
+ }
1269
+ });
1270
+ const response = await client.sendWithResponse(message, timeout);
1271
+ const payload = response.payload;
1272
+ return {
1273
+ success: payload.success,
1274
+ error: payload.error,
1275
+ message: payload.message,
1276
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
1277
+ };
1278
+ }
1279
+ async function deleteBookmark(client, id, timeout) {
1280
+ const messageId = `bookmarks_delete_${Date.now()}`;
1281
+ const message = BookmarksRequestMessageSchema.parse({
1282
+ id: messageId,
1283
+ type: "BOOKMARKS",
1284
+ from: { type: client.type },
1285
+ to: { type: "data-agent" },
1286
+ payload: {
1287
+ operation: "delete",
1288
+ data: {
1289
+ id
1290
+ }
1291
+ }
1292
+ });
1293
+ const response = await client.sendWithResponse(message, timeout);
1294
+ const payload = response.payload;
1295
+ return {
1296
+ success: payload.success,
1297
+ error: payload.error,
1298
+ message: payload.message,
1299
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
1300
+ };
1301
+ }
1302
+ async function getAllBookmarks(client, timeout) {
1303
+ const messageId = `bookmarks_getall_${Date.now()}`;
1304
+ const message = BookmarksRequestMessageSchema.parse({
1305
+ id: messageId,
1306
+ type: "BOOKMARKS",
1307
+ from: { type: client.type },
1308
+ to: { type: "data-agent" },
1309
+ payload: {
1310
+ operation: "getAll"
1311
+ }
1312
+ });
1313
+ const response = await client.sendWithResponse(message, timeout);
1314
+ const payload = response.payload;
1315
+ return {
1316
+ success: payload.success,
1317
+ error: payload.error,
1318
+ data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
1319
+ count: payload.count,
1320
+ message: payload.message
1321
+ };
1322
+ }
1323
+ async function getBookmark(client, id, timeout) {
1324
+ const messageId = `bookmarks_getone_${Date.now()}`;
1325
+ const message = BookmarksRequestMessageSchema.parse({
1326
+ id: messageId,
1327
+ type: "BOOKMARKS",
1328
+ from: { type: client.type },
1329
+ to: { type: "data-agent" },
1330
+ payload: {
1331
+ operation: "getOne",
1332
+ data: {
1333
+ id
1334
+ }
1335
+ }
1336
+ });
1337
+ const response = await client.sendWithResponse(message, timeout);
1338
+ const payload = response.payload;
1339
+ return {
1340
+ success: payload.success,
1341
+ error: payload.error,
1342
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data,
1343
+ message: payload.message
1344
+ };
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
+ }
1395
+
1182
1396
  // src/services/actions.ts
1183
1397
  async function getActions(client, options) {
1184
1398
  const messageId = `msg_${Date.now()}_${Math.random().toString(36).substring(7)}`;
@@ -1619,6 +1833,64 @@ var SuperatomClient = class {
1619
1833
  this.log("info", "Fetching dashboard:", dashboardId);
1620
1834
  return getDashboard(this, dashboardId, timeout);
1621
1835
  }
1836
+ // ==================== Bookmark Management Methods ====================
1837
+ // These methods delegate to bookmark service for bookmark CRUD operations
1838
+ /**
1839
+ * Create a new bookmark
1840
+ * Delegates to bookmarks service
1841
+ */
1842
+ async createBookmark(userId, uiblock, threadId, timeout) {
1843
+ this.log("info", "Creating bookmark for user:", userId);
1844
+ return createBookmark(this, userId, uiblock, threadId, timeout);
1845
+ }
1846
+ /**
1847
+ * Update an existing bookmark
1848
+ * Delegates to bookmarks service
1849
+ */
1850
+ async updateBookmark(id, uiblock, timeout) {
1851
+ this.log("info", "Updating bookmark:", id);
1852
+ return updateBookmark(this, id, uiblock, timeout);
1853
+ }
1854
+ /**
1855
+ * Delete a bookmark
1856
+ * Delegates to bookmarks service
1857
+ */
1858
+ async deleteBookmark(id, timeout) {
1859
+ this.log("info", "Deleting bookmark:", id);
1860
+ return deleteBookmark(this, id, timeout);
1861
+ }
1862
+ /**
1863
+ * Get all bookmarks
1864
+ * Delegates to bookmarks service
1865
+ */
1866
+ async getAllBookmarks(timeout) {
1867
+ this.log("info", "Fetching all bookmarks");
1868
+ return getAllBookmarks(this, timeout);
1869
+ }
1870
+ /**
1871
+ * Get a specific bookmark by ID
1872
+ * Delegates to bookmarks service
1873
+ */
1874
+ async getBookmark(id, timeout) {
1875
+ this.log("info", "Fetching bookmark:", id);
1876
+ return getBookmark(this, id, timeout);
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
+ }
1622
1894
  // ==================== Report Management Methods ====================
1623
1895
  // These methods delegate to report service for admin report CRUD operations
1624
1896
  /**