@superatomai/sdk-web 0.0.7 → 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 +36 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -5
- package/dist/index.d.ts +39 -5
- package/dist/index.js +36 -12
- 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
|
|
@@ -1442,21 +1462,32 @@ declare class SuperatomClient {
|
|
|
1442
1462
|
* Create a new user
|
|
1443
1463
|
* Delegates to users service
|
|
1444
1464
|
*/
|
|
1445
|
-
createUser(username: string, password: string, timeout?: number): Promise<{
|
|
1465
|
+
createUser(username: string, password: string, email?: string, fullname?: string, role?: string, timeout?: number): Promise<{
|
|
1446
1466
|
success: boolean;
|
|
1447
1467
|
error?: string;
|
|
1448
1468
|
message?: string;
|
|
1449
1469
|
username?: string;
|
|
1470
|
+
email?: string;
|
|
1471
|
+
fullname?: string;
|
|
1472
|
+
role?: string;
|
|
1450
1473
|
}>;
|
|
1451
1474
|
/**
|
|
1452
1475
|
* Update an existing user
|
|
1453
1476
|
* Delegates to users service
|
|
1454
1477
|
*/
|
|
1455
|
-
updateUser(username: string,
|
|
1478
|
+
updateUser(username: string, updates: {
|
|
1479
|
+
password?: string;
|
|
1480
|
+
email?: string;
|
|
1481
|
+
fullname?: string;
|
|
1482
|
+
role?: string;
|
|
1483
|
+
}, timeout?: number): Promise<{
|
|
1456
1484
|
success: boolean;
|
|
1457
1485
|
error?: string;
|
|
1458
1486
|
message?: string;
|
|
1459
1487
|
username?: string;
|
|
1488
|
+
email?: string;
|
|
1489
|
+
fullname?: string;
|
|
1490
|
+
role?: string;
|
|
1460
1491
|
}>;
|
|
1461
1492
|
/**
|
|
1462
1493
|
* Delete a user
|
|
@@ -1467,6 +1498,9 @@ declare class SuperatomClient {
|
|
|
1467
1498
|
error?: string;
|
|
1468
1499
|
message?: string;
|
|
1469
1500
|
username?: string;
|
|
1501
|
+
email?: string;
|
|
1502
|
+
fullname?: string;
|
|
1503
|
+
role?: string;
|
|
1470
1504
|
}>;
|
|
1471
1505
|
/**
|
|
1472
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
|
|
@@ -1442,21 +1462,32 @@ declare class SuperatomClient {
|
|
|
1442
1462
|
* Create a new user
|
|
1443
1463
|
* Delegates to users service
|
|
1444
1464
|
*/
|
|
1445
|
-
createUser(username: string, password: string, timeout?: number): Promise<{
|
|
1465
|
+
createUser(username: string, password: string, email?: string, fullname?: string, role?: string, timeout?: number): Promise<{
|
|
1446
1466
|
success: boolean;
|
|
1447
1467
|
error?: string;
|
|
1448
1468
|
message?: string;
|
|
1449
1469
|
username?: string;
|
|
1470
|
+
email?: string;
|
|
1471
|
+
fullname?: string;
|
|
1472
|
+
role?: string;
|
|
1450
1473
|
}>;
|
|
1451
1474
|
/**
|
|
1452
1475
|
* Update an existing user
|
|
1453
1476
|
* Delegates to users service
|
|
1454
1477
|
*/
|
|
1455
|
-
updateUser(username: string,
|
|
1478
|
+
updateUser(username: string, updates: {
|
|
1479
|
+
password?: string;
|
|
1480
|
+
email?: string;
|
|
1481
|
+
fullname?: string;
|
|
1482
|
+
role?: string;
|
|
1483
|
+
}, timeout?: number): Promise<{
|
|
1456
1484
|
success: boolean;
|
|
1457
1485
|
error?: string;
|
|
1458
1486
|
message?: string;
|
|
1459
1487
|
username?: string;
|
|
1488
|
+
email?: string;
|
|
1489
|
+
fullname?: string;
|
|
1490
|
+
role?: string;
|
|
1460
1491
|
}>;
|
|
1461
1492
|
/**
|
|
1462
1493
|
* Delete a user
|
|
@@ -1467,6 +1498,9 @@ declare class SuperatomClient {
|
|
|
1467
1498
|
error?: string;
|
|
1468
1499
|
message?: string;
|
|
1469
1500
|
username?: string;
|
|
1501
|
+
email?: string;
|
|
1502
|
+
fullname?: string;
|
|
1503
|
+
role?: string;
|
|
1470
1504
|
}>;
|
|
1471
1505
|
/**
|
|
1472
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()
|
|
@@ -778,7 +790,7 @@ async function sendComponents(client, components) {
|
|
|
778
790
|
}
|
|
779
791
|
|
|
780
792
|
// src/services/users.ts
|
|
781
|
-
async function createUser(client, username, password, timeout) {
|
|
793
|
+
async function createUser(client, username, password, email, fullname, role, timeout) {
|
|
782
794
|
const messageId = `users_create_${Date.now()}`;
|
|
783
795
|
const message = UsersRequestMessageSchema.parse({
|
|
784
796
|
id: messageId,
|
|
@@ -789,7 +801,10 @@ async function createUser(client, username, password, timeout) {
|
|
|
789
801
|
operation: "create",
|
|
790
802
|
data: {
|
|
791
803
|
username,
|
|
792
|
-
password
|
|
804
|
+
password,
|
|
805
|
+
email,
|
|
806
|
+
fullname,
|
|
807
|
+
role
|
|
793
808
|
}
|
|
794
809
|
}
|
|
795
810
|
});
|
|
@@ -799,10 +814,13 @@ async function createUser(client, username, password, timeout) {
|
|
|
799
814
|
success: payload.success,
|
|
800
815
|
error: payload.error,
|
|
801
816
|
message: payload.data?.message,
|
|
802
|
-
username: payload.data?.username
|
|
817
|
+
username: payload.data?.username,
|
|
818
|
+
email: payload.data?.email,
|
|
819
|
+
fullname: payload.data?.fullname,
|
|
820
|
+
role: payload.data?.role
|
|
803
821
|
};
|
|
804
822
|
}
|
|
805
|
-
async function updateUser(client, username,
|
|
823
|
+
async function updateUser(client, username, updates, timeout) {
|
|
806
824
|
const messageId = `users_update_${Date.now()}`;
|
|
807
825
|
const message = UsersRequestMessageSchema.parse({
|
|
808
826
|
id: messageId,
|
|
@@ -813,7 +831,7 @@ async function updateUser(client, username, password, timeout) {
|
|
|
813
831
|
operation: "update",
|
|
814
832
|
data: {
|
|
815
833
|
username,
|
|
816
|
-
|
|
834
|
+
...updates
|
|
817
835
|
}
|
|
818
836
|
}
|
|
819
837
|
});
|
|
@@ -823,7 +841,10 @@ async function updateUser(client, username, password, timeout) {
|
|
|
823
841
|
success: payload.success,
|
|
824
842
|
error: payload.error,
|
|
825
843
|
message: payload.data?.message,
|
|
826
|
-
username: payload.data?.username
|
|
844
|
+
username: payload.data?.username,
|
|
845
|
+
email: payload.data?.email,
|
|
846
|
+
fullname: payload.data?.fullname,
|
|
847
|
+
role: payload.data?.role
|
|
827
848
|
};
|
|
828
849
|
}
|
|
829
850
|
async function deleteUser(client, username, timeout) {
|
|
@@ -846,7 +867,10 @@ async function deleteUser(client, username, timeout) {
|
|
|
846
867
|
success: payload.success,
|
|
847
868
|
error: payload.error,
|
|
848
869
|
message: payload.data?.message,
|
|
849
|
-
username: payload.data?.username
|
|
870
|
+
username: payload.data?.username,
|
|
871
|
+
email: payload.data?.email,
|
|
872
|
+
fullname: payload.data?.fullname,
|
|
873
|
+
role: payload.data?.role
|
|
850
874
|
};
|
|
851
875
|
}
|
|
852
876
|
async function getAllUsers(client, timeout) {
|
|
@@ -1494,17 +1518,17 @@ var SuperatomClient = class {
|
|
|
1494
1518
|
* Create a new user
|
|
1495
1519
|
* Delegates to users service
|
|
1496
1520
|
*/
|
|
1497
|
-
async createUser(username, password, timeout) {
|
|
1521
|
+
async createUser(username, password, email, fullname, role, timeout) {
|
|
1498
1522
|
this.log("info", "Creating user:", username);
|
|
1499
|
-
return createUser(this, username, password, timeout);
|
|
1523
|
+
return createUser(this, username, password, email, fullname, role, timeout);
|
|
1500
1524
|
}
|
|
1501
1525
|
/**
|
|
1502
1526
|
* Update an existing user
|
|
1503
1527
|
* Delegates to users service
|
|
1504
1528
|
*/
|
|
1505
|
-
async updateUser(username,
|
|
1529
|
+
async updateUser(username, updates, timeout) {
|
|
1506
1530
|
this.log("info", "Updating user:", username);
|
|
1507
|
-
return updateUser(this, username,
|
|
1531
|
+
return updateUser(this, username, updates, timeout);
|
|
1508
1532
|
}
|
|
1509
1533
|
/**
|
|
1510
1534
|
* Delete a user
|