@superatomai/sdk-web 0.0.19 → 0.0.21

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
@@ -259,6 +259,7 @@ var AuthVerifyResponseMessageSchema = z.object({
259
259
  });
260
260
  var UserPromptRequestPayloadSchema = z.object({
261
261
  prompt: z.string(),
262
+ userId: z.string().optional(),
262
263
  SA_RUNTIME: z.object({
263
264
  threadId: z.string(),
264
265
  uiBlockId: z.string()
@@ -272,17 +273,18 @@ var UserPromptRequestMessageSchema = z.object({
272
273
  to: MessageParticipantSchema.optional(),
273
274
  payload: UserPromptRequestPayloadSchema
274
275
  });
276
+ var ComponentPropsSchema = z.object({
277
+ query: z.string().optional(),
278
+ title: z.string().optional(),
279
+ description: z.string().optional(),
280
+ config: z.record(z.string(), z.unknown()).optional()
281
+ }).passthrough();
275
282
  var ComponentSchema = z.object({
276
283
  id: z.string(),
277
284
  name: z.string(),
278
285
  type: z.string(),
279
286
  description: z.string(),
280
- props: z.object({
281
- query: z.string().optional(),
282
- title: z.string().optional(),
283
- description: z.string().optional(),
284
- config: z.record(z.string(), z.unknown()).optional()
285
- }),
287
+ props: ComponentPropsSchema,
286
288
  category: z.string().optional(),
287
289
  keywords: z.array(z.string()).optional()
288
290
  });
@@ -304,6 +306,7 @@ var UserPromptResponseMessageSchema = z.object({
304
306
  });
305
307
  var UserPromptSuggestionsRequestPayloadSchema = z.object({
306
308
  prompt: z.string(),
309
+ userId: z.string().optional(),
307
310
  limit: z.number().int().positive().default(5)
308
311
  });
309
312
  var UserPromptSuggestionsRequestMessageSchema = z.object({
@@ -332,10 +335,13 @@ var UserPromptSuggestionsResponseMessageSchema = z.object({
332
335
  });
333
336
  var DashCompRequestPayloadSchema = z.object({
334
337
  prompt: z.string(),
338
+ userId: z.string().optional(),
335
339
  SA_RUNTIME: z.object({
336
340
  threadId: z.string().optional(),
337
341
  uiBlockId: z.string().optional()
338
- }).optional()
342
+ }).optional(),
343
+ existingComponents: z.array(ComponentSchema).optional(),
344
+ req_type: z.enum(["create", "update", "filter"]).optional()
339
345
  });
340
346
  var DashCompRequestMessageSchema = z.object({
341
347
  id: z.string(),
@@ -350,13 +356,24 @@ z.object({
350
356
  action: z.enum(["get", "create", "update", "delete"]),
351
357
  params: z.record(z.string(), z.unknown())
352
358
  });
359
+ z.object({
360
+ filterId: z.string(),
361
+ filterField: z.string(),
362
+ targetComponentId: z.string(),
363
+ targetField: z.string()
364
+ });
353
365
  var DashCompResponsePayloadSchema = z.object({
354
366
  success: z.boolean(),
355
367
  errors: z.array(z.string()).optional(),
356
368
  data: z.object({
369
+ // For create/update requests
357
370
  component: ComponentSchema.optional(),
358
371
  reasoning: z.string().optional(),
359
- dataSource: z.enum(["database", "external_tool", "none"]).optional()
372
+ dataSource: z.enum(["database", "external_tool", "none"]).optional(),
373
+ // For filter requests
374
+ filterComponent: ComponentSchema.optional(),
375
+ updatedComponents: z.array(ComponentSchema).optional(),
376
+ filterBindings: z.record(z.string(), z.unknown()).optional()
360
377
  }).optional()
361
378
  });
362
379
  z.object({
@@ -446,6 +463,7 @@ var UILogsMessageSchema = z.object({
446
463
  payload: UILogsPayloadSchema
447
464
  });
448
465
  var ActionsRequestPayloadSchema = z.object({
466
+ userId: z.string().optional(),
449
467
  SA_RUNTIME: z.object({
450
468
  threadId: z.string(),
451
469
  uiBlockId: z.string()
@@ -568,6 +586,7 @@ var DashboardsRequestPayloadSchema = z.object({
568
586
  published: z.boolean().optional(),
569
587
  createdBy: z.number().optional(),
570
588
  updatedBy: z.number().optional(),
589
+ allowedUsers: z.array(z.number()).optional(),
571
590
  dashboard: DSLRendererPropsSchema.optional(),
572
591
  // Query operation fields
573
592
  filters: DashboardQueryFiltersSchema.optional(),
@@ -956,7 +975,7 @@ async function sendAuthVerifyRequest(client, token, timeout) {
956
975
  }
957
976
 
958
977
  // src/services/userPrompt.ts
959
- async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, responseMode, onStream, timeout) {
978
+ async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, userId, responseMode, onStream, timeout) {
960
979
  const messageId = `user_prompt_req_msg_${Date.now()}`;
961
980
  const message = UserPromptRequestMessageSchema.parse({
962
981
  id: messageId,
@@ -969,6 +988,7 @@ async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, respon
969
988
  },
970
989
  payload: {
971
990
  prompt,
991
+ userId,
972
992
  SA_RUNTIME: {
973
993
  threadId,
974
994
  uiBlockId
@@ -996,7 +1016,7 @@ async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, respon
996
1016
  }
997
1017
  }
998
1018
  }
999
- async function sendUserPromptSuggestionsRequest(client, prompt, limit = 5, timeout) {
1019
+ async function sendUserPromptSuggestionsRequest(client, prompt, userId, limit = 5, timeout) {
1000
1020
  if (!prompt || prompt.trim().length === 0) {
1001
1021
  return null;
1002
1022
  }
@@ -1012,6 +1032,7 @@ async function sendUserPromptSuggestionsRequest(client, prompt, limit = 5, timeo
1012
1032
  },
1013
1033
  payload: {
1014
1034
  prompt,
1035
+ userId,
1015
1036
  limit
1016
1037
  }
1017
1038
  });
@@ -1286,7 +1307,7 @@ async function queryUsers(client, options = {}, timeout) {
1286
1307
 
1287
1308
  // src/services/dashboards/index.ts
1288
1309
  async function createDashboard(client, options, timeout) {
1289
- const { dashboardId, projectId, name, description, published, createdBy, dashboard } = options;
1310
+ const { dashboardId, projectId, name, description, published, createdBy, allowedUsers, dashboard } = options;
1290
1311
  const messageId = `dashboards_create_${Date.now()}`;
1291
1312
  const message = DashboardsRequestMessageSchema.parse({
1292
1313
  id: messageId,
@@ -1302,6 +1323,7 @@ async function createDashboard(client, options, timeout) {
1302
1323
  description,
1303
1324
  published,
1304
1325
  createdBy,
1326
+ allowedUsers,
1305
1327
  dashboard
1306
1328
  }
1307
1329
  }
@@ -1318,7 +1340,7 @@ async function createDashboard(client, options, timeout) {
1318
1340
  };
1319
1341
  }
1320
1342
  async function updateDashboard(client, options, timeout) {
1321
- const { id, name, description, published, createdBy, updatedBy, dashboard } = options;
1343
+ const { id, name, description, published, createdBy, updatedBy, allowedUsers, dashboard } = options;
1322
1344
  const messageId = `dashboards_update_${Date.now()}`;
1323
1345
  const message = DashboardsRequestMessageSchema.parse({
1324
1346
  id: messageId,
@@ -1334,6 +1356,7 @@ async function updateDashboard(client, options, timeout) {
1334
1356
  published,
1335
1357
  createdBy,
1336
1358
  updatedBy,
1359
+ allowedUsers,
1337
1360
  dashboard
1338
1361
  }
1339
1362
  }
@@ -1769,6 +1792,7 @@ async function getActions(client, options) {
1769
1792
  from: { type: client.type },
1770
1793
  to: { type: "data-agent" },
1771
1794
  payload: {
1795
+ userId: options.userId,
1772
1796
  SA_RUNTIME: options.SA_RUNTIME
1773
1797
  }
1774
1798
  });
@@ -2214,7 +2238,7 @@ async function getKbNodeTags(client, timeout) {
2214
2238
 
2215
2239
  // src/services/dash-comp.ts
2216
2240
  async function sendDashCompRequest(client, options) {
2217
- const { prompt, threadId, uiBlockId, timeout } = options;
2241
+ const { prompt, userId, threadId, uiBlockId, timeout, existingComponents, reqType } = options;
2218
2242
  const messageId = `dash_comp_req_${Date.now()}_${Math.random().toString(36).substring(7)}`;
2219
2243
  const message = DashCompRequestMessageSchema.parse({
2220
2244
  id: messageId,
@@ -2227,10 +2251,13 @@ async function sendDashCompRequest(client, options) {
2227
2251
  },
2228
2252
  payload: {
2229
2253
  prompt,
2254
+ userId,
2230
2255
  SA_RUNTIME: threadId || uiBlockId ? {
2231
2256
  threadId,
2232
2257
  uiBlockId
2233
- } : void 0
2258
+ } : void 0,
2259
+ existingComponents,
2260
+ req_type: reqType
2234
2261
  }
2235
2262
  });
2236
2263
  try {
@@ -2242,6 +2269,15 @@ async function sendDashCompRequest(client, options) {
2242
2269
  errors: payload.errors || ["Unknown error occurred"]
2243
2270
  };
2244
2271
  }
2272
+ if (reqType === "filter") {
2273
+ return {
2274
+ success: true,
2275
+ filterComponent: payload.data?.filterComponent,
2276
+ updatedComponents: payload.data?.updatedComponents,
2277
+ filterBindings: payload.data?.filterBindings,
2278
+ reasoning: payload.data?.reasoning
2279
+ };
2280
+ }
2245
2281
  return {
2246
2282
  success: true,
2247
2283
  component: payload.data?.component,
@@ -2541,20 +2577,22 @@ var SuperatomClient = class {
2541
2577
  /**
2542
2578
  * Send a user prompt request
2543
2579
  * Delegates to user prompt service
2580
+ * @param userId - User ID for the request
2544
2581
  * @param responseMode - 'component' for component response (default), 'text' for text streaming
2545
2582
  * @param onStream - Optional callback for streaming text chunks (only for text mode)
2546
2583
  */
2547
- async sendUserPromptRequest(prompt, threadId, uiBlockId, responseMode, onStream, timeout) {
2584
+ async sendUserPromptRequest(prompt, threadId, uiBlockId, userId, responseMode, onStream, timeout) {
2548
2585
  this.log("info", "Sending user prompt request with streaming support");
2549
- return sendUserPromptRequest(this, prompt, threadId, uiBlockId, responseMode, onStream, timeout);
2586
+ return sendUserPromptRequest(this, prompt, threadId, uiBlockId, userId, responseMode, onStream, timeout);
2550
2587
  }
2551
2588
  /**
2552
2589
  * Send a user prompt suggestions request
2553
2590
  * Delegates to user prompt service
2591
+ * @param userId - User ID for the request
2554
2592
  */
2555
- async sendUserPromptSuggestionsRequest(prompt, limit = 5, timeout) {
2593
+ async sendUserPromptSuggestionsRequest(prompt, userId, limit = 5, timeout) {
2556
2594
  this.log("info", "Sending user prompt suggestions request");
2557
- return sendUserPromptSuggestionsRequest(this, prompt, limit, timeout);
2595
+ return sendUserPromptSuggestionsRequest(this, prompt, userId, limit, timeout);
2558
2596
  }
2559
2597
  /**
2560
2598
  * Request bundle from server
@@ -2583,6 +2621,7 @@ var SuperatomClient = class {
2583
2621
  /**
2584
2622
  * Get AI-powered component suggestions based on a query
2585
2623
  * Delegates to component service
2624
+ * @param userId - User ID for the request
2586
2625
  */
2587
2626
  async getActions(options) {
2588
2627
  this.log("info", "Requesting actions");