@careflair/common 1.0.35 → 1.0.37
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/applicationSchema.d.ts +3 -11
- package/dist/schemas/applicationSchema.js +2 -2
- package/dist/schemas/availabilitySchemaValidation.d.ts +6 -52
- package/dist/schemas/availabilitySchemaValidation.js +3 -3
- package/dist/schemas/businessServicesValidation.d.ts +2 -2
- package/dist/schemas/businessServicesValidation.js +2 -2
- package/dist/schemas/educationSchemas.d.ts +2 -30
- package/dist/schemas/educationSchemas.js +1 -1
- package/dist/schemas/forms.d.ts +17 -225
- package/dist/schemas/forms.js +16 -16
- package/dist/schemas/hourlyRateSchemaValidation.d.ts +3 -29
- package/dist/schemas/hourlyRateSchemaValidation.js +1 -1
- package/dist/schemas/otp.d.ts +3 -23
- package/dist/schemas/otp.js +1 -1
- package/dist/schemas/userValiationSchema.d.ts +5 -41
- package/dist/schemas/userValiationSchema.js +10 -5
- package/dist/schemas/validation.d.ts +3 -19
- package/dist/schemas/validation.js +10 -5
- package/dist/schemas/workHistorySchema.d.ts +2 -26
- package/dist/schemas/workHistorySchema.js +1 -1
- package/package.json +3 -3
|
@@ -2,15 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const isValidVideoUrl: (url: string) => boolean;
|
|
3
3
|
export declare const applicationSchema: z.ZodObject<{
|
|
4
4
|
proposal: z.ZodString;
|
|
5
|
-
videoLink: z.
|
|
6
|
-
amount: z.
|
|
7
|
-
},
|
|
8
|
-
proposal: string;
|
|
9
|
-
videoLink?: string | undefined;
|
|
10
|
-
amount?: string | undefined;
|
|
11
|
-
}, {
|
|
12
|
-
proposal: string;
|
|
13
|
-
videoLink?: string | undefined;
|
|
14
|
-
amount?: string | undefined;
|
|
15
|
-
}>;
|
|
5
|
+
videoLink: z.ZodOptional<z.ZodString>;
|
|
6
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
16
8
|
export type ApplicationFormValues = z.infer<typeof applicationSchema>;
|
|
@@ -18,7 +18,7 @@ exports.applicationSchema = zod_1.z.object({
|
|
|
18
18
|
.string()
|
|
19
19
|
.optional()
|
|
20
20
|
.refine((val) => !val || (0, exports.isValidVideoUrl)(val), {
|
|
21
|
-
|
|
21
|
+
error: "Please provide a valid YouTube or Vimeo URL",
|
|
22
22
|
}),
|
|
23
23
|
amount: zod_1.z
|
|
24
24
|
.string()
|
|
@@ -26,6 +26,6 @@ exports.applicationSchema = zod_1.z.object({
|
|
|
26
26
|
.refine((val) => !val ||
|
|
27
27
|
(parseFloat(val) >= limits_1.MIN_HOURLY_RATE &&
|
|
28
28
|
parseFloat(val) <= limits_1.MAX_HOURLY_RATE), {
|
|
29
|
-
|
|
29
|
+
error: `Hourly rate must be between $${limits_1.MIN_HOURLY_RATE} and $${limits_1.MAX_HOURLY_RATE}`,
|
|
30
30
|
}),
|
|
31
31
|
});
|
|
@@ -1,56 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const AvailabilitiesSchemaZod: z.
|
|
2
|
+
export declare const AvailabilitiesSchemaZod: z.ZodArray<z.ZodObject<{
|
|
3
3
|
day: z.ZodString;
|
|
4
4
|
isEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
-
shifts: z.
|
|
6
|
-
startTime: z.
|
|
7
|
-
endTime: z.
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
startTime: string;
|
|
11
|
-
}, {
|
|
12
|
-
endTime: string;
|
|
13
|
-
startTime: string;
|
|
14
|
-
}>, {
|
|
15
|
-
endTime: string;
|
|
16
|
-
startTime: string;
|
|
17
|
-
}, {
|
|
18
|
-
endTime: string;
|
|
19
|
-
startTime: string;
|
|
20
|
-
}>, "many">, {
|
|
21
|
-
endTime: string;
|
|
22
|
-
startTime: string;
|
|
23
|
-
}[], {
|
|
24
|
-
endTime: string;
|
|
25
|
-
startTime: string;
|
|
26
|
-
}[]>;
|
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
day: string;
|
|
29
|
-
isEnabled: boolean;
|
|
30
|
-
shifts: {
|
|
31
|
-
endTime: string;
|
|
32
|
-
startTime: string;
|
|
33
|
-
}[];
|
|
34
|
-
}, {
|
|
35
|
-
day: string;
|
|
36
|
-
shifts: {
|
|
37
|
-
endTime: string;
|
|
38
|
-
startTime: string;
|
|
39
|
-
}[];
|
|
40
|
-
isEnabled?: boolean | undefined;
|
|
41
|
-
}>, "many">, {
|
|
42
|
-
day: string;
|
|
43
|
-
isEnabled: boolean;
|
|
44
|
-
shifts: {
|
|
45
|
-
endTime: string;
|
|
46
|
-
startTime: string;
|
|
47
|
-
}[];
|
|
48
|
-
}[], {
|
|
49
|
-
day: string;
|
|
50
|
-
shifts: {
|
|
51
|
-
endTime: string;
|
|
52
|
-
startTime: string;
|
|
53
|
-
}[];
|
|
54
|
-
isEnabled?: boolean | undefined;
|
|
55
|
-
}[]>;
|
|
5
|
+
shifts: z.ZodArray<z.ZodObject<{
|
|
6
|
+
startTime: z.ZodString;
|
|
7
|
+
endTime: z.ZodString;
|
|
8
|
+
}, z.core.$strip>>;
|
|
9
|
+
}, z.core.$strip>>;
|
|
56
10
|
export type AvailabilityZodInput = z.infer<typeof AvailabilitiesSchemaZod>;
|
|
@@ -42,7 +42,7 @@ const ShiftSchema = zod_1.z.object({
|
|
|
42
42
|
const endInMinutes = convertToMinutes(data.endTime);
|
|
43
43
|
return startInMinutes < endInMinutes; // Ensure start time is before end time
|
|
44
44
|
}, {
|
|
45
|
-
|
|
45
|
+
error: 'Start time must be before end time',
|
|
46
46
|
path: ['startTime', 'endTime'],
|
|
47
47
|
});
|
|
48
48
|
// Availability schema with shift overlap validation
|
|
@@ -66,7 +66,7 @@ const AvailabilitySchemaZod = zod_1.z.object({
|
|
|
66
66
|
}
|
|
67
67
|
return true;
|
|
68
68
|
}, {
|
|
69
|
-
|
|
69
|
+
error: 'Shifts cannot overlap',
|
|
70
70
|
}),
|
|
71
71
|
});
|
|
72
72
|
// Schema for the entire availability array (the list of availabilities)
|
|
@@ -75,5 +75,5 @@ exports.AvailabilitiesSchemaZod = zod_1.z.array(AvailabilitySchemaZod).refine(av
|
|
|
75
75
|
const uniqueDays = new Set(days);
|
|
76
76
|
return days.length === uniqueDays.size; // Ensure no duplicate days
|
|
77
77
|
}, {
|
|
78
|
-
|
|
78
|
+
error: 'There should be no duplicate days',
|
|
79
79
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CategoryEnum, SupportWorkerService } from '../enums';
|
|
3
|
-
export declare const ServicesSchema: z.
|
|
3
|
+
export declare const ServicesSchema: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof CategoryEnum>>>;
|
|
4
4
|
export declare const validateServices: (services?: string[]) => boolean;
|
|
5
|
-
export declare const SupportWorkerServicesSchema: z.
|
|
5
|
+
export declare const SupportWorkerServicesSchema: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof SupportWorkerService>>>;
|
|
6
6
|
export declare const validateSupportWorkerServices: (services?: string[]) => boolean;
|
|
@@ -6,7 +6,7 @@ const enums_1 = require("../enums");
|
|
|
6
6
|
exports.ServicesSchema = zod_1.z
|
|
7
7
|
.array(zod_1.z.nativeEnum(enums_1.CategoryEnum))
|
|
8
8
|
.optional()
|
|
9
|
-
.refine((services) => !services || services.every((service) => Object.values(enums_1.CategoryEnum).includes(service)), {
|
|
9
|
+
.refine((services) => !services || services.every((service) => Object.values(enums_1.CategoryEnum).includes(service)), { error: 'Invalid services provided.' });
|
|
10
10
|
const validateServices = (services) => {
|
|
11
11
|
const result = exports.ServicesSchema.safeParse(services);
|
|
12
12
|
return result.success;
|
|
@@ -15,7 +15,7 @@ exports.validateServices = validateServices;
|
|
|
15
15
|
exports.SupportWorkerServicesSchema = zod_1.z
|
|
16
16
|
.array(zod_1.z.nativeEnum(enums_1.SupportWorkerService))
|
|
17
17
|
.optional()
|
|
18
|
-
.refine((services) => !services || services.every((service) => Object.values(enums_1.SupportWorkerService).includes(service)), {
|
|
18
|
+
.refine((services) => !services || services.every((service) => Object.values(enums_1.SupportWorkerService).includes(service)), { error: 'Invalid services provided.' });
|
|
19
19
|
const validateSupportWorkerServices = (services) => {
|
|
20
20
|
const result = exports.SupportWorkerServicesSchema.safeParse(services);
|
|
21
21
|
return result.success;
|
|
@@ -1,38 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const EducationAndTrainingSchema: z.
|
|
2
|
+
export declare const EducationAndTrainingSchema: z.ZodObject<{
|
|
3
3
|
school: z.ZodString;
|
|
4
4
|
type: z.ZodString;
|
|
5
5
|
degree: z.ZodString;
|
|
6
6
|
startDate: z.ZodDate;
|
|
7
7
|
endDate: z.ZodOptional<z.ZodDate>;
|
|
8
8
|
isCurrentlyStudying: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
-
},
|
|
10
|
-
type: string;
|
|
11
|
-
school: string;
|
|
12
|
-
degree: string;
|
|
13
|
-
startDate: Date;
|
|
14
|
-
isCurrentlyStudying: boolean;
|
|
15
|
-
endDate?: Date | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
type: string;
|
|
18
|
-
school: string;
|
|
19
|
-
degree: string;
|
|
20
|
-
startDate: Date;
|
|
21
|
-
endDate?: Date | undefined;
|
|
22
|
-
isCurrentlyStudying?: boolean | undefined;
|
|
23
|
-
}>, {
|
|
24
|
-
type: string;
|
|
25
|
-
school: string;
|
|
26
|
-
degree: string;
|
|
27
|
-
startDate: Date;
|
|
28
|
-
isCurrentlyStudying: boolean;
|
|
29
|
-
endDate?: Date | undefined;
|
|
30
|
-
}, {
|
|
31
|
-
type: string;
|
|
32
|
-
school: string;
|
|
33
|
-
degree: string;
|
|
34
|
-
startDate: Date;
|
|
35
|
-
endDate?: Date | undefined;
|
|
36
|
-
isCurrentlyStudying?: boolean | undefined;
|
|
37
|
-
}>;
|
|
9
|
+
}, z.core.$strip>;
|
|
38
10
|
export type EducationAndTrainingInputValidation = z.infer<typeof EducationAndTrainingSchema>;
|
|
@@ -24,6 +24,6 @@ exports.EducationAndTrainingSchema = zod_1.z
|
|
|
24
24
|
}
|
|
25
25
|
return data.isCurrentlyStudying || data.endDate !== undefined;
|
|
26
26
|
}, {
|
|
27
|
-
|
|
27
|
+
error: "If there is an endDate, is Currently Studying must be false. If is Currently Studying is false, endDate must be provided.",
|
|
28
28
|
path: ["endDate", "isCurrentlyStudying"],
|
|
29
29
|
});
|
package/dist/schemas/forms.d.ts
CHANGED
|
@@ -2,263 +2,55 @@ import { z } from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* Registration form schema
|
|
4
4
|
*/
|
|
5
|
-
export declare const registrationFormSchema: z.
|
|
5
|
+
export declare const registrationFormSchema: z.ZodObject<{
|
|
6
6
|
firstName: z.ZodString;
|
|
7
7
|
lastName: z.ZodString;
|
|
8
|
-
email: z.
|
|
9
|
-
username: z.
|
|
8
|
+
email: z.ZodEmail;
|
|
9
|
+
username: z.ZodString;
|
|
10
10
|
role: z.ZodString;
|
|
11
11
|
password: z.ZodString;
|
|
12
12
|
confirmPassword: z.ZodString;
|
|
13
13
|
fingerPrint: z.ZodOptional<z.ZodString>;
|
|
14
|
-
},
|
|
15
|
-
role: string;
|
|
16
|
-
username: string;
|
|
17
|
-
email: string;
|
|
18
|
-
firstName: string;
|
|
19
|
-
lastName: string;
|
|
20
|
-
password: string;
|
|
21
|
-
confirmPassword: string;
|
|
22
|
-
fingerPrint?: string | undefined;
|
|
23
|
-
}, {
|
|
24
|
-
role: string;
|
|
25
|
-
username: string;
|
|
26
|
-
email: string;
|
|
27
|
-
firstName: string;
|
|
28
|
-
lastName: string;
|
|
29
|
-
password: string;
|
|
30
|
-
confirmPassword: string;
|
|
31
|
-
fingerPrint?: string | undefined;
|
|
32
|
-
}>, {
|
|
33
|
-
role: string;
|
|
34
|
-
username: string;
|
|
35
|
-
email: string;
|
|
36
|
-
firstName: string;
|
|
37
|
-
lastName: string;
|
|
38
|
-
password: string;
|
|
39
|
-
confirmPassword: string;
|
|
40
|
-
fingerPrint?: string | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
role: string;
|
|
43
|
-
username: string;
|
|
44
|
-
email: string;
|
|
45
|
-
firstName: string;
|
|
46
|
-
lastName: string;
|
|
47
|
-
password: string;
|
|
48
|
-
confirmPassword: string;
|
|
49
|
-
fingerPrint?: string | undefined;
|
|
50
|
-
}>;
|
|
14
|
+
}, z.core.$strip>;
|
|
51
15
|
/**
|
|
52
16
|
* Participant location form schema
|
|
53
17
|
*/
|
|
54
18
|
export declare const participantLocationFormSchema: z.ZodObject<{
|
|
55
|
-
address: z.
|
|
19
|
+
address: z.ZodObject<{
|
|
56
20
|
value: z.ZodString;
|
|
57
21
|
label: z.ZodString;
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
label: string;
|
|
61
|
-
}, {
|
|
62
|
-
value: string;
|
|
63
|
-
label: string;
|
|
64
|
-
}>, {
|
|
65
|
-
value: string;
|
|
66
|
-
label: string;
|
|
67
|
-
}, {
|
|
68
|
-
value: string;
|
|
69
|
-
label: string;
|
|
70
|
-
}>;
|
|
71
|
-
state: z.ZodEffects<z.ZodObject<{
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
state: z.ZodObject<{
|
|
72
24
|
value: z.ZodString;
|
|
73
25
|
label: z.ZodString;
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
label: string;
|
|
77
|
-
}, {
|
|
78
|
-
value: string;
|
|
79
|
-
label: string;
|
|
80
|
-
}>, {
|
|
81
|
-
value: string;
|
|
82
|
-
label: string;
|
|
83
|
-
}, {
|
|
84
|
-
value: string;
|
|
85
|
-
label: string;
|
|
86
|
-
}>;
|
|
87
|
-
}, "strip", z.ZodTypeAny, {
|
|
88
|
-
state: {
|
|
89
|
-
value: string;
|
|
90
|
-
label: string;
|
|
91
|
-
};
|
|
92
|
-
address: {
|
|
93
|
-
value: string;
|
|
94
|
-
label: string;
|
|
95
|
-
};
|
|
96
|
-
}, {
|
|
97
|
-
state: {
|
|
98
|
-
value: string;
|
|
99
|
-
label: string;
|
|
100
|
-
};
|
|
101
|
-
address: {
|
|
102
|
-
value: string;
|
|
103
|
-
label: string;
|
|
104
|
-
};
|
|
105
|
-
}>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
}, z.core.$strip>;
|
|
106
28
|
/**
|
|
107
29
|
* Contact details form schema
|
|
108
30
|
*/
|
|
109
31
|
export declare const ContactDetailsFormSchema: z.ZodObject<{
|
|
110
|
-
phone: z.ZodUnion<[z.ZodOptional<z.
|
|
111
|
-
email: z.ZodUnion<[z.ZodOptional<z.
|
|
32
|
+
phone: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
33
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodEmail>, z.ZodLiteral<"">]>;
|
|
112
34
|
website: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
113
35
|
enableSmsNotifications: z.ZodOptional<z.ZodBoolean>;
|
|
114
|
-
},
|
|
115
|
-
email?: string | undefined;
|
|
116
|
-
phone?: string | undefined;
|
|
117
|
-
website?: string | undefined;
|
|
118
|
-
enableSmsNotifications?: boolean | undefined;
|
|
119
|
-
}, {
|
|
120
|
-
email?: string | undefined;
|
|
121
|
-
phone?: string | undefined;
|
|
122
|
-
website?: string | undefined;
|
|
123
|
-
enableSmsNotifications?: boolean | undefined;
|
|
124
|
-
}>;
|
|
36
|
+
}, z.core.$strip>;
|
|
125
37
|
/**
|
|
126
38
|
* Education and training form schema
|
|
127
39
|
*/
|
|
128
|
-
export declare const EducationAndTrainingFormSchema: z.
|
|
40
|
+
export declare const EducationAndTrainingFormSchema: z.ZodObject<{
|
|
129
41
|
type: z.ZodString;
|
|
130
42
|
school: z.ZodString;
|
|
131
43
|
degree: z.ZodString;
|
|
132
44
|
startDate: z.ZodOptional<z.ZodDate>;
|
|
133
45
|
endDate: z.ZodOptional<z.ZodDate>;
|
|
134
|
-
},
|
|
135
|
-
type: string;
|
|
136
|
-
school: string;
|
|
137
|
-
degree: string;
|
|
138
|
-
startDate?: Date | undefined;
|
|
139
|
-
endDate?: Date | undefined;
|
|
140
|
-
}, {
|
|
141
|
-
type: string;
|
|
142
|
-
school: string;
|
|
143
|
-
degree: string;
|
|
144
|
-
startDate?: Date | undefined;
|
|
145
|
-
endDate?: Date | undefined;
|
|
146
|
-
}>, {
|
|
147
|
-
type: string;
|
|
148
|
-
school: string;
|
|
149
|
-
degree: string;
|
|
150
|
-
startDate?: Date | undefined;
|
|
151
|
-
endDate?: Date | undefined;
|
|
152
|
-
}, {
|
|
153
|
-
type: string;
|
|
154
|
-
school: string;
|
|
155
|
-
degree: string;
|
|
156
|
-
startDate?: Date | undefined;
|
|
157
|
-
endDate?: Date | undefined;
|
|
158
|
-
}>, {
|
|
159
|
-
type: string;
|
|
160
|
-
school: string;
|
|
161
|
-
degree: string;
|
|
162
|
-
startDate?: Date | undefined;
|
|
163
|
-
endDate?: Date | undefined;
|
|
164
|
-
}, {
|
|
165
|
-
type: string;
|
|
166
|
-
school: string;
|
|
167
|
-
degree: string;
|
|
168
|
-
startDate?: Date | undefined;
|
|
169
|
-
endDate?: Date | undefined;
|
|
170
|
-
}>, {
|
|
171
|
-
type: string;
|
|
172
|
-
school: string;
|
|
173
|
-
degree: string;
|
|
174
|
-
startDate?: Date | undefined;
|
|
175
|
-
endDate?: Date | undefined;
|
|
176
|
-
}, {
|
|
177
|
-
type: string;
|
|
178
|
-
school: string;
|
|
179
|
-
degree: string;
|
|
180
|
-
startDate?: Date | undefined;
|
|
181
|
-
endDate?: Date | undefined;
|
|
182
|
-
}>, {
|
|
183
|
-
type: string;
|
|
184
|
-
school: string;
|
|
185
|
-
degree: string;
|
|
186
|
-
startDate?: Date | undefined;
|
|
187
|
-
endDate?: Date | undefined;
|
|
188
|
-
}, {
|
|
189
|
-
type: string;
|
|
190
|
-
school: string;
|
|
191
|
-
degree: string;
|
|
192
|
-
startDate?: Date | undefined;
|
|
193
|
-
endDate?: Date | undefined;
|
|
194
|
-
}>;
|
|
46
|
+
}, z.core.$strip>;
|
|
195
47
|
/**
|
|
196
48
|
* Work history form schema
|
|
197
49
|
*/
|
|
198
|
-
export declare const WorkHistoryFormSchema: z.
|
|
50
|
+
export declare const WorkHistoryFormSchema: z.ZodObject<{
|
|
199
51
|
jobTitle: z.ZodString;
|
|
200
52
|
organisation: z.ZodString;
|
|
201
|
-
startDate: z.
|
|
53
|
+
startDate: z.ZodString;
|
|
202
54
|
endDate: z.ZodOptional<z.ZodString>;
|
|
203
55
|
isCurrentlyWorking: z.ZodDefault<z.ZodBoolean>;
|
|
204
|
-
},
|
|
205
|
-
startDate: string;
|
|
206
|
-
jobTitle: string;
|
|
207
|
-
organisation: string;
|
|
208
|
-
isCurrentlyWorking: boolean;
|
|
209
|
-
endDate?: string | undefined;
|
|
210
|
-
}, {
|
|
211
|
-
startDate: string;
|
|
212
|
-
jobTitle: string;
|
|
213
|
-
organisation: string;
|
|
214
|
-
endDate?: string | undefined;
|
|
215
|
-
isCurrentlyWorking?: boolean | undefined;
|
|
216
|
-
}>, {
|
|
217
|
-
startDate: string;
|
|
218
|
-
jobTitle: string;
|
|
219
|
-
organisation: string;
|
|
220
|
-
isCurrentlyWorking: boolean;
|
|
221
|
-
endDate?: string | undefined;
|
|
222
|
-
}, {
|
|
223
|
-
startDate: string;
|
|
224
|
-
jobTitle: string;
|
|
225
|
-
organisation: string;
|
|
226
|
-
endDate?: string | undefined;
|
|
227
|
-
isCurrentlyWorking?: boolean | undefined;
|
|
228
|
-
}>, {
|
|
229
|
-
startDate: string;
|
|
230
|
-
jobTitle: string;
|
|
231
|
-
organisation: string;
|
|
232
|
-
isCurrentlyWorking: boolean;
|
|
233
|
-
endDate?: string | undefined;
|
|
234
|
-
}, {
|
|
235
|
-
startDate: string;
|
|
236
|
-
jobTitle: string;
|
|
237
|
-
organisation: string;
|
|
238
|
-
endDate?: string | undefined;
|
|
239
|
-
isCurrentlyWorking?: boolean | undefined;
|
|
240
|
-
}>, {
|
|
241
|
-
startDate: string;
|
|
242
|
-
jobTitle: string;
|
|
243
|
-
organisation: string;
|
|
244
|
-
isCurrentlyWorking: boolean;
|
|
245
|
-
endDate?: string | undefined;
|
|
246
|
-
}, {
|
|
247
|
-
startDate: string;
|
|
248
|
-
jobTitle: string;
|
|
249
|
-
organisation: string;
|
|
250
|
-
endDate?: string | undefined;
|
|
251
|
-
isCurrentlyWorking?: boolean | undefined;
|
|
252
|
-
}>, {
|
|
253
|
-
startDate: string;
|
|
254
|
-
jobTitle: string;
|
|
255
|
-
organisation: string;
|
|
256
|
-
isCurrentlyWorking: boolean;
|
|
257
|
-
endDate?: string | undefined;
|
|
258
|
-
}, {
|
|
259
|
-
startDate: string;
|
|
260
|
-
jobTitle: string;
|
|
261
|
-
organisation: string;
|
|
262
|
-
endDate?: string | undefined;
|
|
263
|
-
isCurrentlyWorking?: boolean | undefined;
|
|
264
|
-
}>;
|
|
56
|
+
}, z.core.$strip>;
|
package/dist/schemas/forms.js
CHANGED
|
@@ -37,7 +37,7 @@ exports.registrationFormSchema = zod_1.z
|
|
|
37
37
|
})
|
|
38
38
|
// Password match validation
|
|
39
39
|
.refine((data) => data.password === data.confirmPassword, {
|
|
40
|
-
|
|
40
|
+
error: "Passwords don't match",
|
|
41
41
|
path: ["confirmPassword"],
|
|
42
42
|
});
|
|
43
43
|
/**
|
|
@@ -50,7 +50,7 @@ exports.participantLocationFormSchema = zod_1.z.object({
|
|
|
50
50
|
label: zod_1.z.string(),
|
|
51
51
|
})
|
|
52
52
|
.refine((data) => data.value && data.label, {
|
|
53
|
-
|
|
53
|
+
error: "Address is required",
|
|
54
54
|
path: ["value"],
|
|
55
55
|
}),
|
|
56
56
|
state: zod_1.z
|
|
@@ -59,7 +59,7 @@ exports.participantLocationFormSchema = zod_1.z.object({
|
|
|
59
59
|
label: zod_1.z.string(),
|
|
60
60
|
})
|
|
61
61
|
.refine((data) => data.value && data.label, {
|
|
62
|
-
|
|
62
|
+
error: "State is required",
|
|
63
63
|
path: ["value"],
|
|
64
64
|
}),
|
|
65
65
|
});
|
|
@@ -81,11 +81,11 @@ exports.ContactDetailsFormSchema = zod_1.z.object({
|
|
|
81
81
|
const type = parsed.getType();
|
|
82
82
|
return type === "MOBILE" || type === "FIXED_LINE_OR_MOBILE";
|
|
83
83
|
}, {
|
|
84
|
-
|
|
84
|
+
error: "Please enter a valid Australian mobile number (04XX XXX XXX)",
|
|
85
85
|
})
|
|
86
86
|
.optional()
|
|
87
87
|
.or(zod_1.z.literal("")),
|
|
88
|
-
email: zod_1.z.
|
|
88
|
+
email: zod_1.z.email("Invalid email address").optional().or(zod_1.z.literal("")),
|
|
89
89
|
website: zod_1.z
|
|
90
90
|
.string()
|
|
91
91
|
.regex(/^(?:https?:\/\/)?[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?$/, "Invalid URL")
|
|
@@ -109,21 +109,21 @@ exports.EducationAndTrainingFormSchema = zod_1.z
|
|
|
109
109
|
.max(limits_1.EDUTRAINING_DEGREE_MAX_LENGTH, "Degree is too long"),
|
|
110
110
|
startDate: zod_1.z
|
|
111
111
|
.date({
|
|
112
|
-
|
|
112
|
+
error: "Please select a start date",
|
|
113
113
|
})
|
|
114
114
|
.optional(),
|
|
115
115
|
endDate: zod_1.z
|
|
116
116
|
.date({
|
|
117
|
-
|
|
117
|
+
error: "Please select an end date",
|
|
118
118
|
})
|
|
119
119
|
.optional(),
|
|
120
120
|
})
|
|
121
121
|
.refine((data) => data.startDate !== undefined && data.startDate !== null, {
|
|
122
|
-
|
|
122
|
+
error: "Start date is required",
|
|
123
123
|
path: ["startDate"],
|
|
124
124
|
})
|
|
125
125
|
.refine((data) => data.endDate !== undefined && data.endDate !== null, {
|
|
126
|
-
|
|
126
|
+
error: "End date is required",
|
|
127
127
|
path: ["endDate"],
|
|
128
128
|
})
|
|
129
129
|
.refine((data) => {
|
|
@@ -134,7 +134,7 @@ exports.EducationAndTrainingFormSchema = zod_1.z
|
|
|
134
134
|
return true; // Skip if dates are not set yet
|
|
135
135
|
return endDate > startDate;
|
|
136
136
|
}, {
|
|
137
|
-
|
|
137
|
+
error: "End date must be after start date",
|
|
138
138
|
path: ["endDate"],
|
|
139
139
|
})
|
|
140
140
|
.refine((data) => {
|
|
@@ -147,7 +147,7 @@ exports.EducationAndTrainingFormSchema = zod_1.z
|
|
|
147
147
|
(endDate.getMonth() - startDate.getMonth());
|
|
148
148
|
return diffInMonths >= 1;
|
|
149
149
|
}, {
|
|
150
|
-
|
|
150
|
+
error: "There must be at least 1 month between start and end date",
|
|
151
151
|
path: ["endDate"],
|
|
152
152
|
});
|
|
153
153
|
// Helper function to check if date is in the future
|
|
@@ -183,7 +183,7 @@ exports.WorkHistoryFormSchema = zod_1.z
|
|
|
183
183
|
.string()
|
|
184
184
|
.min(1, "Start date is required")
|
|
185
185
|
.refine((date) => !isDateInFuture(date), {
|
|
186
|
-
|
|
186
|
+
error: "Start date cannot be in the future",
|
|
187
187
|
}),
|
|
188
188
|
endDate: zod_1.z.string().optional(),
|
|
189
189
|
isCurrentlyWorking: zod_1.z.boolean().default(false),
|
|
@@ -197,7 +197,7 @@ exports.WorkHistoryFormSchema = zod_1.z
|
|
|
197
197
|
}
|
|
198
198
|
return true;
|
|
199
199
|
}, {
|
|
200
|
-
|
|
200
|
+
error: "End date must be after start date",
|
|
201
201
|
path: ["endDate"],
|
|
202
202
|
})
|
|
203
203
|
.refine((data) => {
|
|
@@ -207,7 +207,7 @@ exports.WorkHistoryFormSchema = zod_1.z
|
|
|
207
207
|
}
|
|
208
208
|
return true;
|
|
209
209
|
}, {
|
|
210
|
-
|
|
210
|
+
error: "End date cannot be in the future",
|
|
211
211
|
path: ["endDate"],
|
|
212
212
|
})
|
|
213
213
|
.refine((data) => {
|
|
@@ -217,7 +217,7 @@ exports.WorkHistoryFormSchema = zod_1.z
|
|
|
217
217
|
}
|
|
218
218
|
return true;
|
|
219
219
|
}, {
|
|
220
|
-
|
|
220
|
+
error: "There must be at least 1 month between start and end date",
|
|
221
221
|
path: ["endDate"],
|
|
222
222
|
})
|
|
223
223
|
.refine((data) => {
|
|
@@ -229,6 +229,6 @@ exports.WorkHistoryFormSchema = zod_1.z
|
|
|
229
229
|
// If no endDate, isCurrentlyWorking must be true
|
|
230
230
|
return data.isCurrentlyWorking;
|
|
231
231
|
}, {
|
|
232
|
-
|
|
232
|
+
error: "If there is an endDate, Currently Working must be false. If Currently Working is false, endDate must be provided.",
|
|
233
233
|
path: ["endDate", "isCurrentlyWorking"],
|
|
234
234
|
});
|
|
@@ -1,36 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const HourlyRateInputZod: z.ZodObject<{
|
|
3
3
|
service: z.ZodString;
|
|
4
|
-
dayRates: z.
|
|
4
|
+
dayRates: z.ZodArray<z.ZodObject<{
|
|
5
5
|
day: z.ZodString;
|
|
6
6
|
price: z.ZodNumber;
|
|
7
|
-
},
|
|
8
|
-
day: string;
|
|
9
|
-
price: number;
|
|
10
|
-
}, {
|
|
11
|
-
day: string;
|
|
12
|
-
price: number;
|
|
13
|
-
}>, "many">, {
|
|
14
|
-
day: string;
|
|
15
|
-
price: number;
|
|
16
|
-
}[], {
|
|
17
|
-
day: string;
|
|
18
|
-
price: number;
|
|
19
|
-
}[]>;
|
|
7
|
+
}, z.core.$strip>>;
|
|
20
8
|
isNegotiable: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
-
},
|
|
22
|
-
service: string;
|
|
23
|
-
dayRates: {
|
|
24
|
-
day: string;
|
|
25
|
-
price: number;
|
|
26
|
-
}[];
|
|
27
|
-
isNegotiable?: boolean | undefined;
|
|
28
|
-
}, {
|
|
29
|
-
service: string;
|
|
30
|
-
dayRates: {
|
|
31
|
-
day: string;
|
|
32
|
-
price: number;
|
|
33
|
-
}[];
|
|
34
|
-
isNegotiable?: boolean | undefined;
|
|
35
|
-
}>;
|
|
9
|
+
}, z.core.$strip>;
|
|
36
10
|
export type HourlyRateInputZodType = z.infer<typeof HourlyRateInputZod>;
|
|
@@ -19,7 +19,7 @@ exports.HourlyRateInputZod = zod_1.z.object({
|
|
|
19
19
|
const uniqueDays = new Set(days);
|
|
20
20
|
return days.length === uniqueDays.size; // Ensure no duplicate days
|
|
21
21
|
}, {
|
|
22
|
-
|
|
22
|
+
error: "There should be no duplicate days in dayRates",
|
|
23
23
|
}),
|
|
24
24
|
isNegotiable: zod_1.z.boolean().optional(),
|
|
25
25
|
});
|
package/dist/schemas/otp.d.ts
CHANGED
|
@@ -9,33 +9,13 @@ export declare const pinSchema: z.ZodString;
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const generalOTPSchema: z.ZodObject<{
|
|
11
11
|
pin: z.ZodString;
|
|
12
|
-
},
|
|
13
|
-
pin: string;
|
|
14
|
-
}, {
|
|
15
|
-
pin: string;
|
|
16
|
-
}>;
|
|
12
|
+
}, z.core.$strip>;
|
|
17
13
|
/**
|
|
18
14
|
* Reset password schema
|
|
19
15
|
* Validates OTP pin, new password, and password confirmation
|
|
20
16
|
*/
|
|
21
|
-
export declare const ResetPasswordSchema: z.
|
|
17
|
+
export declare const ResetPasswordSchema: z.ZodObject<{
|
|
22
18
|
pin: z.ZodString;
|
|
23
19
|
password: z.ZodString;
|
|
24
20
|
confirmPassword: z.ZodString;
|
|
25
|
-
},
|
|
26
|
-
password: string;
|
|
27
|
-
confirmPassword: string;
|
|
28
|
-
pin: string;
|
|
29
|
-
}, {
|
|
30
|
-
password: string;
|
|
31
|
-
confirmPassword: string;
|
|
32
|
-
pin: string;
|
|
33
|
-
}>, {
|
|
34
|
-
password: string;
|
|
35
|
-
confirmPassword: string;
|
|
36
|
-
pin: string;
|
|
37
|
-
}, {
|
|
38
|
-
password: string;
|
|
39
|
-
confirmPassword: string;
|
|
40
|
-
pin: string;
|
|
41
|
-
}>;
|
|
21
|
+
}, z.core.$strip>;
|
package/dist/schemas/otp.js
CHANGED
|
@@ -36,6 +36,6 @@ exports.ResetPasswordSchema = zod_1.z
|
|
|
36
36
|
.max(limits_1.PASSWORD_MAX_LENGTH, `Password must be at most ${limits_1.PASSWORD_MAX_LENGTH} characters long`),
|
|
37
37
|
})
|
|
38
38
|
.refine((data) => data.password === data.confirmPassword, {
|
|
39
|
-
|
|
39
|
+
error: "Passwords do not match",
|
|
40
40
|
path: ["confirmPassword"],
|
|
41
41
|
});
|
|
@@ -1,50 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const emailSchema: z.
|
|
2
|
+
export declare const emailSchema: z.ZodEmail;
|
|
3
3
|
export declare const passwordSchema: z.ZodString;
|
|
4
|
-
export declare const UserRegistrationSchema: z.
|
|
4
|
+
export declare const UserRegistrationSchema: z.ZodObject<{
|
|
5
5
|
firstName: z.ZodString;
|
|
6
6
|
lastName: z.ZodString;
|
|
7
|
-
email: z.
|
|
8
|
-
username: z.
|
|
7
|
+
email: z.ZodEmail;
|
|
8
|
+
username: z.ZodString;
|
|
9
9
|
role: z.ZodString;
|
|
10
10
|
password: z.ZodString;
|
|
11
11
|
confirmPassword: z.ZodString;
|
|
12
12
|
fingerPrint: z.ZodOptional<z.ZodString>;
|
|
13
|
-
},
|
|
14
|
-
role: string;
|
|
15
|
-
username: string;
|
|
16
|
-
email: string;
|
|
17
|
-
firstName: string;
|
|
18
|
-
lastName: string;
|
|
19
|
-
password: string;
|
|
20
|
-
confirmPassword: string;
|
|
21
|
-
fingerPrint?: string | undefined;
|
|
22
|
-
}, {
|
|
23
|
-
role: string;
|
|
24
|
-
username: string;
|
|
25
|
-
email: string;
|
|
26
|
-
firstName: string;
|
|
27
|
-
lastName: string;
|
|
28
|
-
password: string;
|
|
29
|
-
confirmPassword: string;
|
|
30
|
-
fingerPrint?: string | undefined;
|
|
31
|
-
}>, {
|
|
32
|
-
role: string;
|
|
33
|
-
username: string;
|
|
34
|
-
email: string;
|
|
35
|
-
firstName: string;
|
|
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;
|
|
48
|
-
fingerPrint?: string | undefined;
|
|
49
|
-
}>;
|
|
13
|
+
}, z.core.$strip>;
|
|
50
14
|
export type UserRegistrationInput = z.infer<typeof UserRegistrationSchema>;
|
|
@@ -5,11 +5,16 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const limits_1 = require("../constants/limits");
|
|
6
6
|
// Reusable email validation schema
|
|
7
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
8
|
.email("Invalid email")
|
|
12
|
-
.
|
|
9
|
+
.refine((val) => val.length >= 1, {
|
|
10
|
+
error: "Email is required",
|
|
11
|
+
})
|
|
12
|
+
.refine((val) => val.length <= limits_1.EMAIL_MAX_LENGTH, {
|
|
13
|
+
error: "Email is too long",
|
|
14
|
+
})
|
|
15
|
+
.refine((val) => /^[^+]+@/.test(val), {
|
|
16
|
+
error: "Email aliasing is not allowed",
|
|
17
|
+
});
|
|
13
18
|
// Reusable password validation schema
|
|
14
19
|
exports.passwordSchema = zod_1.z
|
|
15
20
|
.string()
|
|
@@ -45,6 +50,6 @@ exports.UserRegistrationSchema = zod_1.z
|
|
|
45
50
|
})
|
|
46
51
|
// Password match validation
|
|
47
52
|
.refine((data) => data.password === data.confirmPassword, {
|
|
48
|
-
|
|
53
|
+
error: "Passwords don't match",
|
|
49
54
|
path: ["confirmPassword"],
|
|
50
55
|
});
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* Reusable email validation schema
|
|
4
4
|
*/
|
|
5
|
-
export declare const emailSchema: z.
|
|
5
|
+
export declare const emailSchema: z.ZodEmail;
|
|
6
6
|
/**
|
|
7
7
|
* Reusable password validation schema
|
|
8
8
|
*/
|
|
@@ -10,24 +10,8 @@ export declare const passwordSchema: z.ZodString;
|
|
|
10
10
|
/**
|
|
11
11
|
* Reusable password change schema
|
|
12
12
|
*/
|
|
13
|
-
export declare const passwordChangeSchema: z.
|
|
13
|
+
export declare const passwordChangeSchema: z.ZodObject<{
|
|
14
14
|
currentPassword: z.ZodString;
|
|
15
15
|
newPassword: z.ZodString;
|
|
16
16
|
confirmPassword: z.ZodString;
|
|
17
|
-
},
|
|
18
|
-
confirmPassword: string;
|
|
19
|
-
currentPassword: string;
|
|
20
|
-
newPassword: string;
|
|
21
|
-
}, {
|
|
22
|
-
confirmPassword: string;
|
|
23
|
-
currentPassword: string;
|
|
24
|
-
newPassword: string;
|
|
25
|
-
}>, {
|
|
26
|
-
confirmPassword: string;
|
|
27
|
-
currentPassword: string;
|
|
28
|
-
newPassword: string;
|
|
29
|
-
}, {
|
|
30
|
-
confirmPassword: string;
|
|
31
|
-
currentPassword: string;
|
|
32
|
-
newPassword: string;
|
|
33
|
-
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
@@ -7,11 +7,16 @@ const limits_1 = require("../constants/limits");
|
|
|
7
7
|
* Reusable email validation schema
|
|
8
8
|
*/
|
|
9
9
|
exports.emailSchema = zod_1.z
|
|
10
|
-
.string()
|
|
11
|
-
.min(1, "Email is required")
|
|
12
|
-
.max(limits_1.EMAIL_MAX_LENGTH, "Email is too long")
|
|
13
10
|
.email("Invalid email")
|
|
14
|
-
.
|
|
11
|
+
.refine((val) => val.length >= 1, {
|
|
12
|
+
error: "Email is required",
|
|
13
|
+
})
|
|
14
|
+
.refine((val) => val.length <= limits_1.EMAIL_MAX_LENGTH, {
|
|
15
|
+
error: "Email is too long",
|
|
16
|
+
})
|
|
17
|
+
.refine((val) => /^[^+]+@/.test(val), {
|
|
18
|
+
error: "Email aliasing is not allowed",
|
|
19
|
+
});
|
|
15
20
|
/**
|
|
16
21
|
* Reusable password validation schema
|
|
17
22
|
*/
|
|
@@ -33,6 +38,6 @@ exports.passwordChangeSchema = zod_1.z
|
|
|
33
38
|
.max(limits_1.PASSWORD_MAX_LENGTH, "Confirm password is too long"),
|
|
34
39
|
})
|
|
35
40
|
.refine((data) => data.newPassword === data.confirmPassword, {
|
|
36
|
-
|
|
41
|
+
error: "Passwords don't match",
|
|
37
42
|
path: ["confirmPassword"],
|
|
38
43
|
});
|
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const WorkHistorySchema: z.
|
|
2
|
+
export declare const WorkHistorySchema: z.ZodObject<{
|
|
3
3
|
jobTitle: z.ZodString;
|
|
4
4
|
startDate: z.ZodDate;
|
|
5
5
|
endDate: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
6
6
|
organisation: z.ZodString;
|
|
7
7
|
isCurrentlyWorking: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
-
},
|
|
9
|
-
startDate: Date;
|
|
10
|
-
jobTitle: string;
|
|
11
|
-
organisation: string;
|
|
12
|
-
isCurrentlyWorking: boolean;
|
|
13
|
-
endDate?: Date | null | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
startDate: Date;
|
|
16
|
-
jobTitle: string;
|
|
17
|
-
organisation: string;
|
|
18
|
-
endDate?: Date | null | undefined;
|
|
19
|
-
isCurrentlyWorking?: boolean | undefined;
|
|
20
|
-
}>, {
|
|
21
|
-
startDate: Date;
|
|
22
|
-
jobTitle: string;
|
|
23
|
-
organisation: string;
|
|
24
|
-
isCurrentlyWorking: boolean;
|
|
25
|
-
endDate?: Date | null | undefined;
|
|
26
|
-
}, {
|
|
27
|
-
startDate: Date;
|
|
28
|
-
jobTitle: string;
|
|
29
|
-
organisation: string;
|
|
30
|
-
endDate?: Date | null | undefined;
|
|
31
|
-
isCurrentlyWorking?: boolean | undefined;
|
|
32
|
-
}>;
|
|
8
|
+
}, z.core.$strip>;
|
|
33
9
|
export type WorkHistoryInputValidation = z.infer<typeof WorkHistorySchema>;
|
|
@@ -23,6 +23,6 @@ exports.WorkHistorySchema = zod_1.z
|
|
|
23
23
|
}
|
|
24
24
|
return data.isCurrentlyWorking || data.endDate !== undefined;
|
|
25
25
|
}, {
|
|
26
|
-
|
|
26
|
+
error: "If there is an endDate, is Currently Working must be false. If is Currently Working is false, endDate must be provided.",
|
|
27
27
|
path: ["endDate", "isCurrentlyWorking"],
|
|
28
28
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@careflair/common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "Shared assets for CareFlair",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"typescript": "^5.9.3",
|
|
13
|
-
"zod": "^
|
|
13
|
+
"zod": "^4.2.1"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"pnp-zod"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"libphonenumber-js": "^1.12.25"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"zod": "^
|
|
25
|
+
"zod": "^4.2.1"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|