@superatomai/sdk-web 0.0.12 → 0.0.13

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
@@ -188,7 +188,7 @@ var DSLRendererPropsSchema2 = zod.z.object({
188
188
  context: zod.z.record(zod.z.string(), zod.z.any()).optional()
189
189
  });
190
190
 
191
- // src/schemas.ts
191
+ // src/types.ts
192
192
  var MessageParticipantSchema = zod.z.object({
193
193
  id: zod.z.string().optional(),
194
194
  type: zod.z.string().optional()
@@ -431,14 +431,25 @@ var ComponentsSendMessageSchema = zod.z.object({
431
431
  to: MessageParticipantSchema.optional(),
432
432
  payload: ComponentsSendPayloadSchema
433
433
  });
434
+ var UserQueryFiltersSchema = zod.z.object({
435
+ username: zod.z.string().optional(),
436
+ email: zod.z.string().optional(),
437
+ role: zod.z.string().optional(),
438
+ fullname: zod.z.string().optional()
439
+ });
434
440
  var UsersRequestPayloadSchema = zod.z.object({
435
- operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne"]),
441
+ operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
436
442
  data: zod.z.object({
443
+ id: zod.z.number().optional(),
437
444
  username: zod.z.string().optional(),
438
445
  email: zod.z.string().email("Invalid email format").optional(),
439
446
  password: zod.z.string().optional(),
440
447
  fullname: zod.z.string().optional(),
441
- role: zod.z.string().optional()
448
+ role: zod.z.string().optional(),
449
+ // Query operation fields
450
+ filters: UserQueryFiltersSchema.optional(),
451
+ limit: zod.z.number().optional(),
452
+ sort: zod.z.enum(["ASC", "DESC"]).optional()
442
453
  }).optional()
443
454
  });
444
455
  var UsersRequestMessageSchema = zod.z.object({
@@ -649,15 +660,24 @@ var BookmarkDataSchema = zod.z.object({
649
660
  created_at: zod.z.string().optional(),
650
661
  updated_at: zod.z.string().optional()
651
662
  });
663
+ var BookmarkQueryFiltersSchema = zod.z.object({
664
+ userId: zod.z.number().optional(),
665
+ threadId: zod.z.string().optional(),
666
+ name: zod.z.string().optional()
667
+ });
652
668
  var BookmarksRequestPayloadSchema = zod.z.object({
653
- operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "getByUser", "getByThread"]),
669
+ operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
654
670
  data: zod.z.object({
655
671
  id: zod.z.number().optional(),
656
672
  userId: zod.z.number().optional(),
657
673
  threadId: zod.z.string().optional(),
658
674
  name: zod.z.string().optional(),
659
675
  description: zod.z.string().optional(),
660
- uiblock: DBUIBlockSchema.optional()
676
+ uiblock: DBUIBlockSchema.optional(),
677
+ // Query operation fields
678
+ filters: BookmarkQueryFiltersSchema.optional(),
679
+ limit: zod.z.number().optional(),
680
+ sort: zod.z.enum(["ASC", "DESC"]).optional()
661
681
  }).optional()
662
682
  });
663
683
  var BookmarksRequestMessageSchema = zod.z.object({
@@ -723,16 +743,16 @@ __export(services_exports, {
723
743
  getAllUIs: () => getAllUIs,
724
744
  getAllUsers: () => getAllUsers,
725
745
  getBookmark: () => getBookmark,
726
- getBookmarksByThread: () => getBookmarksByThread,
727
- getBookmarksByUser: () => getBookmarksByUser,
728
746
  getComponentSuggestions: () => getComponentSuggestions,
729
747
  getDashboard: () => getDashboard,
730
748
  getReport: () => getReport,
731
749
  getUI: () => getUI,
732
750
  getUser: () => getUser,
751
+ queryBookmarks: () => queryBookmarks,
733
752
  queryDashboards: () => queryDashboards,
734
753
  queryReports: () => queryReports,
735
754
  queryUIs: () => queryUIs,
755
+ queryUsers: () => queryUsers,
736
756
  requestBundle: () => requestBundle,
737
757
  requestData: () => requestData,
738
758
  sendAuthLoginRequest: () => sendAuthLoginRequest,
@@ -1086,6 +1106,33 @@ async function getUser(client, username, timeout) {
1086
1106
  message: payload.data?.message
1087
1107
  };
1088
1108
  }
1109
+ async function queryUsers(client, options = {}, timeout) {
1110
+ const { filters, limit, sort } = options;
1111
+ const messageId = `users_query_${Date.now()}`;
1112
+ const message = UsersRequestMessageSchema.parse({
1113
+ id: messageId,
1114
+ type: "USERS",
1115
+ from: { type: client.type },
1116
+ to: { type: "data-agent" },
1117
+ payload: {
1118
+ operation: "query",
1119
+ data: {
1120
+ filters,
1121
+ limit,
1122
+ sort
1123
+ }
1124
+ }
1125
+ });
1126
+ const response = await client.sendWithResponse(message, timeout);
1127
+ const payload = response.payload;
1128
+ return {
1129
+ success: payload.success,
1130
+ error: payload.error,
1131
+ users: payload.data?.users,
1132
+ count: payload.data?.count,
1133
+ message: payload.data?.message
1134
+ };
1135
+ }
1089
1136
 
1090
1137
  // src/services/dashboards/index.ts
1091
1138
  async function createDashboard(client, options, timeout) {
@@ -1531,42 +1578,20 @@ async function getBookmark(client, id, timeout) {
1531
1578
  message: payload.message
1532
1579
  };
1533
1580
  }
1534
- async function getBookmarksByUser(client, userId, threadId, timeout) {
1535
- const messageId = `bookmarks_getbyuser_${Date.now()}`;
1536
- const message = BookmarksRequestMessageSchema.parse({
1537
- id: messageId,
1538
- type: "BOOKMARKS",
1539
- from: { type: client.type },
1540
- to: { type: "data-agent" },
1541
- payload: {
1542
- operation: "getByUser",
1543
- data: {
1544
- userId,
1545
- threadId
1546
- }
1547
- }
1548
- });
1549
- const response = await client.sendWithResponse(message, timeout);
1550
- const payload = response.payload;
1551
- return {
1552
- success: payload.success,
1553
- error: payload.error,
1554
- data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
1555
- count: payload.count,
1556
- message: payload.message
1557
- };
1558
- }
1559
- async function getBookmarksByThread(client, threadId, timeout) {
1560
- const messageId = `bookmarks_getbythread_${Date.now()}`;
1581
+ async function queryBookmarks(client, options = {}, timeout) {
1582
+ const { filters, limit, sort } = options;
1583
+ const messageId = `bookmarks_query_${Date.now()}`;
1561
1584
  const message = BookmarksRequestMessageSchema.parse({
1562
1585
  id: messageId,
1563
1586
  type: "BOOKMARKS",
1564
1587
  from: { type: client.type },
1565
1588
  to: { type: "data-agent" },
1566
1589
  payload: {
1567
- operation: "getByThread",
1590
+ operation: "query",
1568
1591
  data: {
1569
- threadId
1592
+ filters,
1593
+ limit,
1594
+ sort
1570
1595
  }
1571
1596
  }
1572
1597
  });
@@ -2139,6 +2164,14 @@ var SuperatomClient = class {
2139
2164
  this.log("info", "Fetching user:", username);
2140
2165
  return getUser(this, username, timeout);
2141
2166
  }
2167
+ /**
2168
+ * Query users with filters, limit, and sort
2169
+ * Delegates to users service
2170
+ */
2171
+ async queryUsers(options = {}, timeout) {
2172
+ this.log("info", "Querying users with filters:", options.filters);
2173
+ return queryUsers(this, options, timeout);
2174
+ }
2142
2175
  // ==================== Dashboard Management Methods ====================
2143
2176
  // These methods delegate to dashboard service for admin dashboard CRUD operations
2144
2177
  /**
@@ -2232,20 +2265,12 @@ var SuperatomClient = class {
2232
2265
  return getBookmark(this, id, timeout);
2233
2266
  }
2234
2267
  /**
2235
- * Get bookmarks by user ID (and optionally by thread ID)
2236
- * Delegates to bookmarks service
2237
- */
2238
- async getBookmarksByUser(userId, threadId, timeout) {
2239
- this.log("info", "Fetching bookmarks for user:", userId);
2240
- return getBookmarksByUser(this, userId, threadId, timeout);
2241
- }
2242
- /**
2243
- * Get bookmarks by thread ID
2268
+ * Query bookmarks with filters, limit, and sort
2244
2269
  * Delegates to bookmarks service
2245
2270
  */
2246
- async getBookmarksByThread(threadId, timeout) {
2247
- this.log("info", "Fetching bookmarks for thread:", threadId);
2248
- return getBookmarksByThread(this, threadId, timeout);
2271
+ async queryBookmarks(options = {}, timeout) {
2272
+ this.log("info", "Querying bookmarks with filters:", options.filters);
2273
+ return queryBookmarks(this, options, timeout);
2249
2274
  }
2250
2275
  // ==================== Report Management Methods ====================
2251
2276
  // These methods delegate to report service for admin report CRUD operations