vr-commons 1.0.53 → 1.0.55
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/index.d.ts +3 -1
- package/dist/utils/index.js +8 -1
- package/dist/utils/types.d.ts +25 -0
- package/dist/utils/types.js +2 -0
- package/dist/utils/verification.utils.d.ts +7 -0
- package/dist/utils/verification.utils.js +133 -0
- package/dist/validations/auth.validations.d.ts +97 -2
- package/dist/validations/auth.validations.js +44 -1
- package/dist/validations/index.d.ts +1 -1
- package/dist/validations/index.js +5 -1
- package/package.json +5 -4
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { checkAccountDependencies, hasActiveDependencies, checkBanStatus, checkIsUserBannedOrSuspended, checkSuspensionStatus, } from "./account.utils";
|
|
2
|
-
export { generateAdminToken, generatePassengerToken, generateRiderToken, verifyToken, } from "./authTokens.utils";
|
|
2
|
+
export { generateAdminToken, generatePassengerToken, generateRiderToken, verifyToken, JWTPayload, } from "./authTokens.utils";
|
|
3
3
|
export { logEvent } from "./eventLog.utils";
|
|
4
4
|
export { sendSuccessResponse, sendErrorResponse } from "./response.utils";
|
|
5
5
|
export { formatUserProfile, formatUserListResponse, hasRole, hasPermission, hasAnyPermission, hasAllPermissions, canModifyAccount, isAccountAccessible, getUserById, getUsersByRole, findSecurityClearanceByRole, generateUserSearchConditions, generateEventSearchConditions, getSortOrder, generateJacketId, validateUniqueFields, validatePassword, hashPassword, softDeleteUser, } from "./profiles.utils";
|
|
@@ -7,3 +7,5 @@ export { canModerate, canModerateUser, getModeratableRoles, hasHigherAuthority,
|
|
|
7
7
|
export { banUtil } from "./bans.utils";
|
|
8
8
|
export { suspensionUtil } from "./suspension.utils";
|
|
9
9
|
export { createSession, getTokenTimeRemaining, shouldRefreshToken, } from "./session.utils";
|
|
10
|
+
export { generateOTP, getOTPExpiry, getVerificationMethod, sendEmail, sendSMS, sendVerificationCode, } from "./verification.utils";
|
|
11
|
+
export { PendingRegistration, VerificationMethod, ConfirmResponse, } from "./types";
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shouldRefreshToken = exports.getTokenTimeRemaining = exports.createSession = 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.verifyToken = exports.generateRiderToken = exports.generatePassengerToken = exports.generateAdminToken = exports.checkSuspensionStatus = exports.checkIsUserBannedOrSuspended = exports.checkBanStatus = exports.hasActiveDependencies = exports.checkAccountDependencies = void 0;
|
|
3
|
+
exports.sendVerificationCode = exports.sendSMS = exports.sendEmail = exports.getVerificationMethod = exports.getOTPExpiry = exports.generateOTP = exports.shouldRefreshToken = exports.getTokenTimeRemaining = exports.createSession = 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.verifyToken = exports.generateRiderToken = exports.generatePassengerToken = exports.generateAdminToken = exports.checkSuspensionStatus = exports.checkIsUserBannedOrSuspended = exports.checkBanStatus = exports.hasActiveDependencies = exports.checkAccountDependencies = void 0;
|
|
4
4
|
var account_utils_1 = require("./account.utils");
|
|
5
5
|
Object.defineProperty(exports, "checkAccountDependencies", { enumerable: true, get: function () { return account_utils_1.checkAccountDependencies; } });
|
|
6
6
|
Object.defineProperty(exports, "hasActiveDependencies", { enumerable: true, get: function () { return account_utils_1.hasActiveDependencies; } });
|
|
@@ -57,3 +57,10 @@ var session_utils_1 = require("./session.utils");
|
|
|
57
57
|
Object.defineProperty(exports, "createSession", { enumerable: true, get: function () { return session_utils_1.createSession; } });
|
|
58
58
|
Object.defineProperty(exports, "getTokenTimeRemaining", { enumerable: true, get: function () { return session_utils_1.getTokenTimeRemaining; } });
|
|
59
59
|
Object.defineProperty(exports, "shouldRefreshToken", { enumerable: true, get: function () { return session_utils_1.shouldRefreshToken; } });
|
|
60
|
+
var verification_utils_1 = require("./verification.utils");
|
|
61
|
+
Object.defineProperty(exports, "generateOTP", { enumerable: true, get: function () { return verification_utils_1.generateOTP; } });
|
|
62
|
+
Object.defineProperty(exports, "getOTPExpiry", { enumerable: true, get: function () { return verification_utils_1.getOTPExpiry; } });
|
|
63
|
+
Object.defineProperty(exports, "getVerificationMethod", { enumerable: true, get: function () { return verification_utils_1.getVerificationMethod; } });
|
|
64
|
+
Object.defineProperty(exports, "sendEmail", { enumerable: true, get: function () { return verification_utils_1.sendEmail; } });
|
|
65
|
+
Object.defineProperty(exports, "sendSMS", { enumerable: true, get: function () { return verification_utils_1.sendSMS; } });
|
|
66
|
+
Object.defineProperty(exports, "sendVerificationCode", { enumerable: true, get: function () { return verification_utils_1.sendVerificationCode; } });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type VerificationMethod = "SMS" | "EMAIL";
|
|
2
|
+
export interface PendingRegistration {
|
|
3
|
+
id: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
phoneNumber: string;
|
|
7
|
+
email: string;
|
|
8
|
+
password: string;
|
|
9
|
+
nationalId: string;
|
|
10
|
+
otp: string;
|
|
11
|
+
otpExpiresAt: Date;
|
|
12
|
+
verificationMethod: VerificationMethod;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
}
|
|
15
|
+
export interface VerifyPhoneResponse {
|
|
16
|
+
available: boolean;
|
|
17
|
+
message: string;
|
|
18
|
+
method?: VerificationMethod;
|
|
19
|
+
}
|
|
20
|
+
export interface ConfirmResponse {
|
|
21
|
+
success: boolean;
|
|
22
|
+
message: string;
|
|
23
|
+
token?: string;
|
|
24
|
+
user?: any;
|
|
25
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { VerificationMethod } from "./types";
|
|
2
|
+
export declare const getVerificationMethod: () => VerificationMethod;
|
|
3
|
+
export declare const generateOTP: (length?: number) => string;
|
|
4
|
+
export declare const getOTPExpiry: (minutes?: number) => Date;
|
|
5
|
+
export declare const sendSMS: (phoneNumber: string, message: string) => Promise<boolean>;
|
|
6
|
+
export declare const sendEmail: (to: string, subject: string, html: string) => Promise<boolean>;
|
|
7
|
+
export declare const sendVerificationCode: (method: VerificationMethod, target: string, otp: string) => Promise<boolean>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.sendVerificationCode = exports.sendEmail = exports.sendSMS = exports.getOTPExpiry = exports.generateOTP = exports.getVerificationMethod = void 0;
|
|
7
|
+
const twilio_1 = __importDefault(require("twilio"));
|
|
8
|
+
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
9
|
+
// Get verification method from env
|
|
10
|
+
const getVerificationMethod = () => {
|
|
11
|
+
const method = process.env.VERIFICATION_METHOD?.toUpperCase();
|
|
12
|
+
if (method === "EMAIL")
|
|
13
|
+
return "EMAIL";
|
|
14
|
+
return "SMS"; // Default to SMS
|
|
15
|
+
};
|
|
16
|
+
exports.getVerificationMethod = getVerificationMethod;
|
|
17
|
+
// Generate OTP
|
|
18
|
+
const generateOTP = (length = 6) => {
|
|
19
|
+
const digits = "0123456789";
|
|
20
|
+
let otp = "";
|
|
21
|
+
for (let i = 0; i < length; i++) {
|
|
22
|
+
otp += digits[Math.floor(Math.random() * 10)];
|
|
23
|
+
}
|
|
24
|
+
return otp;
|
|
25
|
+
};
|
|
26
|
+
exports.generateOTP = generateOTP;
|
|
27
|
+
// Calculate OTP expiry
|
|
28
|
+
const getOTPExpiry = (minutes = 15) => {
|
|
29
|
+
const expiry = new Date();
|
|
30
|
+
expiry.setMinutes(expiry.getMinutes() + minutes);
|
|
31
|
+
return expiry;
|
|
32
|
+
};
|
|
33
|
+
exports.getOTPExpiry = getOTPExpiry;
|
|
34
|
+
// SMS Sender
|
|
35
|
+
const sendSMS = async (phoneNumber, message) => {
|
|
36
|
+
try {
|
|
37
|
+
const accountSid = process.env.TWILIO_ACCOUNT_SID;
|
|
38
|
+
const authToken = process.env.TWILIO_AUTH_TOKEN;
|
|
39
|
+
const fromNumber = process.env.TWILIO_PHONE_NUMBER;
|
|
40
|
+
if (!accountSid || !authToken || !fromNumber) {
|
|
41
|
+
console.error("Twilio credentials not configured");
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const client = (0, twilio_1.default)(accountSid, authToken);
|
|
45
|
+
await client.messages.create({
|
|
46
|
+
body: message,
|
|
47
|
+
from: fromNumber,
|
|
48
|
+
to: phoneNumber,
|
|
49
|
+
});
|
|
50
|
+
console.log(`✅ SMS sent to ${phoneNumber}`);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error("Error sending SMS:", error);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.sendSMS = sendSMS;
|
|
59
|
+
// Email Sender
|
|
60
|
+
const sendEmail = async (to, subject, html) => {
|
|
61
|
+
try {
|
|
62
|
+
// Configure transporter
|
|
63
|
+
const transporter = nodemailer_1.default.createTransport({
|
|
64
|
+
host: process.env.SMTP_HOST,
|
|
65
|
+
port: parseInt(process.env.SMTP_PORT || "587"),
|
|
66
|
+
secure: false,
|
|
67
|
+
auth: {
|
|
68
|
+
user: process.env.SMTP_USER,
|
|
69
|
+
pass: process.env.SMTP_PASS,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
await transporter.sendMail({
|
|
73
|
+
from: process.env.EMAIL_FROM,
|
|
74
|
+
to,
|
|
75
|
+
subject,
|
|
76
|
+
html,
|
|
77
|
+
});
|
|
78
|
+
console.log(`✅ Email sent to ${to}`);
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error("Error sending email:", error);
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.sendEmail = sendEmail;
|
|
87
|
+
// Send verification code based on method
|
|
88
|
+
const sendVerificationCode = async (method, target, otp) => {
|
|
89
|
+
const expiryMinutes = process.env.OTP_EXPIRY_MINUTES || "15";
|
|
90
|
+
const message = `VIBRIDE - ${otp}`;
|
|
91
|
+
if (method === "SMS") {
|
|
92
|
+
// Format phone number if needed
|
|
93
|
+
const formattedPhone = target.startsWith("+") ? target : `+${target}`;
|
|
94
|
+
return await (0, exports.sendSMS)(formattedPhone, message);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const html = `
|
|
98
|
+
<div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
|
|
99
|
+
<h2>Verify Your Email</h2>
|
|
100
|
+
<p>Your verification code is:</p>
|
|
101
|
+
<h1 style="font-size: 32px; letter-spacing: 5px; background: #f4f4f4; padding: 10px; text-align: center;">${otp}</h1>
|
|
102
|
+
<p>This code will expire in ${expiryMinutes} minutes.</p>
|
|
103
|
+
<p>If you didn't request this, please ignore this email.</p>
|
|
104
|
+
</div>
|
|
105
|
+
`;
|
|
106
|
+
return await (0, exports.sendEmail)(target, "Verify Your Account", html);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
exports.sendVerificationCode = sendVerificationCode;
|
|
110
|
+
// // Africa's Talking
|
|
111
|
+
// export const sendAfricaTalkingSMS = async (phone: string, message: string) => {
|
|
112
|
+
// try {
|
|
113
|
+
// const response = await axios.post(
|
|
114
|
+
// "https://api.sandbox.africastalking.com/version1/messaging",
|
|
115
|
+
// {
|
|
116
|
+
// username: process.env.AFRICA_TALKING_USERNAME,
|
|
117
|
+
// to: phone,
|
|
118
|
+
// message: message,
|
|
119
|
+
// from: "VIBRIDE",
|
|
120
|
+
// },
|
|
121
|
+
// {
|
|
122
|
+
// headers: {
|
|
123
|
+
// apiKey: process.env.AFRICA_TALKING_API_KEY,
|
|
124
|
+
// "Content-Type": "application/x-www-form-urlencoded",
|
|
125
|
+
// },
|
|
126
|
+
// }
|
|
127
|
+
// );
|
|
128
|
+
// return response.data;
|
|
129
|
+
// } catch (error) {
|
|
130
|
+
// console.error("Africa's Talking error:", error);
|
|
131
|
+
// return null;
|
|
132
|
+
// }
|
|
133
|
+
// };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const phoneRegex: RegExp;
|
|
3
|
+
export declare const passwordRegex: RegExp;
|
|
2
4
|
export declare const riderLoginSchema: z.ZodObject<{
|
|
3
5
|
body: z.ZodObject<{
|
|
4
6
|
phoneNumber: z.ZodString;
|
|
@@ -18,16 +20,16 @@ export declare const riderLoginSchema: z.ZodObject<{
|
|
|
18
20
|
phoneNumber: string;
|
|
19
21
|
nationalId: string;
|
|
20
22
|
};
|
|
21
|
-
query?: {} | undefined;
|
|
22
23
|
params?: {} | undefined;
|
|
24
|
+
query?: {} | undefined;
|
|
23
25
|
headers?: {} | undefined;
|
|
24
26
|
}, {
|
|
25
27
|
body: {
|
|
26
28
|
phoneNumber: string;
|
|
27
29
|
nationalId: string;
|
|
28
30
|
};
|
|
29
|
-
query?: {} | undefined;
|
|
30
31
|
params?: {} | undefined;
|
|
32
|
+
query?: {} | undefined;
|
|
31
33
|
headers?: {} | undefined;
|
|
32
34
|
}>;
|
|
33
35
|
export declare const userLoginSchema: z.ZodObject<{
|
|
@@ -86,3 +88,96 @@ export declare const refreshTokenSchema: z.ZodObject<{
|
|
|
86
88
|
refreshToken: string;
|
|
87
89
|
};
|
|
88
90
|
}>;
|
|
91
|
+
export declare const registerSchema: z.ZodObject<{
|
|
92
|
+
body: z.ZodObject<{
|
|
93
|
+
firstName: z.ZodString;
|
|
94
|
+
lastName: z.ZodString;
|
|
95
|
+
phoneNumber: z.ZodString;
|
|
96
|
+
email: z.ZodOptional<z.ZodString>;
|
|
97
|
+
password: z.ZodString;
|
|
98
|
+
}, "strict", z.ZodTypeAny, {
|
|
99
|
+
phoneNumber: string;
|
|
100
|
+
password: string;
|
|
101
|
+
firstName: string;
|
|
102
|
+
lastName: string;
|
|
103
|
+
email?: string | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
phoneNumber: string;
|
|
106
|
+
password: string;
|
|
107
|
+
firstName: string;
|
|
108
|
+
lastName: string;
|
|
109
|
+
email?: string | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
body: {
|
|
113
|
+
phoneNumber: string;
|
|
114
|
+
password: string;
|
|
115
|
+
firstName: string;
|
|
116
|
+
lastName: string;
|
|
117
|
+
email?: string | undefined;
|
|
118
|
+
};
|
|
119
|
+
}, {
|
|
120
|
+
body: {
|
|
121
|
+
phoneNumber: string;
|
|
122
|
+
password: string;
|
|
123
|
+
firstName: string;
|
|
124
|
+
lastName: string;
|
|
125
|
+
email?: string | undefined;
|
|
126
|
+
};
|
|
127
|
+
}>;
|
|
128
|
+
export declare const confirmSchema: z.ZodObject<{
|
|
129
|
+
body: z.ZodObject<{
|
|
130
|
+
phoneNumber: z.ZodString;
|
|
131
|
+
otp: z.ZodString;
|
|
132
|
+
}, "strict", z.ZodTypeAny, {
|
|
133
|
+
phoneNumber: string;
|
|
134
|
+
otp: string;
|
|
135
|
+
}, {
|
|
136
|
+
phoneNumber: string;
|
|
137
|
+
otp: string;
|
|
138
|
+
}>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
body: {
|
|
141
|
+
phoneNumber: string;
|
|
142
|
+
otp: string;
|
|
143
|
+
};
|
|
144
|
+
}, {
|
|
145
|
+
body: {
|
|
146
|
+
phoneNumber: string;
|
|
147
|
+
otp: string;
|
|
148
|
+
};
|
|
149
|
+
}>;
|
|
150
|
+
export declare const verifySchema: z.ZodObject<{
|
|
151
|
+
body: z.ZodObject<{
|
|
152
|
+
phoneNumber: z.ZodString;
|
|
153
|
+
}, "strict", z.ZodTypeAny, {
|
|
154
|
+
phoneNumber: string;
|
|
155
|
+
}, {
|
|
156
|
+
phoneNumber: string;
|
|
157
|
+
}>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
body: {
|
|
160
|
+
phoneNumber: string;
|
|
161
|
+
};
|
|
162
|
+
}, {
|
|
163
|
+
body: {
|
|
164
|
+
phoneNumber: string;
|
|
165
|
+
};
|
|
166
|
+
}>;
|
|
167
|
+
export declare const resendOtpSchema: z.ZodObject<{
|
|
168
|
+
body: z.ZodObject<{
|
|
169
|
+
phoneNumber: z.ZodString;
|
|
170
|
+
}, "strict", z.ZodTypeAny, {
|
|
171
|
+
phoneNumber: string;
|
|
172
|
+
}, {
|
|
173
|
+
phoneNumber: string;
|
|
174
|
+
}>;
|
|
175
|
+
}, "strip", z.ZodTypeAny, {
|
|
176
|
+
body: {
|
|
177
|
+
phoneNumber: string;
|
|
178
|
+
};
|
|
179
|
+
}, {
|
|
180
|
+
body: {
|
|
181
|
+
phoneNumber: string;
|
|
182
|
+
};
|
|
183
|
+
}>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.refreshTokenSchema = exports.forgotPasswordSchema = exports.userLoginSchema = exports.riderLoginSchema = void 0;
|
|
3
|
+
exports.resendOtpSchema = exports.verifySchema = exports.confirmSchema = exports.registerSchema = exports.refreshTokenSchema = exports.forgotPasswordSchema = exports.userLoginSchema = exports.riderLoginSchema = exports.passwordRegex = exports.phoneRegex = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
exports.phoneRegex = /^[0-9]{10,15}$/;
|
|
6
|
+
exports.passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$/;
|
|
5
7
|
exports.riderLoginSchema = zod_1.z.object({
|
|
6
8
|
body: zod_1.z.object({
|
|
7
9
|
phoneNumber: zod_1.z
|
|
@@ -31,3 +33,44 @@ exports.refreshTokenSchema = zod_1.z.object({
|
|
|
31
33
|
refreshToken: zod_1.z.string().min(1, "Refresh token is required"),
|
|
32
34
|
}),
|
|
33
35
|
});
|
|
36
|
+
exports.registerSchema = zod_1.z.object({
|
|
37
|
+
body: zod_1.z
|
|
38
|
+
.object({
|
|
39
|
+
firstName: zod_1.z
|
|
40
|
+
.string()
|
|
41
|
+
.min(2, "First name must be at least 2 characters")
|
|
42
|
+
.max(50, "First name too long"),
|
|
43
|
+
lastName: zod_1.z
|
|
44
|
+
.string()
|
|
45
|
+
.min(2, "Last name must be at least 2 characters")
|
|
46
|
+
.max(50, "Last name too long"),
|
|
47
|
+
phoneNumber: zod_1.z.string().regex(exports.phoneRegex, "Invalid phone number format"),
|
|
48
|
+
email: zod_1.z.string().email("Invalid email format").optional(),
|
|
49
|
+
password: zod_1.z
|
|
50
|
+
.string()
|
|
51
|
+
.regex(exports.passwordRegex, "Password must be at least 6 characters with at least one letter and one number"),
|
|
52
|
+
})
|
|
53
|
+
.strict(),
|
|
54
|
+
});
|
|
55
|
+
exports.confirmSchema = zod_1.z.object({
|
|
56
|
+
body: zod_1.z
|
|
57
|
+
.object({
|
|
58
|
+
phoneNumber: zod_1.z.string().regex(exports.phoneRegex, "Invalid phone number format"),
|
|
59
|
+
otp: zod_1.z.string().length(6, "OTP must be 6 digits"),
|
|
60
|
+
})
|
|
61
|
+
.strict(),
|
|
62
|
+
});
|
|
63
|
+
exports.verifySchema = zod_1.z.object({
|
|
64
|
+
body: zod_1.z
|
|
65
|
+
.object({
|
|
66
|
+
phoneNumber: zod_1.z.string().regex(exports.phoneRegex, "Invalid phone number format"),
|
|
67
|
+
})
|
|
68
|
+
.strict(),
|
|
69
|
+
});
|
|
70
|
+
exports.resendOtpSchema = zod_1.z.object({
|
|
71
|
+
body: zod_1.z
|
|
72
|
+
.object({
|
|
73
|
+
phoneNumber: zod_1.z.string().regex(exports.phoneRegex, "Invalid phone number format"),
|
|
74
|
+
})
|
|
75
|
+
.strict(),
|
|
76
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { validate } from "./validate.validations";
|
|
2
|
-
export { riderLoginSchema, forgotPasswordSchema, userLoginSchema, refreshTokenSchema, } from "./auth.validations";
|
|
2
|
+
export { riderLoginSchema, forgotPasswordSchema, userLoginSchema, refreshTokenSchema, registerSchema, confirmSchema, verifySchema, resendOtpSchema, } from "./auth.validations";
|
|
3
3
|
export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUsersSchema, viewProfileSchema, passengerSignupSchema, updatePassengerProfileSchema, updateRiderProfileSchema, createRiderSchema, changePasswordSchema, deactivateAccountSchema, deleteAccountSchema, } from "./profiles.validations";
|
|
4
4
|
export { listBansSchema, listPendingAppealsSchema, listSuspensionsSchema, reviewAppealSchema, revokeBanSchema, revokeSuspensionSchema, extendSuspensionSchema, exportBansSchema, } from "./moderation.validations";
|
|
5
5
|
export { submitBanAppealSchema, submitSuspensionAppealSchema, } from "./appeals.validations";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAppSpecsSchema = exports.activateAppSpecsSchema = exports.getActiveAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = exports.createSuspensionSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = exports.createBanSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.exportBansSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.reviewAppealSchema = exports.listSuspensionsSchema = exports.listPendingAppealsSchema = exports.listBansSchema = exports.deleteAccountSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
|
|
3
|
+
exports.getAppSpecsSchema = exports.activateAppSpecsSchema = exports.getActiveAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = exports.createSuspensionSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = exports.createBanSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.exportBansSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.reviewAppealSchema = exports.listSuspensionsSchema = exports.listPendingAppealsSchema = exports.listBansSchema = exports.deleteAccountSchema = exports.deactivateAccountSchema = exports.changePasswordSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.resendOtpSchema = exports.verifySchema = exports.confirmSchema = exports.registerSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
|
|
4
4
|
var validate_validations_1 = require("./validate.validations");
|
|
5
5
|
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
|
|
6
6
|
var auth_validations_1 = require("./auth.validations");
|
|
@@ -8,6 +8,10 @@ Object.defineProperty(exports, "riderLoginSchema", { enumerable: true, get: func
|
|
|
8
8
|
Object.defineProperty(exports, "forgotPasswordSchema", { enumerable: true, get: function () { return auth_validations_1.forgotPasswordSchema; } });
|
|
9
9
|
Object.defineProperty(exports, "userLoginSchema", { enumerable: true, get: function () { return auth_validations_1.userLoginSchema; } });
|
|
10
10
|
Object.defineProperty(exports, "refreshTokenSchema", { enumerable: true, get: function () { return auth_validations_1.refreshTokenSchema; } });
|
|
11
|
+
Object.defineProperty(exports, "registerSchema", { enumerable: true, get: function () { return auth_validations_1.registerSchema; } });
|
|
12
|
+
Object.defineProperty(exports, "confirmSchema", { enumerable: true, get: function () { return auth_validations_1.confirmSchema; } });
|
|
13
|
+
Object.defineProperty(exports, "verifySchema", { enumerable: true, get: function () { return auth_validations_1.verifySchema; } });
|
|
14
|
+
Object.defineProperty(exports, "resendOtpSchema", { enumerable: true, get: function () { return auth_validations_1.resendOtpSchema; } });
|
|
11
15
|
var profiles_validations_1 = require("./profiles.validations");
|
|
12
16
|
// Admin/Super Admin Schema
|
|
13
17
|
Object.defineProperty(exports, "createUserSchema", { enumerable: true, get: function () { return profiles_validations_1.createUserSchema; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vr-commons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.55",
|
|
4
4
|
"description": "Shared functions package",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"bcryptjs": "^1.x || ^2.x || ^3.x || ^4.x || ^5.x",
|
|
53
53
|
"date-fns": "^1.x || ^2.x || ^3.x || ^4.x || ^5.x",
|
|
54
54
|
"express": "^4.x || ^5.x || ^6.x",
|
|
55
|
-
"vr-models": "^1.x || ^2.x || ^3.x || ^4.x || ^5.x",
|
|
56
55
|
"jsonwebtoken": "^8.x || ^9.x || ^10.x",
|
|
57
56
|
"ua-parser-js": "^0.x || ^1.x || ^2.x",
|
|
57
|
+
"vr-models": "^1.x || ^2.x || ^3.x || ^4.x || ^5.x",
|
|
58
58
|
"zod": "^3.x || ^4.x || ^5.x"
|
|
59
59
|
},
|
|
60
60
|
"peerDependenciesMeta": {
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"@types/uuid": "^10.0.0",
|
|
99
99
|
"axios": "^1.9.0",
|
|
100
100
|
"date-fns": "^4.1.0",
|
|
101
|
-
"vr-models": "^1.0.37",
|
|
102
101
|
"rimraf": "^5.0.5",
|
|
103
102
|
"typescript": "^5.3.3",
|
|
103
|
+
"vr-models": "^1.0.37",
|
|
104
104
|
"zod": "^3.25.20"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
"dayjs": "^1.11.13",
|
|
111
111
|
"google-auth-library": "^9.15.1",
|
|
112
112
|
"nodemailer": "^7.0.3",
|
|
113
|
-
"socket.io": "^4.8.1"
|
|
113
|
+
"socket.io": "^4.8.1",
|
|
114
|
+
"twilio": "^5.13.1"
|
|
114
115
|
}
|
|
115
116
|
}
|