-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathreplayTask.ts
More file actions
30 lines (27 loc) · 699 Bytes
/
replayTask.ts
File metadata and controls
30 lines (27 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { z } from "zod";
import { RunOptionsData } from "./testTask";
export const ReplayRunData = z
.object({
environment: z.string().optional(),
payload: z.string().optional(),
metadata: z
.string()
.optional()
.transform((val, ctx) => {
if (!val) {
return {};
}
try {
return JSON.parse(val);
} catch {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Metadata must be a valid JSON string",
});
return z.NEVER;
}
}),
failedRedirect: z.string(),
})
.and(RunOptionsData);
export type ReplayRunData = z.infer<typeof ReplayRunData>;