@superatomai/sdk-web 0.0.6 → 0.0.8
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/README.md +111 -7
- package/dist/index.cjs +67 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -5
- package/dist/index.d.ts +43 -5
- package/dist/index.js +67 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -961,6 +961,9 @@ declare function sendComponents(client: SuperatomClient, components: any[]): Pro
|
|
|
961
961
|
*/
|
|
962
962
|
interface User {
|
|
963
963
|
username: string;
|
|
964
|
+
email?: string;
|
|
965
|
+
fullname?: string;
|
|
966
|
+
role?: string;
|
|
964
967
|
wsIds: string[];
|
|
965
968
|
}
|
|
966
969
|
/**
|
|
@@ -968,28 +971,42 @@ interface User {
|
|
|
968
971
|
* @param client - SuperatomClient instance
|
|
969
972
|
* @param username - Username for the new user
|
|
970
973
|
* @param password - Password for the new user
|
|
974
|
+
* @param email - Email for the new user (optional)
|
|
975
|
+
* @param fullname - Full name for the new user (optional)
|
|
976
|
+
* @param role - Role for the new user (optional)
|
|
971
977
|
* @param timeout - Request timeout in milliseconds
|
|
972
978
|
* @returns Server response with success status
|
|
973
979
|
*/
|
|
974
|
-
declare function createUser(client: SuperatomClient, username: string, password: string, timeout?: number): Promise<{
|
|
980
|
+
declare function createUser(client: SuperatomClient, username: string, password: string, email?: string, fullname?: string, role?: string, timeout?: number): Promise<{
|
|
975
981
|
success: boolean;
|
|
976
982
|
error?: string;
|
|
977
983
|
message?: string;
|
|
978
984
|
username?: string;
|
|
985
|
+
email?: string;
|
|
986
|
+
fullname?: string;
|
|
987
|
+
role?: string;
|
|
979
988
|
}>;
|
|
980
989
|
/**
|
|
981
990
|
* Update an existing user
|
|
982
991
|
* @param client - SuperatomClient instance
|
|
983
992
|
* @param username - Username to update
|
|
984
|
-
* @param
|
|
993
|
+
* @param updates - Object containing fields to update (password, email, fullname, role)
|
|
985
994
|
* @param timeout - Request timeout in milliseconds
|
|
986
995
|
* @returns Server response with success status
|
|
987
996
|
*/
|
|
988
|
-
declare function updateUser(client: SuperatomClient, username: string,
|
|
997
|
+
declare function updateUser(client: SuperatomClient, username: string, updates: {
|
|
998
|
+
password?: string;
|
|
999
|
+
email?: string;
|
|
1000
|
+
fullname?: string;
|
|
1001
|
+
role?: string;
|
|
1002
|
+
}, timeout?: number): Promise<{
|
|
989
1003
|
success: boolean;
|
|
990
1004
|
error?: string;
|
|
991
1005
|
message?: string;
|
|
992
1006
|
username?: string;
|
|
1007
|
+
email?: string;
|
|
1008
|
+
fullname?: string;
|
|
1009
|
+
role?: string;
|
|
993
1010
|
}>;
|
|
994
1011
|
/**
|
|
995
1012
|
* Delete a user
|
|
@@ -1003,6 +1020,9 @@ declare function deleteUser(client: SuperatomClient, username: string, timeout?:
|
|
|
1003
1020
|
error?: string;
|
|
1004
1021
|
message?: string;
|
|
1005
1022
|
username?: string;
|
|
1023
|
+
email?: string;
|
|
1024
|
+
fullname?: string;
|
|
1025
|
+
role?: string;
|
|
1006
1026
|
}>;
|
|
1007
1027
|
/**
|
|
1008
1028
|
* Get all users
|
|
@@ -1355,6 +1375,10 @@ declare class SuperatomClient {
|
|
|
1355
1375
|
* Get current reconnection attempts
|
|
1356
1376
|
*/
|
|
1357
1377
|
getReconnectAttempts(): number;
|
|
1378
|
+
/**
|
|
1379
|
+
* Get client type
|
|
1380
|
+
*/
|
|
1381
|
+
get type(): string;
|
|
1358
1382
|
/**
|
|
1359
1383
|
* Send a message and wait for response with timeout (alias for sendWithResponse)
|
|
1360
1384
|
*/
|
|
@@ -1438,21 +1462,32 @@ declare class SuperatomClient {
|
|
|
1438
1462
|
* Create a new user
|
|
1439
1463
|
* Delegates to users service
|
|
1440
1464
|
*/
|
|
1441
|
-
createUser(username: string, password: string, timeout?: number): Promise<{
|
|
1465
|
+
createUser(username: string, password: string, email?: string, fullname?: string, role?: string, timeout?: number): Promise<{
|
|
1442
1466
|
success: boolean;
|
|
1443
1467
|
error?: string;
|
|
1444
1468
|
message?: string;
|
|
1445
1469
|
username?: string;
|
|
1470
|
+
email?: string;
|
|
1471
|
+
fullname?: string;
|
|
1472
|
+
role?: string;
|
|
1446
1473
|
}>;
|
|
1447
1474
|
/**
|
|
1448
1475
|
* Update an existing user
|
|
1449
1476
|
* Delegates to users service
|
|
1450
1477
|
*/
|
|
1451
|
-
updateUser(username: string,
|
|
1478
|
+
updateUser(username: string, updates: {
|
|
1479
|
+
password?: string;
|
|
1480
|
+
email?: string;
|
|
1481
|
+
fullname?: string;
|
|
1482
|
+
role?: string;
|
|
1483
|
+
}, timeout?: number): Promise<{
|
|
1452
1484
|
success: boolean;
|
|
1453
1485
|
error?: string;
|
|
1454
1486
|
message?: string;
|
|
1455
1487
|
username?: string;
|
|
1488
|
+
email?: string;
|
|
1489
|
+
fullname?: string;
|
|
1490
|
+
role?: string;
|
|
1456
1491
|
}>;
|
|
1457
1492
|
/**
|
|
1458
1493
|
* Delete a user
|
|
@@ -1463,6 +1498,9 @@ declare class SuperatomClient {
|
|
|
1463
1498
|
error?: string;
|
|
1464
1499
|
message?: string;
|
|
1465
1500
|
username?: string;
|
|
1501
|
+
email?: string;
|
|
1502
|
+
fullname?: string;
|
|
1503
|
+
role?: string;
|
|
1466
1504
|
}>;
|
|
1467
1505
|
/**
|
|
1468
1506
|
* Get all users
|
package/dist/index.d.ts
CHANGED
|
@@ -961,6 +961,9 @@ declare function sendComponents(client: SuperatomClient, components: any[]): Pro
|
|
|
961
961
|
*/
|
|
962
962
|
interface User {
|
|
963
963
|
username: string;
|
|
964
|
+
email?: string;
|
|
965
|
+
fullname?: string;
|
|
966
|
+
role?: string;
|
|
964
967
|
wsIds: string[];
|
|
965
968
|
}
|
|
966
969
|
/**
|
|
@@ -968,28 +971,42 @@ interface User {
|
|
|
968
971
|
* @param client - SuperatomClient instance
|
|
969
972
|
* @param username - Username for the new user
|
|
970
973
|
* @param password - Password for the new user
|
|
974
|
+
* @param email - Email for the new user (optional)
|
|
975
|
+
* @param fullname - Full name for the new user (optional)
|
|
976
|
+
* @param role - Role for the new user (optional)
|
|
971
977
|
* @param timeout - Request timeout in milliseconds
|
|
972
978
|
* @returns Server response with success status
|
|
973
979
|
*/
|
|
974
|
-
declare function createUser(client: SuperatomClient, username: string, password: string, timeout?: number): Promise<{
|
|
980
|
+
declare function createUser(client: SuperatomClient, username: string, password: string, email?: string, fullname?: string, role?: string, timeout?: number): Promise<{
|
|
975
981
|
success: boolean;
|
|
976
982
|
error?: string;
|
|
977
983
|
message?: string;
|
|
978
984
|
username?: string;
|
|
985
|
+
email?: string;
|
|
986
|
+
fullname?: string;
|
|
987
|
+
role?: string;
|
|
979
988
|
}>;
|
|
980
989
|
/**
|
|
981
990
|
* Update an existing user
|
|
982
991
|
* @param client - SuperatomClient instance
|
|
983
992
|
* @param username - Username to update
|
|
984
|
-
* @param
|
|
993
|
+
* @param updates - Object containing fields to update (password, email, fullname, role)
|
|
985
994
|
* @param timeout - Request timeout in milliseconds
|
|
986
995
|
* @returns Server response with success status
|
|
987
996
|
*/
|
|
988
|
-
declare function updateUser(client: SuperatomClient, username: string,
|
|
997
|
+
declare function updateUser(client: SuperatomClient, username: string, updates: {
|
|
998
|
+
password?: string;
|
|
999
|
+
email?: string;
|
|
1000
|
+
fullname?: string;
|
|
1001
|
+
role?: string;
|
|
1002
|
+
}, timeout?: number): Promise<{
|
|
989
1003
|
success: boolean;
|
|
990
1004
|
error?: string;
|
|
991
1005
|
message?: string;
|
|
992
1006
|
username?: string;
|
|
1007
|
+
email?: string;
|
|
1008
|
+
fullname?: string;
|
|
1009
|
+
role?: string;
|
|
993
1010
|
}>;
|
|
994
1011
|
/**
|
|
995
1012
|
* Delete a user
|
|
@@ -1003,6 +1020,9 @@ declare function deleteUser(client: SuperatomClient, username: string, timeout?:
|
|
|
1003
1020
|
error?: string;
|
|
1004
1021
|
message?: string;
|
|
1005
1022
|
username?: string;
|
|
1023
|
+
email?: string;
|
|
1024
|
+
fullname?: string;
|
|
1025
|
+
role?: string;
|
|
1006
1026
|
}>;
|
|
1007
1027
|
/**
|
|
1008
1028
|
* Get all users
|
|
@@ -1355,6 +1375,10 @@ declare class SuperatomClient {
|
|
|
1355
1375
|
* Get current reconnection attempts
|
|
1356
1376
|
*/
|
|
1357
1377
|
getReconnectAttempts(): number;
|
|
1378
|
+
/**
|
|
1379
|
+
* Get client type
|
|
1380
|
+
*/
|
|
1381
|
+
get type(): string;
|
|
1358
1382
|
/**
|
|
1359
1383
|
* Send a message and wait for response with timeout (alias for sendWithResponse)
|
|
1360
1384
|
*/
|
|
@@ -1438,21 +1462,32 @@ declare class SuperatomClient {
|
|
|
1438
1462
|
* Create a new user
|
|
1439
1463
|
* Delegates to users service
|
|
1440
1464
|
*/
|
|
1441
|
-
createUser(username: string, password: string, timeout?: number): Promise<{
|
|
1465
|
+
createUser(username: string, password: string, email?: string, fullname?: string, role?: string, timeout?: number): Promise<{
|
|
1442
1466
|
success: boolean;
|
|
1443
1467
|
error?: string;
|
|
1444
1468
|
message?: string;
|
|
1445
1469
|
username?: string;
|
|
1470
|
+
email?: string;
|
|
1471
|
+
fullname?: string;
|
|
1472
|
+
role?: string;
|
|
1446
1473
|
}>;
|
|
1447
1474
|
/**
|
|
1448
1475
|
* Update an existing user
|
|
1449
1476
|
* Delegates to users service
|
|
1450
1477
|
*/
|
|
1451
|
-
updateUser(username: string,
|
|
1478
|
+
updateUser(username: string, updates: {
|
|
1479
|
+
password?: string;
|
|
1480
|
+
email?: string;
|
|
1481
|
+
fullname?: string;
|
|
1482
|
+
role?: string;
|
|
1483
|
+
}, timeout?: number): Promise<{
|
|
1452
1484
|
success: boolean;
|
|
1453
1485
|
error?: string;
|
|
1454
1486
|
message?: string;
|
|
1455
1487
|
username?: string;
|
|
1488
|
+
email?: string;
|
|
1489
|
+
fullname?: string;
|
|
1490
|
+
role?: string;
|
|
1456
1491
|
}>;
|
|
1457
1492
|
/**
|
|
1458
1493
|
* Delete a user
|
|
@@ -1463,6 +1498,9 @@ declare class SuperatomClient {
|
|
|
1463
1498
|
error?: string;
|
|
1464
1499
|
message?: string;
|
|
1465
1500
|
username?: string;
|
|
1501
|
+
email?: string;
|
|
1502
|
+
fullname?: string;
|
|
1503
|
+
role?: string;
|
|
1466
1504
|
}>;
|
|
1467
1505
|
/**
|
|
1468
1506
|
* Get all users
|
package/dist/index.js
CHANGED
|
@@ -432,7 +432,10 @@ var UsersRequestPayloadSchema = z.object({
|
|
|
432
432
|
operation: z.enum(["create", "update", "delete", "getAll", "getOne"]),
|
|
433
433
|
data: z.object({
|
|
434
434
|
username: z.string().optional(),
|
|
435
|
-
|
|
435
|
+
email: z.string().email("Invalid email format").optional(),
|
|
436
|
+
password: z.string().optional(),
|
|
437
|
+
fullname: z.string().optional(),
|
|
438
|
+
role: z.string().optional()
|
|
436
439
|
}).optional()
|
|
437
440
|
});
|
|
438
441
|
var UsersRequestMessageSchema = z.object({
|
|
@@ -447,13 +450,22 @@ var UsersResponsePayloadSchema = z.object({
|
|
|
447
450
|
error: z.string().optional(),
|
|
448
451
|
data: z.object({
|
|
449
452
|
username: z.string().optional(),
|
|
453
|
+
email: z.string().optional(),
|
|
454
|
+
fullname: z.string().optional(),
|
|
455
|
+
role: z.string().optional(),
|
|
450
456
|
message: z.string().optional(),
|
|
451
457
|
users: z.array(z.object({
|
|
452
458
|
username: z.string(),
|
|
459
|
+
email: z.string().optional(),
|
|
460
|
+
fullname: z.string().optional(),
|
|
461
|
+
role: z.string().optional(),
|
|
453
462
|
wsIds: z.array(z.string())
|
|
454
463
|
})).optional(),
|
|
455
464
|
user: z.object({
|
|
456
465
|
username: z.string(),
|
|
466
|
+
email: z.string().optional(),
|
|
467
|
+
fullname: z.string().optional(),
|
|
468
|
+
role: z.string().optional(),
|
|
457
469
|
wsIds: z.array(z.string())
|
|
458
470
|
}).optional(),
|
|
459
471
|
count: z.number().optional()
|
|
@@ -591,7 +603,7 @@ async function sendAuthLoginRequest(client, loginDataBase64, timeout) {
|
|
|
591
603
|
id: messageId,
|
|
592
604
|
type: "AUTH_LOGIN_REQ",
|
|
593
605
|
from: {
|
|
594
|
-
type:
|
|
606
|
+
type: client.type
|
|
595
607
|
},
|
|
596
608
|
to: {
|
|
597
609
|
type: "data-agent"
|
|
@@ -601,6 +613,7 @@ async function sendAuthLoginRequest(client, loginDataBase64, timeout) {
|
|
|
601
613
|
}
|
|
602
614
|
});
|
|
603
615
|
const response = await client.sendWithResponse(message, timeout);
|
|
616
|
+
console.log("sdk auth login response", response);
|
|
604
617
|
return response;
|
|
605
618
|
}
|
|
606
619
|
async function sendAuthVerifyRequest(client, token, timeout) {
|
|
@@ -609,7 +622,7 @@ async function sendAuthVerifyRequest(client, token, timeout) {
|
|
|
609
622
|
id: messageId,
|
|
610
623
|
type: "AUTH_VERIFY_REQ",
|
|
611
624
|
from: {
|
|
612
|
-
type:
|
|
625
|
+
type: client.type
|
|
613
626
|
},
|
|
614
627
|
to: {
|
|
615
628
|
type: "data-agent"
|
|
@@ -629,7 +642,7 @@ async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, timeou
|
|
|
629
642
|
id: messageId,
|
|
630
643
|
type: "USER_PROMPT_REQ",
|
|
631
644
|
from: {
|
|
632
|
-
type:
|
|
645
|
+
type: client.type
|
|
633
646
|
},
|
|
634
647
|
to: {
|
|
635
648
|
type: "data-agent"
|
|
@@ -654,7 +667,7 @@ async function sendUserPromptSuggestionsRequest(client, prompt, limit = 5, timeo
|
|
|
654
667
|
id: messageId,
|
|
655
668
|
type: "USER_PROMPT_SUGGESTIONS_REQ",
|
|
656
669
|
from: {
|
|
657
|
-
type:
|
|
670
|
+
type: client.type
|
|
658
671
|
},
|
|
659
672
|
to: {
|
|
660
673
|
type: "data-agent"
|
|
@@ -674,7 +687,7 @@ async function requestBundle(client, options) {
|
|
|
674
687
|
const message = BundleRequestMessageSchema.parse({
|
|
675
688
|
id: messageId,
|
|
676
689
|
type: "BUNDLE_REQ",
|
|
677
|
-
from: { type:
|
|
690
|
+
from: { type: client.type },
|
|
678
691
|
to: { type: "data-agent" },
|
|
679
692
|
payload: {}
|
|
680
693
|
});
|
|
@@ -722,7 +735,7 @@ async function requestData(client, options) {
|
|
|
722
735
|
const message = DataRequestMessageSchema.parse({
|
|
723
736
|
id: messageId,
|
|
724
737
|
type: "DATA_REQ",
|
|
725
|
-
from: { type:
|
|
738
|
+
from: { type: client.type },
|
|
726
739
|
to: { type: "data-agent" },
|
|
727
740
|
payload: {
|
|
728
741
|
collection: options.collection,
|
|
@@ -764,7 +777,7 @@ async function sendComponents(client, components) {
|
|
|
764
777
|
id: messageId,
|
|
765
778
|
type: "COMPONENT_LIST_RES",
|
|
766
779
|
from: {
|
|
767
|
-
type:
|
|
780
|
+
type: client.type
|
|
768
781
|
},
|
|
769
782
|
to: {
|
|
770
783
|
type: "data-agent"
|
|
@@ -777,18 +790,21 @@ async function sendComponents(client, components) {
|
|
|
777
790
|
}
|
|
778
791
|
|
|
779
792
|
// src/services/users.ts
|
|
780
|
-
async function createUser(client, username, password, timeout) {
|
|
793
|
+
async function createUser(client, username, password, email, fullname, role, timeout) {
|
|
781
794
|
const messageId = `users_create_${Date.now()}`;
|
|
782
795
|
const message = UsersRequestMessageSchema.parse({
|
|
783
796
|
id: messageId,
|
|
784
797
|
type: "USERS",
|
|
785
|
-
from: { type:
|
|
798
|
+
from: { type: client.type },
|
|
786
799
|
to: { type: "data-agent" },
|
|
787
800
|
payload: {
|
|
788
801
|
operation: "create",
|
|
789
802
|
data: {
|
|
790
803
|
username,
|
|
791
|
-
password
|
|
804
|
+
password,
|
|
805
|
+
email,
|
|
806
|
+
fullname,
|
|
807
|
+
role
|
|
792
808
|
}
|
|
793
809
|
}
|
|
794
810
|
});
|
|
@@ -798,21 +814,24 @@ async function createUser(client, username, password, timeout) {
|
|
|
798
814
|
success: payload.success,
|
|
799
815
|
error: payload.error,
|
|
800
816
|
message: payload.data?.message,
|
|
801
|
-
username: payload.data?.username
|
|
817
|
+
username: payload.data?.username,
|
|
818
|
+
email: payload.data?.email,
|
|
819
|
+
fullname: payload.data?.fullname,
|
|
820
|
+
role: payload.data?.role
|
|
802
821
|
};
|
|
803
822
|
}
|
|
804
|
-
async function updateUser(client, username,
|
|
823
|
+
async function updateUser(client, username, updates, timeout) {
|
|
805
824
|
const messageId = `users_update_${Date.now()}`;
|
|
806
825
|
const message = UsersRequestMessageSchema.parse({
|
|
807
826
|
id: messageId,
|
|
808
827
|
type: "USERS",
|
|
809
|
-
from: { type:
|
|
828
|
+
from: { type: client.type },
|
|
810
829
|
to: { type: "data-agent" },
|
|
811
830
|
payload: {
|
|
812
831
|
operation: "update",
|
|
813
832
|
data: {
|
|
814
833
|
username,
|
|
815
|
-
|
|
834
|
+
...updates
|
|
816
835
|
}
|
|
817
836
|
}
|
|
818
837
|
});
|
|
@@ -822,7 +841,10 @@ async function updateUser(client, username, password, timeout) {
|
|
|
822
841
|
success: payload.success,
|
|
823
842
|
error: payload.error,
|
|
824
843
|
message: payload.data?.message,
|
|
825
|
-
username: payload.data?.username
|
|
844
|
+
username: payload.data?.username,
|
|
845
|
+
email: payload.data?.email,
|
|
846
|
+
fullname: payload.data?.fullname,
|
|
847
|
+
role: payload.data?.role
|
|
826
848
|
};
|
|
827
849
|
}
|
|
828
850
|
async function deleteUser(client, username, timeout) {
|
|
@@ -830,7 +852,7 @@ async function deleteUser(client, username, timeout) {
|
|
|
830
852
|
const message = UsersRequestMessageSchema.parse({
|
|
831
853
|
id: messageId,
|
|
832
854
|
type: "USERS",
|
|
833
|
-
from: { type:
|
|
855
|
+
from: { type: client.type },
|
|
834
856
|
to: { type: "data-agent" },
|
|
835
857
|
payload: {
|
|
836
858
|
operation: "delete",
|
|
@@ -845,7 +867,10 @@ async function deleteUser(client, username, timeout) {
|
|
|
845
867
|
success: payload.success,
|
|
846
868
|
error: payload.error,
|
|
847
869
|
message: payload.data?.message,
|
|
848
|
-
username: payload.data?.username
|
|
870
|
+
username: payload.data?.username,
|
|
871
|
+
email: payload.data?.email,
|
|
872
|
+
fullname: payload.data?.fullname,
|
|
873
|
+
role: payload.data?.role
|
|
849
874
|
};
|
|
850
875
|
}
|
|
851
876
|
async function getAllUsers(client, timeout) {
|
|
@@ -853,7 +878,7 @@ async function getAllUsers(client, timeout) {
|
|
|
853
878
|
const message = UsersRequestMessageSchema.parse({
|
|
854
879
|
id: messageId,
|
|
855
880
|
type: "USERS",
|
|
856
|
-
from: { type:
|
|
881
|
+
from: { type: client.type },
|
|
857
882
|
to: { type: "data-agent" },
|
|
858
883
|
payload: {
|
|
859
884
|
operation: "getAll"
|
|
@@ -874,7 +899,7 @@ async function getUser(client, username, timeout) {
|
|
|
874
899
|
const message = UsersRequestMessageSchema.parse({
|
|
875
900
|
id: messageId,
|
|
876
901
|
type: "USERS",
|
|
877
|
-
from: { type:
|
|
902
|
+
from: { type: client.type },
|
|
878
903
|
to: { type: "data-agent" },
|
|
879
904
|
payload: {
|
|
880
905
|
operation: "getOne",
|
|
@@ -899,7 +924,7 @@ async function createDashboard(client, dashboardId, dashboard, timeout) {
|
|
|
899
924
|
const message = DashboardsRequestMessageSchema.parse({
|
|
900
925
|
id: messageId,
|
|
901
926
|
type: "DASHBOARDS",
|
|
902
|
-
from: { type:
|
|
927
|
+
from: { type: client.type },
|
|
903
928
|
to: { type: "data-agent" },
|
|
904
929
|
payload: {
|
|
905
930
|
operation: "create",
|
|
@@ -924,7 +949,7 @@ async function updateDashboard(client, dashboardId, dashboard, timeout) {
|
|
|
924
949
|
const message = DashboardsRequestMessageSchema.parse({
|
|
925
950
|
id: messageId,
|
|
926
951
|
type: "DASHBOARDS",
|
|
927
|
-
from: { type:
|
|
952
|
+
from: { type: client.type },
|
|
928
953
|
to: { type: "data-agent" },
|
|
929
954
|
payload: {
|
|
930
955
|
operation: "update",
|
|
@@ -949,7 +974,7 @@ async function deleteDashboard(client, dashboardId, timeout) {
|
|
|
949
974
|
const message = DashboardsRequestMessageSchema.parse({
|
|
950
975
|
id: messageId,
|
|
951
976
|
type: "DASHBOARDS",
|
|
952
|
-
from: { type:
|
|
977
|
+
from: { type: client.type },
|
|
953
978
|
to: { type: "data-agent" },
|
|
954
979
|
payload: {
|
|
955
980
|
operation: "delete",
|
|
@@ -972,7 +997,7 @@ async function getAllDashboards(client, timeout) {
|
|
|
972
997
|
const message = DashboardsRequestMessageSchema.parse({
|
|
973
998
|
id: messageId,
|
|
974
999
|
type: "DASHBOARDS",
|
|
975
|
-
from: { type:
|
|
1000
|
+
from: { type: client.type },
|
|
976
1001
|
to: { type: "data-agent" },
|
|
977
1002
|
payload: {
|
|
978
1003
|
operation: "getAll"
|
|
@@ -993,7 +1018,7 @@ async function getDashboard(client, dashboardId, timeout) {
|
|
|
993
1018
|
const message = DashboardsRequestMessageSchema.parse({
|
|
994
1019
|
id: messageId,
|
|
995
1020
|
type: "DASHBOARDS",
|
|
996
|
-
from: { type:
|
|
1021
|
+
from: { type: client.type },
|
|
997
1022
|
to: { type: "data-agent" },
|
|
998
1023
|
payload: {
|
|
999
1024
|
operation: "getOne",
|
|
@@ -1019,7 +1044,7 @@ async function createReport(client, reportId, report, timeout) {
|
|
|
1019
1044
|
const message = ReportsRequestMessageSchema.parse({
|
|
1020
1045
|
id: messageId,
|
|
1021
1046
|
type: "REPORTS",
|
|
1022
|
-
from: { type:
|
|
1047
|
+
from: { type: client.type },
|
|
1023
1048
|
to: { type: "data-agent" },
|
|
1024
1049
|
payload: {
|
|
1025
1050
|
operation: "create",
|
|
@@ -1044,7 +1069,7 @@ async function updateReport(client, reportId, report, timeout) {
|
|
|
1044
1069
|
const message = ReportsRequestMessageSchema.parse({
|
|
1045
1070
|
id: messageId,
|
|
1046
1071
|
type: "REPORTS",
|
|
1047
|
-
from: { type:
|
|
1072
|
+
from: { type: client.type },
|
|
1048
1073
|
to: { type: "data-agent" },
|
|
1049
1074
|
payload: {
|
|
1050
1075
|
operation: "update",
|
|
@@ -1069,7 +1094,7 @@ async function deleteReport(client, reportId, timeout) {
|
|
|
1069
1094
|
const message = ReportsRequestMessageSchema.parse({
|
|
1070
1095
|
id: messageId,
|
|
1071
1096
|
type: "REPORTS",
|
|
1072
|
-
from: { type:
|
|
1097
|
+
from: { type: client.type },
|
|
1073
1098
|
to: { type: "data-agent" },
|
|
1074
1099
|
payload: {
|
|
1075
1100
|
operation: "delete",
|
|
@@ -1092,7 +1117,7 @@ async function getAllReports(client, timeout) {
|
|
|
1092
1117
|
const message = ReportsRequestMessageSchema.parse({
|
|
1093
1118
|
id: messageId,
|
|
1094
1119
|
type: "REPORTS",
|
|
1095
|
-
from: { type:
|
|
1120
|
+
from: { type: client.type },
|
|
1096
1121
|
to: { type: "data-agent" },
|
|
1097
1122
|
payload: {
|
|
1098
1123
|
operation: "getAll"
|
|
@@ -1113,7 +1138,7 @@ async function getReport(client, reportId, timeout) {
|
|
|
1113
1138
|
const message = ReportsRequestMessageSchema.parse({
|
|
1114
1139
|
id: messageId,
|
|
1115
1140
|
type: "REPORTS",
|
|
1116
|
-
from: { type:
|
|
1141
|
+
from: { type: client.type },
|
|
1117
1142
|
to: { type: "data-agent" },
|
|
1118
1143
|
payload: {
|
|
1119
1144
|
operation: "getOne",
|
|
@@ -1139,7 +1164,7 @@ async function getActions(client, options) {
|
|
|
1139
1164
|
const message = ActionsRequestMessageSchema.parse({
|
|
1140
1165
|
id: messageId,
|
|
1141
1166
|
type: "ACTIONS",
|
|
1142
|
-
from: { type:
|
|
1167
|
+
from: { type: client.type },
|
|
1143
1168
|
to: { type: "data-agent" },
|
|
1144
1169
|
payload: {
|
|
1145
1170
|
SA_RUNTIME: options.SA_RUNTIME
|
|
@@ -1327,7 +1352,7 @@ var SuperatomClient = class {
|
|
|
1327
1352
|
}
|
|
1328
1353
|
const fullMessage = {
|
|
1329
1354
|
...message,
|
|
1330
|
-
from: message.from || { type:
|
|
1355
|
+
from: message.from || { type: this.config.type }
|
|
1331
1356
|
};
|
|
1332
1357
|
try {
|
|
1333
1358
|
this.socket.send(JSON.stringify(fullMessage));
|
|
@@ -1405,6 +1430,12 @@ var SuperatomClient = class {
|
|
|
1405
1430
|
getReconnectAttempts() {
|
|
1406
1431
|
return this.reconnectAttempts;
|
|
1407
1432
|
}
|
|
1433
|
+
/**
|
|
1434
|
+
* Get client type
|
|
1435
|
+
*/
|
|
1436
|
+
get type() {
|
|
1437
|
+
return this.config.type;
|
|
1438
|
+
}
|
|
1408
1439
|
/**
|
|
1409
1440
|
* Send a message and wait for response with timeout (alias for sendWithResponse)
|
|
1410
1441
|
*/
|
|
@@ -1487,17 +1518,17 @@ var SuperatomClient = class {
|
|
|
1487
1518
|
* Create a new user
|
|
1488
1519
|
* Delegates to users service
|
|
1489
1520
|
*/
|
|
1490
|
-
async createUser(username, password, timeout) {
|
|
1521
|
+
async createUser(username, password, email, fullname, role, timeout) {
|
|
1491
1522
|
this.log("info", "Creating user:", username);
|
|
1492
|
-
return createUser(this, username, password, timeout);
|
|
1523
|
+
return createUser(this, username, password, email, fullname, role, timeout);
|
|
1493
1524
|
}
|
|
1494
1525
|
/**
|
|
1495
1526
|
* Update an existing user
|
|
1496
1527
|
* Delegates to users service
|
|
1497
1528
|
*/
|
|
1498
|
-
async updateUser(username,
|
|
1529
|
+
async updateUser(username, updates, timeout) {
|
|
1499
1530
|
this.log("info", "Updating user:", username);
|
|
1500
|
-
return updateUser(this, username,
|
|
1531
|
+
return updateUser(this, username, updates, timeout);
|
|
1501
1532
|
}
|
|
1502
1533
|
/**
|
|
1503
1534
|
* Delete a user
|