Skip to content

Commit 68a6492

Browse files
committed
chore: upgrade to zod v4
1 parent 86235e5 commit 68a6492

120 files changed

Lines changed: 877 additions & 864 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/zod-4-support.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@trigger.dev/core": minor
3+
"@trigger.dev/sdk": minor
4+
"trigger.dev": minor
5+
"@trigger.dev/redis-worker": minor
6+
"@trigger.dev/schema-to-json": minor
7+
---
8+
9+
Add zod v4 compatibility. The `zod` peer dependency is widened to `^3.25.0 || ^4.0.0`, so projects can use zod 3.25+ or zod 4. Internal code was updated for zod v4 API changes (`ZodError.errors``.issues`, single-arg `z.record` → keyed, unified `error` option, `z.ZodSchema`/`z.AnyZodObject``z.ZodType`/`z.ZodObject`, `z.any()` object fields made `.optional()` to preserve v3 inference). No runtime behavior change for existing zod 3 users.

apps/supervisor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"prom-client": "^15.1.0",
2424
"socket.io": "4.7.4",
2525
"std-env": "^3.8.0",
26-
"zod": "3.25.76"
26+
"zod": "4.4.3"
2727
},
2828
"devDependencies": {
2929
"@internal/testcontainers": "workspace:*",

apps/webapp/app/components/Feedback.tsx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import {
2-
getFormProps,
3-
getSelectProps,
4-
getInputProps,
5-
getTextareaProps,
6-
useForm,
7-
} from "@conform-to/react";
8-
import { parseWithZod } from "@conform-to/zod";
1+
import { getFormProps, getSelectProps, getInputProps, getTextareaProps, useForm } from "@conform-to/react";
2+
import { parseWithZod } from "@conform-to/zod/v4";
93
import { InformationCircleIcon, ArrowUpCircleIcon } from "@heroicons/react/20/solid";
104
import { EnvelopeIcon, ShieldCheckIcon } from "@heroicons/react/24/solid";
115
import { Form, useActionData, useLocation, useNavigation, useSearchParams } from "@remix-run/react";
@@ -53,11 +47,11 @@ export function Feedback({ button, defaultValue = "bug", onOpenChange }: Feedbac
5347
if (
5448
navigation.formAction === "/resources/feedback" &&
5549
navigation.state === "loading" &&
56-
Object.keys(form.allErrors).length === 0
50+
(form.errors === undefined || form.errors.length === 0)
5751
) {
5852
setOpen(false);
5953
}
60-
}, [navigation.formAction, navigation.state, form.allErrors]);
54+
}, [navigation, form]);
6155

6256
// Handle URL param functionality
6357
useEffect(() => {
@@ -95,17 +89,9 @@ export function Feedback({ button, defaultValue = "bug", onOpenChange }: Feedbac
9589
type === "concurrency" ||
9690
type === "hipaa"
9791
) && <hr className="border-grid-dimmed" />}
98-
<Form
99-
method="post"
100-
action="/resources/feedback"
101-
{...getFormProps(form)}
102-
className="w-full"
103-
>
92+
<Form method="post" action="/resources/feedback" {...getFormProps(form)} className="w-full">
10493
<Fieldset className="max-w-full gap-y-3">
105-
<input
106-
value={location.pathname}
107-
{...getInputProps(fields.path, { type: "hidden" })}
108-
/>
94+
<input value={location.pathname} {...getInputProps(fields.path, { type: "hidden", value: false })} />
10995
<InputGroup className="max-w-full">
11096
{type === "feature" && (
11197
<InfoPanel

apps/webapp/app/components/errors/ConfigureErrorAlerts.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getFormProps, getInputProps, useForm } from "@conform-to/react";
2-
import { parseWithZod } from "@conform-to/zod";
2+
import { parseWithZod } from "@conform-to/zod/v4";
33
import {
44
EnvelopeIcon,
55
GlobeAltIcon,
@@ -135,7 +135,12 @@ export function ConfigureErrorAlerts({
135135
/>
136136
</div>
137137

138-
<fetcher.Form method="post" action={formAction} {...getFormProps(form)} className="contents">
138+
<fetcher.Form
139+
method="post"
140+
action={formAction}
141+
{...getFormProps(form)}
142+
className="contents"
143+
>
139144
<div className="flex-1 overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
140145
<Fieldset className="flex flex-col gap-4 p-4">
141146
<div className="flex flex-col">

apps/webapp/app/components/metrics/QueryWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const chartConfigOptions = {
5555
sortByColumn: z.string().nullable(),
5656
sortDirection: SortDirection,
5757
aggregation: AggregationType,
58-
seriesColors: z.record(z.string()).optional(),
58+
seriesColors: z.record(z.string(), z.string()).optional(),
5959
};
6060

6161
const ChartConfiguration = z.object({ ...chartConfigOptions });

apps/webapp/app/components/runs/v3/ReplayRunDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getFormProps, getInputProps, getSelectProps, useForm } from "@conform-to/react";
2-
import { parseWithZod } from "@conform-to/zod";
2+
import { parseWithZod } from "@conform-to/zod/v4";
33
import { RectangleStackIcon } from "@heroicons/react/20/solid";
44
import { DialogClose } from "@radix-ui/react-dialog";
55
import { Form, useActionData, useNavigation, useParams, useSubmit } from "@remix-run/react";

apps/webapp/app/components/schedules/PurchaseSchedulesModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getFormProps, useForm } from "@conform-to/react";
2-
import { parseWithZod } from "@conform-to/zod";
2+
import { parseWithZod } from "@conform-to/zod/v4";
33
import { EnvelopeIcon } from "@heroicons/react/20/solid";
44
import { DialogClose } from "@radix-ui/react-dialog";
55
import { useFetcher } from "@remix-run/react";

apps/webapp/app/models/orgIntegration.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const SlackSecretSchema = z.object({
2020
refreshToken: z.string().optional(),
2121
botScopes: z.array(z.string()).optional(),
2222
userScopes: z.array(z.string()).optional(),
23-
raw: z.record(z.any()).optional(),
23+
raw: z.record(z.string(), z.any()).optional(),
2424
});
2525

2626
type SlackSecret = z.infer<typeof SlackSecretSchema>;

apps/webapp/app/models/vercelIntegration.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const VercelSecretSchema = z.object({
129129
teamId: z.string().nullable().optional(),
130130
userId: z.string().optional(),
131131
installationId: z.string().optional(),
132-
raw: z.record(z.any()).optional(),
132+
raw: z.record(z.string(), z.any()).optional(),
133133
});
134134

135135
export type VercelSecret = z.infer<typeof VercelSecretSchema>;

apps/webapp/app/models/vercelSdkRecovery.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ export const VercelSchemas = {
145145
.union([
146146
z
147147
.object({
148-
envs: z.array(z.record(z.unknown())),
148+
envs: z.array(z.record(z.string(), z.unknown())),
149149
pagination: z.unknown().optional(),
150150
})
151151
.passthrough(),
152-
z.array(z.record(z.unknown())),
152+
z.array(z.record(z.string(), z.unknown())),
153153
])
154154
.transform((val) => (Array.isArray(val) ? { envs: val } : val)),
155155

0 commit comments

Comments
 (0)