vr-commons 1.0.188 → 1.0.190
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/middlewares/index.d.ts +1 -0
- package/dist/middlewares/index.js +4 -1
- package/dist/middlewares/shared/shared.appVersion.middleware.d.ts +9 -0
- package/dist/middlewares/shared/shared.appVersion.middleware.js +175 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +9 -1
- package/dist/utils/users/users.accountRecovery.utils.d.ts +13 -0
- package/dist/utils/users/users.accountRecovery.utils.js +52 -0
- package/dist/validations/admin/admin.devicePayments.validations.d.ts +6 -6
- package/dist/validations/admin/admin.devices.validations.d.ts +12 -12
- package/dist/validations/admin/admin.eventLogs.validations.d.ts +24 -24
- package/dist/validations/admin/admin.installments.validations.d.ts +4 -4
- package/dist/validations/admin/admin.pricings.validations.d.ts +8 -8
- package/dist/validations/admin/admin.products.validations.d.ts +12 -12
- package/dist/validations/admin/admin.users.validations.d.ts +50 -50
- package/dist/validations/index.d.ts +1 -0
- package/dist/validations/index.js +5 -2
- package/dist/validations/shared/shared.account.validations.d.ts +10 -10
- package/dist/validations/shared/shared.appSpecs.validations.d.ts +70 -48
- package/dist/validations/shared/shared.appSpecs.validations.js +7 -2
- package/dist/validations/shared/shared.auth.validations.d.ts +28 -28
- package/dist/validations/shared/shared.moderation.validations.d.ts +18 -18
- package/dist/validations/shared/shared.profiles.validations.d.ts +86 -86
- package/dist/validations/users/users.accountRecovery.validations.d.ts +98 -0
- package/dist/validations/users/users.accountRecovery.validations.js +41 -0
- package/dist/validations/users/users.devicePaymentPlans.validations.d.ts +6 -6
- package/package.json +2 -2
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const requestRiderAccountRecoverySchema: z.ZodObject<{
|
|
3
|
+
body: z.ZodEffects<z.ZodObject<{
|
|
4
|
+
phoneNumber: z.ZodString;
|
|
5
|
+
plateNumber: z.ZodString;
|
|
6
|
+
birthDate: z.ZodNumber;
|
|
7
|
+
birthMonth: z.ZodNumber;
|
|
8
|
+
birthYear: z.ZodNumber;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
plateNumber: string;
|
|
11
|
+
birthDate: number;
|
|
12
|
+
birthMonth: number;
|
|
13
|
+
birthYear: number;
|
|
14
|
+
phoneNumber: string;
|
|
15
|
+
}, {
|
|
16
|
+
plateNumber: string;
|
|
17
|
+
birthDate: number;
|
|
18
|
+
birthMonth: number;
|
|
19
|
+
birthYear: number;
|
|
20
|
+
phoneNumber: string;
|
|
21
|
+
}>, {
|
|
22
|
+
plateNumber: string;
|
|
23
|
+
birthDate: number;
|
|
24
|
+
birthMonth: number;
|
|
25
|
+
birthYear: number;
|
|
26
|
+
phoneNumber: string;
|
|
27
|
+
}, {
|
|
28
|
+
plateNumber: string;
|
|
29
|
+
birthDate: number;
|
|
30
|
+
birthMonth: number;
|
|
31
|
+
birthYear: number;
|
|
32
|
+
phoneNumber: string;
|
|
33
|
+
}>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
body: {
|
|
36
|
+
plateNumber: string;
|
|
37
|
+
birthDate: number;
|
|
38
|
+
birthMonth: number;
|
|
39
|
+
birthYear: number;
|
|
40
|
+
phoneNumber: string;
|
|
41
|
+
};
|
|
42
|
+
}, {
|
|
43
|
+
body: {
|
|
44
|
+
plateNumber: string;
|
|
45
|
+
birthDate: number;
|
|
46
|
+
birthMonth: number;
|
|
47
|
+
birthYear: number;
|
|
48
|
+
phoneNumber: string;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
export declare const completeRiderAccountRecoverySchema: z.ZodEffects<z.ZodObject<{
|
|
52
|
+
body: z.ZodObject<{
|
|
53
|
+
phoneNumber: z.ZodString;
|
|
54
|
+
recoveryCode: z.ZodString;
|
|
55
|
+
newPassword: z.ZodEffects<z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>, string, string | undefined>;
|
|
56
|
+
confirmNewPassword: z.ZodString;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
newPassword: string;
|
|
59
|
+
phoneNumber: string;
|
|
60
|
+
recoveryCode: string;
|
|
61
|
+
confirmNewPassword: string;
|
|
62
|
+
}, {
|
|
63
|
+
phoneNumber: string;
|
|
64
|
+
recoveryCode: string;
|
|
65
|
+
confirmNewPassword: string;
|
|
66
|
+
newPassword?: string | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
body: {
|
|
70
|
+
newPassword: string;
|
|
71
|
+
phoneNumber: string;
|
|
72
|
+
recoveryCode: string;
|
|
73
|
+
confirmNewPassword: string;
|
|
74
|
+
};
|
|
75
|
+
}, {
|
|
76
|
+
body: {
|
|
77
|
+
phoneNumber: string;
|
|
78
|
+
recoveryCode: string;
|
|
79
|
+
confirmNewPassword: string;
|
|
80
|
+
newPassword?: string | undefined;
|
|
81
|
+
};
|
|
82
|
+
}>, {
|
|
83
|
+
body: {
|
|
84
|
+
newPassword: string;
|
|
85
|
+
phoneNumber: string;
|
|
86
|
+
recoveryCode: string;
|
|
87
|
+
confirmNewPassword: string;
|
|
88
|
+
};
|
|
89
|
+
}, {
|
|
90
|
+
body: {
|
|
91
|
+
phoneNumber: string;
|
|
92
|
+
recoveryCode: string;
|
|
93
|
+
confirmNewPassword: string;
|
|
94
|
+
newPassword?: string | undefined;
|
|
95
|
+
};
|
|
96
|
+
}>;
|
|
97
|
+
export type RequestRiderAccountRecoverySchema = z.infer<typeof requestRiderAccountRecoverySchema>;
|
|
98
|
+
export type CompleteRiderAccountRecoverySchema = z.infer<typeof completeRiderAccountRecoverySchema>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.completeRiderAccountRecoverySchema = exports.requestRiderAccountRecoverySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const regex_constants_1 = require("../../constants/regex.constants");
|
|
6
|
+
const shared_account_validations_1 = require("../shared/shared.account.validations");
|
|
7
|
+
const birthDateFields = {
|
|
8
|
+
birthDate: zod_1.z.number().int().min(1).max(31),
|
|
9
|
+
birthMonth: zod_1.z.number().int().min(1).max(12),
|
|
10
|
+
birthYear: zod_1.z.number().int().min(1900).max(new Date().getFullYear()),
|
|
11
|
+
};
|
|
12
|
+
exports.requestRiderAccountRecoverySchema = zod_1.z
|
|
13
|
+
.object({
|
|
14
|
+
body: zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
...birthDateFields,
|
|
17
|
+
phoneNumber: zod_1.z.string().regex(regex_constants_1.PHONE_NUMBER_REGEX, "Enter a valid Rwandan phone number"),
|
|
18
|
+
plateNumber: zod_1.z.string().trim().regex(regex_constants_1.RWANDA_PLATE_NUMBER_REGEX, "Enter a valid plate number"),
|
|
19
|
+
})
|
|
20
|
+
.refine(({ birthDate, birthMonth, birthYear }) => birthDate <= new Date(birthYear, birthMonth, 0).getDate(), { message: "Enter a valid date of birth", path: ["birthDate"] }),
|
|
21
|
+
});
|
|
22
|
+
const recoveryCodeSchema = zod_1.z
|
|
23
|
+
.string()
|
|
24
|
+
.length(4, "Recovery code must be 4 digits")
|
|
25
|
+
.regex(regex_constants_1.FOUR_DIGIT_PIN_REGEX, "Recovery code must contain only digits");
|
|
26
|
+
const newRiderPINSchema = shared_account_validations_1.riderPasswordSchema.refine((pin) => pin !== "1234", {
|
|
27
|
+
message: "Choose a PIN different from the temporary PIN",
|
|
28
|
+
});
|
|
29
|
+
exports.completeRiderAccountRecoverySchema = zod_1.z
|
|
30
|
+
.object({
|
|
31
|
+
body: zod_1.z.object({
|
|
32
|
+
phoneNumber: zod_1.z.string().regex(regex_constants_1.PHONE_NUMBER_REGEX, "Enter a valid Rwandan phone number"),
|
|
33
|
+
recoveryCode: recoveryCodeSchema,
|
|
34
|
+
newPassword: newRiderPINSchema,
|
|
35
|
+
confirmNewPassword: zod_1.z.string().length(4).regex(regex_constants_1.FOUR_DIGIT_PIN_REGEX),
|
|
36
|
+
}),
|
|
37
|
+
})
|
|
38
|
+
.refine((data) => data.body.newPassword === data.body.confirmNewPassword, {
|
|
39
|
+
message: "PINs do not match",
|
|
40
|
+
path: ["body", "confirmNewPassword"],
|
|
41
|
+
});
|
|
@@ -11,13 +11,13 @@ export declare const listUserPaymentPlansSchema: z.ZodObject<{
|
|
|
11
11
|
page: number;
|
|
12
12
|
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
13
13
|
sortBy?: "createdAt" | "updatedAt" | "status" | "nextInstallmentDueAt" | undefined;
|
|
14
|
-
sortOrder?: "
|
|
14
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
limit?: string | undefined;
|
|
17
|
-
page?: string | undefined;
|
|
18
17
|
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
18
|
+
page?: string | undefined;
|
|
19
19
|
sortBy?: "createdAt" | "updatedAt" | "status" | "nextInstallmentDueAt" | undefined;
|
|
20
|
-
sortOrder?: "
|
|
20
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
21
21
|
}>;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
23
|
query: {
|
|
@@ -25,15 +25,15 @@ export declare const listUserPaymentPlansSchema: z.ZodObject<{
|
|
|
25
25
|
page: number;
|
|
26
26
|
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
27
27
|
sortBy?: "createdAt" | "updatedAt" | "status" | "nextInstallmentDueAt" | undefined;
|
|
28
|
-
sortOrder?: "
|
|
28
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
29
29
|
};
|
|
30
30
|
}, {
|
|
31
31
|
query: {
|
|
32
32
|
limit?: string | undefined;
|
|
33
|
-
page?: string | undefined;
|
|
34
33
|
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
34
|
+
page?: string | undefined;
|
|
35
35
|
sortBy?: "createdAt" | "updatedAt" | "status" | "nextInstallmentDueAt" | undefined;
|
|
36
|
-
sortOrder?: "
|
|
36
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
37
37
|
};
|
|
38
38
|
}>;
|
|
39
39
|
export declare const getUserPaymentPlanSchema: z.ZodObject<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vr-commons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.190",
|
|
4
4
|
"description": "Shared functions package",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"rimraf": "^5.0.5",
|
|
104
104
|
"streamifier": "^0.1.1",
|
|
105
105
|
"typescript": "^5.3.3",
|
|
106
|
-
"vr-models": "^1.0.
|
|
106
|
+
"vr-models": "^1.0.119",
|
|
107
107
|
"zod": "^3.25.20"
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|