@superatomai/sdk-web 0.0.13 → 0.0.15
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/README.md +755 -755
- package/dist/index.cjs +459 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +538 -9
- package/dist/index.d.ts +538 -9
- package/dist/index.js +454 -13
- package/dist/index.js.map +1 -1
- package/package.json +43 -41
package/dist/index.cjs
CHANGED
|
@@ -320,7 +320,9 @@ var UserPromptSuggestionsResponseMessageSchema = zod.z.object({
|
|
|
320
320
|
to: MessageParticipantSchema.optional(),
|
|
321
321
|
payload: UserPromptSuggestionsResponsePayloadSchema
|
|
322
322
|
});
|
|
323
|
-
var BundleRequestPayloadSchema = zod.z.object({
|
|
323
|
+
var BundleRequestPayloadSchema = zod.z.object({
|
|
324
|
+
devbundlereq: zod.z.boolean().optional().default(false)
|
|
325
|
+
});
|
|
324
326
|
var BundleRequestMessageSchema = zod.z.object({
|
|
325
327
|
id: zod.z.string(),
|
|
326
328
|
type: zod.z.literal("BUNDLE_REQ"),
|
|
@@ -704,6 +706,82 @@ zod.z.object({
|
|
|
704
706
|
to: MessageParticipantSchema.optional(),
|
|
705
707
|
payload: BookmarksResponsePayloadSchema
|
|
706
708
|
});
|
|
709
|
+
var KbNodeDataSchema = zod.z.object({
|
|
710
|
+
id: zod.z.number().optional(),
|
|
711
|
+
title: zod.z.string(),
|
|
712
|
+
content: zod.z.string(),
|
|
713
|
+
category: zod.z.string().nullable().optional(),
|
|
714
|
+
tags: zod.z.array(zod.z.string()).nullable().optional(),
|
|
715
|
+
createdBy: zod.z.number(),
|
|
716
|
+
updatedBy: zod.z.number().optional(),
|
|
717
|
+
createdAt: zod.z.string().optional(),
|
|
718
|
+
updatedAt: zod.z.string().optional()
|
|
719
|
+
});
|
|
720
|
+
var KbNodesQueryFiltersSchema = zod.z.object({
|
|
721
|
+
query: zod.z.string().optional(),
|
|
722
|
+
category: zod.z.string().optional(),
|
|
723
|
+
tags: zod.z.array(zod.z.string()).optional(),
|
|
724
|
+
createdBy: zod.z.number().optional()
|
|
725
|
+
});
|
|
726
|
+
var KbNodesRequestPayloadSchema = zod.z.object({
|
|
727
|
+
operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "search", "getByCategory", "getByUser", "getCategories", "getTags"]),
|
|
728
|
+
data: zod.z.object({
|
|
729
|
+
id: zod.z.number().optional(),
|
|
730
|
+
title: zod.z.string().optional(),
|
|
731
|
+
content: zod.z.string().optional(),
|
|
732
|
+
category: zod.z.string().optional(),
|
|
733
|
+
tags: zod.z.array(zod.z.string()).optional(),
|
|
734
|
+
createdBy: zod.z.number().optional(),
|
|
735
|
+
updatedBy: zod.z.number().optional(),
|
|
736
|
+
userId: zod.z.number().optional(),
|
|
737
|
+
// Query/search operation fields
|
|
738
|
+
query: zod.z.string().optional(),
|
|
739
|
+
filters: KbNodesQueryFiltersSchema.optional(),
|
|
740
|
+
limit: zod.z.number().optional(),
|
|
741
|
+
offset: zod.z.number().optional()
|
|
742
|
+
}).optional()
|
|
743
|
+
});
|
|
744
|
+
var KbNodesRequestMessageSchema = zod.z.object({
|
|
745
|
+
id: zod.z.string(),
|
|
746
|
+
type: zod.z.literal("KB_NODES"),
|
|
747
|
+
from: MessageParticipantSchema,
|
|
748
|
+
to: MessageParticipantSchema.optional(),
|
|
749
|
+
payload: KbNodesRequestPayloadSchema
|
|
750
|
+
});
|
|
751
|
+
var KbNodesResponsePayloadSchema = zod.z.object({
|
|
752
|
+
success: zod.z.boolean(),
|
|
753
|
+
error: zod.z.string().optional(),
|
|
754
|
+
data: zod.z.object({
|
|
755
|
+
// Single node operations
|
|
756
|
+
id: zod.z.number().optional(),
|
|
757
|
+
title: zod.z.string().optional(),
|
|
758
|
+
content: zod.z.string().optional(),
|
|
759
|
+
category: zod.z.string().nullable().optional(),
|
|
760
|
+
tags: zod.z.array(zod.z.string()).nullable().optional(),
|
|
761
|
+
createdBy: zod.z.number().optional(),
|
|
762
|
+
updatedBy: zod.z.number().optional(),
|
|
763
|
+
createdAt: zod.z.string().optional(),
|
|
764
|
+
updatedAt: zod.z.string().optional(),
|
|
765
|
+
message: zod.z.string().optional(),
|
|
766
|
+
// GetOne response
|
|
767
|
+
node: KbNodeDataSchema.optional(),
|
|
768
|
+
// List operations
|
|
769
|
+
nodes: zod.z.array(KbNodeDataSchema).optional(),
|
|
770
|
+
count: zod.z.number().optional(),
|
|
771
|
+
// getByCategory/getByUser
|
|
772
|
+
userId: zod.z.number().optional(),
|
|
773
|
+
// getCategories
|
|
774
|
+
categories: zod.z.array(zod.z.string()).optional()
|
|
775
|
+
// getTags
|
|
776
|
+
}).optional()
|
|
777
|
+
});
|
|
778
|
+
var KbNodesResponseMessageSchema = zod.z.object({
|
|
779
|
+
id: zod.z.string(),
|
|
780
|
+
type: zod.z.literal("KB_NODES_RES"),
|
|
781
|
+
from: MessageParticipantSchema,
|
|
782
|
+
to: MessageParticipantSchema.optional(),
|
|
783
|
+
payload: KbNodesResponsePayloadSchema
|
|
784
|
+
});
|
|
707
785
|
var ClientConfigSchema = zod.z.object({
|
|
708
786
|
userId: zod.z.string(),
|
|
709
787
|
projectId: zod.z.string(),
|
|
@@ -728,23 +806,31 @@ __export(services_exports, {
|
|
|
728
806
|
UIElementSchema: () => UIElementSchema,
|
|
729
807
|
createBookmark: () => createBookmark,
|
|
730
808
|
createDashboard: () => createDashboard,
|
|
809
|
+
createKbNode: () => createKbNode,
|
|
731
810
|
createReport: () => createReport,
|
|
732
811
|
createUI: () => createUI,
|
|
733
812
|
createUser: () => createUser,
|
|
734
813
|
deleteBookmark: () => deleteBookmark,
|
|
735
814
|
deleteDashboard: () => deleteDashboard,
|
|
815
|
+
deleteKbNode: () => deleteKbNode,
|
|
736
816
|
deleteReport: () => deleteReport,
|
|
737
817
|
deleteUI: () => deleteUI,
|
|
738
818
|
deleteUser: () => deleteUser,
|
|
739
819
|
getActions: () => getActions,
|
|
740
820
|
getAllBookmarks: () => getAllBookmarks,
|
|
741
821
|
getAllDashboards: () => getAllDashboards,
|
|
822
|
+
getAllKbNodes: () => getAllKbNodes,
|
|
742
823
|
getAllReports: () => getAllReports,
|
|
743
824
|
getAllUIs: () => getAllUIs,
|
|
744
825
|
getAllUsers: () => getAllUsers,
|
|
745
826
|
getBookmark: () => getBookmark,
|
|
746
827
|
getComponentSuggestions: () => getComponentSuggestions,
|
|
747
828
|
getDashboard: () => getDashboard,
|
|
829
|
+
getKbNode: () => getKbNode,
|
|
830
|
+
getKbNodeCategories: () => getKbNodeCategories,
|
|
831
|
+
getKbNodeTags: () => getKbNodeTags,
|
|
832
|
+
getKbNodesByCategory: () => getKbNodesByCategory,
|
|
833
|
+
getKbNodesByUser: () => getKbNodesByUser,
|
|
748
834
|
getReport: () => getReport,
|
|
749
835
|
getUI: () => getUI,
|
|
750
836
|
getUser: () => getUser,
|
|
@@ -755,6 +841,7 @@ __export(services_exports, {
|
|
|
755
841
|
queryUsers: () => queryUsers,
|
|
756
842
|
requestBundle: () => requestBundle,
|
|
757
843
|
requestData: () => requestData,
|
|
844
|
+
searchKbNodes: () => searchKbNodes,
|
|
758
845
|
sendAuthLoginRequest: () => sendAuthLoginRequest,
|
|
759
846
|
sendAuthVerifyRequest: () => sendAuthVerifyRequest,
|
|
760
847
|
sendComponents: () => sendComponents,
|
|
@@ -762,6 +849,7 @@ __export(services_exports, {
|
|
|
762
849
|
sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
|
|
763
850
|
updateBookmark: () => updateBookmark,
|
|
764
851
|
updateDashboard: () => updateDashboard,
|
|
852
|
+
updateKbNode: () => updateKbNode,
|
|
765
853
|
updateReport: () => updateReport,
|
|
766
854
|
updateUI: () => updateUI,
|
|
767
855
|
updateUser: () => updateUser
|
|
@@ -878,7 +966,7 @@ async function requestBundle(client, options) {
|
|
|
878
966
|
type: "BUNDLE_REQ",
|
|
879
967
|
from: { type: client.type },
|
|
880
968
|
to: { type: "data-agent" },
|
|
881
|
-
payload: {}
|
|
969
|
+
payload: { devbundlereq: options?.devbundlereq ?? false }
|
|
882
970
|
});
|
|
883
971
|
const chunks = [];
|
|
884
972
|
let totalChunks = 0;
|
|
@@ -1009,7 +1097,7 @@ async function createUser(client, username, password, email, fullname, role, tim
|
|
|
1009
1097
|
role: payload.data?.role
|
|
1010
1098
|
};
|
|
1011
1099
|
}
|
|
1012
|
-
async function updateUser(client,
|
|
1100
|
+
async function updateUser(client, id, updates, timeout) {
|
|
1013
1101
|
const messageId = `users_update_${Date.now()}`;
|
|
1014
1102
|
const message = UsersRequestMessageSchema.parse({
|
|
1015
1103
|
id: messageId,
|
|
@@ -1019,7 +1107,7 @@ async function updateUser(client, username, updates, timeout) {
|
|
|
1019
1107
|
payload: {
|
|
1020
1108
|
operation: "update",
|
|
1021
1109
|
data: {
|
|
1022
|
-
|
|
1110
|
+
id,
|
|
1023
1111
|
...updates
|
|
1024
1112
|
}
|
|
1025
1113
|
}
|
|
@@ -1036,7 +1124,7 @@ async function updateUser(client, username, updates, timeout) {
|
|
|
1036
1124
|
role: payload.data?.role
|
|
1037
1125
|
};
|
|
1038
1126
|
}
|
|
1039
|
-
async function deleteUser(client,
|
|
1127
|
+
async function deleteUser(client, id, timeout) {
|
|
1040
1128
|
const messageId = `users_delete_${Date.now()}`;
|
|
1041
1129
|
const message = UsersRequestMessageSchema.parse({
|
|
1042
1130
|
id: messageId,
|
|
@@ -1046,7 +1134,7 @@ async function deleteUser(client, username, timeout) {
|
|
|
1046
1134
|
payload: {
|
|
1047
1135
|
operation: "delete",
|
|
1048
1136
|
data: {
|
|
1049
|
-
|
|
1137
|
+
id
|
|
1050
1138
|
}
|
|
1051
1139
|
}
|
|
1052
1140
|
});
|
|
@@ -1787,6 +1875,277 @@ async function queryUIs(client, options = {}, timeout) {
|
|
|
1787
1875
|
};
|
|
1788
1876
|
}
|
|
1789
1877
|
|
|
1878
|
+
// src/services/kb-nodes.ts
|
|
1879
|
+
async function createKbNode(client, title, content, createdBy, category, tags, timeout) {
|
|
1880
|
+
const messageId = `kb_nodes_create_${Date.now()}`;
|
|
1881
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1882
|
+
id: messageId,
|
|
1883
|
+
type: "KB_NODES",
|
|
1884
|
+
from: { type: client.type },
|
|
1885
|
+
to: { type: "data-agent" },
|
|
1886
|
+
payload: {
|
|
1887
|
+
operation: "create",
|
|
1888
|
+
data: {
|
|
1889
|
+
title,
|
|
1890
|
+
content,
|
|
1891
|
+
createdBy,
|
|
1892
|
+
category,
|
|
1893
|
+
tags
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
});
|
|
1897
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1898
|
+
const payload = response.payload;
|
|
1899
|
+
return {
|
|
1900
|
+
success: payload.success,
|
|
1901
|
+
error: payload.error,
|
|
1902
|
+
message: payload.data?.message,
|
|
1903
|
+
node: payload.data ? {
|
|
1904
|
+
id: payload.data.id,
|
|
1905
|
+
title: payload.data.title || title,
|
|
1906
|
+
content: payload.data.content || content,
|
|
1907
|
+
category: payload.data.category,
|
|
1908
|
+
tags: payload.data.tags,
|
|
1909
|
+
createdBy: payload.data.createdBy || createdBy,
|
|
1910
|
+
updatedBy: payload.data.updatedBy,
|
|
1911
|
+
createdAt: payload.data.createdAt,
|
|
1912
|
+
updatedAt: payload.data.updatedAt
|
|
1913
|
+
} : void 0
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1916
|
+
async function updateKbNode(client, id, updatedBy, updates, timeout) {
|
|
1917
|
+
const messageId = `kb_nodes_update_${Date.now()}`;
|
|
1918
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1919
|
+
id: messageId,
|
|
1920
|
+
type: "KB_NODES",
|
|
1921
|
+
from: { type: client.type },
|
|
1922
|
+
to: { type: "data-agent" },
|
|
1923
|
+
payload: {
|
|
1924
|
+
operation: "update",
|
|
1925
|
+
data: {
|
|
1926
|
+
id,
|
|
1927
|
+
updatedBy,
|
|
1928
|
+
...updates
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1932
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1933
|
+
const payload = response.payload;
|
|
1934
|
+
return {
|
|
1935
|
+
success: payload.success,
|
|
1936
|
+
error: payload.error,
|
|
1937
|
+
message: payload.data?.message,
|
|
1938
|
+
node: payload.data ? {
|
|
1939
|
+
id: payload.data.id,
|
|
1940
|
+
title: payload.data.title || "",
|
|
1941
|
+
content: payload.data.content || "",
|
|
1942
|
+
category: payload.data.category,
|
|
1943
|
+
tags: payload.data.tags,
|
|
1944
|
+
createdBy: payload.data.createdBy || 0,
|
|
1945
|
+
updatedBy: payload.data.updatedBy,
|
|
1946
|
+
createdAt: payload.data.createdAt,
|
|
1947
|
+
updatedAt: payload.data.updatedAt
|
|
1948
|
+
} : void 0
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
async function deleteKbNode(client, id, timeout) {
|
|
1952
|
+
const messageId = `kb_nodes_delete_${Date.now()}`;
|
|
1953
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1954
|
+
id: messageId,
|
|
1955
|
+
type: "KB_NODES",
|
|
1956
|
+
from: { type: client.type },
|
|
1957
|
+
to: { type: "data-agent" },
|
|
1958
|
+
payload: {
|
|
1959
|
+
operation: "delete",
|
|
1960
|
+
data: {
|
|
1961
|
+
id
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
});
|
|
1965
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1966
|
+
const payload = response.payload;
|
|
1967
|
+
return {
|
|
1968
|
+
success: payload.success,
|
|
1969
|
+
error: payload.error,
|
|
1970
|
+
message: payload.data?.message
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
async function getAllKbNodes(client, limit, offset, timeout) {
|
|
1974
|
+
const messageId = `kb_nodes_getall_${Date.now()}`;
|
|
1975
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1976
|
+
id: messageId,
|
|
1977
|
+
type: "KB_NODES",
|
|
1978
|
+
from: { type: client.type },
|
|
1979
|
+
to: { type: "data-agent" },
|
|
1980
|
+
payload: {
|
|
1981
|
+
operation: "getAll",
|
|
1982
|
+
data: {
|
|
1983
|
+
limit,
|
|
1984
|
+
offset
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
});
|
|
1988
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1989
|
+
const payload = response.payload;
|
|
1990
|
+
return {
|
|
1991
|
+
success: payload.success,
|
|
1992
|
+
error: payload.error,
|
|
1993
|
+
nodes: payload.data?.nodes,
|
|
1994
|
+
count: payload.data?.count,
|
|
1995
|
+
message: payload.data?.message
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
async function getKbNode(client, id, timeout) {
|
|
1999
|
+
const messageId = `kb_nodes_getone_${Date.now()}`;
|
|
2000
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2001
|
+
id: messageId,
|
|
2002
|
+
type: "KB_NODES",
|
|
2003
|
+
from: { type: client.type },
|
|
2004
|
+
to: { type: "data-agent" },
|
|
2005
|
+
payload: {
|
|
2006
|
+
operation: "getOne",
|
|
2007
|
+
data: {
|
|
2008
|
+
id
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2013
|
+
const payload = response.payload;
|
|
2014
|
+
return {
|
|
2015
|
+
success: payload.success,
|
|
2016
|
+
error: payload.error,
|
|
2017
|
+
node: payload.data?.node,
|
|
2018
|
+
message: payload.data?.message
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
async function searchKbNodes(client, options = {}, timeout) {
|
|
2022
|
+
const { query, category, tags, createdBy, limit, offset } = options;
|
|
2023
|
+
const messageId = `kb_nodes_search_${Date.now()}`;
|
|
2024
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2025
|
+
id: messageId,
|
|
2026
|
+
type: "KB_NODES",
|
|
2027
|
+
from: { type: client.type },
|
|
2028
|
+
to: { type: "data-agent" },
|
|
2029
|
+
payload: {
|
|
2030
|
+
operation: "search",
|
|
2031
|
+
data: {
|
|
2032
|
+
query,
|
|
2033
|
+
category,
|
|
2034
|
+
tags,
|
|
2035
|
+
createdBy,
|
|
2036
|
+
limit,
|
|
2037
|
+
offset
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
});
|
|
2041
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2042
|
+
const payload = response.payload;
|
|
2043
|
+
return {
|
|
2044
|
+
success: payload.success,
|
|
2045
|
+
error: payload.error,
|
|
2046
|
+
nodes: payload.data?.nodes,
|
|
2047
|
+
count: payload.data?.count,
|
|
2048
|
+
message: payload.data?.message
|
|
2049
|
+
};
|
|
2050
|
+
}
|
|
2051
|
+
async function getKbNodesByCategory(client, category, limit, offset, timeout) {
|
|
2052
|
+
const messageId = `kb_nodes_getbycategory_${Date.now()}`;
|
|
2053
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2054
|
+
id: messageId,
|
|
2055
|
+
type: "KB_NODES",
|
|
2056
|
+
from: { type: client.type },
|
|
2057
|
+
to: { type: "data-agent" },
|
|
2058
|
+
payload: {
|
|
2059
|
+
operation: "getByCategory",
|
|
2060
|
+
data: {
|
|
2061
|
+
category,
|
|
2062
|
+
limit,
|
|
2063
|
+
offset
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
});
|
|
2067
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2068
|
+
const payload = response.payload;
|
|
2069
|
+
return {
|
|
2070
|
+
success: payload.success,
|
|
2071
|
+
error: payload.error,
|
|
2072
|
+
nodes: payload.data?.nodes,
|
|
2073
|
+
count: payload.data?.count,
|
|
2074
|
+
category: payload.data?.category || category,
|
|
2075
|
+
message: payload.data?.message
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2078
|
+
async function getKbNodesByUser(client, userId, limit, offset, timeout) {
|
|
2079
|
+
const messageId = `kb_nodes_getbyuser_${Date.now()}`;
|
|
2080
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2081
|
+
id: messageId,
|
|
2082
|
+
type: "KB_NODES",
|
|
2083
|
+
from: { type: client.type },
|
|
2084
|
+
to: { type: "data-agent" },
|
|
2085
|
+
payload: {
|
|
2086
|
+
operation: "getByUser",
|
|
2087
|
+
data: {
|
|
2088
|
+
userId,
|
|
2089
|
+
limit,
|
|
2090
|
+
offset
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2095
|
+
const payload = response.payload;
|
|
2096
|
+
return {
|
|
2097
|
+
success: payload.success,
|
|
2098
|
+
error: payload.error,
|
|
2099
|
+
nodes: payload.data?.nodes,
|
|
2100
|
+
count: payload.data?.count,
|
|
2101
|
+
userId: payload.data?.userId || userId,
|
|
2102
|
+
message: payload.data?.message
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2105
|
+
async function getKbNodeCategories(client, timeout) {
|
|
2106
|
+
const messageId = `kb_nodes_getcategories_${Date.now()}`;
|
|
2107
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2108
|
+
id: messageId,
|
|
2109
|
+
type: "KB_NODES",
|
|
2110
|
+
from: { type: client.type },
|
|
2111
|
+
to: { type: "data-agent" },
|
|
2112
|
+
payload: {
|
|
2113
|
+
operation: "getCategories"
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
2116
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2117
|
+
const payload = response.payload;
|
|
2118
|
+
return {
|
|
2119
|
+
success: payload.success,
|
|
2120
|
+
error: payload.error,
|
|
2121
|
+
categories: payload.data?.categories,
|
|
2122
|
+
count: payload.data?.count,
|
|
2123
|
+
message: payload.data?.message
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
async function getKbNodeTags(client, timeout) {
|
|
2127
|
+
const messageId = `kb_nodes_gettags_${Date.now()}`;
|
|
2128
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2129
|
+
id: messageId,
|
|
2130
|
+
type: "KB_NODES",
|
|
2131
|
+
from: { type: client.type },
|
|
2132
|
+
to: { type: "data-agent" },
|
|
2133
|
+
payload: {
|
|
2134
|
+
operation: "getTags"
|
|
2135
|
+
}
|
|
2136
|
+
});
|
|
2137
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2138
|
+
const payload = response.payload;
|
|
2139
|
+
const responseData = payload.data;
|
|
2140
|
+
return {
|
|
2141
|
+
success: payload.success,
|
|
2142
|
+
error: payload.error,
|
|
2143
|
+
tags: responseData?.tags,
|
|
2144
|
+
count: payload.data?.count,
|
|
2145
|
+
message: payload.data?.message
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
|
|
1790
2149
|
// src/client.ts
|
|
1791
2150
|
var SuperatomClient = class {
|
|
1792
2151
|
constructor(config) {
|
|
@@ -2136,17 +2495,17 @@ var SuperatomClient = class {
|
|
|
2136
2495
|
* Update an existing user
|
|
2137
2496
|
* Delegates to users service
|
|
2138
2497
|
*/
|
|
2139
|
-
async updateUser(
|
|
2140
|
-
this.log("info", "Updating user:",
|
|
2141
|
-
return updateUser(this,
|
|
2498
|
+
async updateUser(id, updates, timeout) {
|
|
2499
|
+
this.log("info", "Updating user:", id);
|
|
2500
|
+
return updateUser(this, id, updates, timeout);
|
|
2142
2501
|
}
|
|
2143
2502
|
/**
|
|
2144
2503
|
* Delete a user
|
|
2145
2504
|
* Delegates to users service
|
|
2146
2505
|
*/
|
|
2147
|
-
async deleteUser(
|
|
2148
|
-
this.log("info", "Deleting user:",
|
|
2149
|
-
return deleteUser(this,
|
|
2506
|
+
async deleteUser(id, timeout) {
|
|
2507
|
+
this.log("info", "Deleting user:", id);
|
|
2508
|
+
return deleteUser(this, id, timeout);
|
|
2150
2509
|
}
|
|
2151
2510
|
/**
|
|
2152
2511
|
* Get all users
|
|
@@ -2372,6 +2731,88 @@ var SuperatomClient = class {
|
|
|
2372
2731
|
this.log("info", "Querying UIs with filters:", options?.filters);
|
|
2373
2732
|
return queryUIs(this, options, timeout);
|
|
2374
2733
|
}
|
|
2734
|
+
// ==================== KB Nodes (Knowledge Base) Management Methods ====================
|
|
2735
|
+
// These methods delegate to kb-nodes service for knowledge base CRUD operations
|
|
2736
|
+
/**
|
|
2737
|
+
* Create a new knowledge base node
|
|
2738
|
+
* Delegates to kb-nodes service
|
|
2739
|
+
*/
|
|
2740
|
+
async createKbNode(title, content, createdBy, category, tags, timeout) {
|
|
2741
|
+
this.log("info", "Creating KB node:", title);
|
|
2742
|
+
return createKbNode(this, title, content, createdBy, category, tags, timeout);
|
|
2743
|
+
}
|
|
2744
|
+
/**
|
|
2745
|
+
* Update an existing knowledge base node
|
|
2746
|
+
* Delegates to kb-nodes service
|
|
2747
|
+
*/
|
|
2748
|
+
async updateKbNode(id, updatedBy, updates, timeout) {
|
|
2749
|
+
this.log("info", "Updating KB node:", id);
|
|
2750
|
+
return updateKbNode(this, id, updatedBy, updates, timeout);
|
|
2751
|
+
}
|
|
2752
|
+
/**
|
|
2753
|
+
* Delete a knowledge base node
|
|
2754
|
+
* Delegates to kb-nodes service
|
|
2755
|
+
*/
|
|
2756
|
+
async deleteKbNode(id, timeout) {
|
|
2757
|
+
this.log("info", "Deleting KB node:", id);
|
|
2758
|
+
return deleteKbNode(this, id, timeout);
|
|
2759
|
+
}
|
|
2760
|
+
/**
|
|
2761
|
+
* Get all knowledge base nodes
|
|
2762
|
+
* Delegates to kb-nodes service
|
|
2763
|
+
*/
|
|
2764
|
+
async getAllKbNodes(limit, offset, timeout) {
|
|
2765
|
+
this.log("info", "Fetching all KB nodes");
|
|
2766
|
+
return getAllKbNodes(this, limit, offset, timeout);
|
|
2767
|
+
}
|
|
2768
|
+
/**
|
|
2769
|
+
* Get a specific knowledge base node by ID
|
|
2770
|
+
* Delegates to kb-nodes service
|
|
2771
|
+
*/
|
|
2772
|
+
async getKbNode(id, timeout) {
|
|
2773
|
+
this.log("info", "Fetching KB node:", id);
|
|
2774
|
+
return getKbNode(this, id, timeout);
|
|
2775
|
+
}
|
|
2776
|
+
/**
|
|
2777
|
+
* Search knowledge base nodes with full-text search and filters
|
|
2778
|
+
* Delegates to kb-nodes service
|
|
2779
|
+
*/
|
|
2780
|
+
async searchKbNodes(options = {}, timeout) {
|
|
2781
|
+
this.log("info", "Searching KB nodes with query:", options.query);
|
|
2782
|
+
return searchKbNodes(this, options, timeout);
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Get knowledge base nodes by category
|
|
2786
|
+
* Delegates to kb-nodes service
|
|
2787
|
+
*/
|
|
2788
|
+
async getKbNodesByCategory(category, limit, offset, timeout) {
|
|
2789
|
+
this.log("info", "Fetching KB nodes by category:", category);
|
|
2790
|
+
return getKbNodesByCategory(this, category, limit, offset, timeout);
|
|
2791
|
+
}
|
|
2792
|
+
/**
|
|
2793
|
+
* Get knowledge base nodes by user (creator)
|
|
2794
|
+
* Delegates to kb-nodes service
|
|
2795
|
+
*/
|
|
2796
|
+
async getKbNodesByUser(userId, limit, offset, timeout) {
|
|
2797
|
+
this.log("info", "Fetching KB nodes by user:", userId);
|
|
2798
|
+
return getKbNodesByUser(this, userId, limit, offset, timeout);
|
|
2799
|
+
}
|
|
2800
|
+
/**
|
|
2801
|
+
* Get all unique categories from knowledge base nodes
|
|
2802
|
+
* Delegates to kb-nodes service
|
|
2803
|
+
*/
|
|
2804
|
+
async getKbNodeCategories(timeout) {
|
|
2805
|
+
this.log("info", "Fetching KB node categories");
|
|
2806
|
+
return getKbNodeCategories(this, timeout);
|
|
2807
|
+
}
|
|
2808
|
+
/**
|
|
2809
|
+
* Get all unique tags from knowledge base nodes
|
|
2810
|
+
* Delegates to kb-nodes service
|
|
2811
|
+
*/
|
|
2812
|
+
async getKbNodeTags(timeout) {
|
|
2813
|
+
this.log("info", "Fetching KB node tags");
|
|
2814
|
+
return getKbNodeTags(this, timeout);
|
|
2815
|
+
}
|
|
2375
2816
|
/**
|
|
2376
2817
|
* Internal logging
|
|
2377
2818
|
*/
|
|
@@ -2443,6 +2884,12 @@ exports.DataRequestMessageSchema = DataRequestMessageSchema;
|
|
|
2443
2884
|
exports.DataRequestPayloadSchema = DataRequestPayloadSchema;
|
|
2444
2885
|
exports.DataResponseMessageSchema = DataResponseMessageSchema;
|
|
2445
2886
|
exports.DataResponsePayloadSchema = DataResponsePayloadSchema;
|
|
2887
|
+
exports.KbNodeDataSchema = KbNodeDataSchema;
|
|
2888
|
+
exports.KbNodesQueryFiltersSchema = KbNodesQueryFiltersSchema;
|
|
2889
|
+
exports.KbNodesRequestMessageSchema = KbNodesRequestMessageSchema;
|
|
2890
|
+
exports.KbNodesRequestPayloadSchema = KbNodesRequestPayloadSchema;
|
|
2891
|
+
exports.KbNodesResponseMessageSchema = KbNodesResponseMessageSchema;
|
|
2892
|
+
exports.KbNodesResponsePayloadSchema = KbNodesResponsePayloadSchema;
|
|
2446
2893
|
exports.MessageParticipantSchema = MessageParticipantSchema;
|
|
2447
2894
|
exports.MessageSchema = MessageSchema;
|
|
2448
2895
|
exports.SDK_VERSION = SDK_VERSION;
|