@careflair/common 1.0.37 → 1.0.39

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.
@@ -2,7 +2,15 @@ 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.ZodOptional<z.ZodString>;
6
- amount: z.ZodOptional<z.ZodString>;
7
- }, z.core.$strip>;
5
+ videoLink: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
6
+ amount: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ proposal: string;
9
+ videoLink?: string | undefined;
10
+ amount?: string | undefined;
11
+ }, {
12
+ proposal: string;
13
+ videoLink?: string | undefined;
14
+ amount?: string | undefined;
15
+ }>;
8
16
  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
- error: "Please provide a valid YouTube or Vimeo URL",
21
+ message: "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
- error: `Hourly rate must be between $${limits_1.MIN_HOURLY_RATE} and $${limits_1.MAX_HOURLY_RATE}`,
29
+ message: `Hourly rate must be between $${limits_1.MIN_HOURLY_RATE} and $${limits_1.MAX_HOURLY_RATE}`,
30
30
  }),
31
31
  });
@@ -1,10 +1,56 @@
1
1
  import { z } from 'zod';
2
- export declare const AvailabilitiesSchemaZod: z.ZodArray<z.ZodObject<{
2
+ export declare const AvailabilitiesSchemaZod: z.ZodEffects<z.ZodArray<z.ZodObject<{
3
3
  day: z.ZodString;
4
4
  isEnabled: z.ZodDefault<z.ZodBoolean>;
5
- shifts: z.ZodArray<z.ZodObject<{
6
- startTime: z.ZodString;
7
- endTime: z.ZodString;
8
- }, z.core.$strip>>;
9
- }, z.core.$strip>>;
5
+ shifts: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
6
+ startTime: z.ZodEffects<z.ZodString, string, string>;
7
+ endTime: z.ZodEffects<z.ZodString, string, string>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ endTime: string;
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
+ }[]>;
10
56
  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
- error: 'Start time must be before end time',
45
+ message: '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
- error: 'Shifts cannot overlap',
69
+ message: '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
- error: 'There should be no duplicate days',
78
+ message: '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.ZodOptional<z.ZodArray<z.ZodEnum<typeof CategoryEnum>>>;
3
+ export declare const ServicesSchema: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof CategoryEnum>, "many">>, CategoryEnum[] | undefined, CategoryEnum[] | undefined>;
4
4
  export declare const validateServices: (services?: string[]) => boolean;
