@superatomai/sdk-web 0.0.9 → 0.0.10

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,44 @@ 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"]),
563
+ data: zod.z.object({
564
+ id: zod.z.number().optional(),
565
+ uiblock: zod.z.any().optional()
566
+ }).optional()
567
+ });
568
+ var BookmarksRequestMessageSchema = zod.z.object({
569
+ id: zod.z.string(),
570
+ type: zod.z.literal("BOOKMARKS"),
571
+ from: MessageParticipantSchema,
572
+ to: MessageParticipantSchema.optional(),
573
+ payload: BookmarksRequestPayloadSchema
574
+ });
575
+ var BookmarksResponsePayloadSchema = zod.z.object({
576
+ success: zod.z.boolean(),
577
+ error: zod.z.string().optional(),
578
+ data: zod.z.union([
579
+ BookmarkDataSchema,
580
+ zod.z.array(BookmarkDataSchema)
581
+ ]).optional(),
582
+ count: zod.z.number().optional(),
583
+ message: zod.z.string().optional()
584
+ });
585
+ zod.z.object({
586
+ id: zod.z.string(),
587
+ type: zod.z.literal("BOOKMARKS_RES"),
588
+ from: MessageParticipantSchema,
589
+ to: MessageParticipantSchema.optional(),
590
+ payload: BookmarksResponsePayloadSchema
591
+ });
554
592
  var ClientConfigSchema = zod.z.object({
555
593
  userId: zod.z.string(),
556
594
  projectId: zod.z.string(),
@@ -573,16 +611,20 @@ __export(services_exports, {
573
611
  QuerySpecSchema: () => QuerySpecSchema,
574
612
  UIComponentSchema: () => UIComponentSchema,
575
613
  UIElementSchema: () => UIElementSchema,
614
+ createBookmark: () => createBookmark,
576
615
  createDashboard: () => createDashboard,
577
616
  createReport: () => createReport,
578
617
  createUser: () => createUser,
618
+ deleteBookmark: () => deleteBookmark,
579
619
  deleteDashboard: () => deleteDashboard,
580
620
  deleteReport: () => deleteReport,
581
621
  deleteUser: () => deleteUser,
582
622
  getActions: () => getActions,
623
+ getAllBookmarks: () => getAllBookmarks,
583
624
  getAllDashboards: () => getAllDashboards,
584
625
  getAllReports: () => getAllReports,
585
626
  getAllUsers: () => getAllUsers,
627
+ getBookmark: () => getBookmark,
586
628
  getComponentSuggestions: () => getComponentSuggestions,
587
629
  getDashboard: () => getDashboard,
588
630
  getReport: () => getReport,
@@ -594,6 +636,7 @@ __export(services_exports, {
594
636
  sendComponents: () => sendComponents,
595
637
  sendUserPromptRequest: () => sendUserPromptRequest,
596
638
  sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
639
+ updateBookmark: () => updateBookmark,
597
640
  updateDashboard: () => updateDashboard,
598
641
  updateReport: () => updateReport,
599
642
  updateUser: () => updateUser
@@ -1179,6 +1222,122 @@ async function getReport(client, reportId, timeout) {
1179
1222
  };
1180
1223
  }
1181
1224
 
1225
+ // src/services/bookmarks/index.ts
1226
+ async function createBookmark(client, uiblock, timeout) {
1227
+ const messageId = `bookmarks_create_${Date.now()}`;
1228
+ const message = BookmarksRequestMessageSchema.parse({
1229
+ id: messageId,
1230
+ type: "BOOKMARKS",
1231
+ from: { type: client.type },
1232
+ to: { type: "data-agent" },
1233
+ payload: {
1234
+ operation: "create",
1235
+ data: {
1236
+ uiblock
1237
+ }
1238
+ }
1239
+ });
1240
+ const response = await client.sendWithResponse(message, timeout);
1241
+ const payload = response.payload;
1242
+ return {
1243
+ success: payload.success,
1244
+ error: payload.error,
1245
+ message: payload.message,
1246
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
1247
+ };
1248
+ }
1249
+ async function updateBookmark(client, id, uiblock, timeout) {
1250
+ const messageId = `bookmarks_update_${Date.now()}`;
1251
+ const message = BookmarksRequestMessageSchema.parse({
1252
+ id: messageId,
1253
+ type: "BOOKMARKS",
1254
+ from: { type: client.type },
1255
+ to: { type: "data-agent" },
1256
+ payload: {
1257
+ operation: "update",
1258
+ data: {
1259
+ id,
1260
+ uiblock
1261
+ }
1262
+ }
1263
+ });
1264
+ const response = await client.sendWithResponse(message, timeout);
1265
+ const payload = response.payload;
1266
+ return {
1267
+ success: payload.success,
1268
+ error: payload.error,
1269
+ message: payload.message,
1270
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
1271
+ };
1272
+ }
1273
+ async function deleteBookmark(client, id, timeout) {
1274
+ const messageId = `bookmarks_delete_${Date.now()}`;
1275
+ const message = BookmarksRequestMessageSchema.parse({
1276
+ id: messageId,
1277
+ type: "BOOKMARKS",
1278
+ from: { type: client.type },
1279
+ to: { type: "data-agent" },
1280
+ payload: {
1281
+ operation: "delete",
1282
+ data: {
1283
+ id
1284
+ }
1285
+ }
1286
+ });
1287
+ const response = await client.sendWithResponse(message, timeout);
1288
+ const payload = response.payload;
1289
+ return {
1290
+ success: payload.success,
1291
+ error: payload.error,
1292
+ message: payload.message,
1293
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
1294
+ };
1295
+ }
1296
+ async function getAllBookmarks(client, timeout) {
1297
+ const messageId = `bookmarks_getall_${Date.now()}`;
1298
+ const message = BookmarksRequestMessageSchema.parse({
1299
+ id: messageId,
1300
+ type: "BOOKMARKS",
1301
+ from: { type: client.type },
1302
+ to: { type: "data-agent" },
1303
+ payload: {
1304
+ operation: "getAll"
1305
+ }
1306
+ });
1307
+ const response = await client.sendWithResponse(message, timeout);
1308
+ const payload = response.payload;
1309
+ return {
1310
+ success: payload.success,
1311
+ error: payload.error,
1312
+ data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
1313
+ count: payload.count,
1314
+ message: payload.message
1315
+ };
1316
+ }
1317
+ async function getBookmark(client, id, timeout) {
1318
+ const messageId = `bookmarks_getone_${Date.now()}`;
1319
+ const message = BookmarksRequestMessageSchema.parse({
1320
+ id: messageId,
1321
+ type: "BOOKMARKS",
1322
+ from: { type: client.type },
1323
+ to: { type: "data-agent" },
1324
+ payload: {
1325
+ operation: "getOne",
1326
+ data: {
1327
+ id
1328
+ }
1329
+ }
1330
+ });
1331
+ const response = await client.sendWithResponse(message, timeout);
1332
+ const payload = response.payload;
1333
+ return {
1334
+ success: payload.success,
1335
+ error: payload.error,
1336
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data,
1337
+ message: payload.message
1338
+ };
1339
+ }
1340
+
1182
1341
  // src/services/actions.ts
1183
1342
  async function getActions(client, options) {
1184
1343
  const messageId = `msg_${Date.now()}_${Math.random().toString(36).substring(7)}`;
@@ -1619,6 +1778,48 @@ var SuperatomClient = class {
1619
1778
  this.log("info", "Fetching dashboard:", dashboardId);
1620
1779
  return getDashboard(this, dashboardId, timeout);
1621
1780
  }
1781
+ // ==================== Bookmark Management Methods ====================
1782
+ // These methods delegate to bookmark service for bookmark CRUD operations
1783
+ /**
1784
+ * Create a new bookmark
1785
+ * Delegates to bookmarks service
1786
+ */
1787
+ async createBookmark(uiblock, timeout) {
1788
+ this.log("info", "Creating bookmark");
1789
+ return createBookmark(this, uiblock, timeout);
1790
+ }
1791
+ /**
1792
+ * Update an existing bookmark
1793
+ * Delegates to bookmarks service
1794
+ */
1795
+ async updateBookmark(id, uiblock, timeout) {
1796
+ this.log("info", "Updating bookmark:", id);
1797
+ return updateBookmark(this, id, uiblock, timeout);
1798
+ }
1799
+ /**
1800
+ * Delete a bookmark
1801
+ * Delegates to bookmarks service
1802
+ */
1803
+ async deleteBookmark(id, timeout) {
1804
+ this.log("info", "Deleting bookmark:", id);
1805
+ return deleteBookmark(this, id, timeout);
1806
+ }
1807
+ /**
1808
+ * Get all bookmarks
1809
+ * Delegates to bookmarks service
1810
+ */
1811
+ async getAllBookmarks(timeout) {
1812
+ this.log("info", "Fetching all bookmarks");
1813
+ return getAllBookmarks(this, timeout);
1814
+ }
1815
+ /**
1816
+ * Get a specific bookmark by ID
1817
+ * Delegates to bookmarks service
1818
+ */
1819
+ async getBookmark(id, timeout) {
1820
+ this.log("info", "Fetching bookmark:", id);
1821
+ return getBookmark(this, id, timeout);
1822
+ }
1622
1823
  // ==================== Report Management Methods ====================
1623
1824
  // These methods delegate to report service for admin report CRUD operations
1624
1825
  /**