@superatomai/sdk-web 0.0.23 → 0.0.25

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 CHANGED
@@ -786,12 +786,69 @@ zod.z.object({
786
786
  to: MessageParticipantSchema.optional(),
787
787
  payload: BookmarksResponsePayloadSchema
788
788
  });
789
+ var ArtifactDataSchema = zod.z.object({
790
+ id: zod.z.number().optional(),
791
+ name: zod.z.string(),
792
+ createdBy: zod.z.number().nullable().optional(),
793
+ dsl: zod.z.record(zod.z.string(), zod.z.any()).nullable().optional(),
794
+ status: zod.z.string().nullable().optional(),
795
+ deleted: zod.z.boolean().optional(),
796
+ createdAt: zod.z.string().optional(),
797
+ updatedAt: zod.z.string().optional()
798
+ });
799
+ var ArtifactsQueryFiltersSchema = zod.z.object({
800
+ createdBy: zod.z.number().optional(),
801
+ status: zod.z.string().optional(),
802
+ name: zod.z.string().optional(),
803
+ deleted: zod.z.boolean().optional()
804
+ });
805
+ var ArtifactsRequestPayloadSchema = zod.z.object({
806
+ operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
807
+ data: zod.z.object({
808
+ id: zod.z.number().optional(),
809
+ name: zod.z.string().optional(),
810
+ createdBy: zod.z.number().optional(),
811
+ dsl: zod.z.record(zod.z.string(), zod.z.any()).optional(),
812
+ status: zod.z.string().optional(),
813
+ deleted: zod.z.boolean().optional(),
814
+ limit: zod.z.number().optional(),
815
+ // Query operation fields
816
+ filters: ArtifactsQueryFiltersSchema.optional(),
817
+ sort: zod.z.enum(["ASC", "DESC"]).optional()
818
+ }).optional()
819
+ });
820
+ var ArtifactsRequestMessageSchema = zod.z.object({
821
+ id: zod.z.string(),
822
+ type: zod.z.literal("ARTIFACTS"),
823
+ from: MessageParticipantSchema,
824
+ to: MessageParticipantSchema.optional(),
825
+ payload: ArtifactsRequestPayloadSchema
826
+ });
827
+ var ArtifactsResponsePayloadSchema = zod.z.object({
828
+ success: zod.z.boolean(),
829
+ error: zod.z.string().optional(),
830
+ data: zod.z.union([
831
+ ArtifactDataSchema,
832
+ zod.z.array(ArtifactDataSchema)
833
+ ]).optional(),
834
+ count: zod.z.number().optional(),
835
+ message: zod.z.string().optional()
836
+ });
837
+ zod.z.object({
838
+ id: zod.z.string(),
839
+ type: zod.z.literal("ARTIFACTS_RES"),
840
+ from: MessageParticipantSchema,
841
+ to: MessageParticipantSchema.optional(),
842
+ payload: ArtifactsResponsePayloadSchema
843
+ });
844
+ var KbNodeTypeSchema = zod.z.enum(["global", "user", "query"]);
789
845
  var KbNodeDataSchema = zod.z.object({
790
846
  id: zod.z.number().optional(),
791
847
  title: zod.z.string(),
792
848
  content: zod.z.string(),
793
849
  category: zod.z.string().nullable().optional(),
794
850
  tags: zod.z.array(zod.z.string()).nullable().optional(),
851
+ type: KbNodeTypeSchema.nullable().optional(),
795
852
  createdBy: zod.z.number(),
796
853
  updatedBy: zod.z.number().optional(),
797
854
  createdAt: zod.z.string().optional(),
@@ -801,6 +858,7 @@ var KbNodesQueryFiltersSchema = zod.z.object({
801
858
  query: zod.z.string().optional(),
802
859
  category: zod.z.string().optional(),
803
860
  tags: zod.z.array(zod.z.string()).optional(),
861
+ type: KbNodeTypeSchema.optional(),
804
862
  createdBy: zod.z.number().optional()
805
863
  });
806
864
  var KbNodesRequestPayloadSchema = zod.z.object({
@@ -811,6 +869,7 @@ var KbNodesRequestPayloadSchema = zod.z.object({
811
869
  content: zod.z.string().optional(),
812
870
  category: zod.z.string().optional(),
813
871
  tags: zod.z.array(zod.z.string()).optional(),
872
+ type: KbNodeTypeSchema.optional(),
814
873
  createdBy: zod.z.number().optional(),
815
874
  updatedBy: zod.z.number().optional(),
816
875
  userId: zod.z.number().optional(),
@@ -838,6 +897,7 @@ var KbNodesResponsePayloadSchema = zod.z.object({
838
897
  content: zod.z.string().optional(),
839
898
  category: zod.z.string().nullable().optional(),
840
899
  tags: zod.z.array(zod.z.string()).nullable().optional(),
900
+ type: KbNodeTypeSchema.nullable().optional(),
841
901
  createdBy: zod.z.number().optional(),
842
902
  updatedBy: zod.z.number().optional(),
843
903
  createdAt: zod.z.string().optional(),
@@ -950,6 +1010,7 @@ __export(services_exports, {
950
1010
  QuerySpecSchema: () => QuerySpecSchema,
951
1011
  UIComponentSchema: () => UIComponentSchema,
952
1012
  UIElementSchema: () => UIElementSchema,
1013
+ createArtifact: () => createArtifact,
953
1014
  createBookmark: () => createBookmark,
954
1015
  createDashboard: () => createDashboard,
955
1016
  createKbNode: () => createKbNode,
@@ -957,6 +1018,7 @@ __export(services_exports, {
957
1018
  createReport: () => createReport,
958
1019
  createUI: () => createUI,
959
1020
  createUser: () => createUser,
1021
+ deleteArtifact: () => deleteArtifact,
960
1022
  deleteBookmark: () => deleteBookmark,
961
1023
  deleteDashboard: () => deleteDashboard,
962
1024
  deleteKbNode: () => deleteKbNode,
@@ -965,6 +1027,7 @@ __export(services_exports, {
965
1027
  deleteUI: () => deleteUI,
966
1028
  deleteUser: () => deleteUser,
967
1029
  getActions: () => getActions,
1030
+ getAllArtifacts: () => getAllArtifacts,
968
1031
  getAllBookmarks: () => getAllBookmarks,
969
1032
  getAllDashboards: () => getAllDashboards,
970
1033
  getAllKbNodes: () => getAllKbNodes,
@@ -972,6 +1035,7 @@ __export(services_exports, {
972
1035
  getAllReports: () => getAllReports,
973
1036
  getAllUIs: () => getAllUIs,
974
1037
  getAllUsers: () => getAllUsers,
1038
+ getArtifact: () => getArtifact,
975
1039
  getBookmark: () => getBookmark,
976
1040
  getChildMenus: () => getChildMenus,
977
1041
  getComponentSuggestions: () => getComponentSuggestions,
@@ -987,6 +1051,7 @@ __export(services_exports, {
987
1051
  getRootMenus: () => getRootMenus,
988
1052
  getUI: () => getUI,
989
1053
  getUser: () => getUser,
1054
+ queryArtifacts: () => queryArtifacts,
990
1055
  queryBookmarks: () => queryBookmarks,
991
1056
  queryDashboards: () => queryDashboards,
992
1057
  queryMenus: () => queryMenus,
@@ -1003,6 +1068,7 @@ __export(services_exports, {
1003
1068
  sendDashCompRequest: () => sendDashCompRequest,
1004
1069
  sendUserPromptRequest: () => sendUserPromptRequest,
1005
1070
  sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
1071
+ updateArtifact: () => updateArtifact,
1006
1072
  updateBookmark: () => updateBookmark,
1007
1073
  updateDashboard: () => updateDashboard,
1008
1074
  updateKbNode: () => updateKbNode,
@@ -1860,6 +1926,158 @@ async function queryBookmarks(client, options = {}, timeout) {
1860
1926
  };
1861
1927
  }
1862
1928
 
1929
+ // src/services/artifacts/index.ts
1930
+ async function createArtifact(client, options, timeout) {
1931
+ const { name, createdBy, dsl, status } = options;
1932
+ const messageId = `artifacts_create_${Date.now()}`;
1933
+ const message = ArtifactsRequestMessageSchema.parse({
1934
+ id: messageId,
1935
+ type: "ARTIFACTS",
1936
+ from: { type: client.type },
1937
+ to: { type: "data-agent" },
1938
+ payload: {
1939
+ operation: "create",
1940
+ data: {
1941
+ name,
1942
+ createdBy,
1943
+ dsl,
1944
+ status
1945
+ }
1946
+ }
1947
+ });
1948
+ const response = await client.sendWithResponse(message, timeout);
1949
+ const payload = response.payload;
1950
+ return {
1951
+ success: payload.success,
1952
+ error: payload.error,
1953
+ message: payload.message,
1954
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
1955
+ };
1956
+ }
1957
+ async function updateArtifact(client, options, timeout) {
1958
+ const { id, name, dsl, status, deleted } = options;
1959
+ const messageId = `artifacts_update_${Date.now()}`;
1960
+ const message = ArtifactsRequestMessageSchema.parse({
1961
+ id: messageId,
1962
+ type: "ARTIFACTS",
1963
+ from: { type: client.type },
1964
+ to: { type: "data-agent" },
1965
+ payload: {
1966
+ operation: "update",
1967
+ data: {
1968
+ id,
1969
+ name,
1970
+ dsl,
1971
+ status,
1972
+ deleted
1973
+ }
1974
+ }
1975
+ });
1976
+ const response = await client.sendWithResponse(message, timeout);
1977
+ const payload = response.payload;
1978
+ return {
1979
+ success: payload.success,
1980
+ error: payload.error,
1981
+ message: payload.message,
1982
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
1983
+ };
1984
+ }
1985
+ async function deleteArtifact(client, id, timeout) {
1986
+ const messageId = `artifacts_delete_${Date.now()}`;
1987
+ const message = ArtifactsRequestMessageSchema.parse({
1988
+ id: messageId,
1989
+ type: "ARTIFACTS",
1990
+ from: { type: client.type },
1991
+ to: { type: "data-agent" },
1992
+ payload: {
1993
+ operation: "delete",
1994
+ data: {
1995
+ id
1996
+ }
1997
+ }
1998
+ });
1999
+ const response = await client.sendWithResponse(message, timeout);
2000
+ const payload = response.payload;
2001
+ return {
2002
+ success: payload.success,
2003
+ error: payload.error,
2004
+ message: payload.message,
2005
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data
2006
+ };
2007
+ }
2008
+ async function getAllArtifacts(client, limit, timeout) {
2009
+ const messageId = `artifacts_getall_${Date.now()}`;
2010
+ const message = ArtifactsRequestMessageSchema.parse({
2011
+ id: messageId,
2012
+ type: "ARTIFACTS",
2013
+ from: { type: client.type },
2014
+ to: { type: "data-agent" },
2015
+ payload: {
2016
+ operation: "getAll",
2017
+ data: limit ? { limit } : void 0
2018
+ }
2019
+ });
2020
+ const response = await client.sendWithResponse(message, timeout);
2021
+ const payload = response.payload;
2022
+ return {
2023
+ success: payload.success,
2024
+ error: payload.error,
2025
+ data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
2026
+ count: payload.count,
2027
+ message: payload.message
2028
+ };
2029
+ }
2030
+ async function getArtifact(client, id, timeout) {
2031
+ const messageId = `artifacts_getone_${Date.now()}`;
2032
+ const message = ArtifactsRequestMessageSchema.parse({
2033
+ id: messageId,
2034
+ type: "ARTIFACTS",
2035
+ from: { type: client.type },
2036
+ to: { type: "data-agent" },
2037
+ payload: {
2038
+ operation: "getOne",
2039
+ data: {
2040
+ id
2041
+ }
2042
+ }
2043
+ });
2044
+ const response = await client.sendWithResponse(message, timeout);
2045
+ const payload = response.payload;
2046
+ return {
2047
+ success: payload.success,
2048
+ error: payload.error,
2049
+ data: Array.isArray(payload.data) ? payload.data[0] : payload.data,
2050
+ message: payload.message
2051
+ };
2052
+ }
2053
+ async function queryArtifacts(client, options = {}, timeout) {
2054
+ const { filters, limit, sort } = options;
2055
+ const messageId = `artifacts_query_${Date.now()}`;
2056
+ const message = ArtifactsRequestMessageSchema.parse({
2057
+ id: messageId,
2058
+ type: "ARTIFACTS",
2059
+ from: { type: client.type },
2060
+ to: { type: "data-agent" },
2061
+ payload: {
2062
+ operation: "query",
2063
+ data: {
2064
+ filters,
2065
+ limit,
2066
+ sort
2067
+ }
2068
+ }
2069
+ });
2070
+ const response = await client.sendWithResponse(message, timeout);
2071
+ const payload = response.payload;
2072
+ return {
2073
+ success: payload.success,
2074
+ error: payload.error,
2075
+ data: Array.isArray(payload.data) ? payload.data : payload.data ? [payload.data] : [],
2076
+ count: payload.count,
2077
+ message: payload.message
2078
+ };
2079
+ }
2080
+
1863
2081
  // src/services/actions.ts
1864
2082
  async function getActions(client, options) {
1865
2083
  const messageId = `msg_${Date.now()}_${Math.random().toString(36).substring(7)}`;
@@ -2043,7 +2261,7 @@ async function queryUIs(client, options = {}, timeout) {
2043
2261
  }
2044
2262
 
2045
2263
  // src/services/kb-nodes.ts
2046
- async function createKbNode(client, title, content, createdBy, category, tags, timeout) {
2264
+ async function createKbNode(client, title, content, createdBy, category, tags, type, timeout) {
2047
2265
  const messageId = `kb_nodes_create_${Date.now()}`;
2048
2266
  const message = KbNodesRequestMessageSchema.parse({
2049
2267
  id: messageId,
@@ -2057,7 +2275,8 @@ async function createKbNode(client, title, content, createdBy, category, tags, t
2057
2275
  content,
2058
2276
  createdBy,
2059
2277
  category,
2060
- tags
2278
+ tags,
2279
+ type: type || "query"
2061
2280
  }
2062
2281
  }
2063
2282
  });
@@ -2073,6 +2292,7 @@ async function createKbNode(client, title, content, createdBy, category, tags, t
2073
2292
  content: payload.data.content || content,
2074
2293
  category: payload.data.category,
2075
2294
  tags: payload.data.tags,
2295
+ type: payload.data.type,
2076
2296
  createdBy: payload.data.createdBy || createdBy,
2077
2297
  updatedBy: payload.data.updatedBy,
2078
2298
  createdAt: payload.data.createdAt,
@@ -2108,6 +2328,7 @@ async function updateKbNode(client, id, updatedBy, updates, timeout) {
2108
2328
  content: payload.data.content || "",
2109
2329
  category: payload.data.category,
2110
2330
  tags: payload.data.tags,
2331
+ type: payload.data.type,
2111
2332
  createdBy: payload.data.createdBy || 0,
2112
2333
  updatedBy: payload.data.updatedBy,
2113
2334
  createdAt: payload.data.createdAt,
@@ -2186,7 +2407,7 @@ async function getKbNode(client, id, timeout) {
2186
2407
  };
2187
2408
  }
2188
2409
  async function searchKbNodes(client, options = {}, timeout) {
2189
- const { query, category, tags, createdBy, limit, offset } = options;
2410
+ const { query, category, tags, type, createdBy, limit, offset } = options;
2190
2411
  const messageId = `kb_nodes_search_${Date.now()}`;
2191
2412
  const message = KbNodesRequestMessageSchema.parse({
2192
2413
  id: messageId,
@@ -2199,6 +2420,7 @@ async function searchKbNodes(client, options = {}, timeout) {
2199
2420
  query,
2200
2421
  category,
2201
2422
  tags,
2423
+ type,
2202
2424
  createdBy,
2203
2425
  limit,
2204
2426
  offset
@@ -3106,6 +3328,56 @@ var SuperatomClient = class {
3106
3328
  this.log("info", "Querying bookmarks with filters:", options.filters);
3107
3329
  return queryBookmarks(this, options, timeout);
3108
3330
  }
3331
+ // ==================== Artifact Management Methods ====================
3332
+ // These methods delegate to artifact service for artifact CRUD operations
3333
+ /**
3334
+ * Create a new artifact
3335
+ * Delegates to artifacts service
3336
+ */
3337
+ async createArtifact(options, timeout) {
3338
+ this.log("info", "Creating artifact:", options.name);
3339
+ return createArtifact(this, options, timeout);
3340
+ }
3341
+ /**
3342
+ * Update an existing artifact
3343
+ * Delegates to artifacts service
3344
+ */
3345
+ async updateArtifact(options, timeout) {
3346
+ this.log("info", "Updating artifact:", options.id);
3347
+ return updateArtifact(this, options, timeout);
3348
+ }
3349
+ /**
3350
+ * Delete an artifact (soft delete)
3351
+ * Delegates to artifacts service
3352
+ */
3353
+ async deleteArtifact(id, timeout) {
3354
+ this.log("info", "Deleting artifact:", id);
3355
+ return deleteArtifact(this, id, timeout);
3356
+ }
3357
+ /**
3358
+ * Get all artifacts
3359
+ * Delegates to artifacts service
3360
+ */
3361
+ async getAllArtifacts(limit, timeout) {
3362
+ this.log("info", "Fetching all artifacts");
3363
+ return getAllArtifacts(this, limit, timeout);
3364
+ }
3365
+ /**
3366
+ * Get a specific artifact by ID
3367
+ * Delegates to artifacts service
3368
+ */
3369
+ async getArtifact(id, timeout) {
3370
+ this.log("info", "Fetching artifact:", id);
3371
+ return getArtifact(this, id, timeout);
3372
+ }
3373
+ /**
3374
+ * Query artifacts with filters
3375
+ * Delegates to artifacts service
3376
+ */
3377
+ async queryArtifacts(options = {}, timeout) {
3378
+ this.log("info", "Querying artifacts with filters:", JSON.stringify(options.filters));
3379
+ return queryArtifacts(this, options, timeout);
3380
+ }
3109
3381
  // ==================== Report Management Methods ====================
3110
3382
  // These methods delegate to report service for admin report CRUD operations
3111
3383
  /**
@@ -3212,9 +3484,9 @@ var SuperatomClient = class {
3212
3484
  * Create a new knowledge base node
3213
3485
  * Delegates to kb-nodes service
3214
3486
  */
3215
- async createKbNode(title, content, createdBy, category, tags, timeout) {
3487
+ async createKbNode(title, content, createdBy, category, tags, type, timeout) {
3216
3488
  this.log("info", "Creating KB node:", title);
3217
- return createKbNode(this, title, content, createdBy, category, tags, timeout);
3489
+ return createKbNode(this, title, content, createdBy, category, tags, type, timeout);
3218
3490
  }
3219
3491
  /**
3220
3492
  * Update an existing knowledge base node