5
- export declare const SupportWorkerServicesSchema: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof SupportWorkerService>>>;
5
+ export declare const SupportWorkerServicesSchema: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof SupportWorkerService>, "many">>, SupportWorkerService[] | undefined, SupportWorkerService[] | undefined>;
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)), { error: 'Invalid services provided.' });
9
+ .refine((services) => !services || services.every((service) => Object.values(enums_1.CategoryEnum).includes(service)), { message: '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)), { error: 'Invalid services provided.' });
18
+ .refine((services) => !services || services.every((service) => Object.values(enums_1.SupportWorkerService).includes(service)), { message: 'Invalid services provided.' });
19
19
  const validateSupportWorkerServices = (services) => {
20
20
  const result = exports.SupportWorkerServicesSchema.safeParse(services);
21
21
  return result.success;
@@ -1,10 +1,38 @@
1
1
  import { z } from "zod";
2
- export declare const EducationAndTrainingSchema: z.ZodObject<{
2
+ export declare const EducationAndTrainingSchema: z.ZodEffects<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
- }, z.core.$strip>;
9
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
10
38
  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
- error: "If there is an endDate, is Currently Studying must be false. If is Currently Studying is false, endDate must be provided.",
27
+ message: "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
  });
@@ -2,55 +2,263 @@ import { z } from "zod";
2
2
  /**
3
3
  * Registration form schema
4
4
  */
5
- export declare const registrationFormSchema: z.ZodObject<{
5
+ export declare const registrationFormSchema: z.ZodEffects<z.ZodObject<{
6
6
  firstName: z.ZodString;
7
7
  lastName: z.ZodString;
8
- email: z.ZodEmail;
9
- username: z.ZodString;
8
+ email: z.ZodString;
9
+ username: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
10
10
  role: z.ZodString;
11
11
  password: z.ZodString;
12
12
  confirmPassword: z.ZodString;
13
13
  fingerPrint: z.ZodOptional<z.ZodString>;
14
- }, z.core.$strip>;
14
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
15
51
  /**
16
52
  * Participant location form schema
17
53
  */
18
54
  export declare const participantLocationFormSchema: z.ZodObject<{
19
- address: z.ZodObject<{
55
+ address: z.ZodEffects<z.ZodObject<{
20
56
  value: z.ZodString;
21
57
  label: z.ZodString;
22
- }, z.core.$strip>;
23
- state: z.ZodObject<{
58
+ }, "strip", z.ZodTypeAny, {
59
+ value: string;
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<{
24
72
  value: z.ZodString;
25
73
  label: z.ZodString;
26
- }, z.core.$strip>;
27
- }, z.core.$strip>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ value: string;
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
+ }>;
28
106
  /**
29
107
  * Contact details form schema
30
108
  */
31
109
  export declare const ContactDetailsFormSchema: z.ZodObject<{
32
- phone: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
33
- email: z.ZodUnion<[z.ZodOptional<z.ZodEmail>, z.ZodLiteral<"">]>;
110
+ phone: z.ZodUnion<[z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>, z.ZodLiteral<"">]>;
111
+ email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
34
112
  website: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
35
113
  enableSmsNotifications: z.ZodOptional<z.ZodBoolean>;
36
- }, z.core.$strip>;
114
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
37
125
  /**
38
126
  * Education and training form schema
39
127
  */
40
- export declare const EducationAndTrainingFormSchema: z.ZodObject<{
128
+ export declare const EducationAndTrainingFormSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
41
129
  type: z.ZodString;
42
130
  school: z.ZodString;
43
131
  degree: z.ZodString;
44
132
  startDate: z.ZodOptional<z.ZodDate>;
45
133
  endDate: z.ZodOptional<z.ZodDate>;
46
- }, z.core.$strip>;
134
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
47
195
  /**
48
196
  * Work history form schema
49
197
  */
50
- export declare const WorkHistoryFormSchema: z.ZodObject<{
198
+ export declare const WorkHistoryFormSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
51
199
  jobTitle: z.ZodString;
52
200
  organisation: z.ZodString;
53
- startDate: z.ZodString;
201
+ startDate: z.ZodEffects<z.ZodString, string, string>;
54
202
  endDate: z.ZodOptional<z.ZodString>;
55
203
  isCurrentlyWorking: z.ZodDefault<z.ZodBoolean>;
56
- }, z.core.$strip>;
204
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
@@ -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
- error: "Passwords don't match",
40
+ message: "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
- error: "Address is required",
53
+ message: "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
- error: "State is required",
62
+ message: "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
- error: "Please enter a valid Australian mobile number (04XX XXX XXX)",
84
+ message: "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.email("Invalid email address").optional().or(zod_1.z.literal("")),
88
+ email: zod_1.z.string().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
- error: "Please select a start date",
112
+ invalid_type_error: "Please select a start date",
113
113
  })
114
114
  .optional(),
115
115
  endDate: zod_1.z
116
116
  .date({
117
- error: "Please select an end date",
117
+ invalid_type_error: "Please select an end date",
118
118
  })
119
119
  .optional(),
120
120
  })
121
121
  .refine((data) => data.startDate !== undefined && data.startDate !== null, {
122
- error: "Start date is required",
122
+ message: "Start date is required",
123
123
  path: ["startDate"],
124
124
  })
125
125
  .refine((data) => data.endDate !== undefined && data.endDate !== null, {
126
- error: "End date is required",
126
+ message: "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
- error: "End date must be after start date",
137
+ message: "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
- error: "There must be at least 1 month between start and end date",
150
+ message: "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
- error: "Start date cannot be in the future",
186
+ message: "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
- error: "End date must be after start date",
200
+ message: "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
- error: "End date cannot be in the future",
210
+ message: "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
- error: "There must be at least 1 month between start and end date",
220
+ message: "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
- error: "If there is an endDate, Currently Working must be false. If Currently Working is false, endDate must be provided.",
232
+ message: "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,10 +1,36 @@
1
1
  import { z } from "zod";
2
2
  export declare const HourlyRateInputZod: z.ZodObject<{
3
3
  service: z.ZodString;
4
- dayRates: z.ZodArray<z.ZodObject<{
4
+ dayRates: z.ZodEffects<z.ZodArray<z.ZodObject<{
5
5
  day: z.ZodString;
6
6
  price: z.ZodNumber;
7
- }, z.core.$strip>>;
7
+ }, "strip", z.ZodTypeAny, {
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
+ }[]>;
8
20
  isNegotiable: z.ZodOptional<z.ZodBoolean>;
9
- }, z.core.$strip>;
21
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
10
36
  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
- error: "There should be no duplicate days in dayRates",
22
+ message: "There should be no duplicate days in dayRates",
23
23
  }),
24
24
  isNegotiable: zod_1.z.boolean().optional(),
25
25
  });
@@ -9,13 +9,33 @@ export declare const pinSchema: z.ZodString;
9
9
  */
