Skip to content

Commit fee5cea

Browse files
committed
upgrade zod to v4
1 parent fcf98b9 commit fee5cea

File tree

14 files changed

+75
-75
lines changed

14 files changed

+75
-75
lines changed

apps/hackathon-e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@t3-oss/env-core": "0.13.8",
77
"@t3-oss/env-nextjs": "0.13.8",
88
"dotenv": "^17.2.0",
9-
"zod": "3.25.67"
9+
"zod": "4.0.5"
1010
},
1111
"devDependencies": {
1212
"@clerk/testing": "^1.9.3"

apps/hackathon-e2e/src/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import "dotenv/config";
44

55
export const env = createEnv({
66
server: {
7-
BASE_URL: z.string().url(),
7+
BASE_URL: z.url(),
88
CLERK_PUBLISHABLE_KEY: z.string().min(1),
99
CLERK_SECRET_KEY: z.string().min(1),
10-
PLAYWRIGHT_USER_EMAIL: z.string().email(),
10+
PLAYWRIGHT_USER_EMAIL: z.email(),
1111
PLAYWRIGHT_USER_PASSWORD: z.string().min(1),
1212
},
1313
client: {},

apps/hackathon/convex/model/error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const safeParseConvexObject = <T extends z.ZodRawShape>(
5959
}
6060
return err({
6161
type: "DATA_IS_UNEXPECTED_SHAPE",
62-
message: JSON.stringify(result.error.format()),
62+
message: JSON.stringify(z.prettifyError(result.error)),
6363
});
6464
};
6565

@@ -73,7 +73,7 @@ export const safeParseConvexArray = <T extends z.ZodRawShape>(
7373
}
7474
return err({
7575
type: "DATA_IS_UNEXPECTED_SHAPE",
76-
message: JSON.stringify(result.error.format()),
76+
message: JSON.stringify(z.prettifyError(result.error)),
7777
});
7878
};
7979

apps/hackathon/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
"react": "19.1.0",
3030
"react-dom": "19.1.0",
3131
"uuid": "11.1.0",
32-
"zod": "3.25.67"
32+
"zod": "4.0.5"
3333
},
3434
"devDependencies": {
3535
"@storybook/nextjs-vite": "9.0.16",
3636
"@tailwindcss/postcss": "4.1.11",
3737
"@tailwindcss/vite": "4.1.11",
3838
"eslint-plugin-neverthrow": "1.1.4",
3939
"postcss": "8.5.6",
40-
"tailwindcss": "4.1.11"
40+
"tailwindcss": "4.1.12"
4141
}
4242
}

