MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / safeJsonZodParse

Function safeJsonZodParse

apps/webapp/app/utils/json.ts:15–26  ·  view source on GitHub ↗
(
  schema: z.Schema<T>,
  json: string
)

Source from the content-addressed store, hash-verified

13}
14
15export function safeJsonZodParse<T>(
16 schema: z.Schema<T>,
17 json: string
18): z.SafeParseReturnType<unknown, T> | undefined {
19 const parsed = safeJsonParse(json);
20
21 if (parsed === null) {
22 return;
23 }
24
25 return schema.safeParse(parsed);
26}
27
28export async function safeJsonFromResponse(response: Response) {
29 const json = await response.text();

Callers 1

#executeJobMethod · 0.90

Calls 1

safeJsonParseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…