vr-commons 1.0.66 → 1.0.68

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.
@@ -0,0 +1,89 @@
1
+ import { z } from "zod";
2
+ export declare const updateProfileSchema: z.ZodObject<{
3
+ body: z.ZodObject<{
4
+ firstName: z.ZodOptional<z.ZodString>;
5
+ lastName: z.ZodOptional<z.ZodString>;
6
+ plateNumber: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ firstName?: string | undefined;
9
+ lastName?: string | undefined;
10
+ plateNumber?: string | undefined;
11
+ }, {
12
+ firstName?: string | undefined;
13
+ lastName?: string | undefined;
14
+ plateNumber?: string | undefined;
15
+ }>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ body: {
18
+ firstName?: string | undefined;
19
+ lastName?: string | undefined;
20
+ plateNumber?: string | undefined;
21
+ };
22
+ }, {
23
+ body: {
24
+ firstName?: string | undefined;
25
+ lastName?: string | undefined;
26
+ plateNumber?: string | undefined;
27
+ };
28
+ }>;
29
+ export declare const requestPhoneChangeSchema: z.ZodObject<{
30
+ body: z.ZodObject<{
31
+ newPhoneNumber: z.ZodString;
32
+ }, "strip", z.ZodTypeAny, {
33
+ newPhoneNumber: string;
34
+ }, {
35
+ newPhoneNumber: string;
36
+ }>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ body: {
39
+ newPhoneNumber: string;
40
+ };
41
+ }, {
42
+ body: {
43
+ newPhoneNumber: string;
44
+ };
45
+ }>;
46
+ export declare const verifyPhoneChangeSchema: z.ZodObject<{
47
+ body: z.ZodObject<{
48
+ oldPhoneOtp: z.ZodString;
49
+ newPhoneOtp: z.ZodString;
50
+ }, "strip", z.ZodTypeAny, {
51
+ oldPhoneOtp: string;
52
+ newPhoneOtp: string;
53
+ }, {
54
+ oldPhoneOtp: string;
55
+ newPhoneOtp: string;
56
+ }>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ body: {
59
+ oldPhoneOtp: string;
60
+ newPhoneOtp: string;
61
+ };
62
+ }, {
63
+ body: {
64
+ oldPhoneOtp: string;
65
+ newPhoneOtp: string;
66
+ };
67
+ }>;
68
+ export declare const deleteAccountSchema: z.ZodObject<{
69
+ body: z.ZodObject<{
70
+ confirmation: z.ZodLiteral<"DELETE">;
71
+ reason: z.ZodOptional<z.ZodString>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ confirmation: "DELETE";
74
+ reason?: string | undefined;
75
+ }, {
76
+ confirmation: "DELETE";
77
+ reason?: string | undefined;
78
+ }>;
79
+ }, "strip", z.ZodTypeAny, {
80
+ body: {
81
+ confirmation: "DELETE";
82
+ reason?: string | undefined;
83
+ };
84
+ }, {
85
+ body: {
86
+ confirmation: "DELETE";
87
+ reason?: string | undefined;
88
+ };
89
+ }>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteAccountSchema = exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.updateProfileSchema = void 0;
4
+ // src/modules/account/validations/account.schema.ts
5
+ const zod_1 = require("zod");
6
+ const phoneRegex = /^\+?[0-9]{10,15}$/;
7
+ const plateRegex = /^[A-Z0-9]{3,10}$/i;
8
+ exports.updateProfileSchema = zod_1.z.object({
9
+ body: zod_1.z.object({
10
+ firstName: zod_1.z.string().min(2).max(50).optional(),
11
+ lastName: zod_1.z.string().min(2).max(50).optional(),
12
+ plateNumber: zod_1.z
13
+ .string()
14
+ .regex(plateRegex, "Invalid plate number")
15
+ .optional(),
16
+ // Note: jacketId and nationalId are admin-only, not here
17
+ }),
18
+ });
19
+ exports.requestPhoneChangeSchema = zod_1.z.object({
20
+ body: zod_1.z.object({
21
+ newPhoneNumber: zod_1.z.string().regex(phoneRegex, "Invalid phone number format"),
22
+ }),
23
+ });
24
+ exports.verifyPhoneChangeSchema = zod_1.z.object({
25
+ body: zod_1.z.object({
26
+ oldPhoneOtp: zod_1.z.string().length(6, "OTP must be 6 digits"),
27
+ newPhoneOtp: zod_1.z.string().length(6, "OTP must be 6 digits"),
28
+ }),
29
+ });
30
+ exports.deleteAccountSchema = zod_1.z.object({
31
+ body: zod_1.z.object({
32
+ confirmation: zod_1.z.literal("DELETE", {
33
+ errorMap: () => ({ message: 'Type "DELETE" to confirm' }),
34
+ }),
35
+ reason: zod_1.z.string().max(500).optional(),
36
+ }),
37
+ });
@@ -6,30 +6,30 @@ export declare const riderLoginSchema: z.ZodObject<{
6
6
  phoneNumber: z.ZodString;
7
7
  nationalId: z.ZodString;
8
8
  }, "strip", z.ZodTypeAny, {
9
- nationalId: string;
10
9
  phoneNumber: string;
11
- }, {
12
10
  nationalId: string;
11
+ }, {
13
12
  phoneNumber: string;
13
+ nationalId: string;
14
14
  }>;
15
15
  query: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
16
16
  params: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
17
17
  headers: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