10
10
  export declare const generalOTPSchema: z.ZodObject<{
11
11
  pin: z.ZodString;
12
- }, z.core.$strip>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ pin: string;
14
+ }, {
15
+ pin: string;
16
+ }>;
13
17
  /**
14
18
  * Reset password schema
15
19
  * Validates OTP pin, new password, and password confirmation
16
20
  */
17
- export declare const ResetPasswordSchema: z.ZodObject<{
21
+ export declare const ResetPasswordSchema: z.ZodEffects<z.ZodObject<{
18
22
  pin: z.ZodString;
19
23
  password: z.ZodString;
20
24
  confirmPassword: z.ZodString;
21
- }, z.core.$strip>;
25
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
@@ -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
- error: "Passwords do not match",
39
+ message: "Passwords do not match",
40
40
  path: ["confirmPassword"],
41
41
  });
@@ -1,14 +1,50 @@
1
1
  import { z } from "zod";
2
- export declare const emailSchema: z.ZodEmail;
2
+ export declare const emailSchema: z.ZodString;
3
3
  export declare const passwordSchema: z.ZodString;
4
- export declare const UserRegistrationSchema: z.ZodObject<{
4
+ export declare const UserRegistrationSchema: z.ZodEffects<z.ZodObject<{
5
5
  firstName: z.ZodString;
6
6
  lastName: z.ZodString;
7
- email: z.ZodEmail;
8
- username: z.ZodString;
7
+ email: z.ZodString;
8
+ username: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
9
9
  role: z.ZodString;
10
10
  password: z.ZodString;
11
11
  confirmPassword: z.ZodString;
12
12
  fingerPrint: z.ZodOptional<z.ZodString>;
13
- }, z.core.$strip>;
13
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
14
50
  export type UserRegistrationInput = z.infer<typeof UserRegistrationSchema>;
@@ -5,16 +5,11 @@ 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")
8
11
  .email("Invalid email")
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
- });
12
+ .regex(/^[^+]+@/, "Email aliasing is not allowed");
18
13
  // Reusable password validation schema
19
14
  exports.passwordSchema = zod_1.z
20
15
  .string()
@@ -50,6 +45,6 @@ exports.UserRegistrationSchema = zod_1.z
50
45
  })
51
46
  // Password match validation
52
47
  .refine((data) => data.password === data.confirmPassword, {
53
- error: "Passwords don't match",
48
+ message: "Passwords don't match",
54
49
  path: ["confirmPassword"],
55
50
  });
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  /**
3
3
  * Reusable email validation schema
4
4
  */
5
- export declare const emailSchema: z.ZodEmail;
5
+ export declare const emailSchema: z.ZodString;
6
6
  /**
7
7
  * Reusable password validation schema
8
8
  */
@@ -10,8 +10,24 @@ export declare const passwordSchema: z.ZodString;
10
10
  /**
11
11
  * Reusable password change schema
12
12
  */
13
- export declare const passwordChangeSchema: z.ZodObject<{
13
+ export declare const passwordChangeSchema: z.ZodEffects<z.ZodObject<{
14
14
  currentPassword: z.ZodString;
15
15
  newPassword: z.ZodString;
16
16
  confirmPassword: z.ZodString;
17
- }, z.core.$strip>;
17
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
@@ -7,16 +7,11 @@ 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")
10
13
  .email("Invalid email")
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
- });
14
+ .regex(/^[^+]+@/, "Email aliasing is not allowed");
20
15
  /**
21
16
  * Reusable password validation schema
22
17
  */
@@ -38,6 +33,6 @@ exports.passwordChangeSchema = zod_1.z
38
33
  .max(limits_1.PASSWORD_MAX_LENGTH, "Confirm password is too long"),
39
34
  })
40
35
  .refine((data) => data.newPassword === data.confirmPassword, {
41
- error: "Passwords don't match",
36
+ message: "Passwords don't match",
42
37
  path: ["confirmPassword"],
43
38
  });
@@ -1,9 +1,33 @@
1
1
  import { z } from "zod";
2
- export declare const WorkHistorySchema: z.ZodObject<{
2
+ export declare const WorkHistorySchema: z.ZodEffects<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
- }, z.core.$strip>;
8
+ }, "strip", z.ZodTypeAny, {
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
+ }>;
9
33
  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
- error: "If there is an endDate, is Currently Working must be false. If is Currently Working is false, endDate must be provided.",
26
+ message: "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.37",
3
+ "version": "1.0.39",
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": "^4.2.1"
13
+ "zod": "^3.25.76"
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": "^4.2.1"
25
+ "zod": "^3.22.4 || ^3.23.8"
26
26
  },
27
27
  "files": [
28
28
  "dist"