MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / isValidBody

Function isValidBody

lib/edge-runtime/utils.ts:18–29  ·  view source on GitHub ↗
(
  body: any,
  bodySchema: z.ZodType<T>,
)

Source from the content-addressed store, hash-verified

16import { createMiddlewareSupabaseClient } from "@supabase/auth-helpers-nextjs";
17
18export function isValidBody<T extends Record<string, unknown>>(
19 body: any,
20 bodySchema: z.ZodType<T>,
21): body is T {
22 const safeParseOut = bodySchema.safeParse(body);
23 if ("error" in safeParseOut) {
24 console.error(
25 "Error parsing request body: " + safeParseOut.error.toString(),
26 );
27 }
28 return safeParseOut.success;
29}
30
31export function DBChatMessageToGPT(
32 message: DBChatMessage,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected