/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../../lib/primitives.js"; import { collectExtraKeys as collectExtraKeys$, safeParse, } from "../../../lib/schemas.js"; import { Result as SafeParseResult } from "../../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Query = {}; export type Support = {}; /** * The partially evaluated result of the query. */ export type CompileResultJSONResult = { query?: Query | undefined; support?: Support | undefined; additionalProperties?: { [k: string]: any }; }; /** * The partially evaluated result of the query. Result will be empty if the query is never true. */ export type CompileResultJSON = { /** * The partially evaluated result of the query. */ result?: CompileResultJSONResult | undefined; }; /** @internal */ export const Query$inboundSchema: z.ZodType = z .object({}); /** @internal */ export type Query$Outbound = {}; /** @internal */ export const Query$outboundSchema: z.ZodType< Query$Outbound, z.ZodTypeDef, Query > = z.object({}); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Query$ { /** @deprecated use `Query$inboundSchema` instead. */ export const inboundSchema = Query$inboundSchema; /** @deprecated use `Query$outboundSchema` instead. */ export const outboundSchema = Query$outboundSchema; /** @deprecated use `Query$Outbound` instead. */ export type Outbound = Query$Outbound; } export function queryToJSON(query: Query): string { return JSON.stringify(Query$outboundSchema.parse(query)); } export function queryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Query$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Query' from JSON`, ); } /** @internal */ export const Support$inboundSchema: z.ZodType = z.object({}); /** @internal */ export type Support$Outbound = {}; /** @internal */ export const Support$outboundSchema: z.ZodType< Support$Outbound, z.ZodTypeDef, Support > = z.object({}); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Support$ { /** @deprecated use `Support$inboundSchema` instead. */ export const inboundSchema = Support$inboundSchema; /** @deprecated use `Support$outboundSchema` instead. */ export const outboundSchema = Support$outboundSchema; /** @deprecated use `Support$Outbound` instead. */ export type Outbound = Support$Outbound; } export function supportToJSON(support: Support): string { return JSON.stringify(Support$outboundSchema.parse(support)); } export function supportFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Support$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Support' from JSON`, ); } /** @internal */ export const CompileResultJSONResult$inboundSchema: z.ZodType< CompileResultJSONResult, z.ZodTypeDef, unknown > = collectExtraKeys$( z.object({ query: z.lazy(() => Query$inboundSchema).optional(), support: z.lazy(() => Support$inboundSchema).optional(), }).catchall(z.any()), "additionalProperties", true, ); /** @internal */ export type CompileResultJSONResult$Outbound = { query?: Query$Outbound | undefined; support?: Support$Outbound | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const CompileResultJSONResult$outboundSchema: z.ZodType< CompileResultJSONResult$Outbound, z.ZodTypeDef, CompileResultJSONResult > = z.object({ query: z.lazy(() => Query$outboundSchema).optional(), support: z.lazy(() => Support$outboundSchema).optional(), additionalProperties: z.record(z.any()), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { additionalProperties: null, }), }; }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CompileResultJSONResult$ { /** @deprecated use `CompileResultJSONResult$inboundSchema` instead. */ export const inboundSchema = CompileResultJSONResult$inboundSchema; /** @deprecated use `CompileResultJSONResult$outboundSchema` instead. */ export const outboundSchema = CompileResultJSONResult$outboundSchema; /** @deprecated use `CompileResultJSONResult$Outbound` instead. */ export type Outbound = CompileResultJSONResult$Outbound; } export function compileResultJSONResultToJSON( compileResultJSONResult: CompileResultJSONResult, ): string { return JSON.stringify( CompileResultJSONResult$outboundSchema.parse(compileResultJSONResult), ); } export function compileResultJSONResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompileResultJSONResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompileResultJSONResult' from JSON`, ); } /** @internal */ export const CompileResultJSON$inboundSchema: z.ZodType< CompileResultJSON, z.ZodTypeDef, unknown > = z.object({ result: z.lazy(() => CompileResultJSONResult$inboundSchema).optional(), }); /** @internal */ export type CompileResultJSON$Outbound = { result?: CompileResultJSONResult$Outbound | undefined; }; /** @internal */ export const CompileResultJSON$outboundSchema: z.ZodType< CompileResultJSON$Outbound, z.ZodTypeDef, CompileResultJSON > = z.object({ result: z.lazy(() => CompileResultJSONResult$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CompileResultJSON$ { /** @deprecated use `CompileResultJSON$inboundSchema` instead. */ export const inboundSchema = CompileResultJSON$inboundSchema; /** @deprecated use `CompileResultJSON$outboundSchema` instead. */ export const outboundSchema = CompileResultJSON$outboundSchema; /** @deprecated use `CompileResultJSON$Outbound` instead. */ export type Outbound = CompileResultJSON$Outbound; } export function compileResultJSONToJSON( compileResultJSON: CompileResultJSON, ): string { return JSON.stringify( CompileResultJSON$outboundSchema.parse(compileResultJSON), ); } export function compileResultJSONFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompileResultJSON$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompileResultJSON' from JSON`, ); }