Add schema utils

This commit is contained in:
Jamie Kyle 2024-10-02 12:03:10 -07:00 committed by GitHub
parent c8a729f8be
commit b26466e59d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 674 additions and 151 deletions

View file

@ -11,6 +11,7 @@ import { getUserAgent } from '../util/getUserAgent';
import { maybeParseUrl } from '../util/url';
import * as durations from '../util/durations';
import type { LoggerType } from '../types/Logging';
import { parseUnknown } from '../util/schemas';
const BASE_URL = 'https://debuglogs.org';
@ -26,7 +27,7 @@ const tokenBodySchema = z
const parseTokenBody = (
rawBody: unknown
): { fields: Record<string, unknown>; url: string } => {
const body = tokenBodySchema.parse(rawBody);
const body = parseUnknown(tokenBodySchema, rawBody);
const parsedUrl = maybeParseUrl(body.url);
if (!parsedUrl) {