18
18
  }, "strip", z.ZodTypeAny, {
19
19
  body: {
20
- nationalId: string;
21
20
  phoneNumber: string;
21
+ nationalId: string;
22
22
  };
23
- query?: {} | undefined;
24
23
  params?: {} | undefined;
24
+ query?: {} | undefined;
25
25
  headers?: {} | undefined;
26
26
  }, {
27
27
  body: {
28
- nationalId: string;
29
28
  phoneNumber: string;
29
+ nationalId: string;
30
30
  };
31
- query?: {} | undefined;
32
31
  params?: {} | undefined;
32
+ query?: {} | undefined;
33
33
  headers?: {} | undefined;
34
34
  }>;
35
35
  export declare const userLoginSchema: z.ZodObject<{
@@ -37,21 +37,21 @@ export declare const userLoginSchema: z.ZodObject<{
37
37
  email: z.ZodString;
38
38
  password: z.ZodString;
39
39
  }, "strip", z.ZodTypeAny, {
40
- password: string;
41
40
  email: string;
42
- }, {
43
41
  password: string;
42
+ }, {
44
43
  email: string;
44
+ password: string;
45
45
  }>;
46
46
  }, "strip", z.ZodTypeAny, {
47
47
  body: {
48
- password: string;
49
48
  email: string;
49
+ password: string;
50
50
  };
51
51
  }, {
52
52
  body: {
53
- password: string;
54
53
  email: string;
54
+ password: string;
55
55
  };
56
56
  }>;
57
57
  export declare const forgotPasswordSchema: z.ZodObject<{
@@ -96,78 +96,98 @@ export declare const registerSchema: z.ZodObject<{
96
96
  email: z.ZodOptional<z.ZodString>;
97
97
  password: z.ZodString;
98
98
  }, "strict", z.ZodTypeAny, {
99
+ phoneNumber: string;
99
100
  password: string;
100
101
  firstName: string;
101
102
  lastName: string;
102
- phoneNumber: string;
103
103
  email?: string | undefined;
104
104
  }, {
105
+ phoneNumber: string;
105
106
  password: string;
106
107
  firstName: string;
107
108
  lastName: string;
108
- phoneNumber: string;
109
109
  email?: string | undefined;
110
110
  }>;
111
111
  }, "strip", z.ZodTypeAny, {
112
112
  body: {
113
+ phoneNumber: string;
113
114
  password: string;
114
115
  firstName: string;
115
116
  lastName: string;
116
- phoneNumber: string;
117
117
  email?: string | undefined;
118
118
  };
119
119
  }, {
120
120
  body: {
121
+ phoneNumber: string;
121
122
  password: string;
122
123
  firstName: string;
123
124
  lastName: string;
124
- phoneNumber: string;
125
125
  email?: string | undefined;
126
126
  };
127
127
  }>;
128
- export declare const confirmSchema: z.ZodObject<{
128
+ export declare const requestOtpSchema: z.ZodObject<{
129
129
  body: z.ZodObject<{
130
130
  phoneNumber: z.ZodString;
131
- otp: z.ZodString;
132
- }, "strict", z.ZodTypeAny, {
133
- otp: string;
131
+ }, "strip", z.ZodTypeAny, {
134
132
  phoneNumber: string;
135
133
  }, {
136
- otp: string;
137
134
  phoneNumber: string;
138
135
  }>;
139
136
  }, "strip", z.ZodTypeAny, {
140
137
  body: {
141
- otp: string;
142
138
  phoneNumber: string;
143
139
  };
144
140
  }, {
145
141
  body: {
146
- otp: string;
147
142
  phoneNumber: string;
148
143
  };
149
144
  }>;
150
- export declare const verifySchema: z.ZodObject<{
151
- body: z.ZodObject<{
145
+ export declare const verifyOtpSchema: z.ZodObject<{
146
+ body: z.ZodEffects<z.ZodObject<{
152
147
  phoneNumber: z.ZodString;
153
- }, "strict", z.ZodTypeAny, {
148
+ otp: z.ZodString;
149
+ firstName: z.ZodOptional<z.ZodString>;
150
+ lastName: z.ZodOptional<z.ZodString>;
151
+ }, "strip", z.ZodTypeAny, {
152
+ phoneNumber: string;
153
+ otp: string;
154
+ firstName?: string | undefined;
155
+ lastName?: string | undefined;
156
+ }, {
157
+ phoneNumber: string;
158
+ otp: string;
159
+ firstName?: string | undefined;
160
+ lastName?: string | undefined;
161
+ }>, {
154
162
  phoneNumber: string;
163
+ otp: string;
164
+ firstName?: string | undefined;
165
+ lastName?: string | undefined;
155
166
  }, {
156
167
  phoneNumber: string;
168
+ otp: string;
169
+ firstName?: string | undefined;
170
+ lastName?: string | undefined;
157
171
  }>;
158
172
  }, "strip", z.ZodTypeAny, {
159
173
  body: {
160
174
  phoneNumber: string;
175
+ otp: string;
176
+ firstName?: string | undefined;
177
+ lastName?: string | undefined;
161
178
  };
162
179
  }, {
163
180
  body: {
164
181
  phoneNumber: string;
182
+ otp: string;
183
+ firstName?: string | undefined;
184
+ lastName?: string | undefined;
165
185
  };
166
186
  }>;
167
187
  export declare const resendOtpSchema: z.ZodObject<{
168
188
  body: z.ZodObject<{
169
189
  phoneNumber: z.ZodString;
170
- }, "strict", z.ZodTypeAny, {
190
+ }, "strip", z.ZodTypeAny, {
171
191
  phoneNumber: string;
172
192
  }, {
173
193
  phoneNumber: string;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resendOtpSchema = exports.verifySchema = exports.confirmSchema = exports.registerSchema = exports.refreshTokenSchema = exports.forgotPasswordSchema = exports.userLoginSchema = exports.riderLoginSchema = exports.passwordRegex = exports.phoneRegex = void 0;
3
+ exports.resendOtpSchema = exports.verifyOtpSchema = exports.requestOtpSchema = 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}$/;
5
+ exports.phoneRegex = /^\+?[0-9]{10,15}$/;
6
6
  exports.passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$/;
7
7
  exports.riderLoginSchema = zod_1.z.object({
8
8
  body: zod_1.z.object({
@@ -52,25 +52,40 @@ exports.registerSchema = zod_1.z.object({
52
52
  })
53
53
  .strict(),
54
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(),
55
+ exports.requestOtpSchema = zod_1.z.object({
56
+ body: zod_1.z.object({
57
+ phoneNumber: zod_1.z
58
+ .string()
59
+ .regex(exports.phoneRegex, "Invalid phone number format. Use format: +250788123456"),
60
+ }),
62
61
  });
63
- exports.verifySchema = zod_1.z.object({
62
+ exports.verifyOtpSchema = zod_1.z.object({
64
63
  body: zod_1.z
65
64
  .object({
66
65
  phoneNumber: zod_1.z.string().regex(exports.phoneRegex, "Invalid phone number format"),
66
+ otp: zod_1.z.string().length(6, "OTP must be 6 digits"),
67
+ firstName: zod_1.z
68
+ .string()
69
+ .min(2, "First name must be at least 2 characters")
70
+ .max(50)
71
+ .optional(),
72
+ lastName: zod_1.z
73
+ .string()
74
+ .min(2, "Last name must be at least 2 characters")
75
+ .max(50)
76
+ .optional(),
67
77
  })
68
- .strict(),
78
+ .refine((data) => {
79
+ // If it's a new user, firstName and lastName are required
80
+ // We'll check this in service by checking if user exists
81
+ return true;
82
+ }, {
83
+ message: "First name and last name are required for new users",
84
+ path: ["firstName", "lastName"],
85
+ }),
69
86
  });
70
87
  exports.resendOtpSchema = zod_1.z.object({
71
- body: zod_1.z
72
- .object({
88
+ body: zod_1.z.object({
73
89
  phoneNumber: zod_1.z.string().regex(exports.phoneRegex, "Invalid phone number format"),
74
- })
75
- .strict(),
90
+ }),
76
91
  });
@@ -1,6 +1,6 @@
1
1
  export { validate } from "./validate.validations";
2
- export { riderLoginSchema, forgotPasswordSchema, userLoginSchema, refreshTokenSchema, registerSchema, confirmSchema, verifySchema, resendOtpSchema, } from "./auth.validations";
3
- export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUsersSchema, viewProfileSchema, passengerSignupSchema, updatePassengerProfileSchema, updateRiderProfileSchema, createRiderSchema, changePasswordSchema, deactivateAccountSchema, deleteAccountSchema, updateProfileSchema, } from "./profiles.validations";
2
+ export { riderLoginSchema, forgotPasswordSchema, userLoginSchema, refreshTokenSchema, registerSchema, verifyOtpSchema, resendOtpSchema, requestOtpSchema, } from "./auth.validations";
3
+ export { createUserSchema, getUserByIdSchema, updateUserProfileSchema, getAllUsersSchema, viewProfileSchema, passengerSignupSchema, updatePassengerProfileSchema, updateRiderProfileSchema, createRiderSchema, changePasswordSchema, deactivateAccountSchema, } 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";
6
6
  export { getBanSchema, getUserRestrictionsSchema, createBanSchema, } from "./bans.validations";
@@ -9,3 +9,4 @@ export { createAppSpecsSchema, updateAppSpecsSchema, listAppSpecsSchema, getActi
9
9
  export { listUserPaymentPlansSchema, getUserPaymentPlanSchema, } from "./devicePaymentPlan.validations";
10
10
  export { unlockDeviceSchema, extendSessionSchema } from "./devices.validations";
11
11
  export { payInstallmentSchema } from "./payinstallment.validations";
12
+ export { updateProfileSchema, requestPhoneChangeSchema, verifyPhoneChangeSchema, deleteAccountSchema, } from "./account.validations";
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.payInstallmentSchema = exports.extendSessionSchema = exports.unlockDeviceSchema = exports.getUserPaymentPlanSchema = exports.listUserPaymentPlansSchema = 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.updateProfileSchema = 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;
3
+ exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.updateProfileSchema = exports.payInstallmentSchema = exports.extendSessionSchema = exports.unlockDeviceSchema = exports.getUserPaymentPlanSchema = exports.listUserPaymentPlansSchema = 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.deactivateAccountSchema = exports.changePasswordSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.requestOtpSchema = exports.resendOtpSchema = exports.verifyOtpSchema = exports.registerSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
4
+ exports.deleteAccountSchema = void 0;
4
5
  var validate_validations_1 = require("./validate.validations");
5
6
  Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
6
7
  var auth_validations_1 = require("./auth.validations");
@@ -9,9 +10,9 @@ Object.defineProperty(exports, "forgotPasswordSchema", { enumerable: true, get:
9
10
  Object.defineProperty(exports, "userLoginSchema", { enumerable: true, get: function () { return auth_validations_1.userLoginSchema; } });
10
11
  Object.defineProperty(exports, "refreshTokenSchema", { enumerable: true, get: function () { return auth_validations_1.refreshTokenSchema; } });
11
12
  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; } });
13
+ Object.defineProperty(exports, "verifyOtpSchema", { enumerable: true, get: function () { return auth_validations_1.verifyOtpSchema; } });
14
14
  Object.defineProperty(exports, "resendOtpSchema", { enumerable: true, get: function () { return auth_validations_1.resendOtpSchema; } });
15
+ Object.defineProperty(exports, "requestOtpSchema", { enumerable: true, get: function () { return auth_validations_1.requestOtpSchema; } });
15
16
  var profiles_validations_1 = require("./profiles.validations");
16
17
  // Admin/Super Admin Schema
17
18
  Object.defineProperty(exports, "createUserSchema", { enumerable: true, get: function () { return profiles_validations_1.createUserSchema; } });
@@ -29,8 +30,6 @@ Object.defineProperty(exports, "createRiderSchema", { enumerable: true, get: fun
29
30
  // Account Management Schemas
30
31
  Object.defineProperty(exports, "changePasswordSchema", { enumerable: true, get: function () { return profiles_validations_1.changePasswordSchema; } });
31
32
  Object.defineProperty(exports, "deactivateAccountSchema", { enumerable: true, get: function () { return profiles_validations_1.deactivateAccountSchema; } });
32
- Object.defineProperty(exports, "deleteAccountSchema", { enumerable: true, get: function () { return profiles_validations_1.deleteAccountSchema; } });
33
- Object.defineProperty(exports, "updateProfileSchema", { enumerable: true, get: function () { return profiles_validations_1.updateProfileSchema; } });
34
33
  var moderation_validations_1 = require("./moderation.validations");
35
34
  Object.defineProperty(exports, "listBansSchema", { enumerable: true, get: function () { return moderation_validations_1.listBansSchema; } });
36
35
  Object.defineProperty(exports, "listPendingAppealsSchema", { enumerable: true, get: function () { return moderation_validations_1.listPendingAppealsSchema; } });
@@ -66,3 +65,8 @@ Object.defineProperty(exports, "unlockDeviceSchema", { enumerable: true, get: fu
66
65
  Object.defineProperty(exports, "extendSessionSchema", { enumerable: true, get: function () { return devices_validations_1.extendSessionSchema; } });
67
66
  var payinstallment_validations_1 = require("./payinstallment.validations");
68
67
  Object.defineProperty(exports, "payInstallmentSchema", { enumerable: true, get: function () { return payinstallment_validations_1.payInstallmentSchema; } });
68
+ var account_validations_1 = require("./account.validations");
69
+ Object.defineProperty(exports, "updateProfileSchema", { enumerable: true, get: function () { return account_validations_1.updateProfileSchema; } });
70
+ Object.defineProperty(exports, "requestPhoneChangeSchema", { enumerable: true, get: function () { return account_validations_1.requestPhoneChangeSchema; } });
71
+ Object.defineProperty(exports, "verifyPhoneChangeSchema", { enumerable: true, get: function () { return account_validations_1.verifyPhoneChangeSchema; } });
72
+ Object.defineProperty(exports, "deleteAccountSchema", { enumerable: true, get: function () { return account_validations_1.deleteAccountSchema; } });
@@ -21,21 +21,21 @@ export declare const payInstallmentSchema: z.ZodObject<{
21
21
  provider?: "mtn_momo" | "airtel_money" | undefined;
22
22
  }>;
23
23
  }, "strip", z.ZodTypeAny, {
24
+ params: {
25
+ planId: string;
26
+ installmentId: string;
27
+ };
24
28
  body: {
25
29
  phoneNumber: string;
26
30
  provider: "mtn_momo" | "airtel_money";
27
31
  };
32
+ }, {
28
33
  params: {
29
34
  planId: string;
30
35
  installmentId: string;
31
36
  };
32
- }, {
33
37
  body: {
34
38
  phoneNumber: string;
35
39
  provider?: "mtn_momo" | "airtel_money" | undefined;
36
40
  };
37
- params: {
38
- planId: string;
39
- installmentId: string;
40
- };
41
41
  }>;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.payInstallmentSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const uuidSchema = zod_1.z.string().uuid("Invalid ID format");
6
- const phoneRegex = /^(\+?250|0)?[7-9][0-9]{8}$/;
6
+ const phoneRegex = /^\+?[0-9]{10,15}$/;
7
7
  exports.payInstallmentSchema = zod_1.z.object({
8
8
  params: zod_1.z.object({
9
9
  planId: uuidSchema,
@@ -15,25 +15,25 @@ export declare const createUserSchema: z.ZodObject<{
15
15
  plateNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
16
16
  jacketId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
17
17
  }, "strip", z.ZodTypeAny, {
18
- role: "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN";
18
+ phoneNumber: string;
19
+ nationalId: string;
19
20
  password: string;
20
21
  firstName: string;
21
22
  lastName: string;
22
- nationalId: string;
23
- phoneNumber: string;
24
- jacketId?: string | null | undefined;
23
+ role: "AGENT" | "RIDER" | "PASSENGER" | "ADMIN" | "SUPER_ADMIN";
25
24
  email?: string | null | undefined;
26
25
  plateNumber?: string | null | undefined;
26
+ jacketId?: string | null | undefined;
27
27
  }, {
28
- role: "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN";
28
+ phoneNumber: string;
29
+ nationalId: string;
29
30
  password: string;
30
31
  firstName: string;
31
32
  lastName: string;
32
- nationalId: string;
33
- phoneNumber: string;
34
- jacketId?: string | null | undefined;
33
+ role: "AGENT" | "RIDER" | "PASSENGER" | "ADMIN" | "SUPER_ADMIN";
35
34
  email?: string | null | undefined;
36
35
  plateNumber?: string | null | undefined;
36
+ jacketId?: string | null | undefined;
37
37
  }>;
38
38
  headers: z.ZodObject<{
39
39
  authorization: z.ZodString;
@@ -44,30 +44,30 @@ export declare const createUserSchema: z.ZodObject<{
44
44
  }>;
45
45
  }, "strip", z.ZodTypeAny, {
46
46
  body: {
47
- role: "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN";
47
+ phoneNumber: string;
48
+ nationalId: string;
48
49
  password: string;
49
50
  firstName: string;
50
51
  lastName: string;
51
- nationalId: string;
52
- phoneNumber: string;
53
- jacketId?: string | null | undefined;
52
+ role: "AGENT" | "RIDER" | "PASSENGER" | "ADMIN" | "SUPER_ADMIN";
54
53
  email?: string | null | undefined;
55
54
  plateNumber?: string | null | undefined;
55
+ jacketId?: string | null | undefined;
56
56
  };
57
57
  headers: {
58
58
  authorization: string;
59
59
  };
60
60
  }, {
61
61
  body: {
62
- role: "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN";
62
+ phoneNumber: string;
63
+ nationalId: string;
63
64
  password: string;
64
65
  firstName: string;
65
66
  lastName: string;
66
- nationalId: string;
67
- phoneNumber: string;
68
- jacketId?: string | null | undefined;
67
+ role: "AGENT" | "RIDER" | "PASSENGER" | "ADMIN" | "SUPER_ADMIN";
69
68
  email?: string | null | undefined;
70
69
  plateNumber?: string | null | undefined;
70
+ jacketId?: string | null | undefined;
71
71
  };
72
72
  headers: {
73
73
  authorization: string;
@@ -122,45 +122,45 @@ export declare const updateUserProfileSchema: z.ZodObject<{
122
122
  isDeactivated: z.ZodOptional<z.ZodBoolean>;
123
123
  password: z.ZodOptional<z.ZodString>;
124
124
  }, "strip", z.ZodTypeAny, {
125
+ phoneNumber?: string | undefined;
126
+ email?: string | null | undefined;
125
127
  password?: string | undefined;
126
128
  firstName?: string | undefined;
127
129
  lastName?: string | undefined;
128
- email?: string | null | undefined;
129
130
  plateNumber?: string | null | undefined;
130
131
  isActive?: boolean | undefined;
131
- isDeactivated?: boolean | undefined;
132
- phoneNumber?: string | undefined;
133
132
  isSuspended?: boolean | undefined;
133
+ isDeactivated?: boolean | undefined;
134
134
  }, {
135
+ phoneNumber?: string | undefined;
136
+ email?: string | null | undefined;
135
137
  password?: string | undefined;
136
138
  firstName?: string | undefined;
137
139
  lastName?: string | undefined;
138
- email?: string | null | undefined;
139
140
  plateNumber?: string | null | undefined;
140
141
  isActive?: boolean | undefined;
141
- isDeactivated?: boolean | undefined;
142
- phoneNumber?: string | undefined;
143
142
  isSuspended?: boolean | undefined;
143
+ isDeactivated?: boolean | undefined;
144
144
  }>, {
145
+ phoneNumber?: string | undefined;
146
+ email?: string | null | undefined;
145
147
  password?: string | undefined;
146
148
  firstName?: string | undefined;
147
149
  lastName?: string | undefined;
148
- email?: string | null | undefined;
149
150
  plateNumber?: string | null | undefined;
150
151
  isActive?: boolean | undefined;
151
- isDeactivated?: boolean | undefined;
152
- phoneNumber?: string | undefined;
153
152
  isSuspended?: boolean | undefined;
153
+ isDeactivated?: boolean | undefined;
154
154
  }, {
155
+ phoneNumber?: string | undefined;
156
+ email?: string | null | undefined;
155
157
  password?: string | undefined;
156
158
  firstName?: string | undefined;
157
159
  lastName?: string | undefined;
158
- email?: string | null | undefined;
159
160
  plateNumber?: string | null | undefined;
160
161
  isActive?: boolean | undefined;
161
- isDeactivated?: boolean | undefined;
162
- phoneNumber?: string | undefined;
163
162
  isSuspended?: boolean | undefined;
163
+ isDeactivated?: boolean | undefined;
164
164
  }>;
165
165
  headers: z.ZodObject<{
166
166
  authorization: z.ZodString;
@@ -170,37 +170,37 @@ export declare const updateUserProfileSchema: z.ZodObject<{
170
170
  authorization: string;
171
171
  }>;
172
172
  }, "strip", z.ZodTypeAny, {
173
+ params: {
174
+ userId: string;
175
+ };
173
176
  body: {
177
+ phoneNumber?: string | undefined;
178
+ email?: string | null | undefined;
174
179
  password?: string | undefined;
175
180
  firstName?: string | undefined;
176
181
  lastName?: string | undefined;
177
- email?: string | null | undefined;
178
182
  plateNumber?: string | null | undefined;
179
183
  isActive?: boolean | undefined;
180
- isDeactivated?: boolean | undefined;
181
- phoneNumber?: string | undefined;
182
184
  isSuspended?: boolean | undefined;
183
- };
184
- params: {
185
- userId: string;
185
+ isDeactivated?: boolean | undefined;
186
186
  };
187
187
  headers: {
188
188
  authorization: string;
189
189
  };
190
190
  }, {
191
+ params: {
192
+ userId: string;
193
+ };
191
194
  body: {
195
+ phoneNumber?: string | undefined;
196
+ email?: string | null | undefined;
192
197
  password?: string | undefined;
193
198
  firstName?: string | undefined;
194
199
  lastName?: string | undefined;
195
- email?: string | null | undefined;
196
200
  plateNumber?: string | null | undefined;
197
201
  isActive?: boolean | undefined;
198
- isDeactivated?: boolean | undefined;
199
- phoneNumber?: string | undefined;
200
202
  isSuspended?: boolean | undefined;
201
- };
202
- params: {
203
- userId: string;
203
+ isDeactivated?: boolean | undefined;
204
204
  };
205
205
  headers: {
206
206
  authorization: string;
@@ -220,29 +220,29 @@ export declare const getAllUsersSchema: z.ZodObject<{
220
220
  sortBy: z.ZodDefault<z.ZodEnum<["firstName", "lastLoginAt", "createdAt"]>>;
221
221
  order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
222
222
  }, "strip", z.ZodTypeAny, {
223
- order: "desc" | "asc";
224
- sortBy: "createdAt" | "firstName" | "lastLoginAt";
225
- role?: "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN" | undefined;
226
- search?: string | undefined;
227
- limit?: number | undefined;
223
+ sortBy: "firstName" | "lastLoginAt" | "createdAt";
224
+ order: "asc" | "desc";
225
+ role?: "AGENT" | "RIDER" | "PASSENGER" | "ADMIN" | "SUPER_ADMIN" | undefined;
228
226
  isActive?: boolean | undefined;
229
227
  isSuspended?: boolean | undefined;
230
228
  page?: number | undefined;
229
+ limit?: number | undefined;
231
230
  isBanned?: boolean | undefined;
231
+ search?: string | undefined;
232
232
  startDate?: string | undefined;
233
233
  endDate?: string | undefined;
234
234
  }, {
235
- role?: "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN" | undefined;
236
- search?: string | undefined;
237
- limit?: string | undefined;
238
- order?: "desc" | "asc" | undefined;
235
+ role?: "AGENT" | "RIDER" | "PASSENGER" | "ADMIN" | "SUPER_ADMIN" | undefined;
239
236
  isActive?: "true" | "false" | undefined;
240
237
  isSuspended?: "true" | "false" | undefined;
241
238
  page?: string | undefined;
239
+ limit?: string | undefined;
242
240
  isBanned?: "true" | "false" | undefined;
241
+ search?: string | undefined;
243
242
  startDate?: string | undefined;
244
243
  endDate?: string | undefined;
245
- sortBy?: "createdAt" | "firstName" | "lastLoginAt" | undefined;
244
+ sortBy?: "firstName" | "lastLoginAt" | "createdAt" | undefined;
245
+ order?: "asc" | "desc" | undefined;
246
246
  }>;
247
247
  headers: z.ZodObject<{
248
248
  authorization: z.ZodString;
@@ -253,15 +253,15 @@ export declare const getAllUsersSchema: z.ZodObject<{
253
253
  }>;
254
254
  }, "strip", z.ZodTypeAny, {
255
255
  query: {
256
- order: "desc" | "asc";
257
- sortBy: "createdAt" | "firstName" | "lastLoginAt";
258
- role?: "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN" | undefined;
259
- search?: string | undefined;
260
- limit?: number | undefined;
256
+ sortBy: "firstName" | "lastLoginAt" | "createdAt";
257
+ order: "asc" | "desc";
258
+ role?: "AGENT" | "RIDER" | "PASSENGER" | "ADMIN" | "SUPER_ADMIN" | undefined;
261
259
  isActive?: boolean | undefined;
262
260
  isSuspended?: boolean | undefined;
263
261
  page?: number | undefined;
262
+ limit?: number | undefined;
264
263
  isBanned?: boolean | undefined;
264
+ search?: string | undefined;
265
265
  startDate?: string | undefined;
266
266
  endDate?: string | undefined;
267
267
  };
@@ -270,17 +270,17 @@ export declare const getAllUsersSchema: z.ZodObject<{
270
270
  };
271
271
  }, {
272
272
  query: {
273
- role?: "RIDER" | "PASSENGER" | "AGENT" | "ADMIN" | "SUPER_ADMIN" | undefined;
274
- search?: string | undefined;
275
- limit?: string | undefined;
276
- order?: "desc" | "asc" | undefined;
273
+ role?: "AGENT" | "RIDER" | "PASSENGER" | "ADMIN" | "SUPER_ADMIN" | undefined;
277
274
  isActive?: "true" | "false" | undefined;
278
275
  isSuspended?: "true" | "false" | undefined;
279
276
  page?: string | undefined;
277
+ limit?: string | undefined;
280
278
  isBanned?: "true" | "false" | undefined;
279
+ search?: string | undefined;
281
280
  startDate?: string | undefined;
282
281
  endDate?: string | undefined;
283
- sortBy?: "createdAt" | "firstName" | "lastLoginAt" | undefined;
282
+ sortBy?: "firstName" | "lastLoginAt" | "createdAt" | undefined;
283
+ order?: "asc" | "desc" | undefined;
284
284
  };
285
285
  headers: {
286
286
  authorization: string;
@@ -301,16 +301,16 @@ export declare const viewProfileSchema: z.ZodObject<{
301
301
  headers: {
302
302
  authorization: string;
303
303
  };
304
+ params?: {} | undefined;
304
305
  body?: {} | undefined;
305
306
  query?: {} | undefined;
306
- params?: {} | undefined;
307
307
  }, {
308
308
  headers: {
309
309
  authorization: string;
310
310
  };
311
+ params?: {} | undefined;
311
312
  body?: {} | undefined;
312
313
  query?: {} | undefined;
313
- params?: {} | undefined;
314
314
  }>;
315
315
  export declare const passengerSignupSchema: z.ZodObject<{
316
316
  body: z.ZodObject<{
@@ -323,47 +323,47 @@ export declare const passengerSignupSchema: z.ZodObject<{
323
323
  password: z.ZodNullable<z.ZodOptional<z.ZodString>>;
324
324
  plateNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
325
325
  }, "strip", z.ZodTypeAny, {
326
+ phoneNumber: string;
327
+ nationalId: string;
326
328
  firstName: string;
327
329
  lastName: string;
328
- nationalId: string;
329
- phoneNumber: string;
330
- password?: string | null | undefined;
331
- jacketId?: string | undefined;
332
330
  email?: string | null | undefined;
331
+ password?: string | null | undefined;
333
332
  plateNumber?: string | null | undefined;
333
+ jacketId?: string | undefined;
334
334
  }, {
335
+ phoneNumber: string;
336
+ nationalId: string;
335
337
  firstName: string;
336
338
  lastName: string;
337
- nationalId: string;
338
- phoneNumber: string;
339
- password?: string | null | undefined;
340
- jacketId?: string | undefined;
341
339
  email?: string | null | undefined;
340
+ password?: string | null | undefined;
342
341
  plateNumber?: string | null | undefined;
342
+ jacketId?: string | undefined;
343
343
  }>;
344
344
  headers: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
345
345
  }, "strip", z.ZodTypeAny, {
346
346
  body: {
347
+ phoneNumber: string;
348
+ nationalId: string;
347
349
  firstName: string;
348
350
  lastName: string;
349
- nationalId: string;
350
- phoneNumber: string;
351
- password?: string | null | undefined;
352
- jacketId?: string | undefined;
353
351
  email?: string | null | undefined;
352
+ password?: string | null | undefined;
354
353
  plateNumber?: string | null | undefined;
354
+ jacketId?: string | undefined;
355
355
  };
356
356
  headers?: {} | undefined;
357
357
  }, {
358
358
  body: {
359
+ phoneNumber: string;
360
+ nationalId: string;
359
361
  firstName: string;
360
362
  lastName: string;
361
- nationalId: string;
362
- phoneNumber: string;
363
- password?: string | null | undefined;
364
- jacketId?: string | undefined;
365
363
  email?: string | null | undefined;
364
+ password?: string | null | undefined;
366
365
  plateNumber?: string | null | undefined;
366
+ jacketId?: string | undefined;
367
367
  };
368
368
  headers?: {} | undefined;
369
369
  }>;
@@ -420,44 +420,44 @@ export declare const createRiderSchema: z.ZodObject<{
420
420
  plateNumber: z.ZodString;
421
421
  jacketId: z.ZodString;
422
422
  }, "strip", z.ZodTypeAny, {
423
+ phoneNumber: string;
424
+ nationalId: string;
423
425
  firstName: string;
424
426
  lastName: string;
425
- jacketId: string;
426
427
  plateNumber: string;
427
- nationalId: string;
428
- phoneNumber: string;
428
+ jacketId: string;
429
429
  }, {
430
+ phoneNumber: string;
431
+ nationalId: string;
430
432
  firstName: string;
431
433
  lastName: string;
432
- jacketId: string;
433
434
  plateNumber: string;
434
- nationalId: string;
435
- phoneNumber: string;
435
+ jacketId: string;
436
436
  }>;
437
437
  params: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
438
438
  query: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
439
439
  }, "strip", z.ZodTypeAny, {
440
440
  body: {
441
+ phoneNumber: string;
442
+ nationalId: string;
441
443
  firstName: string;
442
444
  lastName: string;
443
- jacketId: string;
444
445
  plateNumber: string;
445
- nationalId: string;
446
- phoneNumber: string;
446
+ jacketId: string;
447
447
  };
448
- query?: {} | undefined;
449
448
  params?: {} | undefined;
449
+ query?: {} | undefined;
450
450
  }, {
451
451
  body: {
452
+ phoneNumber: string;
453
+ nationalId: string;
452
454
  firstName: string;
453
455
  lastName: string;
454
- jacketId: string;
455
456
  plateNumber: string;
456
- nationalId: string;
457
- phoneNumber: string;
457
+ jacketId: string;
458
458
  };
459
- query?: {} | undefined;
460
459
  params?: {} | undefined;
460
+ query?: {} | undefined;
461
461
  }>;
462
462
  export declare const updateRiderProfileSchema: z.ZodObject<{
463
463
  params: z.ZodObject<{
@@ -475,33 +475,33 @@ export declare const updateRiderProfileSchema: z.ZodObject<{
475
475
  plateNumber: z.ZodString;
476
476
  jacketId: z.ZodString;
477
477
  }, "strip", z.ZodTypeAny, {
478
+ phoneNumber: string;
479
+ nationalId: string;
478
480
  firstName: string;
479
481
  lastName: string;
480
- jacketId: string;
481
482
  plateNumber: string;
482
- nationalId: string;
483
- phoneNumber: string;
483
+ jacketId: string;
484
484
  }, {
485
+ phoneNumber: string;
486
+ nationalId: string;
485
487
  firstName: string;
486
488
  lastName: string;
487
- jacketId: string;
488
489
  plateNumber: string;
489
- nationalId: string;
490
- phoneNumber: string;
490
+ jacketId: string;
491
491
  }>, {
492
+ phoneNumber: string;
493
+ nationalId: string;
492
494
  firstName: string;
493
495
  lastName: string;
494
- jacketId: string;
495
496
  plateNumber: string;
496
- nationalId: string;
497
- phoneNumber: string;
497
+ jacketId: string;
498
498
  }, {
499
+ phoneNumber: string;
500
+ nationalId: string;
499
501
  firstName: string;
500
502
  lastName: string;
501
- jacketId: string;
502
503
  plateNumber: string;
503
- nationalId: string;
504
- phoneNumber: string;
504
+ jacketId: string;
505
505
  }>;
506
506
  query: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
507
507
  headers: z.ZodObject<{
@@ -512,32 +512,32 @@ export declare const updateRiderProfileSchema: z.ZodObject<{
512
512
  authorization: string;
513
513
  }>;
514
514
  }, "strip", z.ZodTypeAny, {
515
+ params: {
516
+ id: string;
517
+ };
515
518
  body: {
519
+ phoneNumber: string;
520
+ nationalId: string;
516
521
  firstName: string;
517
522
  lastName: string;
518
- jacketId: string;
519
523
  plateNumber: string;
520
- nationalId: string;
521
- phoneNumber: string;
522
- };
523
- params: {
524
- id: string;
524
+ jacketId: string;
525
525
  };
526
526
  headers: {
527
527
  authorization: string;
528
528
  };
529
529
  query?: {} | undefined;
530
530
  }, {
531
+ params: {
532
+ id: string;
533
+ };
531
534
  body: {
535
+ phoneNumber: string;
536
+ nationalId: string;
532
537
  firstName: string;
533
538
  lastName: string;
534
- jacketId: string;
535
539
  plateNumber: string;
536
- nationalId: string;
537
- phoneNumber: string;
538
- };
539
- params: {
540
- id: string;
540
+ jacketId: string;
541
541
  };
542
542
  headers: {
543
543
  authorization: string;
@@ -666,33 +666,33 @@ export declare const updateProfileSchema: z.ZodObject<{
666
666
  email: z.ZodOptional<z.ZodString>;
667
667
  nationalId: z.ZodOptional<z.ZodString>;
668
668
  }, "strict", z.ZodTypeAny, {
669
+ phoneNumber?: string | undefined;
670
+ nationalId?: string | undefined;
671
+ email?: string | undefined;
669
672
  firstName?: string | undefined;
670
673
  lastName?: string | undefined;
671
- email?: string | undefined;
672
- nationalId?: string | undefined;
673
- phoneNumber?: string | undefined;
674
674
  }, {
675
+ phoneNumber?: string | undefined;
676
+ nationalId?: string | undefined;
677
+ email?: string | undefined;
675
678
  firstName?: string | undefined;
676
679
  lastName?: string | undefined;
677
- email?: string | undefined;
678
- nationalId?: string | undefined;
679
- phoneNumber?: string | undefined;
680
680
  }>;
681
681
  }, "strip", z.ZodTypeAny, {
682
682
  body: {
683
+ phoneNumber?: string | undefined;
684
+ nationalId?: string | undefined;
685
+ email?: string | undefined;
683
686
  firstName?: string | undefined;
684
687
  lastName?: string | undefined;
685
- email?: string | undefined;
686
- nationalId?: string | undefined;
687
- phoneNumber?: string | undefined;
688
688
  };
689
689
  }, {
690
690
  body: {
691
+ phoneNumber?: string | undefined;
692
+ nationalId?: string | undefined;
693
+ email?: string | undefined;
691
694
  firstName?: string | undefined;
692
695
  lastName?: string | undefined;
693
- email?: string | undefined;
694
- nationalId?: string | undefined;
695
- phoneNumber?: string | undefined;
696
696
  };
697
697
  }>;
698
698
  export type CreateUserInput = z.infer<typeof createUserSchema>;
@@ -5,10 +5,10 @@ const zod_1 = require("zod");
5
5
  // ============================================================================
6
6
  // COMMON VALIDATIONS
7
7
  // ============================================================================
8
- exports.phoneNumberRegex = /^(078|079|072|073)\d{7}$/;
8
+ exports.phoneNumberRegex = /^\+?[0-9]{10,15}$/;
9
9
  exports.nationalIdRegex = /^\d{16}$/;
10
10
  exports.jacketIdRegex = /^JKT-\d{9}$/;
11
- exports.phoneRegex = /^[0-9]{10,15}$/;
11
+ exports.phoneRegex = /^\+?[0-9]{10,15}$/;
12
12
  // ============================================================================
13
13
  // ADMIN/SUPER ADMIN SCHEMAS
14
14
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-commons",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
4
4
  "description": "Shared functions package",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",