@superatomai/sdk-web 0.0.22 → 0.0.23

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
@@ -862,6 +862,71 @@ var KbNodesResponseMessageSchema = zod.z.object({
862
862
  to: MessageParticipantSchema.optional(),
863
863
  payload: KbNodesResponsePayloadSchema
864
864
  });
865
+ var MenuDataSchema = zod.z.object({
866
+ id: zod.z.number().optional(),
867
+ name: zod.z.string(),
868
+ componentName: zod.z.string(),
869
+ icon: zod.z.string().nullable().optional(),
870
+ userMessage: zod.z.string().nullable().optional(),
871
+ parentId: zod.z.number().nullable().optional(),
872
+ sortOrder: zod.z.number().optional(),
873
+ props: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
874
+ isActive: zod.z.boolean().optional(),
875
+ createdAt: zod.z.string().optional(),
876
+ updatedAt: zod.z.string().optional(),
877
+ children: zod.z.lazy(() => zod.z.array(MenuDataSchema)).optional()
878
+ });
879
+ var MenuQueryFiltersSchema = zod.z.object({
880
+ parentId: zod.z.number().nullable().optional(),
881
+ isActive: zod.z.boolean().optional()
882
+ });
883
+ var MenusRequestPayloadSchema = zod.z.object({
884
+ operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "query", "getRootMenus", "getChildMenus", "getHierarchy", "reorder"]),
885
+ data: zod.z.object({
886
+ id: zod.z.number().optional(),
887
+ name: zod.z.string().optional(),
888
+ componentName: zod.z.string().optional(),
889
+ icon: zod.z.string().optional(),
890
+ userMessage: zod.z.string().optional(),
891
+ parentId: zod.z.number().nullable().optional(),
892
+ sortOrder: zod.z.number().optional(),
893
+ props: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
894
+ isActive: zod.z.boolean().optional(),
895
+ // Query operation fields
896
+ filters: MenuQueryFiltersSchema.optional(),
897
+ limit: zod.z.number().optional(),
898
+ sort: zod.z.enum(["ASC", "DESC"]).optional(),
899
+ // Reorder operation
900
+ items: zod.z.array(zod.z.object({
901
+ id: zod.z.number(),
902
+ sortOrder: zod.z.number()
903
+ })).optional()
904
+ }).optional()
905
+ });
906
+ var MenusRequestMessageSchema = zod.z.object({
907
+ id: zod.z.string(),
908
+ type: zod.z.literal("MENUS"),
909
+ from: MessageParticipantSchema,
910
+ to: MessageParticipantSchema.optional(),
911
+ payload: MenusRequestPayloadSchema
912
+ });
913
+ var MenusResponsePayloadSchema = zod.z.object({
914
+ success: zod.z.boolean(),
915
+ error: zod.z.string().optional(),
916
+ data: zod.z.union([
917
+ MenuDataSchema,
918
+ zod.z.array(MenuDataSchema)
919
+ ]).optional(),
920
+ count: zod.z.number().optional(),
921
+ message: zod.z.string().optional()
922
+ });
923
+ var MenusResponseMessageSchema = zod.z.object({
924
+ id: zod.z.string(),
925
+ type: zod.z.literal("MENUS_RES"),
926
+ from: MessageParticipantSchema,
927
+ to: MessageParticipantSchema.optional(),
928
+ payload: MenusResponsePayloadSchema
929
+ });
865
930
  var ClientConfigSchema = zod.z.object({
866
931
  userId: zod.z.string(),
867
932
  projectId: zod.z.string(),
@@ -888,12 +953,14 @@ __export(services_exports, {
888
953
  createBookmark: () => createBookmark,
889
954
  createDashboard: () => createDashboard,
890
955
  createKbNode: () => createKbNode,
956
+ createMenu: () => createMenu,
891
957
  createReport: () => createReport,
892
958
  createUI: () => createUI,
893
959
  createUser: () => createUser,
894
960
  deleteBookmark: () => deleteBookmark,
895
961
  deleteDashboard: () => deleteDashboard,
896
962
  deleteKbNode: () => deleteKbNode,
963
+ deleteMenu: () => deleteMenu,
897
964
  deleteReport: () => deleteReport,
898
965
  deleteUI: () => deleteUI,
899
966
  deleteUser: () => deleteUser,
@@ -901,10 +968,12 @@ __export(services_exports, {
901
968
  getAllBookmarks: () => getAllBookmarks,
902
969
  getAllDashboards: () => getAllDashboards,
903
970
  getAllKbNodes: () => getAllKbNodes,
971
+ getAllMenus: () => getAllMenus,
904
972
  getAllReports: () => getAllReports,
905
973
  getAllUIs: () => getAllUIs,
906
974
  getAllUsers: () => getAllUsers,
907
975
  getBookmark: () => getBookmark,
976
+ getChildMenus: () => getChildMenus,
908
977
  getComponentSuggestions: () => getComponentSuggestions,
909
978
  getDashboard: () => getDashboard,
910
979
  getKbNode: () => getKbNode,
@@ -912,14 +981,19 @@ __export(services_exports, {
912
981
  getKbNodeTags: () => getKbNodeTags,
913
982
  getKbNodesByCategory: () => getKbNodesByCategory,
914
983
  getKbNodesByUser: () => getKbNodesByUser,
984
+ getMenu: () => getMenu,
985
+ getMenusHierarchy: () => getMenusHierarchy,
915
986
  getReport: () => getReport,
987
+ getRootMenus: () => getRootMenus,
916
988
  getUI: () => getUI,
917
989
  getUser: () => getUser,
918
990
  queryBookmarks: () => queryBookmarks,
919
991
  queryDashboards: () => queryDashboards,
992
+ queryMenus: () => queryMenus,
920
993
  queryReports: () => queryReports,
921
994
  queryUIs: () => queryUIs,
922
995
  queryUsers: () => queryUsers,
996
+ reorderMenus: () => reorderMenus,
923
997
  requestBundle: () => requestBundle,
924
998
  requestData: () => requestData,
925
999
  searchKbNodes: () => searchKbNodes,
@@ -932,6 +1006,7 @@ __export(services_exports, {
932
1006
  updateBookmark: () => updateBookmark,
933
1007
  updateDashboard: () => updateDashboard,
934
1008
  updateKbNode: () => updateKbNode,
1009
+ updateMenu: () => updateMenu,
935
1010
  updateReport: () => updateReport,
936
1011
  updateUI: () => updateUI,
937
1012
  updateUser: () => updateUser
@@ -2295,6 +2370,254 @@ async function sendDashCompRequest(client, options) {
2295
2370
  }
2296
2371
  }
2297
2372
 
2373
+ // src/services/menus/index.ts
2374
+ async function createMenu(client, options, timeout) {
2375
+ const { name, componentName, icon, userMessage, parentId, sortOrder, props, isActive } = options;
2376
+ const messageId = `menus_create_${Date.now()}`;
2377
+ const message = MenusRequestMessageSchema.parse({
2378
+ id: messageId,
2379
+ type: "MENUS",
2380
+ from: { type: client.type },
2381
+ to: { type: "data-agent" },
2382
+ payload: {
2383
+ operation: "create",
2384
+ data: {
2385
+ name,
2386
+ componentName,
2387
+ icon,
2388
+ userMessage,
2389
+ parentId,
2390
+ sortOrder,
2391
+ props,
2392
+ isActive
2393
+ }
2394
+ }
2395
+ });
2396
+ const response = await client.sendWithResponse(message, timeout);
2397
+ const payload = response.payload;
2398
+ return {
2399
+ success: payload.success,
2400
+ error: payload.error,
2401
+ message: payload.message,
2402
+ data: payload.data
2403
+ };
2404
+ }
2405
+ async function updateMenu(client, options, timeout) {
2406
+ const { id, name, componentName, icon, userMessage, parentId, sortOrder, props, isActive } = options;
2407
+ const messageId = `menus_update_${Date.now()}`;
2408
+ const message = MenusRequestMessageSchema.parse({
2409
+ id: messageId,
2410
+ type: "MENUS",
2411
+ from: { type: client.type },
2412
+ to: { type: "data-agent" },
2413
+ payload: {
2414
+ operation: "update",
2415
+ data: {
2416
+ id,
2417
+ name,
2418
+ componentName,
2419
+ icon,
2420
+ userMessage,
2421
+ parentId,
2422
+ sortOrder,
2423
+ props,
2424
+ isActive
2425
+ }
2426
+ }
2427
+ });
2428
+ const response = await client.sendWithResponse(message, timeout);
2429
+ const payload = response.payload;
2430
+ return {
2431
+ success: payload.success,
2432
+ error: payload.error,
2433
+ message: payload.message,
2434
+ data: payload.data
2435
+ };
2436
+ }
2437
+ async function deleteMenu(client, id, timeout) {
2438
+ const messageId = `menus_delete_${Date.now()}`;
2439
+ const message = MenusRequestMessageSchema.parse({
2440
+ id: messageId,
2441
+ type: "MENUS",
2442
+ from: { type: client.type },
2443
+ to: { type: "data-agent" },
2444
+ payload: {
2445
+ operation: "delete",
2446
+ data: {
2447
+ id
2448
+ }
2449
+ }
2450
+ });
2451
+ const response = await client.sendWithResponse(message, timeout);
2452
+ const payload = response.payload;
2453
+ return {
2454
+ success: payload.success,
2455
+ error: payload.error,
2456
+ message: payload.message,
2457
+ data: payload.data
2458
+ };
2459
+ }
2460
+ async function getAllMenus(client, timeout) {
2461
+ const messageId = `menus_getall_${Date.now()}`;
2462
+ const message = MenusRequestMessageSchema.parse({
2463
+ id: messageId,
2464
+ type: "MENUS",
2465
+ from: { type: client.type },
2466
+ to: { type: "data-agent" },
2467
+ payload: {
2468
+ operation: "getAll"
2469
+ }
2470
+ });
2471
+ const response = await client.sendWithResponse(message, timeout);
2472
+ const payload = response.payload;
2473
+ return {
2474
+ success: payload.success,
2475
+ error: payload.error,
2476
+ menus: Array.isArray(payload.data) ? payload.data : void 0,
2477
+ count: payload.count,
2478
+ message: payload.message
2479
+ };
2480
+ }
2481
+ async function getMenu(client, id, timeout) {
2482
+ const messageId = `menus_getone_${Date.now()}`;
2483
+ const message = MenusRequestMessageSchema.parse({
2484
+ id: messageId,
2485
+ type: "MENUS",
2486
+ from: { type: client.type },
2487
+ to: { type: "data-agent" },
2488
+ payload: {
2489
+ operation: "getOne",
2490
+ data: {
2491
+ id
2492
+ }
2493
+ }
2494
+ });
2495
+ const response = await client.sendWithResponse(message, timeout);
2496
+ const payload = response.payload;
2497
+ return {
2498
+ success: payload.success,
2499
+ error: payload.error,
2500
+ menu: payload.data,
2501
+ message: payload.message
2502
+ };
2503
+ }
2504
+ async function getRootMenus(client, timeout) {
2505
+ const messageId = `menus_getrootmenus_${Date.now()}`;
2506
+ const message = MenusRequestMessageSchema.parse({
2507
+ id: messageId,
2508
+ type: "MENUS",
2509
+ from: { type: client.type },
2510
+ to: { type: "data-agent" },
2511
+ payload: {
2512
+ operation: "getRootMenus"
2513
+ }
2514
+ });
2515
+ const response = await client.sendWithResponse(message, timeout);
2516
+ const payload = response.payload;
2517
+ return {
2518
+ success: payload.success,
2519
+ error: payload.error,
2520
+ menus: Array.isArray(payload.data) ? payload.data : void 0,
2521
+ count: payload.count,
2522
+ message: payload.message
2523
+ };
2524
+ }
2525
+ async function getChildMenus(client, parentId, timeout) {
2526
+ const messageId = `menus_getchildmenus_${Date.now()}`;
2527
+ const message = MenusRequestMessageSchema.parse({
2528
+ id: messageId,
2529
+ type: "MENUS",
2530
+ from: { type: client.type },
2531
+ to: { type: "data-agent" },
2532
+ payload: {
2533
+ operation: "getChildMenus",
2534
+ data: {
2535
+ parentId
2536
+ }
2537
+ }
2538
+ });
2539
+ const response = await client.sendWithResponse(message, timeout);
2540
+ const payload = response.payload;
2541
+ return {
2542
+ success: payload.success,
2543
+ error: payload.error,
2544
+ menus: Array.isArray(payload.data) ? payload.data : void 0,
2545
+ count: payload.count,
2546
+ message: payload.message
2547
+ };
2548
+ }
2549
+ async function getMenusHierarchy(client, timeout) {
2550
+ const messageId = `menus_gethierarchy_${Date.now()}`;
2551
+ const message = MenusRequestMessageSchema.parse({
2552
+ id: messageId,
2553
+ type: "MENUS",
2554
+ from: { type: client.type },
2555
+ to: { type: "data-agent" },
2556
+ payload: {
2557
+ operation: "getHierarchy"
2558
+ }
2559
+ });
2560
+ const response = await client.sendWithResponse(message, timeout);
2561
+ const payload = response.payload;
2562
+ return {
2563
+ success: payload.success,
2564
+ error: payload.error,
2565
+ menus: Array.isArray(payload.data) ? payload.data : void 0,
2566
+ count: payload.count,
2567
+ message: payload.message
2568
+ };
2569
+ }
2570
+ async function queryMenus(client, options = {}, timeout) {
2571
+ const { filters, limit, sort } = options;
2572
+ const messageId = `menus_query_${Date.now()}`;
2573
+ const message = MenusRequestMessageSchema.parse({
2574
+ id: messageId,
2575
+ type: "MENUS",
2576
+ from: { type: client.type },
2577
+ to: { type: "data-agent" },
2578
+ payload: {
2579
+ operation: "query",
2580
+ data: {
2581
+ filters,
2582
+ limit,
2583
+ sort
2584
+ }
2585
+ }
2586
+ });
2587
+ const response = await client.sendWithResponse(message, timeout);
2588
+ const payload = response.payload;
2589
+ return {
2590
+ success: payload.success,
2591
+ error: payload.error,
2592
+ menus: Array.isArray(payload.data) ? payload.data : void 0,
2593
+ count: payload.count,
2594
+ message: payload.message
2595
+ };
2596
+ }
2597
+ async function reorderMenus(client, items, timeout) {
2598
+ const messageId = `menus_reorder_${Date.now()}`;
2599
+ const message = MenusRequestMessageSchema.parse({
2600
+ id: messageId,
2601
+ type: "MENUS",
2602
+ from: { type: client.type },
2603
+ to: { type: "data-agent" },
2604
+ payload: {
2605
+ operation: "reorder",
2606
+ data: {
2607
+ items
2608
+ }
2609
+ }
2610
+ });
2611
+ const response = await client.sendWithResponse(message, timeout);
2612
+ const payload = response.payload;
2613
+ return {
2614
+ success: payload.success,
2615
+ error: payload.error,
2616
+ message: payload.message,
2617
+ data: Array.isArray(payload.data) ? payload.data : void 0
2618
+ };
2619
+ }
2620
+
2298
2621
  // src/client.ts
2299
2622
  var SuperatomClient = class {
2300
2623
  constructor(config) {
@@ -2991,6 +3314,88 @@ var SuperatomClient = class {
2991
3314
  this.log("info", "Sending dash comp request for prompt:", options.prompt.substring(0, 50) + "...");
2992
3315
  return sendDashCompRequest(this, options);
2993
3316
  }
3317
+ // ==================== Menu Management Methods ====================
3318
+ // These methods delegate to menus service for menu CRUD operations
3319
+ /**
3320
+ * Create a new menu
3321
+ * Delegates to menus service
3322
+ */
3323
+ async createMenu(options, timeout) {
3324
+ this.log("info", "Creating menu:", options.name);
3325
+ return createMenu(this, options, timeout);
3326
+ }
3327
+ /**
3328
+ * Update an existing menu
3329
+ * Delegates to menus service
3330
+ */
3331
+ async updateMenu(options, timeout) {
3332
+ this.log("info", "Updating menu:", options.id);
3333
+ return updateMenu(this, options, timeout);
3334
+ }
3335
+ /**
3336
+ * Delete a menu
3337
+ * Delegates to menus service
3338
+ */
3339
+ async deleteMenu(id, timeout) {
3340
+ this.log("info", "Deleting menu:", id);
3341
+ return deleteMenu(this, id, timeout);
3342
+ }
3343
+ /**
3344
+ * Get all menus
3345
+ * Delegates to menus service
3346
+ */
3347
+ async getAllMenus(timeout) {
3348
+ this.log("info", "Fetching all menus");
3349
+ return getAllMenus(this, timeout);
3350
+ }
3351
+ /**
3352
+ * Get a specific menu by ID
3353
+ * Delegates to menus service
3354
+ */
3355
+ async getMenu(id, timeout) {
3356
+ this.log("info", "Fetching menu:", id);
3357
+ return getMenu(this, id, timeout);
3358
+ }
3359
+ /**
3360
+ * Get root menus (top-level sidebar items)
3361
+ * Delegates to menus service
3362
+ */
3363
+ async getRootMenus(timeout) {
3364
+ this.log("info", "Fetching root menus");
3365
+ return getRootMenus(this, timeout);
3366
+ }
3367
+ /**
3368
+ * Get child menus by parent ID
3369
+ * Delegates to menus service
3370
+ */
3371
+ async getChildMenus(parentId, timeout) {
3372
+ this.log("info", "Fetching child menus for parent:", parentId);
3373
+ return getChildMenus(this, parentId, timeout);
3374
+ }
3375
+ /**
3376
+ * Get menus with hierarchy (nested structure)
3377
+ * Delegates to menus service
3378
+ */
3379
+ async getMenusHierarchy(timeout) {
3380
+ this.log("info", "Fetching menus hierarchy");
3381
+ return getMenusHierarchy(this, timeout);
3382
+ }
3383
+ /**
3384
+ * Query menus with filters
3385
+ * Delegates to menus service
3386
+ */
3387
+ async queryMenus(options, timeout) {
3388
+ this.log("info", "Querying menus with filters:", options?.filters);
3389
+ return queryMenus(this, options, timeout);
3390
+ }
3391
+ /**
3392
+ * Reorder menus
3393
+ * Delegates to menus service
3394
+ */
3395
+ async reorderMenus(items, timeout) {
3396
+ this.log("info", "Reordering", items.length, "menus");
3397
+ return reorderMenus(this, items, timeout);
3398
+ }
2994
3399
  /**
2995
3400
  * Internal logging
2996
3401
  */
@@ -3068,6 +3473,12 @@ exports.KbNodesRequestMessageSchema = KbNodesRequestMessageSchema;
3068
3473
  exports.KbNodesRequestPayloadSchema = KbNodesRequestPayloadSchema;
3069
3474
  exports.KbNodesResponseMessageSchema = KbNodesResponseMessageSchema;
3070
3475
  exports.KbNodesResponsePayloadSchema = KbNodesResponsePayloadSchema;
3476
+ exports.MenuDataSchema = MenuDataSchema;
3477
+ exports.MenuQueryFiltersSchema = MenuQueryFiltersSchema;
3478
+ exports.MenusRequestMessageSchema = MenusRequestMessageSchema;
3479
+ exports.MenusRequestPayloadSchema = MenusRequestPayloadSchema;
3480
+ exports.MenusResponseMessageSchema = MenusResponseMessageSchema;
3481
+ exports.MenusResponsePayloadSchema = MenusResponsePayloadSchema;
3071
3482
  exports.MessageParticipantSchema = MessageParticipantSchema;
3072
3483
  exports.MessageSchema = MessageSchema;
3073
3484
  exports.SDK_VERSION = SDK_VERSION;