apps/hackathon/src/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const env = createEnv({
2323
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1),
2424
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL: z.string().min(1),
2525
NEXT_PUBLIC_POSTHOG_KEY: z.string().min(1),
26-
NEXT_PUBLIC_POSTHOG_HOST: z.string().url(),
26+
NEXT_PUBLIC_POSTHOG_HOST: z.url(),
2727
NEXT_PUBLIC_POSTHOG_ENABLED: z
2828
.string()
2929
// only allow "true" or "false"

apps/hackathon/src/server/zod/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const ProjectSchema = z.object({
1414
comments: z.array(CommentSchema),
1515
description: z.string().min(1),
1616
// TODO: add imageUrls
17-
// imageUrls: z.array(z.string().url()).optional(),
17+
// imageUrls: z.array(z.url()).optional(),
1818
hackathonEventId: HackathonEventIdSchema,
1919
title: z.string().min(1),
2020
updatedAt: z.number(),

apps/hackathon/src/server/zod/user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const UserSchema = z.object({
1010
...baseConvexFields("users"),
1111
firstName: z.string().min(1),
1212
lastName: z.string().min(1),
13-
avatarUrl: z.string().url(),
13+
avatarUrl: z.url(),
1414
clerkUserId: z.string(),
1515
role: UserRoleSchema.default("USER"),
1616
});

apps/hire/docs/db_schema.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const CompanySchema = z.object({
3939
* Links Profiles to Companies and defines their role within that company.
4040
*/
4141
export const CompanyMemberSchema = z.object({
42-
companyId: z.string().uuid(), // Foreign key to CompanySchema.id
42+
companyId: z.uuid(), // Foreign key to CompanySchema.id
4343
profileId: nonEmptyString, // Foreign key to ProfileSchema.id (Clerk User ID)
4444
role: CompanyRoleEnum,
4545
createdAt: z.date().default(() => new Date()),
@@ -50,7 +50,7 @@ export const CompanyMemberSchema = z.object({
5050
* Manages the list of candidate sources for a specific company.
5151
*/
5252
export const SourceSchema = z.object({
53-
companyId: z.string().uuid(), // Foreign key to CompanySchema.id
53+
companyId: z.uuid(), // Foreign key to CompanySchema.id
5454
name: nonEmptyString, // e.g., "LinkedIn", "Referral"
5555
order: z.number().int().positive().default(1),
5656
});
@@ -60,7 +60,7 @@ export const SourceSchema = z.object({
6060
* Manages the list of user-defined seniority levels for a specific company.
6161
*/
6262
export const SenioritySchema = z.object({
63-
companyId: z.string().uuid(), // Foreign key to CompanySchema.id
63+
companyId: z.uuid(), // Foreign key to CompanySchema.id
6464
name: nonEmptyString, // e.g., "Intern", "Senior Engineer"
6565
order: z.number().int().positive().default(1),
6666
createdAt: z.date().default(() => new Date()),
@@ -75,7 +75,7 @@ export const SenioritySchema = z.object({
7575
* Manages the list of user-defined hiring stages for a specific company.
7676
*/
7777
export const KanbanStageSchema = z.object({
78-
companyId: z.string().uuid(), // Foreign key to CompanySchema.id
78+
companyId: z.uuid(), // Foreign key to CompanySchema.id
7979
name: nonEmptyString, // e.g., "Applied", "Technical Interview"
8080
order: z.number().int().positive().default(1),
8181
createdAt: z.date().default(() => new Date()),
@@ -90,7 +90,7 @@ export const KanbanStageSchema = z.object({
9090
* Manages the list of user-defined job roles for a specific company.
9191
*/
9292
export const RoleSchema = z.object({
93-
companyId: z.string().uuid(), // Foreign key to CompanySchema.id
93+
companyId: z.uuid(), // Foreign key to CompanySchema.id
9494
name: nonEmptyString, // e.g., "Software Engineer", "Product Manager"
9595
order: z.number().int().positive().default(1),
9696
createdAt: z.date().default(() => new Date()),
@@ -105,7 +105,7 @@ export const RoleSchema = z.object({
105105
* Central table for all candidate information, scoped to a company.
106106
*/
107107
export const CandidateSchema = z.object({
108-
companyId: z.string().uuid(), // Foreign key to CompanySchema.id
108+
companyId: z.uuid(), // Foreign key to CompanySchema.id
109109
name: nonEmptyString,
110110
email: z
111111
.string()
@@ -118,14 +118,14 @@ export const CandidateSchema = z.object({
118118
.url({ message: "Invalid URL" })
119119
.optional()
120120
.nullable(),
121-
resumeUrl: z.string().url({ message: "Invalid URL" }).optional().nullable(), // URL from UploadThing (@https://uploadthing.com/)
121+
resumeUrl: z.url({ message: "Invalid URL" }).optional().nullable(), // URL from UploadThing (@https://uploadthing.com/)
122122
targetTeam: z.string().optional().nullable(),
123-
roleId: z.string().uuid(), // Foreign key to RoleSchema.id
124-
seniorityId: z.string().uuid(), // Foreign key to SenioritySchema.id
125-
kanbanStageId: z.string().uuid(), // Foreign key to KanbanStageSchema.id
123+
roleId: z.uuid(), // Foreign key to RoleSchema.id
124+
seniorityId: z.uuid(), // Foreign key to SenioritySchema.id
125+
kanbanStageId: z.uuid(), // Foreign key to KanbanStageSchema.id
126126
salaryExpectations: z.string().optional().nullable(),
127127
nextSteps: z.string().optional().nullable(),
128-
sourceId: z.string().uuid().optional().nullable(), // Foreign key to SourceSchema.id
128+
sourceId: z.uuid().optional().nullable(), // Foreign key to SourceSchema.id
129129
addedByProfileId: nonEmptyString, // Clerk User ID of the user who added the candidate
130130
updatedAt: z
131131
.date()
@@ -138,7 +138,7 @@ export const CandidateSchema = z.object({
138138
* Stores structured templates for interview notes, scoped to a company.
139139
*/
140140
export const InterviewNoteTemplateSchema = z.object({
141-
companyId: z.string().uuid(), // Foreign key to CompanySchema.id
141+
companyId: z.uuid(), // Foreign key to CompanySchema.id
142142
name: nonEmptyString, // e.g., "Technical Interview Template"
143143
templateFields: z.record(z.string(), z.any()).default({}),
144144
createdAt: z.date().default(() => new Date()),
@@ -154,11 +154,11 @@ export const InterviewNoteTemplateSchema = z.object({
154154
* Implicitly scoped to a company via candidate_id.
155155
*/
156156
export const InterviewSchema = z.object({
157-
candidateId: z.string().uuid(), // Foreign key to CandidateSchema.id
157+
candidateId: z.uuid(), // Foreign key to CandidateSchema.id
158158
interviewType: z.string().optional().nullable(),
159159
interviewDate: z.date().optional().nullable(),
160160
interviewers: z.array(nonEmptyString).default([]),
161-
assignedTemplateId: z.string().uuid().optional().nullable(),
161+
assignedTemplateId: z.uuid().optional().nullable(),
162162
notesContent: z.record(z.string(), z.any()).optional().nullable(),
163163
recordedByProfileId: nonEmptyString, // Clerk User ID of user who recorded the interview
164164
createdAt: z.date().default(() => new Date()),

apps/hire/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"next": "15.3.5",
1818
"react": "19.1.0",
1919
"react-dom": "19.1.0",
20-
"zod": "3.25.67"
20+
"zod": "4.0.5"
2121
},
2222
"devDependencies": {
2323
"@tailwindcss/postcss": "4.1.11",

apps/hire/src/server/zod/candidate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ export const CandidateSchema = z.object({
1111
...baseConvexFields("candidates"),
1212
companyId: CompanyIdSchema,
1313
completedOnboardingSteps: z.array(zid("onboardingSteps")).default([]),
14-
email: z.string().email({ message: "Invalid email address" }).optional(),
14+
email: z.email().optional(),
1515
kanbanStageId: zid("kanbanStages"),
16-
linkedinProfile: z.string().url({ message: "Invalid URL" }).optional(),
16+
linkedinProfile: z.url().optional(),
1717
name: nonEmptyString,
1818
location: z.string().optional(),
1919
startDate: z.number().optional(),
2020
nextSteps: z.string().optional(),
2121
phone: z.string().optional(),
22-
resumeUrl: z.string().url({ message: "Invalid URL" }).optional(),
22+
resumeUrl: z.url().optional(),
2323
roleId: zid("roles").optional(),
2424
salaryExpectations: z.string().optional(),
2525
seniorityId: zid("seniorities").optional(),

0 commit comments

Comments
 (0)