@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.cjs
CHANGED
|
@@ -188,7 +188,7 @@ var DSLRendererPropsSchema2 = zod.z.object({
|
|
|
188
188
|
context: zod.z.record(zod.z.string(), zod.z.any()).optional()
|
|
189
189
|
});
|
|
190
190
|
|
|
191
|
-
// src/
|
|
191
|
+
// src/types.ts
|
|
192
192
|
var MessageParticipantSchema = zod.z.object({
|
|
193
193
|
id: zod.z.string().optional(),
|
|
194
194
|
type: zod.z.string().optional()
|
|
@@ -431,14 +431,25 @@ var ComponentsSendMessageSchema = zod.z.object({
|
|
|
431
431
|
to: MessageParticipantSchema.optional(),
|
|
432
432
|
payload: ComponentsSendPayloadSchema
|
|
433
433
|
});
|
|
434
|
+
var UserQueryFiltersSchema = zod.z.object({
|
|
435
|
+
username: zod.z.string().optional(),
|
|
436
|
+
email: zod.z.string().optional(),
|
|
437
|
+
role: zod.z.string().optional(),
|
|
438
|
+
fullname: zod.z.string().optional()
|
|
439
|
+
});
|
|
434
440
|
var UsersRequestPayloadSchema = zod.z.object({
|
|
435
|
-
operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne"]),
|
|
441
|
+
operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
|
|
436
442
|
data: zod.z.object({
|
|
443
|
+
id: zod.z.number().optional(),
|
|
437
444
|
username: zod.z.string().optional(),
|
|
438
445
|
email: zod.z.string().email("Invalid email format").optional(),
|
|
439
446
|
password: zod.z.string().optional(),
|
|
440
447
|
fullname: zod.z.string().optional(),
|
|
441
|
-
role: zod.z.string().optional()
|
|
448
|
+
role: zod.z.string().optional(),
|
|
449
|
+
// Query operation fields
|
|
450
|
+
filters: UserQueryFiltersSchema.optional(),
|
|
451
|
+
limit: zod.z.number().optional(),
|
|
452
|
+
sort: zod.z.enum(["ASC", "DESC"]).optional()
|
|
442
453
|
}).optional()
|
|
443
454
|
});
|
|
444
455
|
var UsersRequestMessageSchema = zod.z.object({
|
|
@@ -649,15 +660,24 @@ var BookmarkDataSchema = zod.z.object({
|
|
|
649
660
|
created_at: zod.z.string().optional(),
|
|
650
661
|
updated_at: zod.z.string().optional()
|
|
651
662
|
});
|
|
663
|
+
var BookmarkQueryFiltersSchema = zod.z.object({
|
|
664
|
+
userId: zod.z.number().optional(),
|
|
665
|
+
threadId: zod.z.string().optional(),
|
|
666
|
+
name: zod.z.string().optional()
|
|
667
|
+
});
|
|
652
668
|
var BookmarksRequestPayloadSchema = zod.z.object({
|
|
653
|
-
operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "
|
|
669
|
+
operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
|
|
654
670
|
data: zod.z.object({
|
|
655
671
|
id: zod.z.number().optional(),
|
|
656
672
|
userId: zod.z.number().optional(),
|
|
657
673
|
threadId: zod.z.string().optional(),
|
|
658
674
|
name: zod.z.string().optional(),
|
|
659
675
|
description: zod.z.string().optional(),
|
|
660
|
-
uiblock: DBUIBlockSchema.optional()
|
|
676
|
+
uiblock: DBUIBlockSchema.optional(),
|
|
677
|
+
// Query operation fields
|
|
678
|
+
filters: BookmarkQueryFiltersSchema.optional(),
|
|
679
|
+
limit: zod.z.number().optional(),
|
|
680
|
+
sort: zod.z.enum(["ASC", "DESC"]).optional()
|
|
661
681
|
}).optional()
|
|
662
682
|
});
|
|
663
683
|
var BookmarksRequestMessageSchema = zod.z.object({
|
|
@@ -684,6 +704,82 @@ zod.z.object({
|
|
|
684
704
|
to: MessageParticipantSchema.optional(),
|
|
685
705
|
payload: BookmarksResponsePayloadSchema
|
|
686
706
|
});
|
|
707
|
+
var KbNodeDataSchema = zod.z.object({
|
|
708
|
+
id: zod.z.number().optional(),
|
|
709
|
+
title: zod.z.string(),
|
|
710
|
+
content: zod.z.string(),
|
|
711
|
+
category: zod.z.string().nullable().optional(),
|
|
712
|
+
tags: zod.z.array(zod.z.string()).nullable().optional(),
|
|
713
|
+
createdBy: zod.z.number(),
|
|
714
|
+
updatedBy: zod.z.number().optional(),
|
|
715
|
+
createdAt: zod.z.string().optional(),
|
|
716
|
+
updatedAt: zod.z.string().optional()
|
|
717
|
+
});
|
|
718
|
+
var KbNodesQueryFiltersSchema = zod.z.object({
|
|
719
|
+
query: zod.z.string().optional(),
|
|
720
|
+
category: zod.z.string().optional(),
|
|
721
|
+
tags: zod.z.array(zod.z.string()).optional(),
|
|
722
|
+
createdBy: zod.z.number().optional()
|
|
723
|
+
});
|
|
724
|
+
var KbNodesRequestPayloadSchema = zod.z.object({
|
|
725
|
+
operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "search", "getByCategory", "getByUser", "getCategories", "getTags"]),
|
|
726
|
+
data: zod.z.object({
|
|
727
|
+
id: zod.z.number().optional(),
|
|
728
|
+
title: zod.z.string().optional(),
|
|
729
|
+
content: zod.z.string().optional(),
|
|
730
|
+
category: zod.z.string().optional(),
|
|
731
|
+
tags: zod.z.array(zod.z.string()).optional(),
|
|
732
|
+
createdBy: zod.z.number().optional(),
|
|
733
|
+
updatedBy: zod.z.number().optional(),
|
|
734
|
+
userId: zod.z.number().optional(),
|
|
735
|
+
// Query/search operation fields
|
|
736
|
+
query: zod.z.string().optional(),
|
|
737
|
+
filters: KbNodesQueryFiltersSchema.optional(),
|
|
738
|
+
limit: zod.z.number().optional(),
|
|
739
|
+
offset: zod.z.number().optional()
|
|
740
|
+
}).optional()
|
|
741
|
+
});
|
|
742
|
+
var KbNodesRequestMessageSchema = zod.z.object({
|
|
743
|
+
id: zod.z.string(),
|
|
744
|
+
type: zod.z.literal("KB_NODES"),
|
|
745
|
+
from: MessageParticipantSchema,
|
|
746
|
+
to: MessageParticipantSchema.optional(),
|
|
747
|
+
payload: KbNodesRequestPayloadSchema
|
|
748
|
+
});
|
|
749
|
+
var KbNodesResponsePayloadSchema = zod.z.object({
|
|
750
|
+
success: zod.z.boolean(),
|
|
751
|
+
error: zod.z.string().optional(),
|
|
752
|
+
data: zod.z.object({
|
|
753
|
+
// Single node operations
|
|
754
|
+
id: zod.z.number().optional(),
|
|
755
|
+
title: zod.z.string().optional(),
|
|
756
|
+
content: zod.z.string().optional(),
|
|
757
|
+
category: zod.z.string().nullable().optional(),
|
|
758
|
+
tags: zod.z.array(zod.z.string()).nullable().optional(),
|
|
759
|
+
createdBy: zod.z.number().optional(),
|
|
760
|
+
updatedBy: zod.z.number().optional(),
|
|
761
|
+
createdAt: zod.z.string().optional(),
|
|
762
|
+
updatedAt: zod.z.string().optional(),
|
|
763
|
+
message: zod.z.string().optional(),
|
|
764
|
+
// GetOne response
|
|
765
|
+
node: KbNodeDataSchema.optional(),
|
|
766
|
+
// List operations
|
|
767
|
+
nodes: zod.z.array(KbNodeDataSchema).optional(),
|
|
768
|
+
count: zod.z.number().optional(),
|
|
769
|
+
// getByCategory/getByUser
|
|
770
|
+
userId: zod.z.number().optional(),
|
|
771
|
+
// getCategories
|
|
772
|
+
categories: zod.z.array(zod.z.string()).optional()
|
|
773
|
+
// getTags
|
|
774
|
+
}).optional()
|
|
775
|
+
});
|
|
776
|
+
var KbNodesResponseMessageSchema = zod.z.object({
|
|
777
|
+
id: zod.z.string(),
|
|
778
|
+
type: zod.z.literal("KB_NODES_RES"),
|
|
779
|
+
from: MessageParticipantSchema,
|
|
780
|
+
to: MessageParticipantSchema.optional(),
|
|
781
|
+
payload: KbNodesResponsePayloadSchema
|
|
782
|
+
});
|
|
687
783
|
var ClientConfigSchema = zod.z.object({
|
|
688
784
|
userId: zod.z.string(),
|
|
689
785
|
projectId: zod.z.string(),
|
|
@@ -708,33 +804,42 @@ __export(services_exports, {
|
|
|
708
804
|
UIElementSchema: () => UIElementSchema,
|
|
709
805
|
createBookmark: () => createBookmark,
|
|
710
806
|
createDashboard: () => createDashboard,
|
|
807
|
+
createKbNode: () => createKbNode,
|
|
711
808
|
createReport: () => createReport,
|
|
712
809
|
createUI: () => createUI,
|
|
713
810
|
createUser: () => createUser,
|
|
714
811
|
deleteBookmark: () => deleteBookmark,
|
|
715
812
|
deleteDashboard: () => deleteDashboard,
|
|
813
|
+
deleteKbNode: () => deleteKbNode,
|
|
716
814
|
deleteReport: () => deleteReport,
|
|
717
815
|
deleteUI: () => deleteUI,
|
|
718
816
|
deleteUser: () => deleteUser,
|
|
719
817
|
getActions: () => getActions,
|
|
720
818
|
getAllBookmarks: () => getAllBookmarks,
|
|
721
819
|
getAllDashboards: () => getAllDashboards,
|
|
820
|
+
getAllKbNodes: () => getAllKbNodes,
|
|
722
821
|
getAllReports: () => getAllReports,
|
|
723
822
|
getAllUIs: () => getAllUIs,
|
|
724
823
|
getAllUsers: () => getAllUsers,
|
|
725
824
|
getBookmark: () => getBookmark,
|
|
726
|
-
getBookmarksByThread: () => getBookmarksByThread,
|
|
727
|
-
getBookmarksByUser: () => getBookmarksByUser,
|
|
728
825
|
getComponentSuggestions: () => getComponentSuggestions,
|
|
729
826
|
getDashboard: () => getDashboard,
|
|
827
|
+
getKbNode: () => getKbNode,
|
|
828
|
+
getKbNodeCategories: () => getKbNodeCategories,
|
|
829
|
+
getKbNodeTags: () => getKbNodeTags,
|
|
830
|
+
getKbNodesByCategory: () => getKbNodesByCategory,
|
|
831
|
+
getKbNodesByUser: () => getKbNodesByUser,
|
|
730
832
|
getReport: () => getReport,
|
|
731
833
|
getUI: () => getUI,
|
|
732
834
|
getUser: () => getUser,
|
|
835
|
+
queryBookmarks: () => queryBookmarks,
|
|
733
836
|
queryDashboards: () => queryDashboards,
|
|
734
837
|
queryReports: () => queryReports,
|
|
735
838
|
queryUIs: () => queryUIs,
|
|
839
|
+
queryUsers: () => queryUsers,
|
|
736
840
|
requestBundle: () => requestBundle,
|
|
737
841
|
requestData: () => requestData,
|
|
842
|
+
searchKbNodes: () => searchKbNodes,
|
|
738
843
|
sendAuthLoginRequest: () => sendAuthLoginRequest,
|
|
739
844
|
sendAuthVerifyRequest: () => sendAuthVerifyRequest,
|
|
740
845
|
sendComponents: () => sendComponents,
|
|
@@ -742,6 +847,7 @@ __export(services_exports, {
|
|
|
742
847
|
sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
|
|
743
848
|
updateBookmark: () => updateBookmark,
|
|
744
849
|
updateDashboard: () => updateDashboard,
|
|
850
|
+
updateKbNode: () => updateKbNode,
|
|
745
851
|
updateReport: () => updateReport,
|
|
746
852
|
updateUI: () => updateUI,
|
|
747
853
|
updateUser: () => updateUser
|
|
@@ -1086,6 +1192,33 @@ async function getUser(client, username, timeout) {
|
|
|
1086
1192
|
message: payload.data?.message
|
|
1087
1193
|
};
|
|
1088
1194
|
}
|
|
1195
|
+
async function queryUsers(client, options = {}, timeout) {
|
|
1196
|
+
const { filters, limit, sort } = options;
|
|
1197
|
+
const messageId = `users_query_${Date.now()}`;
|
|
1198
|
+
const message = UsersRequestMessageSchema.parse({
|
|
1199
|
+
id: messageId,
|
|
1200
|
+
type: "USERS",
|
|
1201
|
+
from: { type: client.type },
|
|
1202
|
+
to: { type: "data-agent" },
|
|
1203
|
+
payload: {
|
|
1204
|
+
operation: "query",
|
|
1205
|
+
data: {
|
|
1206
|
+
filters,
|
|
1207
|
+
limit,
|
|
1208
|
+
sort
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1212
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1213
|
+
const payload = response.payload;
|
|
1214
|
+
return {
|
|
1215
|
+
success: payload.success,
|
|
1216
|
+
error: payload.error,
|
|
1217
|
+
users: payload.data?.users,
|
|
1218
|
+
count: payload.data?.count,
|
|
1219
|
+
message: payload.data?.message
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1089
1222
|
|
|
1090
1223
|
// src/services/dashboards/index.ts
|
|
1091
1224
|
async function createDashboard(client, options, timeout) {
|
|
@@ -1531,42 +1664,20 @@ async function getBookmark(client, id, timeout) {
|
|
|
1531
1664
|
message: payload.message
|
|
1532
1665
|
};
|
|
1533
1666
|
}
|
|
1534
|
-
async function
|
|
1535
|
-
const
|
|
1536
|
-
const
|
|
1537
|
-
id: messageId,
|
|
1538
|
-
type: "BOOKMARKS",
|
|
1539
|
-
from: { type: client.type },
|
|
1540
|
-
to: { type: "data-agent" },
|
|
1541
|
-
payload: {
|
|
1542
|
-
operation: "getByUser",
|
|
1543
|
-
data: {
|
|
1544
|
-
userId,
|
|
1545
|
-
threadId
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
});
|
|
1549
|
-
const response = await client.sendWithResponse(message, timeout);
|
|
1550
|
-
const payload = response.payload;
|
|
1551
|
-
return {
|
|
1552
|
-
success: payload.success,
|
|
1553
|
-
error: payload.error,
|
|
1554
|
-
data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
|
|
1555
|
-
count: payload.count,
|
|
1556
|
-
message: payload.message
|
|
1557
|
-
};
|
|
1558
|
-
}
|
|
1559
|
-
async function getBookmarksByThread(client, threadId, timeout) {
|
|
1560
|
-
const messageId = `bookmarks_getbythread_${Date.now()}`;
|
|
1667
|
+
async function queryBookmarks(client, options = {}, timeout) {
|
|
1668
|
+
const { filters, limit, sort } = options;
|
|
1669
|
+
const messageId = `bookmarks_query_${Date.now()}`;
|
|
1561
1670
|
const message = BookmarksRequestMessageSchema.parse({
|
|
1562
1671
|
id: messageId,
|
|
1563
1672
|
type: "BOOKMARKS",
|
|
1564
1673
|
from: { type: client.type },
|
|
1565
1674
|
to: { type: "data-agent" },
|
|
1566
1675
|
payload: {
|
|
1567
|
-
operation: "
|
|
1676
|
+
operation: "query",
|
|
1568
1677
|
data: {
|
|
1569
|
-
|
|
1678
|
+
filters,
|
|
1679
|
+
limit,
|
|
1680
|
+
sort
|
|
1570
1681
|
}
|
|
1571
1682
|
}
|
|
1572
1683
|
});
|
|
@@ -1762,6 +1873,277 @@ async function queryUIs(client, options = {}, timeout) {
|
|
|
1762
1873
|
};
|
|
1763
1874
|
}
|
|
1764
1875
|
|
|
1876
|
+
// src/services/kb-nodes.ts
|
|
1877
|
+
async function createKbNode(client, title, content, createdBy, category, tags, timeout) {
|
|
1878
|
+
const messageId = `kb_nodes_create_${Date.now()}`;
|
|
1879
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1880
|
+
id: messageId,
|
|
1881
|
+
type: "KB_NODES",
|
|
1882
|
+
from: { type: client.type },
|
|
1883
|
+
to: { type: "data-agent" },
|
|
1884
|
+
payload: {
|
|
1885
|
+
operation: "create",
|
|
1886
|
+
data: {
|
|
1887
|
+
title,
|
|
1888
|
+
content,
|
|
1889
|
+
createdBy,
|
|
1890
|
+
category,
|
|
1891
|
+
tags
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1896
|
+
const payload = response.payload;
|
|
1897
|
+
return {
|
|
1898
|
+
success: payload.success,
|
|
1899
|
+
error: payload.error,
|
|
1900
|
+
message: payload.data?.message,
|
|
1901
|
+
node: payload.data ? {
|
|
1902
|
+
id: payload.data.id,
|
|
1903
|
+
title: payload.data.title || title,
|
|
1904
|
+
content: payload.data.content || content,
|
|
1905
|
+
category: payload.data.category,
|
|
1906
|
+
tags: payload.data.tags,
|
|
1907
|
+
createdBy: payload.data.createdBy || createdBy,
|
|
1908
|
+
updatedBy: payload.data.updatedBy,
|
|
1909
|
+
createdAt: payload.data.createdAt,
|
|
1910
|
+
updatedAt: payload.data.updatedAt
|
|
1911
|
+
} : void 0
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
async function updateKbNode(client, id, updatedBy, updates, timeout) {
|
|
1915
|
+
const messageId = `kb_nodes_update_${Date.now()}`;
|
|
1916
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1917
|
+
id: messageId,
|
|
1918
|
+
type: "KB_NODES",
|
|
1919
|
+
from: { type: client.type },
|
|
1920
|
+
to: { type: "data-agent" },
|
|
1921
|
+
payload: {
|
|
1922
|
+
operation: "update",
|
|
1923
|
+
data: {
|
|
1924
|
+
id,
|
|
1925
|
+
updatedBy,
|
|
1926
|
+
...updates
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
});
|
|
1930
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1931
|
+
const payload = response.payload;
|
|
1932
|
+
return {
|
|
1933
|
+
success: payload.success,
|
|
1934
|
+
error: payload.error,
|
|
1935
|
+
message: payload.data?.message,
|
|
1936
|
+
node: payload.data ? {
|
|
1937
|
+
id: payload.data.id,
|
|
1938
|
+
title: payload.data.title || "",
|
|
1939
|
+
content: payload.data.content || "",
|
|
1940
|
+
category: payload.data.category,
|
|
1941
|
+
tags: payload.data.tags,
|
|
1942
|
+
createdBy: payload.data.createdBy || 0,
|
|
1943
|
+
updatedBy: payload.data.updatedBy,
|
|
1944
|
+
createdAt: payload.data.createdAt,
|
|
1945
|
+
updatedAt: payload.data.updatedAt
|
|
1946
|
+
} : void 0
|
|
1947
|
+
};
|
|
1948
|
+
}
|
|
1949
|
+
async function deleteKbNode(client, id, timeout) {
|
|
1950
|
+
const messageId = `kb_nodes_delete_${Date.now()}`;
|
|
1951
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1952
|
+
id: messageId,
|
|
1953
|
+
type: "KB_NODES",
|
|
1954
|
+
from: { type: client.type },
|
|
1955
|
+
to: { type: "data-agent" },
|
|
1956
|
+
payload: {
|
|
1957
|
+
operation: "delete",
|
|
1958
|
+
data: {
|
|
1959
|
+
id
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
});
|
|
1963
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1964
|
+
const payload = response.payload;
|
|
1965
|
+
return {
|
|
1966
|
+
success: payload.success,
|
|
1967
|
+
error: payload.error,
|
|
1968
|
+
message: payload.data?.message
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
async function getAllKbNodes(client, limit, offset, timeout) {
|
|
1972
|
+
const messageId = `kb_nodes_getall_${Date.now()}`;
|
|
1973
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1974
|
+
id: messageId,
|
|
1975
|
+
type: "KB_NODES",
|
|
1976
|
+
from: { type: client.type },
|
|
1977
|
+
to: { type: "data-agent" },
|
|
1978
|
+
payload: {
|
|
1979
|
+
operation: "getAll",
|
|
1980
|
+
data: {
|
|
1981
|
+
limit,
|
|
1982
|
+
offset
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
});
|
|
1986
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
1987
|
+
const payload = response.payload;
|
|
1988
|
+
return {
|
|
1989
|
+
success: payload.success,
|
|
1990
|
+
error: payload.error,
|
|
1991
|
+
nodes: payload.data?.nodes,
|
|
1992
|
+
count: payload.data?.count,
|
|
1993
|
+
message: payload.data?.message
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
async function getKbNode(client, id, timeout) {
|
|
1997
|
+
const messageId = `kb_nodes_getone_${Date.now()}`;
|
|
1998
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
1999
|
+
id: messageId,
|
|
2000
|
+
type: "KB_NODES",
|
|
2001
|
+
from: { type: client.type },
|
|
2002
|
+
to: { type: "data-agent" },
|
|
2003
|
+
payload: {
|
|
2004
|
+
operation: "getOne",
|
|
2005
|
+
data: {
|
|
2006
|
+
id
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
});
|
|
2010
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2011
|
+
const payload = response.payload;
|
|
2012
|
+
return {
|
|
2013
|
+
success: payload.success,
|
|
2014
|
+
error: payload.error,
|
|
2015
|
+
node: payload.data?.node,
|
|
2016
|
+
message: payload.data?.message
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
async function searchKbNodes(client, options = {}, timeout) {
|
|
2020
|
+
const { query, category, tags, createdBy, limit, offset } = options;
|
|
2021
|
+
const messageId = `kb_nodes_search_${Date.now()}`;
|
|
2022
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2023
|
+
id: messageId,
|
|
2024
|
+
type: "KB_NODES",
|
|
2025
|
+
from: { type: client.type },
|
|
2026
|
+
to: { type: "data-agent" },
|
|
2027
|
+
payload: {
|
|
2028
|
+
operation: "search",
|
|
2029
|
+
data: {
|
|
2030
|
+
query,
|
|
2031
|
+
category,
|
|
2032
|
+
tags,
|
|
2033
|
+
createdBy,
|
|
2034
|
+
limit,
|
|
2035
|
+
offset
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
});
|
|
2039
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2040
|
+
const payload = response.payload;
|
|
2041
|
+
return {
|
|
2042
|
+
success: payload.success,
|
|
2043
|
+
error: payload.error,
|
|
2044
|
+
nodes: payload.data?.nodes,
|
|
2045
|
+
count: payload.data?.count,
|
|
2046
|
+
message: payload.data?.message
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
async function getKbNodesByCategory(client, category, limit, offset, timeout) {
|
|
2050
|
+
const messageId = `kb_nodes_getbycategory_${Date.now()}`;
|
|
2051
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2052
|
+
id: messageId,
|
|
2053
|
+
type: "KB_NODES",
|
|
2054
|
+
from: { type: client.type },
|
|
2055
|
+
to: { type: "data-agent" },
|
|
2056
|
+
payload: {
|
|
2057
|
+
operation: "getByCategory",
|
|
2058
|
+
data: {
|
|
2059
|
+
category,
|
|
2060
|
+
limit,
|
|
2061
|
+
offset
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
});
|
|
2065
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2066
|
+
const payload = response.payload;
|
|
2067
|
+
return {
|
|
2068
|
+
success: payload.success,
|
|
2069
|
+
error: payload.error,
|
|
2070
|
+
nodes: payload.data?.nodes,
|
|
2071
|
+
count: payload.data?.count,
|
|
2072
|
+
category: payload.data?.category || category,
|
|
2073
|
+
message: payload.data?.message
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
async function getKbNodesByUser(client, userId, limit, offset, timeout) {
|
|
2077
|
+
const messageId = `kb_nodes_getbyuser_${Date.now()}`;
|
|
2078
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2079
|
+
id: messageId,
|
|
2080
|
+
type: "KB_NODES",
|
|
2081
|
+
from: { type: client.type },
|
|
2082
|
+
to: { type: "data-agent" },
|
|
2083
|
+
payload: {
|
|
2084
|
+
operation: "getByUser",
|
|
2085
|
+
data: {
|
|
2086
|
+
userId,
|
|
2087
|
+
limit,
|
|
2088
|
+
offset
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
});
|
|
2092
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2093
|
+
const payload = response.payload;
|
|
2094
|
+
return {
|
|
2095
|
+
success: payload.success,
|
|
2096
|
+
error: payload.error,
|
|
2097
|
+
nodes: payload.data?.nodes,
|
|
2098
|
+
count: payload.data?.count,
|
|
2099
|
+
userId: payload.data?.userId || userId,
|
|
2100
|
+
message: payload.data?.message
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
async function getKbNodeCategories(client, timeout) {
|
|
2104
|
+
const messageId = `kb_nodes_getcategories_${Date.now()}`;
|
|
2105
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2106
|
+
id: messageId,
|
|
2107
|
+
type: "KB_NODES",
|
|
2108
|
+
from: { type: client.type },
|
|
2109
|
+
to: { type: "data-agent" },
|
|
2110
|
+
payload: {
|
|
2111
|
+
operation: "getCategories"
|
|
2112
|
+
}
|
|
2113
|
+
});
|
|
2114
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2115
|
+
const payload = response.payload;
|
|
2116
|
+
return {
|
|
2117
|
+
success: payload.success,
|
|
2118
|
+
error: payload.error,
|
|
2119
|
+
categories: payload.data?.categories,
|
|
2120
|
+
count: payload.data?.count,
|
|
2121
|
+
message: payload.data?.message
|
|
2122
|
+
};
|
|
2123
|
+
}
|
|
2124
|
+
async function getKbNodeTags(client, timeout) {
|
|
2125
|
+
const messageId = `kb_nodes_gettags_${Date.now()}`;
|
|
2126
|
+
const message = KbNodesRequestMessageSchema.parse({
|
|
2127
|
+
id: messageId,
|
|
2128
|
+
type: "KB_NODES",
|
|
2129
|
+
from: { type: client.type },
|
|
2130
|
+
to: { type: "data-agent" },
|
|
2131
|
+
payload: {
|
|
2132
|
+
operation: "getTags"
|
|
2133
|
+
}
|
|
2134
|
+
});
|
|
2135
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2136
|
+
const payload = response.payload;
|
|
2137
|
+
const responseData = payload.data;
|
|
2138
|
+
return {
|
|
2139
|
+
success: payload.success,
|
|
2140
|
+
error: payload.error,
|
|
2141
|
+
tags: responseData?.tags,
|
|
2142
|
+
count: payload.data?.count,
|
|
2143
|
+
message: payload.data?.message
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
|
|
1765
2147
|
// src/client.ts
|
|
1766
2148
|
var SuperatomClient = class {
|
|
1767
2149
|
constructor(config) {
|
|
@@ -2139,6 +2521,14 @@ var SuperatomClient = class {
|
|
|
2139
2521
|
this.log("info", "Fetching user:", username);
|
|
2140
2522
|
return getUser(this, username, timeout);
|
|
2141
2523
|
}
|
|
2524
|
+
/**
|
|
2525
|
+
* Query users with filters, limit, and sort
|
|
2526
|
+
* Delegates to users service
|
|
2527
|
+
*/
|
|
2528
|
+
async queryUsers(options = {}, timeout) {
|
|
2529
|
+
this.log("info", "Querying users with filters:", options.filters);
|
|
2530
|
+
return queryUsers(this, options, timeout);
|
|
2531
|
+
}
|
|
2142
2532
|
// ==================== Dashboard Management Methods ====================
|
|
2143
2533
|
// These methods delegate to dashboard service for admin dashboard CRUD operations
|
|
2144
2534
|
/**
|
|
@@ -2232,20 +2622,12 @@ var SuperatomClient = class {
|
|
|
2232
2622
|
return getBookmark(this, id, timeout);
|
|
2233
2623
|
}
|
|
2234
2624
|
/**
|
|
2235
|
-
*
|
|
2625
|
+
* Query bookmarks with filters, limit, and sort
|
|
2236
2626
|
* Delegates to bookmarks service
|
|
2237
2627
|
*/
|
|
2238
|
-
async
|
|
2239
|
-
this.log("info", "
|
|
2240
|
-
return
|
|
2241
|
-
}
|
|
2242
|
-
/**
|
|
2243
|
-
* Get bookmarks by thread ID
|
|
2244
|
-
* Delegates to bookmarks service
|
|
2245
|
-
*/
|
|
2246
|
-
async getBookmarksByThread(threadId, timeout) {
|
|
2247
|
-
this.log("info", "Fetching bookmarks for thread:", threadId);
|
|
2248
|
-
return getBookmarksByThread(this, threadId, timeout);
|
|
2628
|
+
async queryBookmarks(options = {}, timeout) {
|
|
2629
|
+
this.log("info", "Querying bookmarks with filters:", options.filters);
|
|
2630
|
+
return queryBookmarks(this, options, timeout);
|
|
2249
2631
|
}
|
|
2250
2632
|
// ==================== Report Management Methods ====================
|
|
2251
2633
|
// These methods delegate to report service for admin report CRUD operations
|
|
@@ -2347,6 +2729,88 @@ var SuperatomClient = class {
|
|
|
2347
2729
|
this.log("info", "Querying UIs with filters:", options?.filters);
|
|
2348
2730
|
return queryUIs(this, options, timeout);
|
|
2349
2731
|
}
|
|
2732
|
+
// ==================== KB Nodes (Knowledge Base) Management Methods ====================
|
|
2733
|
+
// These methods delegate to kb-nodes service for knowledge base CRUD operations
|
|
2734
|
+
/**
|
|
2735
|
+
* Create a new knowledge base node
|
|
2736
|
+
* Delegates to kb-nodes service
|
|
2737
|
+
*/
|
|
2738
|
+
async createKbNode(title, content, createdBy, category, tags, timeout) {
|
|
2739
|
+
this.log("info", "Creating KB node:", title);
|
|
2740
|
+
return createKbNode(this, title, content, createdBy, category, tags, timeout);
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* Update an existing knowledge base node
|
|
2744
|
+
* Delegates to kb-nodes service
|
|
2745
|
+
*/
|
|
2746
|
+
async updateKbNode(id, updatedBy, updates, timeout) {
|
|
2747
|
+
this.log("info", "Updating KB node:", id);
|
|
2748
|
+
return updateKbNode(this, id, updatedBy, updates, timeout);
|
|
2749
|
+
}
|
|
2750
|
+
/**
|
|
2751
|
+
* Delete a knowledge base node
|
|
2752
|
+
* Delegates to kb-nodes service
|
|
2753
|
+
*/
|
|
2754
|
+
async deleteKbNode(id, timeout) {
|
|
2755
|
+
this.log("info", "Deleting KB node:", id);
|
|
2756
|
+
return deleteKbNode(this, id, timeout);
|
|
2757
|
+
}
|
|
2758
|
+
/**
|
|
2759
|
+
* Get all knowledge base nodes
|
|
2760
|
+
* Delegates to kb-nodes service
|
|
2761
|
+
*/
|
|
2762
|
+
async getAllKbNodes(limit, offset, timeout) {
|
|
2763
|
+
this.log("info", "Fetching all KB nodes");
|
|
2764
|
+
return getAllKbNodes(this, limit, offset, timeout);
|
|
2765
|
+
}
|
|
2766
|
+
/**
|
|
2767
|
+
* Get a specific knowledge base node by ID
|
|
2768
|
+
* Delegates to kb-nodes service
|
|
2769
|
+
*/
|
|
2770
|
+
async getKbNode(id, timeout) {
|
|
2771
|
+
this.log("info", "Fetching KB node:", id);
|
|
2772
|
+
return getKbNode(this, id, timeout);
|
|
2773
|
+
}
|
|
2774
|
+
/**
|
|
2775
|
+
* Search knowledge base nodes with full-text search and filters
|
|
2776
|
+
* Delegates to kb-nodes service
|
|
2777
|
+
*/
|
|
2778
|
+
async searchKbNodes(options = {}, timeout) {
|
|
2779
|
+
this.log("info", "Searching KB nodes with query:", options.query);
|
|
2780
|
+
return searchKbNodes(this, options, timeout);
|
|
2781
|
+
}
|
|
2782
|
+
/**
|
|
2783
|
+
* Get knowledge base nodes by category
|
|
2784
|
+
* Delegates to kb-nodes service
|
|
2785
|
+
*/
|
|
2786
|
+
async getKbNodesByCategory(category, limit, offset, timeout) {
|
|
2787
|
+
this.log("info", "Fetching KB nodes by category:", category);
|
|
2788
|
+
return getKbNodesByCategory(this, category, limit, offset, timeout);
|
|
2789
|
+
}
|
|
2790
|
+
/**
|
|
2791
|
+
* Get knowledge base nodes by user (creator)
|
|
2792
|
+
* Delegates to kb-nodes service
|
|
2793
|
+
*/
|
|
2794
|
+
async getKbNodesByUser(userId, limit, offset, timeout) {
|
|
2795
|
+
this.log("info", "Fetching KB nodes by user:", userId);
|
|
2796
|
+
return getKbNodesByUser(this, userId, limit, offset, timeout);
|
|
2797
|
+
}
|
|
2798
|
+
/**
|
|
2799
|
+
* Get all unique categories from knowledge base nodes
|
|
2800
|
+
* Delegates to kb-nodes service
|
|
2801
|
+
*/
|
|
2802
|
+
async getKbNodeCategories(timeout) {
|
|
2803
|
+
this.log("info", "Fetching KB node categories");
|
|
2804
|
+
return getKbNodeCategories(this, timeout);
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Get all unique tags from knowledge base nodes
|
|
2808
|
+
* Delegates to kb-nodes service
|
|
2809
|
+
*/
|
|
2810
|
+
async getKbNodeTags(timeout) {
|
|
2811
|
+
this.log("info", "Fetching KB node tags");
|
|
2812
|
+
return getKbNodeTags(this, timeout);
|
|
2813
|
+
}
|
|
2350
2814
|
/**
|
|
2351
2815
|
* Internal logging
|
|
2352
2816
|
*/
|
|
@@ -2418,6 +2882,12 @@ exports.DataRequestMessageSchema = DataRequestMessageSchema;
|
|
|
2418
2882
|
exports.DataRequestPayloadSchema = DataRequestPayloadSchema;
|
|
2419
2883
|
exports.DataResponseMessageSchema = DataResponseMessageSchema;
|
|
2420
2884
|
exports.DataResponsePayloadSchema = DataResponsePayloadSchema;
|
|
2885
|
+
exports.KbNodeDataSchema = KbNodeDataSchema;
|
|
2886
|
+
exports.KbNodesQueryFiltersSchema = KbNodesQueryFiltersSchema;
|
|
2887
|
+
exports.KbNodesRequestMessageSchema = KbNodesRequestMessageSchema;
|
|
2888
|
+
exports.KbNodesRequestPayloadSchema = KbNodesRequestPayloadSchema;
|
|
2889
|
+
exports.KbNodesResponseMessageSchema = KbNodesResponseMessageSchema;
|
|
2890
|
+
exports.KbNodesResponsePayloadSchema = KbNodesResponsePayloadSchema;
|
|
2421
2891
|
exports.MessageParticipantSchema = MessageParticipantSchema;
|
|
2422
2892
|
exports.MessageSchema = MessageSchema;
|
|
2423
2893
|
exports.SDK_VERSION = SDK_VERSION;
|