@superatomai/sdk-node 0.0.25 → 0.0.27
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.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +83 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -395,6 +395,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
395
395
|
password: z.ZodString;
|
|
396
396
|
fullname: z.ZodOptional<z.ZodString>;
|
|
397
397
|
role: z.ZodOptional<z.ZodString>;
|
|
398
|
+
userInfo: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
398
399
|
wsIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
399
400
|
}, "strip", z.ZodTypeAny, {
|
|
400
401
|
username: string;
|
|
@@ -402,6 +403,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
402
403
|
email?: string | undefined;
|
|
403
404
|
fullname?: string | undefined;
|
|
404
405
|
role?: string | undefined;
|
|
406
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
405
407
|
wsIds?: string[] | undefined;
|
|
406
408
|
}, {
|
|
407
409
|
username: string;
|
|
@@ -409,6 +411,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
409
411
|
email?: string | undefined;
|
|
410
412
|
fullname?: string | undefined;
|
|
411
413
|
role?: string | undefined;
|
|
414
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
412
415
|
wsIds?: string[] | undefined;
|
|
413
416
|
}>;
|
|
414
417
|
type User = z.infer<typeof UserSchema>;
|
|
@@ -419,6 +422,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
419
422
|
password: z.ZodString;
|
|
420
423
|
fullname: z.ZodOptional<z.ZodString>;
|
|
421
424
|
role: z.ZodOptional<z.ZodString>;
|
|
425
|
+
userInfo: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
422
426
|
wsIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
423
427
|
}, "strip", z.ZodTypeAny, {
|
|
424
428
|
username: string;
|
|
@@ -426,6 +430,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
426
430
|
email?: string | undefined;
|
|
427
431
|
fullname?: string | undefined;
|
|
428
432
|
role?: string | undefined;
|
|
433
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
429
434
|
wsIds?: string[] | undefined;
|
|
430
435
|
}, {
|
|
431
436
|
username: string;
|
|
@@ -433,6 +438,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
433
438
|
email?: string | undefined;
|
|
434
439
|
fullname?: string | undefined;
|
|
435
440
|
role?: string | undefined;
|
|
441
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
436
442
|
wsIds?: string[] | undefined;
|
|
437
443
|
}>, "many">;
|
|
438
444
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -442,6 +448,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
442
448
|
email?: string | undefined;
|
|
443
449
|
fullname?: string | undefined;
|
|
444
450
|
role?: string | undefined;
|
|
451
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
445
452
|
wsIds?: string[] | undefined;
|
|
446
453
|
}[];
|
|
447
454
|
}, {
|
|
@@ -451,6 +458,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
451
458
|
email?: string | undefined;
|
|
452
459
|
fullname?: string | undefined;
|
|
453
460
|
role?: string | undefined;
|
|
461
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
454
462
|
wsIds?: string[] | undefined;
|
|
455
463
|
}[];
|
|
456
464
|
}>;
|
|
@@ -1458,15 +1466,17 @@ declare const STORAGE_CONFIG: {
|
|
|
1458
1466
|
*/
|
|
1459
1467
|
MAX_ROWS_PER_BLOCK: number;
|
|
1460
1468
|
/**
|
|
1461
|
-
* Maximum size in bytes per UIBlock (
|
|
1469
|
+
* Maximum size in bytes per UIBlock (500KB - reduced to save memory)
|
|
1462
1470
|
*/
|
|
1463
1471
|
MAX_SIZE_PER_BLOCK_BYTES: number;
|
|
1464
1472
|
/**
|
|
1465
1473
|
* Number of days to keep threads before cleanup
|
|
1474
|
+
* Note: This is for in-memory storage. Conversations are also persisted to database.
|
|
1466
1475
|
*/
|
|
1467
1476
|
THREAD_RETENTION_DAYS: number;
|
|
1468
1477
|
/**
|
|
1469
1478
|
* Number of days to keep UIBlocks before cleanup
|
|
1479
|
+
* Note: This is for in-memory storage. Data is also persisted to database.
|
|
1470
1480
|
*/
|
|
1471
1481
|
UIBLOCK_RETENTION_DAYS: number;
|
|
1472
1482
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -395,6 +395,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
395
395
|
password: z.ZodString;
|
|
396
396
|
fullname: z.ZodOptional<z.ZodString>;
|
|
397
397
|
role: z.ZodOptional<z.ZodString>;
|
|
398
|
+
userInfo: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
398
399
|
wsIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
399
400
|
}, "strip", z.ZodTypeAny, {
|
|
400
401
|
username: string;
|
|
@@ -402,6 +403,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
402
403
|
email?: string | undefined;
|
|
403
404
|
fullname?: string | undefined;
|
|
404
405
|
role?: string | undefined;
|
|
406
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
405
407
|
wsIds?: string[] | undefined;
|
|
406
408
|
}, {
|
|
407
409
|
username: string;
|
|
@@ -409,6 +411,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
409
411
|
email?: string | undefined;
|
|
410
412
|
fullname?: string | undefined;
|
|
411
413
|
role?: string | undefined;
|
|
414
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
412
415
|
wsIds?: string[] | undefined;
|
|
413
416
|
}>;
|
|
414
417
|
type User = z.infer<typeof UserSchema>;
|
|
@@ -419,6 +422,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
419
422
|
password: z.ZodString;
|
|
420
423
|
fullname: z.ZodOptional<z.ZodString>;
|
|
421
424
|
role: z.ZodOptional<z.ZodString>;
|
|
425
|
+
userInfo: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
422
426
|
wsIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
423
427
|
}, "strip", z.ZodTypeAny, {
|
|
424
428
|
username: string;
|
|
@@ -426,6 +430,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
426
430
|
email?: string | undefined;
|
|
427
431
|
fullname?: string | undefined;
|
|
428
432
|
role?: string | undefined;
|
|
433
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
429
434
|
wsIds?: string[] | undefined;
|
|
430
435
|
}, {
|
|
431
436
|
username: string;
|
|
@@ -433,6 +438,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
433
438
|
email?: string | undefined;
|
|
434
439
|
fullname?: string | undefined;
|
|
435
440
|
role?: string | undefined;
|
|
441
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
436
442
|
wsIds?: string[] | undefined;
|
|
437
443
|
}>, "many">;
|
|
438
444
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -442,6 +448,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
442
448
|
email?: string | undefined;
|
|
443
449
|
fullname?: string | undefined;
|
|
444
450
|
role?: string | undefined;
|
|
451
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
445
452
|
wsIds?: string[] | undefined;
|
|
446
453
|
}[];
|
|
447
454
|
}, {
|
|
@@ -451,6 +458,7 @@ declare const UsersDataSchema: z.ZodObject<{
|
|
|
451
458
|
email?: string | undefined;
|
|
452
459
|
fullname?: string | undefined;
|
|
453
460
|
role?: string | undefined;
|
|
461
|
+
userInfo?: Record<string, unknown> | undefined;
|
|
454
462
|
wsIds?: string[] | undefined;
|
|
455
463
|
}[];
|
|
456
464
|
}>;
|
|
@@ -1458,15 +1466,17 @@ declare const STORAGE_CONFIG: {
|
|
|
1458
1466
|
*/
|
|
1459
1467
|
MAX_ROWS_PER_BLOCK: number;
|
|
1460
1468
|
/**
|
|
1461
|
-
* Maximum size in bytes per UIBlock (
|
|
1469
|
+
* Maximum size in bytes per UIBlock (500KB - reduced to save memory)
|
|
1462
1470
|
*/
|
|
1463
1471
|
MAX_SIZE_PER_BLOCK_BYTES: number;
|
|
1464
1472
|
/**
|
|
1465
1473
|
* Number of days to keep threads before cleanup
|
|
1474
|
+
* Note: This is for in-memory storage. Conversations are also persisted to database.
|
|
1466
1475
|
*/
|
|
1467
1476
|
THREAD_RETENTION_DAYS: number;
|
|
1468
1477
|
/**
|
|
1469
1478
|
* Number of days to keep UIBlocks before cleanup
|
|
1479
|
+
* Note: This is for in-memory storage. Data is also persisted to database.
|
|
1470
1480
|
*/
|
|
1471
1481
|
UIBLOCK_RETENTION_DAYS: number;
|
|
1472
1482
|
};
|
package/dist/index.js
CHANGED
|
@@ -385,6 +385,7 @@ var UserSchema = import_zod3.z.object({
|
|
|
385
385
|
password: import_zod3.z.string().min(1, "Password is required"),
|
|
386
386
|
fullname: import_zod3.z.string().optional(),
|
|
387
387
|
role: import_zod3.z.string().optional(),
|
|
388
|
+
userInfo: import_zod3.z.record(import_zod3.z.unknown()).optional(),
|
|
388
389
|
wsIds: import_zod3.z.array(import_zod3.z.string()).optional()
|
|
389
390
|
// Only in memory, not persisted to file
|
|
390
391
|
});
|
|
@@ -514,6 +515,7 @@ var UsersRequestPayloadSchema = import_zod3.z.object({
|
|
|
514
515
|
password: import_zod3.z.string().optional(),
|
|
515
516
|
fullname: import_zod3.z.string().optional(),
|
|
516
517
|
role: import_zod3.z.string().optional(),
|
|
518
|
+
userInfo: import_zod3.z.record(import_zod3.z.unknown()).optional(),
|
|
517
519
|
// Query operation fields
|
|
518
520
|
filters: UserQueryFiltersSchema.optional(),
|
|
519
521
|
limit: import_zod3.z.number().optional(),
|
|
@@ -559,7 +561,8 @@ var DashboardQueryFiltersSchema = import_zod3.z.object({
|
|
|
559
561
|
projectId: import_zod3.z.string().optional(),
|
|
560
562
|
createdBy: import_zod3.z.number().optional(),
|
|
561
563
|
updatedBy: import_zod3.z.number().optional(),
|
|
562
|
-
name: import_zod3.z.string().optional()
|
|
564
|
+
name: import_zod3.z.string().optional(),
|
|
565
|
+
published: import_zod3.z.boolean().optional()
|
|
563
566
|
});
|
|
564
567
|
var DashboardsRequestPayloadSchema = import_zod3.z.object({
|
|
565
568
|
operation: import_zod3.z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
|
|
@@ -569,6 +572,7 @@ var DashboardsRequestPayloadSchema = import_zod3.z.object({
|
|
|
569
572
|
projectId: import_zod3.z.string().optional(),
|
|
570
573
|
name: import_zod3.z.string().optional(),
|
|
571
574
|
description: import_zod3.z.string().optional(),
|
|
575
|
+
published: import_zod3.z.boolean().optional(),
|
|
572
576
|
createdBy: import_zod3.z.number().optional(),
|
|
573
577
|
updatedBy: import_zod3.z.number().optional(),
|
|
574
578
|
dashboard: DSLRendererPropsSchema.optional(),
|
|
@@ -589,7 +593,8 @@ var ReportQueryFiltersSchema = import_zod3.z.object({
|
|
|
589
593
|
projectId: import_zod3.z.string().optional(),
|
|
590
594
|
createdBy: import_zod3.z.number().optional(),
|
|
591
595
|
updatedBy: import_zod3.z.number().optional(),
|
|
592
|
-
name: import_zod3.z.string().optional()
|
|
596
|
+
name: import_zod3.z.string().optional(),
|
|
597
|
+
published: import_zod3.z.boolean().optional()
|
|
593
598
|
});
|
|
594
599
|
var ReportsRequestPayloadSchema = import_zod3.z.object({
|
|
595
600
|
operation: import_zod3.z.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
|
|
@@ -599,6 +604,7 @@ var ReportsRequestPayloadSchema = import_zod3.z.object({
|
|
|
599
604
|
projectId: import_zod3.z.string().optional(),
|
|
600
605
|
name: import_zod3.z.string().optional(),
|
|
601
606
|
description: import_zod3.z.string().optional(),
|
|
607
|
+
published: import_zod3.z.boolean().optional(),
|
|
602
608
|
createdBy: import_zod3.z.number().optional(),
|
|
603
609
|
updatedBy: import_zod3.z.number().optional(),
|
|
604
610
|
report: DSLRendererPropsSchema2.optional(),
|
|
@@ -840,18 +846,22 @@ var STORAGE_CONFIG = {
|
|
|
840
846
|
*/
|
|
841
847
|
MAX_ROWS_PER_BLOCK: 10,
|
|
842
848
|
/**
|
|
843
|
-
* Maximum size in bytes per UIBlock (
|
|
849
|
+
* Maximum size in bytes per UIBlock (500KB - reduced to save memory)
|
|
844
850
|
*/
|
|
845
|
-
MAX_SIZE_PER_BLOCK_BYTES:
|
|
846
|
-
//
|
|
851
|
+
MAX_SIZE_PER_BLOCK_BYTES: 500 * 1024,
|
|
852
|
+
// 500KB
|
|
847
853
|
/**
|
|
848
854
|
* Number of days to keep threads before cleanup
|
|
855
|
+
* Note: This is for in-memory storage. Conversations are also persisted to database.
|
|
849
856
|
*/
|
|
850
|
-
THREAD_RETENTION_DAYS:
|
|
857
|
+
THREAD_RETENTION_DAYS: 2,
|
|
858
|
+
// Reduced from 7 to 1 day for memory efficiency
|
|
851
859
|
/**
|
|
852
860
|
* Number of days to keep UIBlocks before cleanup
|
|
861
|
+
* Note: This is for in-memory storage. Data is also persisted to database.
|
|
853
862
|
*/
|
|
854
|
-
UIBLOCK_RETENTION_DAYS:
|
|
863
|
+
UIBLOCK_RETENTION_DAYS: 2
|
|
864
|
+
// Reduced from 7 to 1 day for memory efficiency
|
|
855
865
|
};
|
|
856
866
|
|
|
857
867
|
// src/threads/uiblock.ts
|
|
@@ -1371,8 +1381,15 @@ async function handleDataRequest(data, collections, sendMessage) {
|
|
|
1371
1381
|
}
|
|
1372
1382
|
}
|
|
1373
1383
|
if (uiBlock) {
|
|
1374
|
-
|
|
1375
|
-
|
|
1384
|
+
const dataSummary = {
|
|
1385
|
+
_dataReceived: true,
|
|
1386
|
+
_timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1387
|
+
_collection: collection,
|
|
1388
|
+
_operation: op,
|
|
1389
|
+
_recordCount: Array.isArray(result) ? result.length : result?.data?.length || result?.contacts?.length || result?.salesorders?.length || "unknown"
|
|
1390
|
+
};
|
|
1391
|
+
uiBlock.setComponentData(dataSummary);
|
|
1392
|
+
logger.info(`Updated UIBlock ${uiBlockId} with data summary from ${collection}.${op} (full data not stored to save memory)`);
|
|
1376
1393
|
} else {
|
|
1377
1394
|
logger.warn(`UIBlock ${uiBlockId} not found in threads`);
|
|
1378
1395
|
}
|
|
@@ -3379,10 +3396,15 @@ var LLM = class {
|
|
|
3379
3396
|
for (const toolUse of toolUses) {
|
|
3380
3397
|
try {
|
|
3381
3398
|
const result = await toolHandler(toolUse.name, toolUse.input);
|
|
3399
|
+
let resultContent = typeof result === "string" ? result : JSON.stringify(result);
|
|
3400
|
+
const MAX_RESULT_LENGTH = 5e4;
|
|
3401
|
+
if (resultContent.length > MAX_RESULT_LENGTH) {
|
|
3402
|
+
resultContent = resultContent.substring(0, MAX_RESULT_LENGTH) + "\n\n... [Result truncated - showing first 50000 characters of " + resultContent.length + " total]";
|
|
3403
|
+
}
|
|
3382
3404
|
toolResults.content.push({
|
|
3383
3405
|
type: "tool_result",
|
|
3384
3406
|
tool_use_id: toolUse.id,
|
|
3385
|
-
content:
|
|
3407
|
+
content: resultContent
|
|
3386
3408
|
});
|
|
3387
3409
|
} catch (error) {
|
|
3388
3410
|
toolResults.content.push({
|
|
@@ -3561,9 +3583,14 @@ var LLM = class {
|
|
|
3561
3583
|
for (const fc of functionCalls) {
|
|
3562
3584
|
try {
|
|
3563
3585
|
const result2 = await toolHandler(fc.name, fc.args);
|
|
3586
|
+
let resultContent = typeof result2 === "string" ? result2 : JSON.stringify(result2);
|
|
3587
|
+
const MAX_RESULT_LENGTH = 5e4;
|
|
3588
|
+
if (resultContent.length > MAX_RESULT_LENGTH) {
|
|
3589
|
+
resultContent = resultContent.substring(0, MAX_RESULT_LENGTH) + "\n\n... [Result truncated - showing first 50000 characters of " + resultContent.length + " total]";
|
|
3590
|
+
}
|
|
3564
3591
|
functionResponses.push({
|
|
3565
3592
|
name: fc.name,
|
|
3566
|
-
response: { result:
|
|
3593
|
+
response: { result: resultContent }
|
|
3567
3594
|
});
|
|
3568
3595
|
} catch (error) {
|
|
3569
3596
|
functionResponses.push({
|
|
@@ -3729,6 +3756,10 @@ var LLM = class {
|
|
|
3729
3756
|
const args = JSON.parse(tc.arguments);
|
|
3730
3757
|
const toolResult = await toolHandler(tc.name, args);
|
|
3731
3758
|
result = typeof toolResult === "string" ? toolResult : JSON.stringify(toolResult);
|
|
3759
|
+
const MAX_RESULT_LENGTH = 5e4;
|
|
3760
|
+
if (result.length > MAX_RESULT_LENGTH) {
|
|
3761
|
+
result = result.substring(0, MAX_RESULT_LENGTH) + "\n\n... [Result truncated - showing first 50000 characters of " + result.length + " total]";
|
|
3762
|
+
}
|
|
3732
3763
|
} catch (error) {
|
|
3733
3764
|
result = JSON.stringify({ error: error instanceof Error ? error.message : String(error) });
|
|
3734
3765
|
}
|
|
@@ -4411,6 +4442,7 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
4411
4442
|
*/
|
|
4412
4443
|
async classifyQuestionCategory(userPrompt, apiKey, logCollector, conversationHistory, externalTools) {
|
|
4413
4444
|
try {
|
|
4445
|
+
const schemaDoc = schema.generateSchemaDocumentation();
|
|
4414
4446
|
const availableToolsDoc = externalTools && externalTools.length > 0 ? externalTools.map((tool) => {
|
|
4415
4447
|
const paramsStr = Object.entries(tool.params || {}).map(([key, type]) => `${key}: ${type}`).join(", ");
|
|
4416
4448
|
return `- **${tool.name}** (id: ${tool.id})
|
|
@@ -4420,7 +4452,8 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
4420
4452
|
const prompts = await promptLoader.loadPrompts("category-classification", {
|
|
4421
4453
|
USER_PROMPT: userPrompt,
|
|
4422
4454
|
CONVERSATION_HISTORY: conversationHistory || "No previous conversation",
|
|
4423
|
-
AVAILABLE_TOOLS: availableToolsDoc
|
|
4455
|
+
AVAILABLE_TOOLS: availableToolsDoc,
|
|
4456
|
+
SCHEMA_DOC: schemaDoc || "No database schema available"
|
|
4424
4457
|
});
|
|
4425
4458
|
const result = await LLM.stream(
|
|
4426
4459
|
{
|
|
@@ -4901,13 +4934,26 @@ Please try rephrasing your request or contact support.
|
|
|
4901
4934
|
logger.info(`[${this.getProviderName()}] External tool ${externalTool.name} executed successfully`);
|
|
4902
4935
|
logCollector?.info(`\u2713 ${externalTool.name} executed successfully`);
|
|
4903
4936
|
if (!executedToolsList.find((t) => t.id === externalTool.id)) {
|
|
4937
|
+
let resultSummary = null;
|
|
4938
|
+
if (result2) {
|
|
4939
|
+
const resultStr = typeof result2 === "string" ? result2 : JSON.stringify(result2);
|
|
4940
|
+
if (resultStr.length > 1e3) {
|
|
4941
|
+
resultSummary = {
|
|
4942
|
+
_preview: resultStr.substring(0, 1e3) + "... (truncated)",
|
|
4943
|
+
_totalLength: resultStr.length,
|
|
4944
|
+
_recordCount: Array.isArray(result2) ? result2.length : result2?.data?.length || result2?.contacts?.length || result2?.salesorders?.length || "unknown"
|
|
4945
|
+
};
|
|
4946
|
+
} else {
|
|
4947
|
+
resultSummary = result2;
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4904
4950
|
executedToolsList.push({
|
|
4905
4951
|
id: externalTool.id,
|
|
4906
4952
|
name: externalTool.name,
|
|
4907
4953
|
params: toolInput,
|
|
4908
4954
|
// The actual parameters used in this execution
|
|
4909
|
-
result:
|
|
4910
|
-
// Store
|
|
4955
|
+
result: resultSummary
|
|
4956
|
+
// Store summary instead of full result to save memory
|
|
4911
4957
|
});
|
|
4912
4958
|
logger.info(`[${this.getProviderName()}] Tracked executed tool: ${externalTool.name} with params: ${JSON.stringify(toolInput)}`);
|
|
4913
4959
|
}
|
|
@@ -5015,8 +5061,6 @@ ${errorMsg}
|
|
|
5015
5061
|
if (deferredTools.length > 0) {
|
|
5016
5062
|
logger.info(`[${this.getProviderName()}] Passing ${deferredTools.length} deferred tools for Form generation`);
|
|
5017
5063
|
}
|
|
5018
|
-
logger.info(`[${this.getProviderName()}] passing deferred tools to the matching function: ${JSON.stringify(deferredTools, null, 2)}`);
|
|
5019
|
-
logger.info(`[${this.getProviderName()}] passing executed tools to the matching function: ${JSON.stringify(executedToolsList, null, 2)}`);
|
|
5020
5064
|
const matchResult = await this.matchComponentsFromAnalysis(
|
|
5021
5065
|
textResponse,
|
|
5022
5066
|
components,
|
|
@@ -6535,6 +6579,7 @@ async function handleUsersRequest(data, collections, sendMessage) {
|
|
|
6535
6579
|
const password = requestData?.password;
|
|
6536
6580
|
const fullname = requestData?.fullname;
|
|
6537
6581
|
const role = requestData?.role;
|
|
6582
|
+
const userInfo = requestData?.userInfo;
|
|
6538
6583
|
const filters = requestData?.filters;
|
|
6539
6584
|
const limit = requestData?.limit;
|
|
6540
6585
|
const sort = requestData?.sort;
|
|
@@ -6549,10 +6594,10 @@ async function handleUsersRequest(data, collections, sendMessage) {
|
|
|
6549
6594
|
const userManager = getUserManager();
|
|
6550
6595
|
switch (operation) {
|
|
6551
6596
|
case "create":
|
|
6552
|
-
await handleCreate(id, { username, email, password, fullname, role }, executeCollection, userManager, sendMessage, from.id);
|
|
6597
|
+
await handleCreate(id, { username, email, password, fullname, role, userInfo }, executeCollection, userManager, sendMessage, from.id);
|
|
6553
6598
|
break;
|
|
6554
6599
|
case "update":
|
|
6555
|
-
await handleUpdate(id, numericId, { username, email, password, fullname, role }, executeCollection, userManager, sendMessage, from.id);
|
|
6600
|
+
await handleUpdate(id, numericId, { username, email, password, fullname, role, userInfo }, executeCollection, userManager, sendMessage, from.id);
|
|
6556
6601
|
break;
|
|
6557
6602
|
case "delete":
|
|
6558
6603
|
await handleDelete(id, numericId, username, executeCollection, userManager, sendMessage, from.id);
|
|
@@ -6581,7 +6626,7 @@ async function handleUsersRequest(data, collections, sendMessage) {
|
|
|
6581
6626
|
}
|
|
6582
6627
|
}
|
|
6583
6628
|
async function handleCreate(id, userData, executeCollection, userManager, sendMessage, clientId) {
|
|
6584
|
-
const { username, email, password, fullname, role } = userData;
|
|
6629
|
+
const { username, email, password, fullname, role, userInfo } = userData;
|
|
6585
6630
|
if (!username || username.trim().length === 0) {
|
|
6586
6631
|
sendResponse3(id, {
|
|
6587
6632
|
success: false,
|
|
@@ -6612,7 +6657,8 @@ async function handleCreate(id, userData, executeCollection, userManager, sendMe
|
|
|
6612
6657
|
email: email || void 0,
|
|
6613
6658
|
password,
|
|
6614
6659
|
fullname: fullname || void 0,
|
|
6615
|
-
role: role || void 0
|
|
6660
|
+
role: role || void 0,
|
|
6661
|
+
userInfo: userInfo || void 0
|
|
6616
6662
|
});
|
|
6617
6663
|
if (result && result.success) {
|
|
6618
6664
|
logger.info(`[DB] User created successfully: ${username}`);
|
|
@@ -6680,7 +6726,7 @@ async function handleCreate(id, userData, executeCollection, userManager, sendMe
|
|
|
6680
6726
|
}
|
|
6681
6727
|
}
|
|
6682
6728
|
async function handleUpdate(id, numericId, userData, executeCollection, userManager, sendMessage, clientId) {
|
|
6683
|
-
const { username, email, password, fullname, role } = userData;
|
|
6729
|
+
const { username, email, password, fullname, role, userInfo } = userData;
|
|
6684
6730
|
if (!numericId && !username) {
|
|
6685
6731
|
sendResponse3(id, {
|
|
6686
6732
|
success: false,
|
|
@@ -6696,7 +6742,8 @@ async function handleUpdate(id, numericId, userData, executeCollection, userMana
|
|
|
6696
6742
|
email,
|
|
6697
6743
|
password,
|
|
6698
6744
|
fullname,
|
|
6699
|
-
role
|
|
6745
|
+
role,
|
|
6746
|
+
userInfo
|
|
6700
6747
|
});
|
|
6701
6748
|
if (result && result.success) {
|
|
6702
6749
|
logger.info(`[DB] User updated successfully, ID: ${numericId}`);
|
|
@@ -7056,6 +7103,7 @@ async function handleDashboardsRequest(data, collections, sendMessage) {
|
|
|
7056
7103
|
const projectId = requestData?.projectId;
|
|
7057
7104
|
const name = requestData?.name;
|
|
7058
7105
|
const description = requestData?.description;
|
|
7106
|
+
const published = requestData?.published;
|
|
7059
7107
|
const createdBy = requestData?.createdBy;
|
|
7060
7108
|
const updatedBy = requestData?.updatedBy;
|
|
7061
7109
|
const numericId = requestData?.id;
|
|
@@ -7073,10 +7121,10 @@ async function handleDashboardsRequest(data, collections, sendMessage) {
|
|
|
7073
7121
|
const dashboardManager2 = getDashboardManager();
|
|
7074
7122
|
switch (operation) {
|
|
7075
7123
|
case "create":
|
|
7076
|
-
await handleCreate2(id, dashboardId, dashboard, projectId, name, description, createdBy, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
7124
|
+
await handleCreate2(id, dashboardId, dashboard, projectId, name, description, published, createdBy, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
7077
7125
|
break;
|
|
7078
7126
|
case "update":
|
|
7079
|
-
await handleUpdate2(id, numericId, dashboardId, dashboard, name, description, updatedBy, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
7127
|
+
await handleUpdate2(id, numericId, dashboardId, dashboard, name, description, published, updatedBy, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
7080
7128
|
break;
|
|
7081
7129
|
case "delete":
|
|
7082
7130
|
await handleDelete2(id, numericId, dashboardId, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
@@ -7104,7 +7152,7 @@ async function handleDashboardsRequest(data, collections, sendMessage) {
|
|
|
7104
7152
|
}, sendMessage);
|
|
7105
7153
|
}
|
|
7106
7154
|
}
|
|
7107
|
-
async function handleCreate2(id, dashboardId, dashboard, projectId, name, description, createdBy, executeCollection, dashboardManager2, sendMessage, clientId) {
|
|
7155
|
+
async function handleCreate2(id, dashboardId, dashboard, projectId, name, description, published, createdBy, executeCollection, dashboardManager2, sendMessage, clientId) {
|
|
7108
7156
|
if (!dashboardId || dashboardId.trim().length === 0) {
|
|
7109
7157
|
sendResponse4(id, {
|
|
7110
7158
|
success: false,
|
|
@@ -7126,6 +7174,7 @@ async function handleCreate2(id, dashboardId, dashboard, projectId, name, descri
|
|
|
7126
7174
|
name: name || "",
|
|
7127
7175
|
description,
|
|
7128
7176
|
dashboard,
|
|
7177
|
+
published,
|
|
7129
7178
|
createdBy
|
|
7130
7179
|
});
|
|
7131
7180
|
if (result && result.success) {
|
|
@@ -7165,7 +7214,7 @@ async function handleCreate2(id, dashboardId, dashboard, projectId, name, descri
|
|
|
7165
7214
|
}, sendMessage, clientId);
|
|
7166
7215
|
}
|
|
7167
7216
|
}
|
|
7168
|
-
async function handleUpdate2(id, numericId, dashboardId, dashboard, name, description, updatedBy, executeCollection, dashboardManager2, sendMessage, clientId) {
|
|
7217
|
+
async function handleUpdate2(id, numericId, dashboardId, dashboard, name, description, published, updatedBy, executeCollection, dashboardManager2, sendMessage, clientId) {
|
|
7169
7218
|
if (!numericId) {
|
|
7170
7219
|
sendResponse4(id, {
|
|
7171
7220
|
success: false,
|
|
@@ -7179,6 +7228,7 @@ async function handleUpdate2(id, numericId, dashboardId, dashboard, name, descri
|
|
|
7179
7228
|
name,
|
|
7180
7229
|
description,
|
|
7181
7230
|
dashboard,
|
|
7231
|
+
published,
|
|
7182
7232
|
updatedBy
|
|
7183
7233
|
});
|
|
7184
7234
|
if (result && result.success) {
|
|
@@ -7421,6 +7471,7 @@ async function handleReportsRequest(data, collections, sendMessage) {
|
|
|
7421
7471
|
const projectId = requestData?.projectId;
|
|
7422
7472
|
const name = requestData?.name;
|
|
7423
7473
|
const description = requestData?.description;
|
|
7474
|
+
const published = requestData?.published;
|
|
7424
7475
|
const createdBy = requestData?.createdBy;
|
|
7425
7476
|
const updatedBy = requestData?.updatedBy;
|
|
7426
7477
|
const numericId = requestData?.id;
|
|
@@ -7438,10 +7489,10 @@ async function handleReportsRequest(data, collections, sendMessage) {
|
|
|
7438
7489
|
const reportManager2 = getReportManager();
|
|
7439
7490
|
switch (operation) {
|
|
7440
7491
|
case "create":
|
|
7441
|
-
await handleCreate3(id, reportId, report, projectId, name, description, createdBy, executeCollection, reportManager2, sendMessage, from.id);
|
|
7492
|
+
await handleCreate3(id, reportId, report, projectId, name, description, published, createdBy, executeCollection, reportManager2, sendMessage, from.id);
|
|
7442
7493
|
break;
|
|
7443
7494
|
case "update":
|
|
7444
|
-
await handleUpdate3(id, numericId, reportId, report, name, description, updatedBy, executeCollection, reportManager2, sendMessage, from.id);
|
|
7495
|
+
await handleUpdate3(id, numericId, reportId, report, name, description, published, updatedBy, executeCollection, reportManager2, sendMessage, from.id);
|
|
7445
7496
|
break;
|
|
7446
7497
|
case "delete":
|
|
7447
7498
|
await handleDelete3(id, numericId, reportId, executeCollection, reportManager2, sendMessage, from.id);
|
|
@@ -7469,7 +7520,7 @@ async function handleReportsRequest(data, collections, sendMessage) {
|
|
|
7469
7520
|
}, sendMessage);
|
|
7470
7521
|
}
|
|
7471
7522
|
}
|
|
7472
|
-
async function handleCreate3(id, reportId, report, projectId, name, description, createdBy, executeCollection, reportManager2, sendMessage, clientId) {
|
|
7523
|
+
async function handleCreate3(id, reportId, report, projectId, name, description, published, createdBy, executeCollection, reportManager2, sendMessage, clientId) {
|
|
7473
7524
|
if (!reportId || reportId.trim().length === 0) {
|
|
7474
7525
|
sendResponse5(id, {
|
|
7475
7526
|
success: false,
|
|
@@ -7491,6 +7542,7 @@ async function handleCreate3(id, reportId, report, projectId, name, description,
|
|
|
7491
7542
|
name: name || "",
|
|
7492
7543
|
description,
|
|
7493
7544
|
report,
|
|
7545
|
+
published,
|
|
7494
7546
|
createdBy
|
|
7495
7547
|
});
|
|
7496
7548
|
if (result && result.success) {
|
|
@@ -7530,7 +7582,7 @@ async function handleCreate3(id, reportId, report, projectId, name, description,
|
|
|
7530
7582
|
}, sendMessage, clientId);
|
|
7531
7583
|
}
|
|
7532
7584
|
}
|
|
7533
|
-
async function handleUpdate3(id, numericId, reportId, report, name, description, updatedBy, executeCollection, reportManager2, sendMessage, clientId) {
|
|
7585
|
+
async function handleUpdate3(id, numericId, reportId, report, name, description, published, updatedBy, executeCollection, reportManager2, sendMessage, clientId) {
|
|
7534
7586
|
if (!numericId) {
|
|
7535
7587
|
sendResponse5(id, {
|
|
7536
7588
|
success: false,
|
|
@@ -7544,6 +7596,7 @@ async function handleUpdate3(id, numericId, reportId, report, name, description,
|
|
|
7544
7596
|
name,
|
|
7545
7597
|
description,
|
|
7546
7598
|
report,
|
|
7599
|
+
published,
|
|
7547
7600
|
updatedBy
|
|
7548
7601
|
});
|
|
7549
7602
|
if (result && result.success) {
|