@superatomai/sdk-web 0.0.12 → 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.cjs +518 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +595 -33
- package/dist/index.d.ts +595 -33
- package/dist/index.js +513 -49
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -186,7 +186,7 @@ var DSLRendererPropsSchema2 = z.object({
|
|
|
186
186
|
context: z.record(z.string(), z.any()).optional()
|
|
187
187
|
});
|
|
188
188
|
|
|
189
|
-
// src/
|
|
189
|
+
// src/types.ts
|
|
190
190
|
var MessageParticipantSchema = z.object({
|
|
191
191
|
id: z.string().optional(),
|
|
192
192
|
type: z.string().optional()
|
|
@@ -429,14 +429,25 @@ var ComponentsSendMessageSchema = z.object({
|
|
|
429
429
|
to: MessageParticipantSchema.optional(),
|
|
430
430
|
payload: ComponentsSendPayloadSchema
|
|
431
431
|
});
|
|
432
|
+
var UserQueryFiltersSchema = z.object({
|
|
433
|
+
username: z.string().optional(),
|
|
434
|
+
email: z.string().optional(),
|
|
435
|
+
role: z.string().optional(),
|
|
436
|
+
fullname: z.string().optional()
|
|
437
|
+
});
|
|
432
438
|
var UsersRequestPayloadSchema = z.object({
|
|
433
|
-
operation: z.enum(["create", "update", "delete", "getAll", "getOne"]),
|
|
439
|
+
operation: z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
|
|
434
440
|
data: z.object({
|
|
441
|
+
id: z.number().optional(),
|
|
435
442
|
username: z.string().optional(),
|
|
436
443
|
email: z.string().email("Invalid email format").optional(),
|
|
437
444
|
password: z.string().optional(),
|
|
438
445
|
fullname: z.string().optional(),
|
|
439
|
-
role: z.string().optional()
|
|
446
|
+
role: z.string().optional(),
|
|
447
|
+
// Query operation fields
|
|
448
|
+
filters: UserQueryFiltersSchema.optional(),
|
|
449
|
+
limit: z.number().optional(),
|
|
450
|
+
sort: z.enum(["ASC", "DESC"]).optional()
|
|
440
451
|
}).optional()
|
|
441
452
|
});
|
|
442
453
|
var UsersRequestMessageSchema = z.object({
|
|
@@ -647,15 +658,24 @@ var BookmarkDataSchema = z.object({
|
|
|
647
658
|
created_at: z.string().optional(),
|
|
648
659
|
updated_at: z.string().optional()
|
|
649
660
|
});
|
|
661
|
+
var BookmarkQueryFiltersSchema = z.object({
|
|
662
|
+
userId: z.number().optional(),
|
|
663
|
+
threadId: z.string().optional(),
|
|
664
|
+
name: z.string().optional()
|
|
665
|
+
});
|
|
650
666
|
var BookmarksRequestPayloadSchema = z.object({
|
|
651
|
-
operation: z.enum(["create", "update", "delete", "getAll", "getOne", "
|
|
667
|
+
operation: z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
|
|
652
668
|
data: z.object({
|
|
653
669
|
id: z.number().optional(),
|
|
654
670
|
userId: z.number().optional(),
|
|
655
671
|
threadId: z.string().optional(),
|
|
656
672
|
name: z.string().optional(),
|
|
657
673
|
description: z.string().optional(),
|
|
658
|
-
uiblock: DBUIBlockSchema.optional()
|
|
674
|
+
uiblock: DBUIBlockSchema.optional(),
|
|
675
|
+
// Query operation fields
|
|
676
|
+
filters: BookmarkQueryFiltersSchema.optional(),
|
|
677
|
+
limit: z.number().optional(),
|
|
678
|
+
sort: z.enum(["ASC", "DESC"]).optional()
|
|
659
679
|
}).optional()
|
|
660
680
|
});
|
|
661
681
|
var BookmarksRequestMessageSchema = z.object({
|
|
@@ -682,6 +702,82 @@ z.object({
|
|
|
682
702
|
to: MessageParticipantSchema.optional(),
|
|
683
703
|
payload: BookmarksResponsePayloadSchema
|
|
684
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
|
+
});
|
|
685
781
|
var ClientConfigSchema = z.object({
|
|
686
782
|
userId: z.string(),
|
|
687
783
|
projectId: z.string(),
|
|
@@ -706,33 +802,42 @@ __export(services_exports, {
|
|
|
706
802
|
UIElementSchema: () => UIElementSchema,
|
|
707
803
|
createBookmark: () => createBookmark,
|
|
708
804
|
createDashboard: () => createDashboard,
|
|
805
|
+
createKbNode: () => createKbNode,
|
|
709
806
|
createReport: () => createReport,
|
|
710
807
|
createUI: () => createUI,
|
|
711
808
|
createUser: () => createUser,
|
|
712
809
|
deleteBookmark: () => deleteBookmark,
|
|
713
810
|
deleteDashboard: () => deleteDashboard,
|
|
811
|
+
deleteKbNode: () => deleteKbNode,
|
|
714
812
|
deleteReport: () => deleteReport,
|
|
715
813
|
deleteUI: () => deleteUI,
|
|
716
814
|
deleteUser: () => deleteUser,
|
|
717
815
|
getActions: () => getActions,
|
|
718
816
|
getAllBookmarks: () => getAllBookmarks,
|
|
719
817
|
getAllDashboards: () => getAllDashboards,
|
|
818
|
+
getAllKbNodes: () => getAllKbNodes,
|
|
720
819
|
getAllReports: () => getAllReports,
|
|
721
820
|
getAllUIs: () => getAllUIs,
|
|
722
821
|
getAllUsers: () => getAllUsers,
|
|
723
822
|
getBookmark: () => getBookmark,
|
|
724
|
-
getBookmarksByThread: () => getBookmarksByThread,
|
|
725
|
-
getBookmarksByUser: () => getBookmarksByUser,
|
|
726
823
|
getComponentSuggestions: () => getComponentSuggestions,
|
|
727
824
|
getDashboard: () => getDashboard,
|
|
825
|
+
getKbNode: () => getKbNode,
|
|
826
|
+
getKbNodeCategories: () => getKbNodeCategories,
|
|
827
|
+
getKbNodeTags: () => getKbNodeTags,
|
|
828
|
+
getKbNodesByCategory: () => getKbNodesByCategory,
|
|
829
|
+
getKbNodesByUser: () => getKbNodesByUser,
|
|
728
830
|
getReport: () => getReport,
|
|
729
831
|
getUI: () => getUI,
|
|
730
832
|
getUser: () => getUser,
|
|
833
|
+
queryBookmarks: () => queryBookmarks,
|
|
731
834
|
queryDashboards: () => queryDashboards,
|
|
732
835
|
queryReports: () => queryReports,
|
|
733
836
|
queryUIs: () => queryUIs,
|
|
837
|
+
queryUsers: () => queryUsers,
|
|
734
838
|
requestBundle: () => requestBundle,
|
|
735
839
|
requestData: () => requestData,
|
|
840
|
+
searchKbNodes: () => searchKbNodes,
|
|
736
841
|
sendAuthLoginRequest: () => sendAuthLoginRequest,
|
|
737
842
|
sendAuthVerifyRequest: () => sendAuthVerifyRequest,
|
|
738
843
|
sendComponents: () => sendComponents,
|
|
@@ -740,6 +845,7 @@ __export(services_exports, {
|
|
|
740
845
|
sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
|
|
741
846
|
updateBookmark: () => updateBookmark,
|
|
742
847
|
updateDashboard: () => updateDashboard,
|
|
848
|
+
updateKbNode: () => updateKbNode,
|
|
743
849
|
updateReport: () => updateReport,
|
|
744
850
|
updateUI: () => updateUI,
|
|
745
851
|
updateUser: () => updateUser
|
|
@@ -1084,6 +1190,33 @@ async function getUser(client, username, timeout) {
|
|
|
1084
1190
|
message: payload.data?.message
|
|
1085
1191
|
};
|
|
1086
1192
|
}
|
|
1193
|
+
async function queryUsers(client, options = {}, timeout) {
|
|
1194
|
+
const { filters, limit, sort } = options;
|
|
1195
|
+
const messageId = `users_query_${Date.now()}`;
|
|
1196
|
+
const message = UsersRequestMessageSchema.parse({
|
|
1197
|
+
id: messageId,
|
|
1198
|
+
type: "USERS",
|
|
1199
|
+
from: { type: client.type },
|
|
1200
|
+
to: { type: "data-agent" },
|
|
1201
|
+
payload: {
|
|
1202
|
+
operation: "query",
|
|
1203
|
+
data: {
|
|
1204
|
+
filters,
|
|
1205
|
+
limit,
|
|
1206
|
+
sort
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1210
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1211
|
+
const payload = response.payload;
|
|
1212
|
+
return {
|
|
1213
|
+
success: payload.success,
|
|
1214
|
+
error: payload.error,
|
|
1215
|
+
users: payload.data?.users,
|
|
1216
|
+
count: payload.data?.count,
|
|
1217
|
+
message: payload.data?.message
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1087
1220
|
|
|
1088
1221
|
// src/services/dashboards/index.ts
|
|
1089
1222
|
async function createDashboard(client, options, timeout) {
|
|
@@ -1529,42 +1662,20 @@ async function getBookmark(client, id, timeout) {
|
|
|
1529
1662
|
message: payload.message
|
|
1530
1663
|
};
|
|
1531
1664
|
}
|
|
1532
|
-
async function
|
|
1533
|
-
const
|
|
1534
|
-
const
|
|
1535
|
-
id: messageId,
|
|
1536
|
-
type: "BOOKMARKS",
|
|
1537
|
-
from: { type: client.type },
|
|
1538
|
-
to: { type: "data-agent" },
|
|
1539
|
-
payload: {
|
|
1540
|
-
operation: "getByUser",
|
|
1541
|
-
data: {
|
|
1542
|
-
userId,
|
|
1543
|
-
threadId
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
});
|
|
1547
|
-
const response = await client.sendWithResponse(message, timeout);
|
|
1548
|
-
const payload = response.payload;
|
|
1549
|
-
return {
|
|
1550
|
-
success: payload.success,
|
|
1551
|
-
error: payload.error,
|
|
1552
|
-
data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
|
|
1553
|
-
count: payload.count,
|
|
1554
|
-
message: payload.message
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
async function getBookmarksByThread(client, threadId, timeout) {
|
|
1558
|
-
const messageId = `bookmarks_getbythread_${Date.now()}`;
|
|
1665
|
+
async function queryBookmarks(client, options = {}, timeout) {
|
|
1666
|
+
const { filters, limit, sort } = options;
|
|
1667
|
+
const messageId = `bookmarks_query_${Date.now()}`;
|
|
1559
1668
|
const message = BookmarksRequestMessageSchema.parse({
|
|
1560
1669
|
id: messageId,
|
|
1561
1670
|
type: "BOOKMARKS",
|
|
1562
1671
|
from: { type: client.type },
|
|
1563
1672
|
to: { type: "data-agent" },
|
|
1564
1673
|
payload: {
|
|
1565
|
-
operation: "
|
|
1674
|
+
operation: "query",
|
|
1566
1675
|
data: {
|
|
1567
|
-
|
|
1676
|
+
filters,
|
|
1677
|
+
limit,
|
|
1678
|
+
sort
|
|
1568
1679
|
}
|
|
1569
1680
|
}
|
|
1570
1681
|
});
|
|
@@ -1760,6 +1871,277 @@ async function queryUIs(client, options = {}, timeout) {
|
|
|
1760
1871
|
};
|
|
1761
1872
|
}
|
|
1762
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
|
+
|
|
1763
2145
|
// src/client.ts
|
|
1764
2146
|
var SuperatomClient = class {
|
|
1765
2147
|
constructor(config) {
|
|
@@ -2137,6 +2519,14 @@ var SuperatomClient = class {
|
|
|
2137
2519
|
this.log("info", "Fetching user:", username);
|
|
2138
2520
|
return getUser(this, username, timeout);
|
|
2139
2521
|
}
|
|
2522
|
+
/**
|
|
2523
|
+
* Query users with filters, limit, and sort
|
|
2524
|
+
* Delegates to users service
|
|
2525
|
+
*/
|
|
2526
|
+
async queryUsers(options = {}, timeout) {
|
|
2527
|
+
this.log("info", "Querying users with filters:", options.filters);
|
|
2528
|
+
return queryUsers(this, options, timeout);
|
|
2529
|
+
}
|
|
2140
2530
|
// ==================== Dashboard Management Methods ====================
|
|
2141
2531
|
// These methods delegate to dashboard service for admin dashboard CRUD operations
|
|
2142
2532
|
/**
|
|
@@ -2230,20 +2620,12 @@ var SuperatomClient = class {
|
|
|
2230
2620
|
return getBookmark(this, id, timeout);
|
|
2231
2621
|
}
|
|
2232
2622
|
/**
|
|
2233
|
-
*
|
|
2623
|
+
* Query bookmarks with filters, limit, and sort
|
|
2234
2624
|
* Delegates to bookmarks service
|
|
2235
2625
|
*/
|
|
2236
|
-
async
|
|
2237
|
-
this.log("info", "
|
|
2238
|
-
return
|
|
2239
|
-
}
|
|
2240
|
-
/**
|
|
2241
|
-
* Get bookmarks by thread ID
|
|
2242
|
-
* Delegates to bookmarks service
|
|
2243
|
-
*/
|
|
2244
|
-
async getBookmarksByThread(threadId, timeout) {
|
|
2245
|
-
this.log("info", "Fetching bookmarks for thread:", threadId);
|
|
2246
|
-
return getBookmarksByThread(this, threadId, timeout);
|
|
2626
|
+
async queryBookmarks(options = {}, timeout) {
|
|
2627
|
+
this.log("info", "Querying bookmarks with filters:", options.filters);
|
|
2628
|
+
return queryBookmarks(this, options, timeout);
|
|
2247
2629
|
}
|
|
2248
2630
|
// ==================== Report Management Methods ====================
|
|
2249
2631
|
// These methods delegate to report service for admin report CRUD operations
|
|
@@ -2345,6 +2727,88 @@ var SuperatomClient = class {
|
|
|
2345
2727
|
this.log("info", "Querying UIs with filters:", options?.filters);
|
|
2346
2728
|
return queryUIs(this, options, timeout);
|
|
2347
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
|
+
}
|
|
2348
2812
|
/**
|
|
2349
2813
|
* Internal logging
|
|
2350
2814
|
*/
|
|
@@ -2390,6 +2854,6 @@ function hasComponents() {
|
|
|
2390
2854
|
// src/index.ts
|
|
2391
2855
|
var SDK_VERSION = "0.1.0";
|
|
2392
2856
|
|
|
2393
|
-
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 };
|
|
2394
2858
|
//# sourceMappingURL=index.js.map
|
|
2395
2859
|
//# sourceMappingURL=index.js.map
|