@superatomai/sdk-web 0.0.22 → 0.0.24
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 +643 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +735 -6
- package/dist/index.d.ts +735 -6
- package/dist/index.js +638 -6
- package/dist/index.js.map +1 -1
- package/package.json +41 -43
package/dist/index.js
CHANGED
|
@@ -784,12 +784,60 @@ z.object({
|
|
|
784
784
|
to: MessageParticipantSchema.optional(),
|
|
785
785
|
payload: BookmarksResponsePayloadSchema
|
|
786
786
|
});
|
|
787
|
+
var ArtifactDataSchema = z.object({
|
|
788
|
+
id: z.number().optional(),
|
|
789
|
+
name: z.string(),
|
|
790
|
+
createdBy: z.number().nullable().optional(),
|
|
791
|
+
dsl: z.record(z.string(), z.any()).nullable().optional(),
|
|
792
|
+
status: z.string().nullable().optional(),
|
|
793
|
+
deleted: z.boolean().optional(),
|
|
794
|
+
createdAt: z.string().optional(),
|
|
795
|
+
updatedAt: z.string().optional()
|
|
796
|
+
});
|
|
797
|
+
var ArtifactsRequestPayloadSchema = z.object({
|
|
798
|
+
operation: z.enum(["create", "update", "delete", "getAll", "getOne"]),
|
|
799
|
+
data: z.object({
|
|
800
|
+
id: z.number().optional(),
|
|
801
|
+
name: z.string().optional(),
|
|
802
|
+
createdBy: z.number().optional(),
|
|
803
|
+
dsl: z.record(z.string(), z.any()).optional(),
|
|
804
|
+
status: z.string().optional(),
|
|
805
|
+
deleted: z.boolean().optional(),
|
|
806
|
+
limit: z.number().optional()
|
|
807
|
+
}).optional()
|
|
808
|
+
});
|
|
809
|
+
var ArtifactsRequestMessageSchema = z.object({
|
|
810
|
+
id: z.string(),
|
|
811
|
+
type: z.literal("ARTIFACTS"),
|
|
812
|
+
from: MessageParticipantSchema,
|
|
813
|
+
to: MessageParticipantSchema.optional(),
|
|
814
|
+
payload: ArtifactsRequestPayloadSchema
|
|
815
|
+
});
|
|
816
|
+
var ArtifactsResponsePayloadSchema = z.object({
|
|
817
|
+
success: z.boolean(),
|
|
818
|
+
error: z.string().optional(),
|
|
819
|
+
data: z.union([
|
|
820
|
+
ArtifactDataSchema,
|
|
821
|
+
z.array(ArtifactDataSchema)
|
|
822
|
+
]).optional(),
|
|
823
|
+
count: z.number().optional(),
|
|
824
|
+
message: z.string().optional()
|
|
825
|
+
});
|
|
826
|
+
z.object({
|
|
827
|
+
id: z.string(),
|
|
828
|
+
type: z.literal("ARTIFACTS_RES"),
|
|
829
|
+
from: MessageParticipantSchema,
|
|
830
|
+
to: MessageParticipantSchema.optional(),
|
|
831
|
+
payload: ArtifactsResponsePayloadSchema
|
|
832
|
+
});
|
|
833
|
+
var KbNodeTypeSchema = z.enum(["global", "user", "query"]);
|
|
787
834
|
var KbNodeDataSchema = z.object({
|
|
788
835
|
id: z.number().optional(),
|
|
789
836
|
title: z.string(),
|
|
790
837
|
content: z.string(),
|
|
791
838
|
category: z.string().nullable().optional(),
|
|
792
839
|
tags: z.array(z.string()).nullable().optional(),
|
|
840
|
+
type: KbNodeTypeSchema.nullable().optional(),
|
|
793
841
|
createdBy: z.number(),
|
|
794
842
|
updatedBy: z.number().optional(),
|
|
795
843
|
createdAt: z.string().optional(),
|
|
@@ -799,6 +847,7 @@ var KbNodesQueryFiltersSchema = z.object({
|
|
|
799
847
|
query: z.string().optional(),
|
|
800
848
|
category: z.string().optional(),
|
|
801
849
|
tags: z.array(z.string()).optional(),
|
|
850
|
+
type: KbNodeTypeSchema.optional(),
|
|
802
851
|
createdBy: z.number().optional()
|
|
803
852
|
});
|
|
804
853
|
var KbNodesRequestPayloadSchema = z.object({
|
|
@@ -809,6 +858,7 @@ var KbNodesRequestPayloadSchema = z.object({
|
|
|
809
858
|
content: z.string().optional(),
|
|
810
859
|
category: z.string().optional(),
|
|
811
860
|
tags: z.array(z.string()).optional(),
|
|
861
|
+
type: KbNodeTypeSchema.optional(),
|
|
812
862
|
createdBy: z.number().optional(),
|
|
813
863
|
updatedBy: z.number().optional(),
|
|
814
864
|
userId: z.number().optional(),
|
|
@@ -836,6 +886,7 @@ var KbNodesResponsePayloadSchema = z.object({
|
|
|
836
886
|
content: z.string().optional(),
|
|
837
887
|
category: z.string().nullable().optional(),
|
|
838
888
|
tags: z.array(z.string()).nullable().optional(),
|
|
889
|
+
type: KbNodeTypeSchema.nullable().optional(),
|
|
839
890
|
createdBy: z.number().optional(),
|
|
840
891
|
updatedBy: z.number().optional(),
|
|
841
892
|
createdAt: z.string().optional(),
|
|
@@ -860,6 +911,71 @@ var KbNodesResponseMessageSchema = z.object({
|
|
|
860
911
|
to: MessageParticipantSchema.optional(),
|
|
861
912
|
payload: KbNodesResponsePayloadSchema
|
|
862
913
|
});
|
|
914
|
+
var MenuDataSchema = z.object({
|
|
915
|
+
id: z.number().optional(),
|
|
916
|
+
name: z.string(),
|
|
917
|
+
componentName: z.string(),
|
|
918
|
+
icon: z.string().nullable().optional(),
|
|
919
|
+
userMessage: z.string().nullable().optional(),
|
|
920
|
+
parentId: z.number().nullable().optional(),
|
|
921
|
+
sortOrder: z.number().optional(),
|
|
922
|
+
props: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
923
|
+
isActive: z.boolean().optional(),
|
|
924
|
+
createdAt: z.string().optional(),
|
|
925
|
+
updatedAt: z.string().optional(),
|
|
926
|
+
children: z.lazy(() => z.array(MenuDataSchema)).optional()
|
|
927
|
+
});
|
|
928
|
+
var MenuQueryFiltersSchema = z.object({
|
|
929
|
+
parentId: z.number().nullable().optional(),
|
|
930
|
+
isActive: z.boolean().optional()
|
|
931
|
+
});
|
|
932
|
+
var MenusRequestPayloadSchema = z.object({
|
|
933
|
+
operation: z.enum(["create", "update", "delete", "getAll", "getOne", "query", "getRootMenus", "getChildMenus", "getHierarchy", "reorder"]),
|
|
934
|
+
data: z.object({
|
|
935
|
+
id: z.number().optional(),
|
|
936
|
+
name: z.string().optional(),
|
|
937
|
+
componentName: z.string().optional(),
|
|
938
|
+
icon: z.string().optional(),
|
|
939
|
+
userMessage: z.string().optional(),
|
|
940
|
+
parentId: z.number().nullable().optional(),
|
|
941
|
+
sortOrder: z.number().optional(),
|
|
942
|
+
props: z.record(z.string(), z.unknown()).optional(),
|
|
943
|
+
isActive: z.boolean().optional(),
|
|
944
|
+
// Query operation fields
|
|
945
|
+
filters: MenuQueryFiltersSchema.optional(),
|
|
946
|
+
limit: z.number().optional(),
|
|
947
|
+
sort: z.enum(["ASC", "DESC"]).optional(),
|
|
948
|
+
// Reorder operation
|
|
949
|
+
items: z.array(z.object({
|
|
950
|
+
id: z.number(),
|
|
951
|
+
sortOrder: z.number()
|
|
952
|
+
})).optional()
|
|
953
|
+
}).optional()
|
|
954
|
+
});
|
|
955
|
+
var MenusRequestMessageSchema = z.object({
|
|
956
|
+
id: z.string(),
|
|
957
|
+
type: z.literal("MENUS"),
|
|
958
|
+
from: MessageParticipantSchema,
|
|
959
|
+
to: MessageParticipantSchema.optional(),
|
|
960
|
+
payload: MenusRequestPayloadSchema
|
|
961
|
+
});
|
|
962
|
+
var MenusResponsePayloadSchema = z.object({
|
|
963
|
+
success: z.boolean(),
|
|
964
|
+
error: z.string().optional(),
|
|
965
|
+
data: z.union([
|
|
966
|
+
MenuDataSchema,
|
|
967
|
+
z.array(MenuDataSchema)
|
|
968
|
+
]).optional(),
|
|
969
|
+
count: z.number().optional(),
|
|
970
|
+
message: z.string().optional()
|
|
971
|
+
});
|
|
972
|
+
var MenusResponseMessageSchema = z.object({
|
|
973
|
+
id: z.string(),
|
|
974
|
+
type: z.literal("MENUS_RES"),
|
|
975
|
+
from: MessageParticipantSchema,
|
|
976
|
+
to: MessageParticipantSchema.optional(),
|
|
977
|
+
payload: MenusResponsePayloadSchema
|
|
978
|
+
});
|
|
863
979
|
var ClientConfigSchema = z.object({
|
|
864
980
|
userId: z.string(),
|
|
865
981
|
projectId: z.string(),
|
|
@@ -883,26 +999,34 @@ __export(services_exports, {
|
|
|
883
999
|
QuerySpecSchema: () => QuerySpecSchema,
|
|
884
1000
|
UIComponentSchema: () => UIComponentSchema,
|
|
885
1001
|
UIElementSchema: () => UIElementSchema,
|
|
1002
|
+
createArtifact: () => createArtifact,
|
|
886
1003
|
createBookmark: () => createBookmark,
|
|
887
1004
|
createDashboard: () => createDashboard,
|
|
888
1005
|
createKbNode: () => createKbNode,
|
|
1006
|
+
createMenu: () => createMenu,
|
|
889
1007
|
createReport: () => createReport,
|
|
890
1008
|
createUI: () => createUI,
|
|
891
1009
|
createUser: () => createUser,
|
|
1010
|
+
deleteArtifact: () => deleteArtifact,
|
|
892
1011
|
deleteBookmark: () => deleteBookmark,
|
|
893
1012
|
deleteDashboard: () => deleteDashboard,
|
|
894
1013
|
deleteKbNode: () => deleteKbNode,
|
|
1014
|
+
deleteMenu: () => deleteMenu,
|
|
895
1015
|
deleteReport: () => deleteReport,
|
|
896
1016
|
deleteUI: () => deleteUI,
|
|
897
1017
|
deleteUser: () => deleteUser,
|
|
898
1018
|
getActions: () => getActions,
|
|
1019
|
+
getAllArtifacts: () => getAllArtifacts,
|
|
899
1020
|
getAllBookmarks: () => getAllBookmarks,
|
|
900
1021
|
getAllDashboards: () => getAllDashboards,
|
|
901
1022
|
getAllKbNodes: () => getAllKbNodes,
|
|
1023
|
+
getAllMenus: () => getAllMenus,
|
|
902
1024
|
getAllReports: () => getAllReports,
|
|
903
1025
|
getAllUIs: () => getAllUIs,
|
|
904
1026
|
getAllUsers: () => getAllUsers,
|
|
1027
|
+
getArtifact: () => getArtifact,
|
|
905
1028
|
getBookmark: () => getBookmark,
|
|
1029
|
+
getChildMenus: () => getChildMenus,
|
|
906
1030
|
getComponentSuggestions: () => getComponentSuggestions,
|
|
907
1031
|
getDashboard: () => getDashboard,
|
|
908
1032
|
getKbNode: () => getKbNode,
|
|
@@ -910,14 +1034,19 @@ __export(services_exports, {
|
|
|
910
1034
|
getKbNodeTags: () => getKbNodeTags,
|
|
911
1035
|
getKbNodesByCategory: () => getKbNodesByCategory,
|
|
912
1036
|
getKbNodesByUser: () => getKbNodesByUser,
|
|
1037
|
+
getMenu: () => getMenu,
|
|
1038
|
+
getMenusHierarchy: () => getMenusHierarchy,
|
|
913
1039
|
getReport: () => getReport,
|
|
1040
|
+
getRootMenus: () => getRootMenus,
|
|
914
1041
|
getUI: () => getUI,
|
|
915
1042
|
getUser: () => getUser,
|
|
916
1043
|
queryBookmarks: () => queryBookmarks,
|
|
917
1044
|
queryDashboards: () => queryDashboards,
|
|
1045
|
+
queryMenus: () => queryMenus,
|
|
918
1046
|
queryReports: () => queryReports,
|
|
919
1047
|
queryUIs: () => queryUIs,
|
|
920
1048
|
queryUsers: () => queryUsers,
|
|
1049
|
+
reorderMenus: () => reorderMenus,
|
|
921
1050
|
requestBundle: () => requestBundle,
|
|
922
1051
|
requestData: () => requestData,
|
|
923
1052
|
searchKbNodes: () => searchKbNodes,
|
|
@@ -927,9 +1056,11 @@ __export(services_exports, {
|
|
|
927
1056
|
sendDashCompRequest: () => sendDashCompRequest,
|
|
928
1057
|
sendUserPromptRequest: () => sendUserPromptRequest,
|
|
929
1058
|
sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
|
|
1059
|
+
updateArtifact: () => updateArtifact,
|
|
930
1060
|
updateBookmark: () => updateBookmark,
|
|
931
1061
|
updateDashboard: () => updateDashboard,
|
|
932
1062
|
updateKbNode: () => updateKbNode,
|
|
1063
|
+
updateMenu: () => updateMenu,
|
|
933
1064
|
updateReport: () => updateReport,
|
|
934
1065
|
updateUI: () => updateUI,
|
|
935
1066
|
updateUser: () => updateUser
|
|
@@ -1783,6 +1914,131 @@ async function queryBookmarks(client, options = {}, timeout) {
|
|
|
1783
1914
|
};
|
|
1784
1915
|
}
|
|
1785
1916
|
|
|
1917
|
+
// src/services/artifacts/index.ts
|
|
1918
|
+
async function createArtifact(client, options, timeout) {
|
|
1919
|
+
const { name, createdBy, dsl, status } = options;
|
|
1920
|
+
const messageId = `artifacts_create_${Date.now()}`;
|
|
1921
|
+
const message = ArtifactsRequestMessageSchema.parse({
|
|
1922
|
+
id: messageId,
|
|
1923
|
+
type: "ARTIFACTS",
|
|
1924
|
+
from: { type: client.type },
|
|
1925
|
+
to: { type: "data-agent" },
|
|
1926
|
+
payload: {
|
|
1927
|
+
operation: "create",
|
|
1928
|
+
data: {
|
|
1929
|
+
name,
|
|
1930
|
+
createdBy,
|
|
1931
|
+
dsl,
|
|
1932
|
+
status
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
});
|
|
1936
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1937
|
+
const payload = response.payload;
|
|
1938
|
+
return {
|
|
1939
|
+
success: payload.success,
|
|
1940
|
+
error: payload.error,
|
|
1941
|
+
message: payload.message,
|
|
1942
|
+
data: Array.isArray(payload.data) ? payload.data[0] : payload.data
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
async function updateArtifact(client, options, timeout) {
|
|
1946
|
+
const { id, name, dsl, status, deleted } = options;
|
|
1947
|
+
const messageId = `artifacts_update_${Date.now()}`;
|
|
1948
|
+
const message = ArtifactsRequestMessageSchema.parse({
|
|
1949
|
+
id: messageId,
|
|
1950
|
+
type: "ARTIFACTS",
|
|
1951
|
+
from: { type: client.type },
|
|
1952
|
+
to: { type: "data-agent" },
|
|
1953
|
+
payload: {
|
|
1954
|
+
operation: "update",
|
|
1955
|
+
data: {
|
|
1956
|
+
id,
|
|
1957
|
+
name,
|
|
1958
|
+
dsl,
|
|
1959
|
+
status,
|
|
1960
|
+
deleted
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1965
|
+
const payload = response.payload;
|
|
1966
|
+
return {
|
|
1967
|
+
success: payload.success,
|
|
1968
|
+
error: payload.error,
|
|
1969
|
+
message: payload.message,
|
|
1970
|
+
data: Array.isArray(payload.data) ? payload.data[0] : payload.data
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
async function deleteArtifact(client, id, timeout) {
|
|
1974
|
+
const messageId = `artifacts_delete_${Date.now()}`;
|
|
1975
|
+
const message = ArtifactsRequestMessageSchema.parse({
|
|
1976
|
+
id: messageId,
|
|
1977
|
+
type: "ARTIFACTS",
|
|
1978
|
+
from: { type: client.type },
|
|
1979
|
+
to: { type: "data-agent" },
|
|
1980
|
+
payload: {
|
|
1981
|
+
operation: "delete",
|
|
1982
|
+
data: {
|
|
1983
|
+
id
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
});
|
|
1987
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1988
|
+
const payload = response.payload;
|
|
1989
|
+
return {
|
|
1990
|
+
success: payload.success,
|
|
1991
|
+
error: payload.error,
|
|
1992
|
+
message: payload.message,
|
|
1993
|
+
data: Array.isArray(payload.data) ? payload.data[0] : payload.data
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
async function getAllArtifacts(client, limit, timeout) {
|
|
1997
|
+
const messageId = `artifacts_getall_${Date.now()}`;
|
|
1998
|
+
const message = ArtifactsRequestMessageSchema.parse({
|
|
1999
|
+
id: messageId,
|
|
2000
|
+
type: "ARTIFACTS",
|
|
2001
|
+
from: { type: client.type },
|
|
2002
|
+
to: { type: "data-agent" },
|
|
2003
|
+
payload: {
|
|
2004
|
+
operation: "getAll",
|
|
2005
|
+
data: limit ? { limit } : void 0
|
|
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
|
+
data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
|
|
2014
|
+
count: payload.count,
|
|
2015
|
+
message: payload.message
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
async function getArtifact(client, id, timeout) {
|
|
2019
|
+
const messageId = `artifacts_getone_${Date.now()}`;
|
|
2020
|
+
const message = ArtifactsRequestMessageSchema.parse({
|
|
2021
|
+
id: messageId,
|
|
2022
|
+
type: "ARTIFACTS",
|
|
2023
|
+
from: { type: client.type },
|
|
2024
|
+
to: { type: "data-agent" },
|
|
2025
|
+
payload: {
|
|
2026
|
+
operation: "getOne",
|
|
2027
|
+
data: {
|
|
2028
|
+
id
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
});
|
|
2032
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2033
|
+
const payload = response.payload;
|
|
2034
|
+
return {
|
|
2035
|
+
success: payload.success,
|
|
2036
|
+
error: payload.error,
|
|
2037
|
+
data: Array.isArray(payload.data) ? payload.data[0] : payload.data,
|
|
2038
|
+
message: payload.message
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
|
|
1786
2042
|
// src/services/actions.ts
|
|
1787
2043
|
async function getActions(client, options) {
|
|
1788
2044
|
const messageId = `msg_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
@@ -1966,7 +2222,7 @@ async function queryUIs(client, options = {}, timeout) {
|
|
|
1966
2222
|
}
|
|
1967
2223
|
|
|
1968
2224
|
// src/services/kb-nodes.ts
|
|
1969
|
-
async function createKbNode(client, title, content, createdBy, category, tags, timeout) {
|
|
2225
|
+
async function createKbNode(client, title, content, createdBy, category, tags, type, timeout) {
|
|
1970
2226
|
const messageId = `kb_nodes_create_${Date.now()}`;
|
|
1971
2227
|
const message = KbNodesRequestMessageSchema.parse({
|
|
1972
2228
|
id: messageId,
|
|
@@ -1980,7 +2236,8 @@ async function createKbNode(client, title, content, createdBy, category, tags, t
|
|
|
1980
2236
|
content,
|
|
1981
2237
|
createdBy,
|
|
1982
2238
|
category,
|
|
1983
|
-
tags
|
|
2239
|
+
tags,
|
|
2240
|
+
type: type || "query"
|
|
1984
2241
|
}
|
|
1985
2242
|
}
|
|
1986
2243
|
});
|
|
@@ -1996,6 +2253,7 @@ async function createKbNode(client, title, content, createdBy, category, tags, t
|
|
|
1996
2253
|
content: payload.data.content || content,
|
|
1997
2254
|
category: payload.data.category,
|
|
1998
2255
|
tags: payload.data.tags,
|
|
2256
|
+
type: payload.data.type,
|
|
1999
2257
|
createdBy: payload.data.createdBy || createdBy,
|
|
2000
2258
|
updatedBy: payload.data.updatedBy,
|
|
2001
2259
|
createdAt: payload.data.createdAt,
|
|
@@ -2031,6 +2289,7 @@ async function updateKbNode(client, id, updatedBy, updates, timeout) {
|
|
|
2031
2289
|
content: payload.data.content || "",
|
|
2032
2290
|
category: payload.data.category,
|
|
2033
2291
|
tags: payload.data.tags,
|
|
2292
|
+
type: payload.data.type,
|
|
2034
2293
|
createdBy: payload.data.createdBy || 0,
|
|
2035
2294
|
updatedBy: payload.data.updatedBy,
|
|
2036
2295
|
createdAt: payload.data.createdAt,
|
|
@@ -2109,7 +2368,7 @@ async function getKbNode(client, id, timeout) {
|
|
|
2109
2368
|
};
|
|
2110
2369
|
}
|
|
2111
2370
|
async function searchKbNodes(client, options = {}, timeout) {
|
|
2112
|
-
const { query, category, tags, createdBy, limit, offset } = options;
|
|
2371
|
+
const { query, category, tags, type, createdBy, limit, offset } = options;
|
|
2113
2372
|
const messageId = `kb_nodes_search_${Date.now()}`;
|
|
2114
2373
|
const message = KbNodesRequestMessageSchema.parse({
|
|
2115
2374
|
id: messageId,
|
|
@@ -2122,6 +2381,7 @@ async function searchKbNodes(client, options = {}, timeout) {
|
|
|
2122
2381
|
query,
|
|
2123
2382
|
category,
|
|
2124
2383
|
tags,
|
|
2384
|
+
type,
|
|
2125
2385
|
createdBy,
|
|
2126
2386
|
limit,
|
|
2127
2387
|
offset
|
|
@@ -2293,6 +2553,254 @@ async function sendDashCompRequest(client, options) {
|
|
|
2293
2553
|
}
|
|
2294
2554
|
}
|
|
2295
2555
|
|
|
2556
|
+
// src/services/menus/index.ts
|
|
2557
|
+
async function createMenu(client, options, timeout) {
|
|
2558
|
+
const { name, componentName, icon, userMessage, parentId, sortOrder, props, isActive } = options;
|
|
2559
|
+
const messageId = `menus_create_${Date.now()}`;
|
|
2560
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2561
|
+
id: messageId,
|
|
2562
|
+
type: "MENUS",
|
|
2563
|
+
from: { type: client.type },
|
|
2564
|
+
to: { type: "data-agent" },
|
|
2565
|
+
payload: {
|
|
2566
|
+
operation: "create",
|
|
2567
|
+
data: {
|
|
2568
|
+
name,
|
|
2569
|
+
componentName,
|
|
2570
|
+
icon,
|
|
2571
|
+
userMessage,
|
|
2572
|
+
parentId,
|
|
2573
|
+
sortOrder,
|
|
2574
|
+
props,
|
|
2575
|
+
isActive
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
});
|
|
2579
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2580
|
+
const payload = response.payload;
|
|
2581
|
+
return {
|
|
2582
|
+
success: payload.success,
|
|
2583
|
+
error: payload.error,
|
|
2584
|
+
message: payload.message,
|
|
2585
|
+
data: payload.data
|
|
2586
|
+
};
|
|
2587
|
+
}
|
|
2588
|
+
async function updateMenu(client, options, timeout) {
|
|
2589
|
+
const { id, name, componentName, icon, userMessage, parentId, sortOrder, props, isActive } = options;
|
|
2590
|
+
const messageId = `menus_update_${Date.now()}`;
|
|
2591
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2592
|
+
id: messageId,
|
|
2593
|
+
type: "MENUS",
|
|
2594
|
+
from: { type: client.type },
|
|
2595
|
+
to: { type: "data-agent" },
|
|
2596
|
+
payload: {
|
|
2597
|
+
operation: "update",
|
|
2598
|
+
data: {
|
|
2599
|
+
id,
|
|
2600
|
+
name,
|
|
2601
|
+
componentName,
|
|
2602
|
+
icon,
|
|
2603
|
+
userMessage,
|
|
2604
|
+
parentId,
|
|
2605
|
+
sortOrder,
|
|
2606
|
+
props,
|
|
2607
|
+
isActive
|
|
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: payload.data
|
|
2618
|
+
};
|
|
2619
|
+
}
|
|
2620
|
+
async function deleteMenu(client, id, timeout) {
|
|
2621
|
+
const messageId = `menus_delete_${Date.now()}`;
|
|
2622
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2623
|
+
id: messageId,
|
|
2624
|
+
type: "MENUS",
|
|
2625
|
+
from: { type: client.type },
|
|
2626
|
+
to: { type: "data-agent" },
|
|
2627
|
+
payload: {
|
|
2628
|
+
operation: "delete",
|
|
2629
|
+
data: {
|
|
2630
|
+
id
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
});
|
|
2634
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2635
|
+
const payload = response.payload;
|
|
2636
|
+
return {
|
|
2637
|
+
success: payload.success,
|
|
2638
|
+
error: payload.error,
|
|
2639
|
+
message: payload.message,
|
|
2640
|
+
data: payload.data
|
|
2641
|
+
};
|
|
2642
|
+
}
|
|
2643
|
+
async function getAllMenus(client, timeout) {
|
|
2644
|
+
const messageId = `menus_getall_${Date.now()}`;
|
|
2645
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2646
|
+
id: messageId,
|
|
2647
|
+
type: "MENUS",
|
|
2648
|
+
from: { type: client.type },
|
|
2649
|
+
to: { type: "data-agent" },
|
|
2650
|
+
payload: {
|
|
2651
|
+
operation: "getAll"
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2655
|
+
const payload = response.payload;
|
|
2656
|
+
return {
|
|
2657
|
+
success: payload.success,
|
|
2658
|
+
error: payload.error,
|
|
2659
|
+
menus: Array.isArray(payload.data) ? payload.data : void 0,
|
|
2660
|
+
count: payload.count,
|
|
2661
|
+
message: payload.message
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
async function getMenu(client, id, timeout) {
|
|
2665
|
+
const messageId = `menus_getone_${Date.now()}`;
|
|
2666
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2667
|
+
id: messageId,
|
|
2668
|
+
type: "MENUS",
|
|
2669
|
+
from: { type: client.type },
|
|
2670
|
+
to: { type: "data-agent" },
|
|
2671
|
+
payload: {
|
|
2672
|
+
operation: "getOne",
|
|
2673
|
+
data: {
|
|
2674
|
+
id
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
});
|
|
2678
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2679
|
+
const payload = response.payload;
|
|
2680
|
+
return {
|
|
2681
|
+
success: payload.success,
|
|
2682
|
+
error: payload.error,
|
|
2683
|
+
menu: payload.data,
|
|
2684
|
+
message: payload.message
|
|
2685
|
+
};
|
|
2686
|
+
}
|
|
2687
|
+
async function getRootMenus(client, timeout) {
|
|
2688
|
+
const messageId = `menus_getrootmenus_${Date.now()}`;
|
|
2689
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2690
|
+
id: messageId,
|
|
2691
|
+
type: "MENUS",
|
|
2692
|
+
from: { type: client.type },
|
|
2693
|
+
to: { type: "data-agent" },
|
|
2694
|
+
payload: {
|
|
2695
|
+
operation: "getRootMenus"
|
|
2696
|
+
}
|
|
2697
|
+
});
|
|
2698
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2699
|
+
const payload = response.payload;
|
|
2700
|
+
return {
|
|
2701
|
+
success: payload.success,
|
|
2702
|
+
error: payload.error,
|
|
2703
|
+
menus: Array.isArray(payload.data) ? payload.data : void 0,
|
|
2704
|
+
count: payload.count,
|
|
2705
|
+
message: payload.message
|
|
2706
|
+
};
|
|
2707
|
+
}
|
|
2708
|
+
async function getChildMenus(client, parentId, timeout) {
|
|
2709
|
+
const messageId = `menus_getchildmenus_${Date.now()}`;
|
|
2710
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2711
|
+
id: messageId,
|
|
2712
|
+
type: "MENUS",
|
|
2713
|
+
from: { type: client.type },
|
|
2714
|
+
to: { type: "data-agent" },
|
|
2715
|
+
payload: {
|
|
2716
|
+
operation: "getChildMenus",
|
|
2717
|
+
data: {
|
|
2718
|
+
parentId
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
});
|
|
2722
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2723
|
+
const payload = response.payload;
|
|
2724
|
+
return {
|
|
2725
|
+
success: payload.success,
|
|
2726
|
+
error: payload.error,
|
|
2727
|
+
menus: Array.isArray(payload.data) ? payload.data : void 0,
|
|
2728
|
+
count: payload.count,
|
|
2729
|
+
message: payload.message
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
async function getMenusHierarchy(client, timeout) {
|
|
2733
|
+
const messageId = `menus_gethierarchy_${Date.now()}`;
|
|
2734
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2735
|
+
id: messageId,
|
|
2736
|
+
type: "MENUS",
|
|
2737
|
+
from: { type: client.type },
|
|
2738
|
+
to: { type: "data-agent" },
|
|
2739
|
+
payload: {
|
|
2740
|
+
operation: "getHierarchy"
|
|
2741
|
+
}
|
|
2742
|
+
});
|
|
2743
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2744
|
+
const payload = response.payload;
|
|
2745
|
+
return {
|
|
2746
|
+
success: payload.success,
|
|
2747
|
+
error: payload.error,
|
|
2748
|
+
menus: Array.isArray(payload.data) ? payload.data : void 0,
|
|
2749
|
+
count: payload.count,
|
|
2750
|
+
message: payload.message
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
async function queryMenus(client, options = {}, timeout) {
|
|
2754
|
+
const { filters, limit, sort } = options;
|
|
2755
|
+
const messageId = `menus_query_${Date.now()}`;
|
|
2756
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2757
|
+
id: messageId,
|
|
2758
|
+
type: "MENUS",
|
|
2759
|
+
from: { type: client.type },
|
|
2760
|
+
to: { type: "data-agent" },
|
|
2761
|
+
payload: {
|
|
2762
|
+
operation: "query",
|
|
2763
|
+
data: {
|
|
2764
|
+
filters,
|
|
2765
|
+
limit,
|
|
2766
|
+
sort
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
});
|
|
2770
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2771
|
+
const payload = response.payload;
|
|
2772
|
+
return {
|
|
2773
|
+
success: payload.success,
|
|
2774
|
+
error: payload.error,
|
|
2775
|
+
menus: Array.isArray(payload.data) ? payload.data : void 0,
|
|
2776
|
+
count: payload.count,
|
|
2777
|
+
message: payload.message
|
|
2778
|
+
};
|
|
2779
|
+
}
|
|
2780
|
+
async function reorderMenus(client, items, timeout) {
|
|
2781
|
+
const messageId = `menus_reorder_${Date.now()}`;
|
|
2782
|
+
const message = MenusRequestMessageSchema.parse({
|
|
2783
|
+
id: messageId,
|
|
2784
|
+
type: "MENUS",
|
|
2785
|
+
from: { type: client.type },
|
|
2786
|
+
to: { type: "data-agent" },
|
|
2787
|
+
payload: {
|
|
2788
|
+
operation: "reorder",
|
|
2789
|
+
data: {
|
|
2790
|
+
items
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
});
|
|
2794
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2795
|
+
const payload = response.payload;
|
|
2796
|
+
return {
|
|
2797
|
+
success: payload.success,
|
|
2798
|
+
error: payload.error,
|
|
2799
|
+
message: payload.message,
|
|
2800
|
+
data: Array.isArray(payload.data) ? payload.data : void 0
|
|
2801
|
+
};
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2296
2804
|
// src/client.ts
|
|
2297
2805
|
var SuperatomClient = class {
|
|
2298
2806
|
constructor(config) {
|
|
@@ -2781,6 +3289,48 @@ var SuperatomClient = class {
|
|
|
2781
3289
|
this.log("info", "Querying bookmarks with filters:", options.filters);
|
|
2782
3290
|
return queryBookmarks(this, options, timeout);
|
|
2783
3291
|
}
|
|
3292
|
+
// ==================== Artifact Management Methods ====================
|
|
3293
|
+
// These methods delegate to artifact service for artifact CRUD operations
|
|
3294
|
+
/**
|
|
3295
|
+
* Create a new artifact
|
|
3296
|
+
* Delegates to artifacts service
|
|
3297
|
+
*/
|
|
3298
|
+
async createArtifact(options, timeout) {
|
|
3299
|
+
this.log("info", "Creating artifact:", options.name);
|
|
3300
|
+
return createArtifact(this, options, timeout);
|
|
3301
|
+
}
|
|
3302
|
+
/**
|
|
3303
|
+
* Update an existing artifact
|
|
3304
|
+
* Delegates to artifacts service
|
|
3305
|
+
*/
|
|
3306
|
+
async updateArtifact(options, timeout) {
|
|
3307
|
+
this.log("info", "Updating artifact:", options.id);
|
|
3308
|
+
return updateArtifact(this, options, timeout);
|
|
3309
|
+
}
|
|
3310
|
+
/**
|
|
3311
|
+
* Delete an artifact (soft delete)
|
|
3312
|
+
* Delegates to artifacts service
|
|
3313
|
+
*/
|
|
3314
|
+
async deleteArtifact(id, timeout) {
|
|
3315
|
+
this.log("info", "Deleting artifact:", id);
|
|
3316
|
+
return deleteArtifact(this, id, timeout);
|
|
3317
|
+
}
|
|
3318
|
+
/**
|
|
3319
|
+
* Get all artifacts
|
|
3320
|
+
* Delegates to artifacts service
|
|
3321
|
+
*/
|
|
3322
|
+
async getAllArtifacts(limit, timeout) {
|
|
3323
|
+
this.log("info", "Fetching all artifacts");
|
|
3324
|
+
return getAllArtifacts(this, limit, timeout);
|
|
3325
|
+
}
|
|
3326
|
+
/**
|
|
3327
|
+
* Get a specific artifact by ID
|
|
3328
|
+
* Delegates to artifacts service
|
|
3329
|
+
*/
|
|
3330
|
+
async getArtifact(id, timeout) {
|
|
3331
|
+
this.log("info", "Fetching artifact:", id);
|
|
3332
|
+
return getArtifact(this, id, timeout);
|
|
3333
|
+
}
|
|
2784
3334
|
// ==================== Report Management Methods ====================
|
|
2785
3335
|
// These methods delegate to report service for admin report CRUD operations
|
|
2786
3336
|
/**
|
|
@@ -2887,9 +3437,9 @@ var SuperatomClient = class {
|
|
|
2887
3437
|
* Create a new knowledge base node
|
|
2888
3438
|
* Delegates to kb-nodes service
|
|
2889
3439
|
*/
|
|
2890
|
-
async createKbNode(title, content, createdBy, category, tags, timeout) {
|
|
3440
|
+
async createKbNode(title, content, createdBy, category, tags, type, timeout) {
|
|
2891
3441
|
this.log("info", "Creating KB node:", title);
|
|
2892
|
-
return createKbNode(this, title, content, createdBy, category, tags, timeout);
|
|
3442
|
+
return createKbNode(this, title, content, createdBy, category, tags, type, timeout);
|
|
2893
3443
|
}
|
|
2894
3444
|
/**
|
|
2895
3445
|
* Update an existing knowledge base node
|
|
@@ -2989,6 +3539,88 @@ var SuperatomClient = class {
|
|
|
2989
3539
|
this.log("info", "Sending dash comp request for prompt:", options.prompt.substring(0, 50) + "...");
|
|
2990
3540
|
return sendDashCompRequest(this, options);
|
|
2991
3541
|
}
|
|
3542
|
+
// ==================== Menu Management Methods ====================
|
|
3543
|
+
// These methods delegate to menus service for menu CRUD operations
|
|
3544
|
+
/**
|
|
3545
|
+
* Create a new menu
|
|
3546
|
+
* Delegates to menus service
|
|
3547
|
+
*/
|
|
3548
|
+
async createMenu(options, timeout) {
|
|
3549
|
+
this.log("info", "Creating menu:", options.name);
|
|
3550
|
+
return createMenu(this, options, timeout);
|
|
3551
|
+
}
|
|
3552
|
+
/**
|
|
3553
|
+
* Update an existing menu
|
|
3554
|
+
* Delegates to menus service
|
|
3555
|
+
*/
|
|
3556
|
+
async updateMenu(options, timeout) {
|
|
3557
|
+
this.log("info", "Updating menu:", options.id);
|
|
3558
|
+
return updateMenu(this, options, timeout);
|
|
3559
|
+
}
|
|
3560
|
+
/**
|
|
3561
|
+
* Delete a menu
|
|
3562
|
+
* Delegates to menus service
|
|
3563
|
+
*/
|
|
3564
|
+
async deleteMenu(id, timeout) {
|
|
3565
|
+
this.log("info", "Deleting menu:", id);
|
|
3566
|
+
return deleteMenu(this, id, timeout);
|
|
3567
|
+
}
|
|
3568
|
+
/**
|
|
3569
|
+
* Get all menus
|
|
3570
|
+
* Delegates to menus service
|
|
3571
|
+
*/
|
|
3572
|
+
async getAllMenus(timeout) {
|
|
3573
|
+
this.log("info", "Fetching all menus");
|
|
3574
|
+
return getAllMenus(this, timeout);
|
|
3575
|
+
}
|
|
3576
|
+
/**
|
|
3577
|
+
* Get a specific menu by ID
|
|
3578
|
+
* Delegates to menus service
|
|
3579
|
+
*/
|
|
3580
|
+
async getMenu(id, timeout) {
|
|
3581
|
+
this.log("info", "Fetching menu:", id);
|
|
3582
|
+
return getMenu(this, id, timeout);
|
|
3583
|
+
}
|
|
3584
|
+
/**
|
|
3585
|
+
* Get root menus (top-level sidebar items)
|
|
3586
|
+
* Delegates to menus service
|
|
3587
|
+
*/
|
|
3588
|
+
async getRootMenus(timeout) {
|
|
3589
|
+
this.log("info", "Fetching root menus");
|
|
3590
|
+
return getRootMenus(this, timeout);
|
|
3591
|
+
}
|
|
3592
|
+
/**
|
|
3593
|
+
* Get child menus by parent ID
|
|
3594
|
+
* Delegates to menus service
|
|
3595
|
+
*/
|
|
3596
|
+
async getChildMenus(parentId, timeout) {
|
|
3597
|
+
this.log("info", "Fetching child menus for parent:", parentId);
|
|
3598
|
+
return getChildMenus(this, parentId, timeout);
|
|
3599
|
+
}
|
|
3600
|
+
/**
|
|
3601
|
+
* Get menus with hierarchy (nested structure)
|
|
3602
|
+
* Delegates to menus service
|
|
3603
|
+
*/
|
|
3604
|
+
async getMenusHierarchy(timeout) {
|
|
3605
|
+
this.log("info", "Fetching menus hierarchy");
|
|
3606
|
+
return getMenusHierarchy(this, timeout);
|
|
3607
|
+
}
|
|
3608
|
+
/**
|
|
3609
|
+
* Query menus with filters
|
|
3610
|
+
* Delegates to menus service
|
|
3611
|
+
*/
|
|
3612
|
+
async queryMenus(options, timeout) {
|
|
3613
|
+
this.log("info", "Querying menus with filters:", options?.filters);
|
|
3614
|
+
return queryMenus(this, options, timeout);
|
|
3615
|
+
}
|
|
3616
|
+
/**
|
|
3617
|
+
* Reorder menus
|
|
3618
|
+
* Delegates to menus service
|
|
3619
|
+
*/
|
|
3620
|
+
async reorderMenus(items, timeout) {
|
|
3621
|
+
this.log("info", "Reordering", items.length, "menus");
|
|
3622
|
+
return reorderMenus(this, items, timeout);
|
|
3623
|
+
}
|
|
2992
3624
|
/**
|
|
2993
3625
|
* Internal logging
|
|
2994
3626
|
*/
|
|
@@ -3034,6 +3666,6 @@ function hasComponents() {
|
|
|
3034
3666
|
// src/index.ts
|
|
3035
3667
|
var SDK_VERSION = "0.1.0";
|
|
3036
3668
|
|
|
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 };
|
|
3669
|
+
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
3670
|
//# sourceMappingURL=index.js.map
|
|
3039
3671
|
//# sourceMappingURL=index.js.map
|