@superatomai/sdk-web 0.0.13 → 0.0.14

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
@@ -702,6 +702,82 @@ z.object({
702
702
  to: MessageParticipantSchema.optional(),
703
703
  payload: BookmarksResponsePayloadSchema
704
704
  });
705
+ var KbNodeDataSchema = z.object({
706
+ id: z.number().optional(),
707
+ title: z.string(),
708
+ content: z.string(),
709
+ category: z.string().nullable().optional(),
710
+ tags: z.array(z.string()).nullable().optional(),
711
+ createdBy: z.number(),
712
+ updatedBy: z.number().optional(),
713
+ createdAt: z.string().optional(),
714
+ updatedAt: z.string().optional()
715
+ });
716
+ var KbNodesQueryFiltersSchema = z.object({
717
+ query: z.string().optional(),
718
+ category: z.string().optional(),
719
+ tags: z.array(z.string()).optional(),
720
+ createdBy: z.number().optional()
721
+ });
722
+ var KbNodesRequestPayloadSchema = z.object({
723
+ operation: z.enum(["create", "update", "delete", "getAll", "getOne", "search", "getByCategory", "getByUser", "getCategories", "getTags"]),
724
+ data: z.object({
725
+ id: z.number().optional(),
726
+ title: z.string().optional(),
727
+ content: z.string().optional(),
728
+ category: z.string().optional(),
729
+ tags: z.array(z.string()).optional(),
730
+ createdBy: z.number().optional(),
731
+ updatedBy: z.number().optional(),
732
+ userId: z.number().optional(),
733
+ // Query/search operation fields
734
+ query: z.string().optional(),
735
+ filters: KbNodesQueryFiltersSchema.optional(),
736
+ limit: z.number().optional(),
737
+ offset: z.number().optional()
738
+ }).optional()
739
+ });
740
+ var KbNodesRequestMessageSchema = z.object({
741
+ id: z.string(),
742
+ type: z.literal("KB_NODES"),
743
+ from: MessageParticipantSchema,
744
+ to: MessageParticipantSchema.optional(),
745
+ payload: KbNodesRequestPayloadSchema
746
+ });
747
+ var KbNodesResponsePayloadSchema = z.object({
748
+ success: z.boolean(),
749
+ error: z.string().optional(),
750
+ data: z.object({
751
+ // Single node operations
752
+ id: z.number().optional(),
753
+ title: z.string().optional(),
754
+ content: z.string().optional(),
755
+ category: z.string().nullable().optional(),
756
+ tags: z.array(z.string()).nullable().optional(),
757
+ createdBy: z.number().optional(),
758
+ updatedBy: z.number().optional(),
759
+ createdAt: z.string().optional(),
760
+ updatedAt: z.string().optional(),
761
+ message: z.string().optional(),
762
+ // GetOne response
763
+ node: KbNodeDataSchema.optional(),
764
+ // List operations
765
+ nodes: z.array(KbNodeDataSchema).optional(),
766
+ count: z.number().optional(),
767
+ // getByCategory/getByUser
768
+ userId: z.number().optional(),
769
+ // getCategories
770
+ categories: z.array(z.string()).optional()
771
+ // getTags
772
+ }).optional()
773
+ });
774
+ var KbNodesResponseMessageSchema = z.object({
775
+ id: z.string(),
776
+ type: z.literal("KB_NODES_RES"),
777
+ from: MessageParticipantSchema,
778
+ to: MessageParticipantSchema.optional(),
779
+ payload: KbNodesResponsePayloadSchema
780
+ });
705
781
  var ClientConfigSchema = z.object({
706
782
  userId: z.string(),
707
783
  projectId: z.string(),
@@ -726,23 +802,31 @@ __export(services_exports, {
726
802
  UIElementSchema: () => UIElementSchema,
727
803
  createBookmark: () => createBookmark,
728
804
  createDashboard: () => createDashboard,
805
+ createKbNode: () => createKbNode,
729
806
  createReport: () => createReport,
730
807
  createUI: () => createUI,
731
808
  createUser: () => createUser,
732
809
  deleteBookmark: () => deleteBookmark,
733
810
  deleteDashboard: () => deleteDashboard,
811
+ deleteKbNode: () => deleteKbNode,
734
812
  deleteReport: () => deleteReport,
735
813
  deleteUI: () => deleteUI,
736
814
  deleteUser: () => deleteUser,
737
815
  getActions: () => getActions,
738
816
  getAllBookmarks: () => getAllBookmarks,
739
817
  getAllDashboards: () => getAllDashboards,
818
+ getAllKbNodes: () => getAllKbNodes,
740
819
  getAllReports: () => getAllReports,
741
820
  getAllUIs: () => getAllUIs,
742
821
  getAllUsers: () => getAllUsers,
743
822
  getBookmark: () => getBookmark,
744
823
  getComponentSuggestions: () => getComponentSuggestions,
745
824
  getDashboard: () => getDashboard,
825
+ getKbNode: () => getKbNode,
826
+ getKbNodeCategories: () => getKbNodeCategories,
827
+ getKbNodeTags: () => getKbNodeTags,
828
+ getKbNodesByCategory: () => getKbNodesByCategory,
829
+ getKbNodesByUser: () => getKbNodesByUser,
746
830
  getReport: () => getReport,
747
831
  getUI: () => getUI,
748
832
  getUser: () => getUser,
@@ -753,6 +837,7 @@ __export(services_exports, {
753
837
  queryUsers: () => queryUsers,
754
838
  requestBundle: () => requestBundle,
755
839
  requestData: () => requestData,
840
+ searchKbNodes: () => searchKbNodes,
756
841
  sendAuthLoginRequest: () => sendAuthLoginRequest,
757
842
  sendAuthVerifyRequest: () => sendAuthVerifyRequest,
758
843
  sendComponents: () => sendComponents,
@@ -760,6 +845,7 @@ __export(services_exports, {
760
845
  sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
761
846
  updateBookmark: () => updateBookmark,
762
847
  updateDashboard: () => updateDashboard,
848
+ updateKbNode: () => updateKbNode,
763
849
  updateReport: () => updateReport,
764
850
  updateUI: () => updateUI,
765
851
  updateUser: () => updateUser
@@ -1785,6 +1871,277 @@ async function queryUIs(client, options = {}, timeout) {
1785
1871
  };
1786
1872
  }
1787
1873
 
1874
+ // src/services/kb-nodes.ts
1875
+ async function createKbNode(client, title, content, createdBy, category, tags, timeout) {
1876
+ const messageId = `kb_nodes_create_${Date.now()}`;
1877
+ const message = KbNodesRequestMessageSchema.parse({
1878
+ id: messageId,
1879
+ type: "KB_NODES",
1880
+ from: { type: client.type },
1881
+ to: { type: "data-agent" },
1882
+ payload: {
1883
+ operation: "create",
1884
+ data: {
1885
+ title,
1886
+ content,
1887
+ createdBy,
1888
+ category,
1889
+ tags
1890
+ }
1891
+ }
1892
+ });
1893
+ const response = await client.sendWithResponse(message, timeout);
1894
+ const payload = response.payload;
1895
+ return {
1896
+ success: payload.success,
1897
+ error: payload.error,
1898
+ message: payload.data?.message,
1899
+ node: payload.data ? {
1900
+ id: payload.data.id,
1901
+ title: payload.data.title || title,
1902
+ content: payload.data.content || content,
1903
+ category: payload.data.category,
1904
+ tags: payload.data.tags,
1905
+ createdBy: payload.data.createdBy || createdBy,
1906
+ updatedBy: payload.data.updatedBy,
1907
+ createdAt: payload.data.createdAt,
1908
+ updatedAt: payload.data.updatedAt
1909
+ } : void 0
1910
+ };
1911
+ }
1912
+ async function updateKbNode(client, id, updatedBy, updates, timeout) {
1913
+ const messageId = `kb_nodes_update_${Date.now()}`;
1914
+ const message = KbNodesRequestMessageSchema.parse({
1915
+ id: messageId,
1916
+ type: "KB_NODES",
1917
+ from: { type: client.type },
1918
+ to: { type: "data-agent" },
1919
+ payload: {
1920
+ operation: "update",
1921
+ data: {
1922
+ id,
1923
+ updatedBy,
1924
+ ...updates
1925
+ }
1926
+ }
1927
+ });
1928
+ const response = await client.sendWithResponse(message, timeout);
1929
+ const payload = response.payload;
1930
+ return {
1931
+ success: payload.success,
1932
+ error: payload.error,
1933
+ message: payload.data?.message,
1934
+ node: payload.data ? {
1935
+ id: payload.data.id,
1936
+ title: payload.data.title || "",
1937
+ content: payload.data.content || "",
1938
+ category: payload.data.category,
1939
+ tags: payload.data.tags,
1940
+ createdBy: payload.data.createdBy || 0,
1941
+ updatedBy: payload.data.updatedBy,
1942
+ createdAt: payload.data.createdAt,
1943
+ updatedAt: payload.data.updatedAt
1944
+ } : void 0
1945
+ };
1946
+ }
1947
+ async function deleteKbNode(client, id, timeout) {
1948
+ const messageId = `kb_nodes_delete_${Date.now()}`;
1949
+ const message = KbNodesRequestMessageSchema.parse({
1950
+ id: messageId,
1951
+ type: "KB_NODES",
1952
+ from: { type: client.type },
1953
+ to: { type: "data-agent" },
1954
+ payload: {
1955
+ operation: "delete",
1956
+ data: {
1957
+ id
1958
+ }
1959
+ }
1960
+ });
1961
+ const response = await client.sendWithResponse(message, timeout);
1962
+ const payload = response.payload;
1963
+ return {
1964
+ success: payload.success,
1965
+ error: payload.error,
1966
+ message: payload.data?.message
1967
+ };
1968
+ }
1969
+ async function getAllKbNodes(client, limit, offset, timeout) {
1970
+ const messageId = `kb_nodes_getall_${Date.now()}`;
1971
+ const message = KbNodesRequestMessageSchema.parse({
1972
+ id: messageId,
1973
+ type: "KB_NODES",
1974
+ from: { type: client.type },
1975
+ to: { type: "data-agent" },
1976
+ payload: {
1977
+ operation: "getAll",
1978
+ data: {
1979
+ limit,
1980
+ offset
1981
+ }
1982
+ }
1983
+ });
1984
+ const response = await client.sendWithResponse(message, timeout);
1985
+ const payload = response.payload;
1986
+ return {
1987
+ success: payload.success,
1988
+ error: payload.error,
1989
+ nodes: payload.data?.nodes,
1990
+ count: payload.data?.count,
1991
+ message: payload.data?.message
1992
+ };
1993
+ }
1994
+ async function getKbNode(client, id, timeout) {
1995
+ const messageId = `kb_nodes_getone_${Date.now()}`;
1996
+ const message = KbNodesRequestMessageSchema.parse({
1997
+ id: messageId,
1998
+ type: "KB_NODES",
1999
+ from: { type: client.type },
2000
+ to: { type: "data-agent" },
2001
+ payload: {
2002
+ operation: "getOne",
2003
+ data: {
2004
+ id
2005
+ }
2006
+ }
2007
+ });
2008
+ const response = await client.sendWithResponse(message, timeout);
2009
+ const payload = response.payload;
2010
+ return {
2011
+ success: payload.success,
2012
+ error: payload.error,
2013
+ node: payload.data?.node,
2014
+ message: payload.data?.message
2015
+ };
2016
+ }
2017
+ async function searchKbNodes(client, options = {}, timeout) {
2018
+ const { query, category, tags, createdBy, limit, offset } = options;
2019
+ const messageId = `kb_nodes_search_${Date.now()}`;
2020
+ const message = KbNodesRequestMessageSchema.parse({
2021
+ id: messageId,
2022
+ type: "KB_NODES",
2023
+ from: { type: client.type },
2024
+ to: { type: "data-agent" },
2025
+ payload: {
2026
+ operation: "search",
2027
+ data: {
2028
+ query,
2029
+ category,
2030
+ tags,
2031
+ createdBy,
2032
+ limit,
2033
+ offset
2034
+ }
2035
+ }
2036
+ });
2037
+ const response = await client.sendWithResponse(message, timeout);
2038
+ const payload = response.payload;
2039
+ return {
2040
+ success: payload.success,
2041
+ error: payload.error,
2042
+ nodes: payload.data?.nodes,
2043
+ count: payload.data?.count,
2044
+ message: payload.data?.message
2045
+ };
2046
+ }
2047
+ async function getKbNodesByCategory(client, category, limit, offset, timeout) {
2048
+ const messageId = `kb_nodes_getbycategory_${Date.now()}`;
2049
+ const message = KbNodesRequestMessageSchema.parse({
2050
+ id: messageId,
2051
+ type: "KB_NODES",
2052
+ from: { type: client.type },
2053
+ to: { type: "data-agent" },
2054
+ payload: {
2055
+ operation: "getByCategory",
2056
+ data: {
2057
+ category,
2058
+ limit,
2059
+ offset
2060
+ }
2061
+ }
2062
+ });
2063
+ const response = await client.sendWithResponse(message, timeout);
2064
+ const payload = response.payload;
2065
+ return {
2066
+ success: payload.success,
2067
+ error: payload.error,
2068
+ nodes: payload.data?.nodes,
2069
+ count: payload.data?.count,
2070
+ category: payload.data?.category || category,
2071
+ message: payload.data?.message
2072
+ };
2073
+ }
2074
+ async function getKbNodesByUser(client, userId, limit, offset, timeout) {
2075
+ const messageId = `kb_nodes_getbyuser_${Date.now()}`;
2076
+ const message = KbNodesRequestMessageSchema.parse({
2077
+ id: messageId,
2078
+ type: "KB_NODES",
2079
+ from: { type: client.type },
2080
+ to: { type: "data-agent" },
2081
+ payload: {
2082
+ operation: "getByUser",
2083
+ data: {
2084
+ userId,
2085
+ limit,
2086
+ offset
2087
+ }
2088
+ }
2089
+ });
2090
+ const response = await client.sendWithResponse(message, timeout);
2091
+ const payload = response.payload;
2092
+ return {
2093
+ success: payload.success,
2094
+ error: payload.error,
2095
+ nodes: payload.data?.nodes,
2096
+ count: payload.data?.count,
2097
+ userId: payload.data?.userId || userId,
2098
+ message: payload.data?.message
2099
+ };
2100
+ }
2101
+ async function getKbNodeCategories(client, timeout) {
2102
+ const messageId = `kb_nodes_getcategories_${Date.now()}`;
2103
+ const message = KbNodesRequestMessageSchema.parse({
2104
+ id: messageId,
2105
+ type: "KB_NODES",
2106
+ from: { type: client.type },
2107
+ to: { type: "data-agent" },
2108
+ payload: {
2109
+ operation: "getCategories"
2110
+ }
2111
+ });
2112
+ const response = await client.sendWithResponse(message, timeout);
2113
+ const payload = response.payload;
2114
+ return {
2115
+ success: payload.success,
2116
+ error: payload.error,
2117
+ categories: payload.data?.categories,
2118
+ count: payload.data?.count,
2119
+ message: payload.data?.message
2120
+ };
2121
+ }
2122
+ async function getKbNodeTags(client, timeout) {
2123
+ const messageId = `kb_nodes_gettags_${Date.now()}`;
2124
+ const message = KbNodesRequestMessageSchema.parse({
2125
+ id: messageId,
2126
+ type: "KB_NODES",
2127
+ from: { type: client.type },
2128
+ to: { type: "data-agent" },
2129
+ payload: {
2130
+ operation: "getTags"
2131
+ }
2132
+ });
2133
+ const response = await client.sendWithResponse(message, timeout);
2134
+ const payload = response.payload;
2135
+ const responseData = payload.data;
2136
+ return {
2137
+ success: payload.success,
2138
+ error: payload.error,
2139
+ tags: responseData?.tags,
2140
+ count: payload.data?.count,
2141
+ message: payload.data?.message
2142
+ };
2143
+ }
2144
+
1788
2145
  // src/client.ts
1789
2146
  var SuperatomClient = class {
1790
2147
  constructor(config) {
@@ -2370,6 +2727,88 @@ var SuperatomClient = class {
2370
2727
  this.log("info", "Querying UIs with filters:", options?.filters);
2371
2728
  return queryUIs(this, options, timeout);
2372
2729
  }
2730
+ // ==================== KB Nodes (Knowledge Base) Management Methods ====================
2731
+ // These methods delegate to kb-nodes service for knowledge base CRUD operations
2732
+ /**
2733
+ * Create a new knowledge base node
2734
+ * Delegates to kb-nodes service
2735
+ */
2736
+ async createKbNode(title, content, createdBy, category, tags, timeout) {
2737
+ this.log("info", "Creating KB node:", title);
2738
+ return createKbNode(this, title, content, createdBy, category, tags, timeout);
2739
+ }
2740
+ /**
2741
+ * Update an existing knowledge base node
2742
+ * Delegates to kb-nodes service
2743
+ */
2744
+ async updateKbNode(id, updatedBy, updates, timeout) {
2745
+ this.log("info", "Updating KB node:", id);
2746
+ return updateKbNode(this, id, updatedBy, updates, timeout);
2747
+ }
2748
+ /**
2749
+ * Delete a knowledge base node
2750
+ * Delegates to kb-nodes service
2751
+ */
2752
+ async deleteKbNode(id, timeout) {
2753
+ this.log("info", "Deleting KB node:", id);
2754
+ return deleteKbNode(this, id, timeout);
2755
+ }
2756
+ /**
2757
+ * Get all knowledge base nodes
2758
+ * Delegates to kb-nodes service
2759
+ */
2760
+ async getAllKbNodes(limit, offset, timeout) {
2761
+ this.log("info", "Fetching all KB nodes");
2762
+ return getAllKbNodes(this, limit, offset, timeout);
2763
+ }
2764
+ /**
2765
+ * Get a specific knowledge base node by ID
2766
+ * Delegates to kb-nodes service
2767
+ */
2768
+ async getKbNode(id, timeout) {
2769
+ this.log("info", "Fetching KB node:", id);
2770
+ return getKbNode(this, id, timeout);
2771
+ }
2772
+ /**
2773
+ * Search knowledge base nodes with full-text search and filters
2774
+ * Delegates to kb-nodes service
2775
+ */
2776
+ async searchKbNodes(options = {}, timeout) {
2777
+ this.log("info", "Searching KB nodes with query:", options.query);
2778
+ return searchKbNodes(this, options, timeout);
2779
+ }
2780
+ /**
2781
+ * Get knowledge base nodes by category
2782
+ * Delegates to kb-nodes service
2783
+ */
2784
+ async getKbNodesByCategory(category, limit, offset, timeout) {
2785
+ this.log("info", "Fetching KB nodes by category:", category);
2786
+ return getKbNodesByCategory(this, category, limit, offset, timeout);
2787
+ }
2788
+ /**
2789
+ * Get knowledge base nodes by user (creator)
2790
+ * Delegates to kb-nodes service
2791
+ */
2792
+ async getKbNodesByUser(userId, limit, offset, timeout) {
2793
+ this.log("info", "Fetching KB nodes by user:", userId);
2794
+ return getKbNodesByUser(this, userId, limit, offset, timeout);
2795
+ }
2796
+ /**
2797
+ * Get all unique categories from knowledge base nodes
2798
+ * Delegates to kb-nodes service
2799
+ */
2800
+ async getKbNodeCategories(timeout) {
2801
+ this.log("info", "Fetching KB node categories");
2802
+ return getKbNodeCategories(this, timeout);
2803
+ }
2804
+ /**
2805
+ * Get all unique tags from knowledge base nodes
2806
+ * Delegates to kb-nodes service
2807
+ */
2808
+ async getKbNodeTags(timeout) {
2809
+ this.log("info", "Fetching KB node tags");
2810
+ return getKbNodeTags(this, timeout);
2811
+ }
2373
2812
  /**
2374
2813
  * Internal logging
2375
2814
  */
@@ -2415,6 +2854,6 @@ function hasComponents() {
2415
2854
  // src/index.ts
2416
2855
  var SDK_VERSION = "0.1.0";
2417
2856
 
2418
- 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, MessageParticipantSchema, MessageSchema, SDK_VERSION, SuperatomClient, UILogEntrySchema, UILogsMessageSchema, UILogsPayloadSchema, UserPromptRequestMessageSchema, UserPromptRequestPayloadSchema, UserPromptResponseMessageSchema, UserPromptResponsePayloadSchema, UserPromptSuggestionsRequestMessageSchema, UserPromptSuggestionsRequestPayloadSchema, UserPromptSuggestionsResponseMessageSchema, UserPromptSuggestionsResponsePayloadSchema, getComponent, getComponents, hasComponents, services_exports as services, setup };
2857
+ 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 };
2419
2858
  //# sourceMappingURL=index.js.map
2420
2859
  //# sourceMappingURL=index.js.map