/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: c5cc252be3b5 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const TypeEnum = { Enum: "ENUM", Text: "TEXT", Int: "INT", Float: "FLOAT", Bool: "BOOL", Timestamp: "TIMESTAMP", Array: "ARRAY", Map: "MAP", } as const; export type TypeEnum = OpenEnum; export const SupportedOperator = { Lt: "lt", Lte: "lte", Gt: "gt", Gte: "gte", Startswith: "startswith", Istartswith: "istartswith", Endswith: "endswith", Iendswith: "iendswith", Contains: "contains", Icontains: "icontains", Matches: "matches", Notcontains: "notcontains", Inotcontains: "inotcontains", Eq: "eq", Neq: "neq", Isnull: "isnull", Includes: "includes", Excludes: "excludes", LenEq: "len_eq", } as const; export type SupportedOperator = OpenEnum; export type BaseFieldDefinition = { name: string; label: string; type: TypeEnum; group?: string | null | undefined; supportedOperators: Array; }; /** @internal */ export const TypeEnum$inboundSchema: z.ZodType = openEnums .inboundSchema(TypeEnum); /** @internal */ export const SupportedOperator$inboundSchema: z.ZodType< SupportedOperator, unknown > = openEnums.inboundSchema(SupportedOperator); /** @internal */ export const BaseFieldDefinition$inboundSchema: z.ZodType< BaseFieldDefinition, unknown > = z.object({ name: z.string(), label: z.string(), type: TypeEnum$inboundSchema, group: z.nullable(z.string()).optional(), supported_operators: z.array(SupportedOperator$inboundSchema), }).transform((v) => { return remap$(v, { "supported_operators": "supportedOperators", }); }); export function baseFieldDefinitionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BaseFieldDefinition$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BaseFieldDefinition' from JSON`, ); }