/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Postgres = { /** * The error received in response to a StartupMessage with an unexpected protocol version. */ protocolError?: { [k: string]: string } | undefined; /** * The error received in response to a StartupMessage without providing the User field. */ startupError?: { [k: string]: string } | undefined; supportedVersions?: string | undefined; }; /** @internal */ export const Postgres$inboundSchema: z.ZodType< Postgres, z.ZodTypeDef, unknown > = z.object({ protocol_error: z.record(z.string()).optional(), startup_error: z.record(z.string()).optional(), supported_versions: z.string().optional(), }).transform((v) => { return remap$(v, { "protocol_error": "protocolError", "startup_error": "startupError", "supported_versions": "supportedVersions", }); }); export function postgresFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Postgres$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Postgres' from JSON`, ); }