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