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