vr-commons 1.0.124 → 1.0.126
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/utils/deviceUtils.d.ts +2 -0
- package/dist/utils/deviceUtils.js +21 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +3 -1
- package/dist/validations/account.validations.d.ts +20 -0
- package/dist/validations/account.validations.js +14 -0
- package/dist/validations/devices.validations.d.ts +1 -0
- package/dist/validations/devices.validations.js +4 -4
- package/dist/validations/index.d.ts +1 -1
- package/dist/validations/index.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractDedicatedUserFromSerial = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const extractDedicatedUserFromSerial = (serialNumber) => {
|
|
6
|
+
// Validate format first
|
|
7
|
+
const match = serialNumber.match(__1.serialRegex);
|
|
8
|
+
if (!match) {
|
|
9
|
+
console.warn(`Invalid serial number format: ${serialNumber}. Defaulting to N/A.`);
|
|
10
|
+
return "N/A";
|
|
11
|
+
}
|
|
12
|
+
// match[1] = VBRD or VIBERIDE (company)
|
|
13
|
+
// match[2] = PASSENGER or RIDER (dedicated user)
|
|
14
|
+
// match[3] = AA001A (serial)
|
|
15
|
+
const role = match[2];
|
|
16
|
+
if (role === "PASSENGER" || role === "RIDER") {
|
|
17
|
+
return role;
|
|
18
|
+
}
|
|
19
|
+
return "N/A";
|
|
20
|
+
};
|
|
21
|
+
exports.extractDedicatedUserFromSerial = extractDedicatedUserFromSerial;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export { cloudinaryUtil } from "./product.utils";
|
|
|
14
14
|
export { DPP_OperationsUtil } from "./admin.devicePayment.utils";
|
|
15
15
|
export { PendingRegistration, VerificationMethod, ConfirmResponse, UploadResult, StockChangeResult, } from "./types";
|
|
16
16
|
export { formatDeviceSession, formatEventLog, formatEventLogs, buildEventLogWhereClause, buildSearchConditions, buildUserSearchConditions, } from "./eventlogs.admin.utils";
|
|
17
|
+
export { extractDedicatedUserFromSerial } from "./deviceUtils";
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateContactValue = exports.detectContactType = exports.sendVerificationCode = exports.sendSMS = exports.sendEmail = exports.getVerificationMethod = exports.getOTPExpiry = exports.generateOTP = exports.createDeviceSession = exports.suspensionUtil = exports.banUtil = exports.hasHigherAuthority = exports.getModeratableRoles = exports.canModerateUser = exports.canModerate = exports.softDeleteUser = exports.hashPassword = exports.validatePassword = exports.validateUniqueFields = exports.generateJacketId = exports.getSortOrder = exports.generateEventSearchConditions = exports.generateUserSearchConditions = exports.findSecurityClearanceByRole = exports.getUsersByRole = exports.getUserById = exports.isAccountAccessible = exports.canModifyAccount = exports.hasAllPermissions = exports.hasAnyPermission = exports.hasPermission = exports.hasRole = exports.formatUserListResponse = exports.formatUserProfile = exports.sendErrorResponse = exports.sendSuccessResponse = exports.logEvent = exports.formatTimeRemaining = exports.getTokenTimeRemaining = exports.generateToken = exports.shouldRefreshToken = exports.verifyToken = exports.generateRiderToken = exports.generatePassengerToken = exports.generateAdminToken = exports.checkSuspensionStatus = exports.checkIsUserBannedOrSuspended = exports.checkBanStatus = exports.hasActiveDependencies = exports.checkAccountDependencies = void 0;
|
|
4
|
-
exports.buildUserSearchConditions = exports.buildSearchConditions = exports.buildEventLogWhereClause = exports.formatEventLogs = exports.formatEventLog = exports.formatDeviceSession = exports.DPP_OperationsUtil = exports.cloudinaryUtil = exports.stockUtil = exports.validateHierarchy = exports.isSuperiorOrEqual = exports.isSuperior = exports.isSubordinateOrEqual = exports.isSubordinate = exports.isRankEqual = exports.getUserLevel = void 0;
|
|
4
|
+
exports.extractDedicatedUserFromSerial = exports.buildUserSearchConditions = exports.buildSearchConditions = exports.buildEventLogWhereClause = exports.formatEventLogs = exports.formatEventLog = exports.formatDeviceSession = exports.DPP_OperationsUtil = exports.cloudinaryUtil = exports.stockUtil = exports.validateHierarchy = exports.isSuperiorOrEqual = exports.isSuperior = exports.isSubordinateOrEqual = exports.isSubordinate = exports.isRankEqual = exports.getUserLevel = void 0;
|
|
5
5
|
var account_utils_1 = require("./account.utils");
|
|
6
6
|
Object.defineProperty(exports, "checkAccountDependencies", { enumerable: true, get: function () { return account_utils_1.checkAccountDependencies; } });
|
|
7
7
|
Object.defineProperty(exports, "hasActiveDependencies", { enumerable: true, get: function () { return account_utils_1.hasActiveDependencies; } });
|
|
@@ -90,3 +90,5 @@ Object.defineProperty(exports, "formatEventLogs", { enumerable: true, get: funct
|
|
|
90
90
|
Object.defineProperty(exports, "buildEventLogWhereClause", { enumerable: true, get: function () { return eventlogs_admin_utils_1.buildEventLogWhereClause; } });
|
|
91
91
|
Object.defineProperty(exports, "buildSearchConditions", { enumerable: true, get: function () { return eventlogs_admin_utils_1.buildSearchConditions; } });
|
|
92
92
|
Object.defineProperty(exports, "buildUserSearchConditions", { enumerable: true, get: function () { return eventlogs_admin_utils_1.buildUserSearchConditions; } });
|
|
93
|
+
var deviceUtils_1 = require("./deviceUtils");
|
|
94
|
+
Object.defineProperty(exports, "extractDedicatedUserFromSerial", { enumerable: true, get: function () { return deviceUtils_1.extractDedicatedUserFromSerial; } });
|
|
@@ -9,26 +9,46 @@ export declare const updateProfileSchema: z.ZodObject<{
|
|
|
9
9
|
firstName: z.ZodOptional<z.ZodString>;
|
|
10
10
|
lastName: z.ZodOptional<z.ZodString>;
|
|
11
11
|
plateNumber: z.ZodOptional<z.ZodString>;
|
|
12
|
+
gender: z.ZodOptional<z.ZodEnum<["male", "female"]>>;
|
|
13
|
+
birthDate: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
birthMonth: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
birthYear: z.ZodOptional<z.ZodNumber>;
|
|
12
16
|
}, "strip", z.ZodTypeAny, {
|
|
13
17
|
firstName?: string | undefined;
|
|
14
18
|
lastName?: string | undefined;
|
|
15
19
|
plateNumber?: string | undefined;
|
|
20
|
+
gender?: "male" | "female" | undefined;
|
|
21
|
+
birthDate?: number | undefined;
|
|
22
|
+
birthMonth?: number | undefined;
|
|
23
|
+
birthYear?: number | undefined;
|
|
16
24
|
}, {
|
|
17
25
|
firstName?: string | undefined;
|
|
18
26
|
lastName?: string | undefined;
|
|
19
27
|
plateNumber?: string | undefined;
|
|
28
|
+
gender?: "male" | "female" | undefined;
|
|
29
|
+
birthDate?: number | undefined;
|
|
30
|
+
birthMonth?: number | undefined;
|
|
31
|
+
birthYear?: number | undefined;
|
|
20
32
|
}>;
|
|
21
33
|
}, "strip", z.ZodTypeAny, {
|
|
22
34
|
body: {
|
|
23
35
|
firstName?: string | undefined;
|
|
24
36
|
lastName?: string | undefined;
|
|
25
37
|
plateNumber?: string | undefined;
|
|
38
|
+
gender?: "male" | "female" | undefined;
|
|
39
|
+
birthDate?: number | undefined;
|
|
40
|
+
birthMonth?: number | undefined;
|
|
41
|
+
birthYear?: number | undefined;
|
|
26
42
|
};
|
|
27
43
|
}, {
|
|
28
44
|
body: {
|
|
29
45
|
firstName?: string | undefined;
|
|
30
46
|
lastName?: string | undefined;
|
|
31
47
|
plateNumber?: string | undefined;
|
|
48
|
+
gender?: "male" | "female" | undefined;
|
|
49
|
+
birthDate?: number | undefined;
|
|
50
|
+
birthMonth?: number | undefined;
|
|
51
|
+
birthYear?: number | undefined;
|
|
32
52
|
};
|
|
33
53
|
}>;
|
|
34
54
|
export declare const updateContactSchema: z.ZodObject<{
|
|
@@ -36,6 +36,20 @@ exports.updateProfileSchema = zod_1.z.object({
|
|
|
36
36
|
.string()
|
|
37
37
|
.regex(plateRegex, "Invalid plate number")
|
|
38
38
|
.optional(),
|
|
39
|
+
gender: zod_1.z
|
|
40
|
+
.enum(["male", "female"], {
|
|
41
|
+
errorMap: () => ({
|
|
42
|
+
message: "Gender must be either 'male' or 'female'",
|
|
43
|
+
}),
|
|
44
|
+
})
|
|
45
|
+
.optional(),
|
|
46
|
+
birthDate: zod_1.z.number().min(1).max(31).optional(),
|
|
47
|
+
birthMonth: zod_1.z.number().min(1).max(12).optional(),
|
|
48
|
+
birthYear: zod_1.z
|
|
49
|
+
.number()
|
|
50
|
+
.min(1900, "Birth year must be between 1900 and current year")
|
|
51
|
+
.max(new Date().getFullYear(), "Birth year cannot be in the future")
|
|
52
|
+
.optional(),
|
|
39
53
|
}),
|
|
40
54
|
});
|
|
41
55
|
// Schema for updating contact (email or phone)
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extendSessionSchema = exports.unlockDeviceSchema = void 0;
|
|
3
|
+
exports.extendSessionSchema = exports.unlockDeviceSchema = exports.serialRegex = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
5
|
+
exports.serialRegex = /^(VBRD|VIBERIDE)-(PASSENGER|RIDER)-([A-Z]{2}\d{3}[A-Z])$/;
|
|
6
6
|
exports.unlockDeviceSchema = zod_1.z.object({
|
|
7
7
|
body: zod_1.z.object({
|
|
8
8
|
deviceSerialNumber: zod_1.z
|
|
9
9
|
.string()
|
|
10
|
-
.regex(serialRegex, "Invalid serial number format"),
|
|
10
|
+
.regex(exports.serialRegex, "Invalid serial number format"),
|
|
11
11
|
}),
|
|
12
12
|
});
|
|
13
13
|
exports.extendSessionSchema = zod_1.z.object({
|
|
14
14
|
body: zod_1.z.object({
|
|
15
15
|
deviceSerialNumber: zod_1.z
|
|
16
16
|
.string()
|
|
17
|
-
.regex(serialRegex, "Invalid serial number format"),
|
|
17
|
+
.regex(exports.serialRegex, "Invalid serial number format"),
|
|
18
18
|
sessionId: zod_1.z.string().uuid("Invalid session ID format"),
|
|
19
19
|
}),
|
|
20
20
|
});
|
|
@@ -4,7 +4,7 @@ export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUse
|
|
|
4
4
|
export { submitBanAppealSchema, submitSuspensionAppealSchema, getBanSchema, getUserRestrictionsSchema, getSuspensionSchema, getUserSuspensionsSchema, getUserBansSchema, listBansSchema, listPendingAppealsSchema, listSuspensionsSchema, reviewAppealSchema, revokeBanSchema, revokeSuspensionSchema, extendSuspensionSchema, createBanSchema, createSuspensionSchema, exportBansSchema, } from "./moderation.validations";
|
|
5
5
|
export { createAppSpecsSchema, updateAppSpecsSchema, listAppSpecsSchema, getActiveAppSpecsSchema, activateAppSpecsSchema, getAppSpecsSchema, } from "./appSpecs.validations";
|
|
6
6
|
export { listUserPaymentPlansSchema, getUserPaymentPlanSchema, } from "./devicePaymentPlan.validations";
|
|
7
|
-
export { unlockDeviceSchema, extendSessionSchema } from "./devices.validations";
|
|
7
|
+
export { unlockDeviceSchema, extendSessionSchema, serialRegex, } from "./devices.validations";
|
|
8
8
|
export { payInstallmentSchema } from "./payinstallment.validations";
|
|
9
9
|
export { updateProfileSchema, requestPhoneChangeSchema, verifyPhoneChangeSchema, deleteAccountSchema, strongPasswordRegex, changePasswordSchema, } from "./account.validations";
|
|
10
10
|
export { updateAdminSchema, updateRiderSchema, deleteUserSchema, getUserSchema, getUsersSchema, hireAdminSchema, promoteAdminSchema, demoteAdminSchema, fireEmployeeSchema, upgradeToRiderSchema, resetPasswordSchema, } from "./users.admin.validations";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAppSpecsSchema = exports.activateAppSpecsSchema = exports.getActiveAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = exports.exportBansSchema = exports.createSuspensionSchema = exports.createBanSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.reviewAppealSchema = exports.listSuspensionsSchema = exports.listPendingAppealsSchema = exports.listBansSchema = exports.getUserBansSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.deactivateAccountSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.googleLoginSchema = exports.completePassengerProfileSchema = exports.checkRiderAccountSchema = exports.setRiderPasswordSchema = exports.riderPasswordRegex = exports.passwordRegex = exports.emailRegex = exports.phoneRegex = exports.requestOtpSchema = exports.resendOtpSchema = exports.verifyOtpSchema = exports.registerSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.getEventLogSchema = exports.listEventLogsSchema = exports.deletePlanSchema = exports.recordPaymentSchema = exports.listPlansSchema = exports.getUserPlansSchema = void 0;
|
|
4
|
+
exports.getDevicePlanSchema = exports.limitedUpdateSchema = exports.createPlanSchema = exports.createDeviceSchema = exports.makePermanentSchema = exports.disableDeviceSchema = exports.deleteDeviceSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.updateDeviceSchema = exports.adminUnlockDeviceSchema = exports.adminLockDeviceSchema = exports.bulkCreateDevicesSchema = exports.checkAvailabilitySchema = exports.deletePricingSchema = exports.getPricingsSchema = exports.getPricingSchema = exports.updatePricingSchema = exports.createPricingSchema = exports.updateStockSchema = exports.deleteProductSchema = exports.activateProductSchema = exports.deactivateProductSchema = exports.getProductsSchema = exports.getProductSchema = exports.updateProductSchema = exports.createProductSchema = exports.resetPasswordSchema = exports.upgradeToRiderSchema = exports.fireEmployeeSchema = exports.demoteAdminSchema = exports.promoteAdminSchema = exports.hireAdminSchema = exports.getUsersSchema = exports.getUserSchema = exports.deleteUserSchema = exports.updateRiderSchema = exports.updateAdminSchema = exports.changePasswordSchema = exports.strongPasswordRegex = exports.deleteAccountSchema = exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.updateProfileSchema = exports.payInstallmentSchema = exports.serialRegex = exports.extendSessionSchema = exports.unlockDeviceSchema = exports.getUserPaymentPlanSchema = exports.listUserPaymentPlansSchema = void 0;
|
|
5
|
+
exports.getEventLogSchema = exports.listEventLogsSchema = exports.deletePlanSchema = exports.recordPaymentSchema = exports.listPlansSchema = exports.getUserPlansSchema = exports.getPlanSchema = void 0;
|
|
6
6
|
var validate_validations_1 = require("./validate.validations");
|
|
7
7
|
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
|
|
8
8
|
var auth_validations_1 = require("./auth.validations");
|
|
@@ -72,6 +72,7 @@ Object.defineProperty(exports, "getUserPaymentPlanSchema", { enumerable: true, g
|
|
|
72
72
|
var devices_validations_1 = require("./devices.validations");
|
|
73
73
|
Object.defineProperty(exports, "unlockDeviceSchema", { enumerable: true, get: function () { return devices_validations_1.unlockDeviceSchema; } });
|
|
74
74
|
Object.defineProperty(exports, "extendSessionSchema", { enumerable: true, get: function () { return devices_validations_1.extendSessionSchema; } });
|
|
75
|
+
Object.defineProperty(exports, "serialRegex", { enumerable: true, get: function () { return devices_validations_1.serialRegex; } });
|
|
75
76
|
var payinstallment_validations_1 = require("./payinstallment.validations");
|
|
76
77
|
Object.defineProperty(exports, "payInstallmentSchema", { enumerable: true, get: function () { return payinstallment_validations_1.payInstallmentSchema; } });
|
|
77
78
|
var account_validations_1 = require("./account.validations");
|