@superatomai/sdk-web 0.0.23 → 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/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(),
@@ -948,6 +999,7 @@ __export(services_exports, {
948
999
  QuerySpecSchema: () => QuerySpecSchema,
949
1000
  UIComponentSchema: () => UIComponentSchema,
950
1001
  UIElementSchema: () => UIElementSchema,
1002
+ createArtifact: () => createArtifact,
951
1003
  createBookmark: () => createBookmark,
952
1004
  createDashboard: () => createDashboard,
953
1005
  createKbNode: () => createKbNode,
@@ -955,6 +1007,7 @@ __export(services_exports, {
955
1007
  createReport: () => createReport,
956
1008
  createUI: () => createUI,
957
1009
  createUser: () => createUser,
1010
+ deleteArtifact: () => deleteArtifact,
958
1011
  deleteBookmark: () => deleteBookmark,
959
1012
  deleteDashboard: () => deleteDashboard,
960
1013
  deleteKbNode: () => deleteKbNode,
@@ -963,6 +1016,7 @@ __export(services_exports, {
963
1016
  deleteUI: () => deleteUI,
964
1017
  deleteUser: () => deleteUser,
965
1018
  getActions: () => getActions,
1019
+ getAllArtifacts: () => getAllArtifacts,
966
1020
  getAllBookmarks: () => getAllBookmarks,
967
1021
  getAllDashboards: () => getAllDashboards,
968
1022
  getAllKbNodes: () => getAllKbNodes,
@@ -970,6 +1024,7 @@ __export(services_exports, {
970
1024
  getAllReports: () => getAllReports,
971
1025
  getAllUIs: () => getAllUIs,
972
1026
  getAllUsers: () => getAllUsers,
1027
+ getArtifact: () => getArtifact,
973
1028
  getBookmark: () => getBookmark,
974
1029
  getChildMenus: () => getChildMenus,
975
1030
  getComponentSuggestions: () => getComponentSuggestions,
@@ -1001,6 +1056,7 @@ __export(services_exports, {
1001
1056
  sendDashCompRequest: () => sendDashCompRequest,
1002
1057
  sendUserPromptRequest: () => sendUserPromptRequest,
1003
1058
  sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
1059
+ updateArtifact: () => updateArtifact,
1004
1060
  updateBookmark: () => updateBookmark,
1005
1061
  updateDashboard: () => updateDashboard,
1006
1062
  updateKbNode: () => updateKbNode,
@@ -1858,6 +1914,131 @@ async function queryBookmarks(client, options = {}, timeout) {
1858
1914
  };
1859
1915
  }
1860
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
+
1861
2042
  // src/services/actions.ts
1862
2043
  async function getActions(client, options) {
1863
2044
  const messageId = `msg_${Date.now()}_${Math.random().toString(36).substring(7)}`;
@@ -2041,7 +2222,7 @@ async function queryUIs(client, options = {}, timeout) {
2041
2222
  }
2042
2223
 
2043
2224
  // src/services/kb-nodes.ts
2044
- async function createKbNode(client, title, content, createdBy, category, tags, timeout) {
2225
+ async function createKbNode(client, title, content, createdBy, category, tags, type, timeout) {
2045
2226
  const messageId = `kb_nodes_create_${Date.now()}`;
2046
2227
  const message = KbNodesRequestMessageSchema.parse({
2047
2228
  id: messageId,
@@ -2055,7 +2236,8 @@ async function createKbNode(client, title, content, createdBy, category, tags, t
2055
2236
  content,
2056
2237
  createdBy,
2057
2238
  category,
2058
- tags
2239
+ tags,
2240
+ type: type || "query"
2059
2241
  }
2060
2242
  }
2061
2243
  });
@@ -2071,6 +2253,7 @@ async function createKbNode(client, title, content, createdBy, category, tags, t
2071
2253
  content: payload.data.content || content,
2072
2254
  category: payload.data.category,
2073
2255
  tags: payload.data.tags,
2256
+ type: payload.data.type,
2074
2257
  createdBy: payload.data.createdBy || createdBy,
2075
2258
  updatedBy: payload.data.updatedBy,
2076
2259
  createdAt: payload.data.createdAt,
@@ -2106,6 +2289,7 @@ async function updateKbNode(client, id, updatedBy, updates, timeout) {
2106
2289
  content: payload.data.content || "",
2107
2290
  category: payload.data.category,
2108
2291
  tags: payload.data.tags,
2292
+ type: payload.data.type,
2109
2293
  createdBy: payload.data.createdBy || 0,
2110
2294
  updatedBy: payload.data.updatedBy,
2111
2295
  createdAt: payload.data.createdAt,
@@ -2184,7 +2368,7 @@ async function getKbNode(client, id, timeout) {
2184
2368
  };
2185
2369
  }
2186
2370
  async function searchKbNodes(client, options = {}, timeout) {
2187
- const { query, category, tags, createdBy, limit, offset } = options;
2371
+ const { query, category, tags, type, createdBy, limit, offset } = options;
2188
2372
  const messageId = `kb_nodes_search_${Date.now()}`;
2189
2373
  const message = KbNodesRequestMessageSchema.parse({
2190
2374
  id: messageId,
@@ -2197,6 +2381,7 @@ async function searchKbNodes(client, options = {}, timeout) {
2197
2381
  query,
2198
2382
  category,
2199
2383
  tags,
2384
+ type,
2200
2385
  createdBy,
2201
2386
  limit,
2202
2387
  offset
@@ -3104,6 +3289,48 @@ var SuperatomClient = class {
3104
3289
  this.log("info", "Querying bookmarks with filters:", options.filters);
3105
3290
  return queryBookmarks(this, options, timeout);
3106
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
+ }
3107
3334
  // ==================== Report Management Methods ====================
3108
3335
  // These methods delegate to report service for admin report CRUD operations
3109
3336
  /**
@@ -3210,9 +3437,9 @@ var SuperatomClient = class {
3210
3437
  * Create a new knowledge base node
3211
3438
  * Delegates to kb-nodes service
3212
3439
  */
3213
- async createKbNode(title, content, createdBy, category, tags, timeout) {
3440
+ async createKbNode(title, content, createdBy, category, tags, type, timeout) {
3214
3441
  this.log("info", "Creating KB node:", title);
3215
- return createKbNode(this, title, content, createdBy, category, tags, timeout);
3442
+ return createKbNode(this, title, content, createdBy, category, tags, type, timeout);
3216
3443
  }
3217
3444
  /**
3218
3445
  * Update an existing knowledge base node