redai-automation-web-sdk 1.9.14 → 1.9.16
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 +22 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +34 -11
- package/dist/index.d.ts +34 -11
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -423,13 +423,25 @@ var ValidationUtils = class {
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
/**
|
|
426
|
-
* Validate
|
|
426
|
+
* Validate creator UUID format
|
|
427
|
+
*/
|
|
428
|
+
static validateCreatedBy(createdBy) {
|
|
429
|
+
if (!createdBy || typeof createdBy !== "string") {
|
|
430
|
+
throw new ValidationError("CreatedBy UUID is required and must be a string", "createdBy");
|
|
431
|
+
}
|
|
432
|
+
const uuidPattern = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
|
|
433
|
+
if (!uuidPattern.test(createdBy)) {
|
|
434
|
+
throw new ValidationError("CreatedBy UUID format is invalid", "createdBy");
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Validate user UUID format (deprecated: use validateCreatedBy)
|
|
427
439
|
*/
|
|
428
440
|
static validateUserUuid(userUuid) {
|
|
429
441
|
if (!userUuid || typeof userUuid !== "string") {
|
|
430
442
|
throw new ValidationError("User UUID is required and must be a string", "userUuid");
|
|
431
443
|
}
|
|
432
|
-
const uuidPattern = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
|
|
444
|
+
const uuidPattern = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
|
|
433
445
|
if (!uuidPattern.test(userUuid)) {
|
|
434
446
|
throw new ValidationError("User UUID format is invalid", "userUuid");
|
|
435
447
|
}
|
|
@@ -891,8 +903,10 @@ var EventUtils = class {
|
|
|
891
903
|
return false;
|
|
892
904
|
}
|
|
893
905
|
}
|
|
894
|
-
|
|
895
|
-
|
|
906
|
+
const userFilterList = criteria.createdBys || criteria.userUuids;
|
|
907
|
+
if (userFilterList && userFilterList.length > 0) {
|
|
908
|
+
const creator = event.createdBy || event.userUuid;
|
|
909
|
+
if (!creator || !userFilterList.includes(creator)) {
|
|
896
910
|
return false;
|
|
897
911
|
}
|
|
898
912
|
}
|
|
@@ -1029,7 +1043,7 @@ var AuthService = class {
|
|
|
1029
1043
|
const response = await this.httpClient.post(
|
|
1030
1044
|
"/auth/zalo/qr-code",
|
|
1031
1045
|
{
|
|
1032
|
-
|
|
1046
|
+
createdBy: request.createdBy !== void 0 ? Number(request.createdBy) : request.userUuid ? Number(request.userUuid) || request.userUuid : void 0,
|
|
1033
1047
|
workspaceId: request.workspaceId,
|
|
1034
1048
|
baseId: request.baseId,
|
|
1035
1049
|
sessionId: request.sessionId,
|
|
@@ -1056,7 +1070,7 @@ var AuthService = class {
|
|
|
1056
1070
|
const response = await this.httpClient.post(
|
|
1057
1071
|
"/auth/zalo/login-with-credentials",
|
|
1058
1072
|
{
|
|
1059
|
-
|
|
1073
|
+
createdBy: request.createdBy !== void 0 ? Number(request.createdBy) : request.userUuid ? Number(request.userUuid) || request.userUuid : void 0,
|
|
1060
1074
|
credentials: {
|
|
1061
1075
|
cookie: request.credentials.cookie,
|
|
1062
1076
|
imei: request.credentials.imei,
|
|
@@ -1071,9 +1085,9 @@ var AuthService = class {
|
|
|
1071
1085
|
/**
|
|
1072
1086
|
* Get list of sessions for a user
|
|
1073
1087
|
*/
|
|
1074
|
-
async getSessionsByUser(
|
|
1088
|
+
async getSessionsByUser(createdBy) {
|
|
1075
1089
|
const response = await this.httpClient.get(
|
|
1076
|
-
`/auth/zalo/sessions/${
|
|
1090
|
+
`/auth/zalo/sessions/${createdBy}`
|
|
1077
1091
|
);
|
|
1078
1092
|
return response;
|
|
1079
1093
|
}
|