@superatomai/sdk-node 0.0.25 → 0.0.26
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 +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +34 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -341,6 +341,7 @@ var UserSchema = z3.object({
|
|
|
341
341
|
password: z3.string().min(1, "Password is required"),
|
|
342
342
|
fullname: z3.string().optional(),
|
|
343
343
|
role: z3.string().optional(),
|
|
344
|
+
userInfo: z3.record(z3.unknown()).optional(),
|
|
344
345
|
wsIds: z3.array(z3.string()).optional()
|
|
345
346
|
// Only in memory, not persisted to file
|
|
346
347
|
});
|
|
@@ -470,6 +471,7 @@ var UsersRequestPayloadSchema = z3.object({
|
|
|
470
471
|
password: z3.string().optional(),
|
|
471
472
|
fullname: z3.string().optional(),
|
|
472
473
|
role: z3.string().optional(),
|
|
474
|
+
userInfo: z3.record(z3.unknown()).optional(),
|
|
473
475
|
// Query operation fields
|
|
474
476
|
filters: UserQueryFiltersSchema.optional(),
|
|
475
477
|
limit: z3.number().optional(),
|
|
@@ -515,7 +517,8 @@ var DashboardQueryFiltersSchema = z3.object({
|
|
|
515
517
|
projectId: z3.string().optional(),
|
|
516
518
|
createdBy: z3.number().optional(),
|
|
517
519
|
updatedBy: z3.number().optional(),
|
|
518
|
-
name: z3.string().optional()
|
|
520
|
+
name: z3.string().optional(),
|
|
521
|
+
published: z3.boolean().optional()
|
|
519
522
|
});
|
|
520
523
|
var DashboardsRequestPayloadSchema = z3.object({
|
|
521
524
|
operation: z3.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
|
|
@@ -525,6 +528,7 @@ var DashboardsRequestPayloadSchema = z3.object({
|
|
|
525
528
|
projectId: z3.string().optional(),
|
|
526
529
|
name: z3.string().optional(),
|
|
527
530
|
description: z3.string().optional(),
|
|
531
|
+
published: z3.boolean().optional(),
|
|
528
532
|
createdBy: z3.number().optional(),
|
|
529
533
|
updatedBy: z3.number().optional(),
|
|
530
534
|
dashboard: DSLRendererPropsSchema.optional(),
|
|
@@ -545,7 +549,8 @@ var ReportQueryFiltersSchema = z3.object({
|
|
|
545
549
|
projectId: z3.string().optional(),
|
|
546
550
|
createdBy: z3.number().optional(),
|
|
547
551
|
updatedBy: z3.number().optional(),
|
|
548
|
-
name: z3.string().optional()
|
|
552
|
+
name: z3.string().optional(),
|
|
553
|
+
published: z3.boolean().optional()
|
|
549
554
|
});
|
|
550
555
|
var ReportsRequestPayloadSchema = z3.object({
|
|
551
556
|
operation: z3.enum(["create", "update", "delete", "getAll", "getOne", "query"]),
|
|
@@ -555,6 +560,7 @@ var ReportsRequestPayloadSchema = z3.object({
|
|
|
555
560
|
projectId: z3.string().optional(),
|
|
556
561
|
name: z3.string().optional(),
|
|
557
562
|
description: z3.string().optional(),
|
|
563
|
+
published: z3.boolean().optional(),
|
|
558
564
|
createdBy: z3.number().optional(),
|
|
559
565
|
updatedBy: z3.number().optional(),
|
|
560
566
|
report: DSLRendererPropsSchema2.optional(),
|
|
@@ -4367,6 +4373,7 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
4367
4373
|
*/
|
|
4368
4374
|
async classifyQuestionCategory(userPrompt, apiKey, logCollector, conversationHistory, externalTools) {
|
|
4369
4375
|
try {
|
|
4376
|
+
const schemaDoc = schema.generateSchemaDocumentation();
|
|
4370
4377
|
const availableToolsDoc = externalTools && externalTools.length > 0 ? externalTools.map((tool) => {
|
|
4371
4378
|
const paramsStr = Object.entries(tool.params || {}).map(([key, type]) => `${key}: ${type}`).join(", ");
|
|
4372
4379
|
return `- **${tool.name}** (id: ${tool.id})
|
|
@@ -4376,7 +4383,8 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
4376
4383
|
const prompts = await promptLoader.loadPrompts("category-classification", {
|
|
4377
4384
|
USER_PROMPT: userPrompt,
|
|
4378
4385
|
CONVERSATION_HISTORY: conversationHistory || "No previous conversation",
|
|
4379
|
-
AVAILABLE_TOOLS: availableToolsDoc
|
|
4386
|
+
AVAILABLE_TOOLS: availableToolsDoc,
|
|
4387
|
+
SCHEMA_DOC: schemaDoc || "No database schema available"
|
|
4380
4388
|
});
|
|
4381
4389
|
const result = await LLM.stream(
|
|
4382
4390
|
{
|
|
@@ -6491,6 +6499,7 @@ async function handleUsersRequest(data, collections, sendMessage) {
|
|
|
6491
6499
|
const password = requestData?.password;
|
|
6492
6500
|
const fullname = requestData?.fullname;
|
|
6493
6501
|
const role = requestData?.role;
|
|
6502
|
+
const userInfo = requestData?.userInfo;
|
|
6494
6503
|
const filters = requestData?.filters;
|
|
6495
6504
|
const limit = requestData?.limit;
|
|
6496
6505
|
const sort = requestData?.sort;
|
|
@@ -6505,10 +6514,10 @@ async function handleUsersRequest(data, collections, sendMessage) {
|
|
|
6505
6514
|
const userManager = getUserManager();
|
|
6506
6515
|
switch (operation) {
|
|
6507
6516
|
case "create":
|
|
6508
|
-
await handleCreate(id, { username, email, password, fullname, role }, executeCollection, userManager, sendMessage, from.id);
|
|
6517
|
+
await handleCreate(id, { username, email, password, fullname, role, userInfo }, executeCollection, userManager, sendMessage, from.id);
|
|
6509
6518
|
break;
|
|
6510
6519
|
case "update":
|
|
6511
|
-
await handleUpdate(id, numericId, { username, email, password, fullname, role }, executeCollection, userManager, sendMessage, from.id);
|
|
6520
|
+
await handleUpdate(id, numericId, { username, email, password, fullname, role, userInfo }, executeCollection, userManager, sendMessage, from.id);
|
|
6512
6521
|
break;
|
|
6513
6522
|
case "delete":
|
|
6514
6523
|
await handleDelete(id, numericId, username, executeCollection, userManager, sendMessage, from.id);
|
|
@@ -6537,7 +6546,7 @@ async function handleUsersRequest(data, collections, sendMessage) {
|
|
|
6537
6546
|
}
|
|
6538
6547
|
}
|
|
6539
6548
|
async function handleCreate(id, userData, executeCollection, userManager, sendMessage, clientId) {
|
|
6540
|
-
const { username, email, password, fullname, role } = userData;
|
|
6549
|
+
const { username, email, password, fullname, role, userInfo } = userData;
|
|
6541
6550
|
if (!username || username.trim().length === 0) {
|
|
6542
6551
|
sendResponse3(id, {
|
|
6543
6552
|
success: false,
|
|
@@ -6568,7 +6577,8 @@ async function handleCreate(id, userData, executeCollection, userManager, sendMe
|
|
|
6568
6577
|
email: email || void 0,
|
|
6569
6578
|
password,
|
|
6570
6579
|
fullname: fullname || void 0,
|
|
6571
|
-
role: role || void 0
|
|
6580
|
+
role: role || void 0,
|
|
6581
|
+
userInfo: userInfo || void 0
|
|
6572
6582
|
});
|
|
6573
6583
|
if (result && result.success) {
|
|
6574
6584
|
logger.info(`[DB] User created successfully: ${username}`);
|
|
@@ -6636,7 +6646,7 @@ async function handleCreate(id, userData, executeCollection, userManager, sendMe
|
|
|
6636
6646
|
}
|
|
6637
6647
|
}
|
|
6638
6648
|
async function handleUpdate(id, numericId, userData, executeCollection, userManager, sendMessage, clientId) {
|
|
6639
|
-
const { username, email, password, fullname, role } = userData;
|
|
6649
|
+
const { username, email, password, fullname, role, userInfo } = userData;
|
|
6640
6650
|
if (!numericId && !username) {
|
|
6641
6651
|
sendResponse3(id, {
|
|
6642
6652
|
success: false,
|
|
@@ -6652,7 +6662,8 @@ async function handleUpdate(id, numericId, userData, executeCollection, userMana
|
|
|
6652
6662
|
email,
|
|
6653
6663
|
password,
|
|
6654
6664
|
fullname,
|
|
6655
|
-
role
|
|
6665
|
+
role,
|
|
6666
|
+
userInfo
|
|
6656
6667
|
});
|
|
6657
6668
|
if (result && result.success) {
|
|
6658
6669
|
logger.info(`[DB] User updated successfully, ID: ${numericId}`);
|
|
@@ -7012,6 +7023,7 @@ async function handleDashboardsRequest(data, collections, sendMessage) {
|
|
|
7012
7023
|
const projectId = requestData?.projectId;
|
|
7013
7024
|
const name = requestData?.name;
|
|
7014
7025
|
const description = requestData?.description;
|
|
7026
|
+
const published = requestData?.published;
|
|
7015
7027
|
const createdBy = requestData?.createdBy;
|
|
7016
7028
|
const updatedBy = requestData?.updatedBy;
|
|
7017
7029
|
const numericId = requestData?.id;
|
|
@@ -7029,10 +7041,10 @@ async function handleDashboardsRequest(data, collections, sendMessage) {
|
|
|
7029
7041
|
const dashboardManager2 = getDashboardManager();
|
|
7030
7042
|
switch (operation) {
|
|
7031
7043
|
case "create":
|
|
7032
|
-
await handleCreate2(id, dashboardId, dashboard, projectId, name, description, createdBy, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
7044
|
+
await handleCreate2(id, dashboardId, dashboard, projectId, name, description, published, createdBy, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
7033
7045
|
break;
|
|
7034
7046
|
case "update":
|
|
7035
|
-
await handleUpdate2(id, numericId, dashboardId, dashboard, name, description, updatedBy, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
7047
|
+
await handleUpdate2(id, numericId, dashboardId, dashboard, name, description, published, updatedBy, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
7036
7048
|
break;
|
|
7037
7049
|
case "delete":
|
|
7038
7050
|
await handleDelete2(id, numericId, dashboardId, executeCollection, dashboardManager2, sendMessage, from.id);
|
|
@@ -7060,7 +7072,7 @@ async function handleDashboardsRequest(data, collections, sendMessage) {
|
|
|
7060
7072
|
}, sendMessage);
|
|
7061
7073
|
}
|
|
7062
7074
|
}
|
|
7063
|
-
async function handleCreate2(id, dashboardId, dashboard, projectId, name, description, createdBy, executeCollection, dashboardManager2, sendMessage, clientId) {
|
|
7075
|
+
async function handleCreate2(id, dashboardId, dashboard, projectId, name, description, published, createdBy, executeCollection, dashboardManager2, sendMessage, clientId) {
|
|
7064
7076
|
if (!dashboardId || dashboardId.trim().length === 0) {
|
|
7065
7077
|
sendResponse4(id, {
|
|
7066
7078
|
success: false,
|
|
@@ -7082,6 +7094,7 @@ async function handleCreate2(id, dashboardId, dashboard, projectId, name, descri
|
|
|
7082
7094
|
name: name || "",
|
|
7083
7095
|
description,
|
|
7084
7096
|
dashboard,
|
|
7097
|
+
published,
|
|
7085
7098
|
createdBy
|
|
7086
7099
|
});
|
|
7087
7100
|
if (result && result.success) {
|
|
@@ -7121,7 +7134,7 @@ async function handleCreate2(id, dashboardId, dashboard, projectId, name, descri
|
|
|
7121
7134
|
}, sendMessage, clientId);
|
|
7122
7135
|
}
|
|
7123
7136
|
}
|
|
7124
|
-
async function handleUpdate2(id, numericId, dashboardId, dashboard, name, description, updatedBy, executeCollection, dashboardManager2, sendMessage, clientId) {
|
|
7137
|
+
async function handleUpdate2(id, numericId, dashboardId, dashboard, name, description, published, updatedBy, executeCollection, dashboardManager2, sendMessage, clientId) {
|
|
7125
7138
|
if (!numericId) {
|
|
7126
7139
|
sendResponse4(id, {
|
|
7127
7140
|
success: false,
|
|
@@ -7135,6 +7148,7 @@ async function handleUpdate2(id, numericId, dashboardId, dashboard, name, descri
|
|
|
7135
7148
|
name,
|
|
7136
7149
|
description,
|
|
7137
7150
|
dashboard,
|
|
7151
|
+
published,
|
|
7138
7152
|
updatedBy
|
|
7139
7153
|
});
|
|
7140
7154
|
if (result && result.success) {
|
|
@@ -7377,6 +7391,7 @@ async function handleReportsRequest(data, collections, sendMessage) {
|
|
|
7377
7391
|
const projectId = requestData?.projectId;
|
|
7378
7392
|
const name = requestData?.name;
|
|
7379
7393
|
const description = requestData?.description;
|
|
7394
|
+
const published = requestData?.published;
|
|
7380
7395
|
const createdBy = requestData?.createdBy;
|
|
7381
7396
|
const updatedBy = requestData?.updatedBy;
|
|
7382
7397
|
const numericId = requestData?.id;
|
|
@@ -7394,10 +7409,10 @@ async function handleReportsRequest(data, collections, sendMessage) {
|
|
|
7394
7409
|
const reportManager2 = getReportManager();
|
|
7395
7410
|
switch (operation) {
|
|
7396
7411
|
case "create":
|
|
7397
|
-
await handleCreate3(id, reportId, report, projectId, name, description, createdBy, executeCollection, reportManager2, sendMessage, from.id);
|
|
7412
|
+
await handleCreate3(id, reportId, report, projectId, name, description, published, createdBy, executeCollection, reportManager2, sendMessage, from.id);
|
|
7398
7413
|
break;
|
|
7399
7414
|
case "update":
|
|
7400
|
-
await handleUpdate3(id, numericId, reportId, report, name, description, updatedBy, executeCollection, reportManager2, sendMessage, from.id);
|
|
7415
|
+
await handleUpdate3(id, numericId, reportId, report, name, description, published, updatedBy, executeCollection, reportManager2, sendMessage, from.id);
|
|
7401
7416
|
break;
|
|
7402
7417
|
case "delete":
|
|
7403
7418
|
await handleDelete3(id, numericId, reportId, executeCollection, reportManager2, sendMessage, from.id);
|
|
@@ -7425,7 +7440,7 @@ async function handleReportsRequest(data, collections, sendMessage) {
|
|
|
7425
7440
|
}, sendMessage);
|
|
7426
7441
|
}
|
|
7427
7442
|
}
|
|
7428
|
-
async function handleCreate3(id, reportId, report, projectId, name, description, createdBy, executeCollection, reportManager2, sendMessage, clientId) {
|
|
7443
|
+
async function handleCreate3(id, reportId, report, projectId, name, description, published, createdBy, executeCollection, reportManager2, sendMessage, clientId) {
|
|
7429
7444
|
if (!reportId || reportId.trim().length === 0) {
|
|
7430
7445
|
sendResponse5(id, {
|
|
7431
7446
|
success: false,
|
|
@@ -7447,6 +7462,7 @@ async function handleCreate3(id, reportId, report, projectId, name, description,
|
|
|
7447
7462
|
name: name || "",
|
|
7448
7463
|
description,
|
|
7449
7464
|
report,
|
|
7465
|
+
published,
|
|
7450
7466
|
createdBy
|
|
7451
7467
|
});
|
|
7452
7468
|
if (result && result.success) {
|
|
@@ -7486,7 +7502,7 @@ async function handleCreate3(id, reportId, report, projectId, name, description,
|
|
|
7486
7502
|
}, sendMessage, clientId);
|
|
7487
7503
|
}
|
|
7488
7504
|
}
|
|
7489
|
-
async function handleUpdate3(id, numericId, reportId, report, name, description, updatedBy, executeCollection, reportManager2, sendMessage, clientId) {
|
|
7505
|
+
async function handleUpdate3(id, numericId, reportId, report, name, description, published, updatedBy, executeCollection, reportManager2, sendMessage, clientId) {
|
|
7490
7506
|
if (!numericId) {
|
|
7491
7507
|
sendResponse5(id, {
|
|
7492
7508
|
success: false,
|
|
@@ -7500,6 +7516,7 @@ async function handleUpdate3(id, numericId, reportId, report, name, description,
|
|
|
7500
7516
|
name,
|
|
7501
7517
|
description,
|
|
7502
7518
|
report,
|
|
7519
|
+
published,
|
|
7503
7520
|
updatedBy
|
|
7504
7521
|
});
|
|
7505
7522
|
if (result && result.success) {
|