@careflair/common 1.0.12 → 1.0.14
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/schemas/forms.d.ts
CHANGED
|
@@ -15,36 +15,36 @@ export declare const registrationFormSchema: z.ZodEffects<z.ZodObject<{
|
|
|
15
15
|
role: string;
|
|
16
16
|
username: string;
|
|
17
17
|
email: string;
|
|
18
|
-
password: string;
|
|
19
18
|
firstName: string;
|
|
20
19
|
lastName: string;
|
|
20
|
+
password: string;
|
|
21
21
|
confirmPassword: string;
|
|
22
22
|
fingerPrint?: string | undefined;
|
|
23
23
|
}, {
|
|
24
24
|
role: string;
|
|
25
25
|
username: string;
|
|
26
26
|
email: string;
|
|
27
|
-
password: string;
|
|
28
27
|
firstName: string;
|
|
29
28
|
lastName: string;
|
|
29
|
+
password: string;
|
|
30
30
|
confirmPassword: string;
|
|
31
31
|
fingerPrint?: string | undefined;
|
|
32
32
|
}>, {
|
|
33
33
|
role: string;
|
|
34
34
|
username: string;
|
|
35
35
|
email: string;
|
|
36
|
-
password: string;
|
|
37
36
|
firstName: string;
|
|
38
37
|
lastName: string;
|
|
38
|
+
password: string;
|
|
39
39
|
confirmPassword: string;
|
|
40
40
|
fingerPrint?: string | undefined;
|
|
41
41
|
}, {
|
|
42
42
|
role: string;
|
|
43
43
|
username: string;
|
|
44
44
|
email: string;
|
|
45
|
-
password: string;
|
|
46
45
|
firstName: string;
|
|
47
46
|
lastName: string;
|
|
47
|
+
password: string;
|
|
48
48
|
confirmPassword: string;
|
|
49
49
|
fingerPrint?: string | undefined;
|
|
50
50
|
}>;
|
|
@@ -1,30 +1,50 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
password: z.ZodString;
|
|
6
|
-
role: z.ZodEnum<["business", "provider", "participant", "support_person", "support_worker"]>;
|
|
7
|
-
fingerPrint: z.ZodOptional<z.ZodString>;
|
|
2
|
+
export declare const emailSchema: z.ZodString;
|
|
3
|
+
export declare const passwordSchema: z.ZodString;
|
|
4
|
+
export declare const UserRegistrationSchema: z.ZodEffects<z.ZodObject<{
|
|
8
5
|
firstName: z.ZodString;
|
|
9
6
|
lastName: z.ZodString;
|
|
10
|
-
|
|
7
|
+
email: z.ZodString;
|
|
8
|
+
username: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
9
|
+
role: z.ZodString;
|
|
10
|
+
password: z.ZodString;
|
|
11
|
+
confirmPassword: z.ZodString;
|
|
12
|
+
fingerPrint: z.ZodOptional<z.ZodString>;
|
|
11
13
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
role:
|
|
14
|
+
role: string;
|
|
13
15
|
username: string;
|
|
14
16
|
email: string;
|
|
15
|
-
password: string;
|
|
16
17
|
firstName: string;
|
|
17
18
|
lastName: string;
|
|
18
|
-
|
|
19
|
+
password: string;
|
|
20
|
+
confirmPassword: string;
|
|
19
21
|
fingerPrint?: string | undefined;
|
|
20
22
|
}, {
|
|
21
|
-
role:
|
|
23
|
+
role: string;
|
|
22
24
|
username: string;
|
|
23
25
|
email: string;
|
|
26
|
+
firstName: string;
|
|
27
|
+
lastName: string;
|
|
24
28
|
password: string;
|
|
29
|
+
confirmPassword: string;
|
|
30
|
+
fingerPrint?: string | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
role: string;
|
|
33
|
+
username: string;
|
|
34
|
+
email: string;
|
|
25
35
|
firstName: string;
|
|
26
36
|
lastName: string;
|
|
37
|
+
password: string;
|
|
38
|
+
confirmPassword: string;
|
|
39
|
+
fingerPrint?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
role: string;
|
|
42
|
+
username: string;
|
|
43
|
+
email: string;
|
|
44
|
+
firstName: string;
|
|
45
|
+
lastName: string;
|
|
46
|
+
password: string;
|
|
47
|
+
confirmPassword: string;
|
|
27
48
|
fingerPrint?: string | undefined;
|
|
28
|
-
isSmallProvider?: boolean | undefined;
|
|
29
49
|
}>;
|
|
30
50
|
export type UserRegistrationInput = z.infer<typeof UserRegistrationSchema>;
|
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserRegistrationSchema = void 0;
|
|
3
|
+
exports.UserRegistrationSchema = exports.passwordSchema = exports.emailSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const limits_1 = require("../constants/limits");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.max(limits_1.PASSWORD_MAX_LENGTH, `Password must be at most ${limits_1.PASSWORD_MAX_LENGTH} characters long`),
|
|
22
|
-
role: zod_1.z.enum(["business", "provider", "participant", "support_person", "support_worker"], {
|
|
23
|
-
message: "Role must be one of: business, provider, participant, support_person, support_worker",
|
|
24
|
-
}),
|
|
25
|
-
fingerPrint: zod_1.z.string().optional(),
|
|
6
|
+
// Reusable email validation schema
|
|
7
|
+
exports.emailSchema = zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1, "Email is required")
|
|
10
|
+
.max(limits_1.EMAIL_MAX_LENGTH, "Email is too long")
|
|
11
|
+
.email("Invalid email")
|
|
12
|
+
.regex(/^[^+]+@/, "Email aliasing is not allowed");
|
|
13
|
+
// Reusable password validation schema
|
|
14
|
+
exports.passwordSchema = zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.min(1, "Password is required")
|
|
17
|
+
.min(limits_1.PASSWORD_MIN_LENGTH, `Password must be at least ${limits_1.PASSWORD_MIN_LENGTH} characters long`)
|
|
18
|
+
.max(limits_1.PASSWORD_MAX_LENGTH, `Password must be at most ${limits_1.PASSWORD_MAX_LENGTH} characters long`);
|
|
19
|
+
exports.UserRegistrationSchema = zod_1.z
|
|
20
|
+
.object({
|
|
26
21
|
firstName: zod_1.z
|
|
27
22
|
.string()
|
|
23
|
+
.min(1, "First name is required")
|
|
28
24
|
.min(limits_1.NAME_MIN_LENGTH, `First name must be at least ${limits_1.NAME_MIN_LENGTH} characters long`)
|
|
29
|
-
.max(limits_1.NAME_MAX_LENGTH, `First name must be
|
|
25
|
+
.max(limits_1.NAME_MAX_LENGTH, `First name must be under ${limits_1.NAME_MAX_LENGTH} characters`),
|
|
30
26
|
lastName: zod_1.z
|
|
31
27
|
.string()
|
|
28
|
+
.min(1, "Last name is required")
|
|
32
29
|
.min(limits_1.NAME_MIN_LENGTH, `Last name must be at least ${limits_1.NAME_MIN_LENGTH} characters long`)
|
|
33
|
-
.max(limits_1.NAME_MAX_LENGTH, `Last name must be
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
.max(limits_1.NAME_MAX_LENGTH, `Last name must be under ${limits_1.NAME_MAX_LENGTH} characters`),
|
|
31
|
+
email: exports.emailSchema,
|
|
32
|
+
username: zod_1.z
|
|
33
|
+
.string()
|
|
34
|
+
.min(1, "Username is required")
|
|
35
|
+
.min(limits_1.USERNAME_MIN_LENGTH, `Username must be at least ${limits_1.USERNAME_MIN_LENGTH} characters long`)
|
|
36
|
+
.max(limits_1.USERNAME_MAX_LENGTH, `Username must be under ${limits_1.USERNAME_MAX_LENGTH} characters`)
|
|
37
|
+
.regex(/^[a-zA-Z0-9_]+$/, "Username can only contain letters, numbers, and underscores")
|
|
38
|
+
.refine((value) => !value.startsWith("_"), "Username cannot start with an underscore")
|
|
39
|
+
.refine((value) => !value.endsWith("_"), "Username cannot end with an underscore")
|
|
40
|
+
.refine((value) => !value.includes("__"), "Username cannot contain consecutive underscores"),
|
|
41
|
+
role: zod_1.z.string().min(1, "Please select your role"),
|
|
42
|
+
password: exports.passwordSchema,
|
|
43
|
+
confirmPassword: zod_1.z.string().min(1, "Confirm password is required"),
|
|
44
|
+
fingerPrint: zod_1.z.string().optional(),
|
|
45
|
+
})
|
|
46
|
+
// Password match validation
|
|
47
|
+
.refine((data) => data.password === data.confirmPassword, {
|
|
48
|
+
message: "Passwords don't match",
|
|
49
|
+
path: ["confirmPassword"],
|
|
38
50
|
});
|
|
@@ -15,19 +15,19 @@ export declare const passwordChangeSchema: z.ZodEffects<z.ZodObject<{
|
|
|
15
15
|
newPassword: z.ZodString;
|
|
16
16
|
confirmPassword: z.ZodString;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
confirmPassword: string;
|
|
18
19
|
currentPassword: string;
|
|
19
20
|
newPassword: string;
|
|
20
|
-
confirmPassword: string;
|
|
21
21
|
}, {
|
|
22
|
+
confirmPassword: string;
|
|
22
23
|
currentPassword: string;
|
|
23
24
|
newPassword: string;
|
|
24
|
-
confirmPassword: string;
|
|
25
25
|
}>, {
|
|
26
|
+
confirmPassword: string;
|
|
26
27
|
currentPassword: string;
|
|
27
28
|
newPassword: string;
|
|
28
|
-
confirmPassword: string;
|
|
29
29
|
}, {
|
|
30
|
+
confirmPassword: string;
|
|
30
31
|
currentPassword: string;
|
|
31
32
|
newPassword: string;
|
|
32
|
-
confirmPassword: string;
|
|
33
33
|
}>;
|