/* * 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"; import { FileContentItem, FileContentItem$inboundSchema, FileContentItem$Outbound, FileContentItem$outboundSchema, } from "./filecontentitem.js"; export type VectorStoreFileContentAttributes = string | boolean | number; /** * The parsed contents of a vector store file. */ export type VectorStoreFileContent = { /** * The ID of the file. */ fileId: string; /** * The name of the file. */ filename: string; /** * File attributes. */ attributes?: { [k: string]: string | boolean | number } | undefined; /** * Array of parsed content items from the file. */ content: Array; }; /** @internal */ export const VectorStoreFileContentAttributes$inboundSchema: z.ZodType< VectorStoreFileContentAttributes, z.ZodTypeDef, unknown > = z.union([z.string(), z.boolean(), z.number()]); /** @internal */ export type VectorStoreFileContentAttributes$Outbound = | string | boolean | number; /** @internal */ export const VectorStoreFileContentAttributes$outboundSchema: z.ZodType< VectorStoreFileContentAttributes$Outbound, z.ZodTypeDef, VectorStoreFileContentAttributes > = z.union([z.string(), z.boolean(), z.number()]); export function vectorStoreFileContentAttributesToJSON( vectorStoreFileContentAttributes: VectorStoreFileContentAttributes, ): string { return JSON.stringify( VectorStoreFileContentAttributes$outboundSchema.parse( vectorStoreFileContentAttributes, ), ); } export function vectorStoreFileContentAttributesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VectorStoreFileContentAttributes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VectorStoreFileContentAttributes' from JSON`, ); } /** @internal */ export const VectorStoreFileContent$inboundSchema: z.ZodType< VectorStoreFileContent, z.ZodTypeDef, unknown > = z.object({ file_id: z.string(), filename: z.string(), attributes: z.record(z.union([z.string(), z.boolean(), z.number()])) .optional(), content: z.array(FileContentItem$inboundSchema), }).transform((v) => { return remap$(v, { "file_id": "fileId", }); }); /** @internal */ export type VectorStoreFileContent$Outbound = { file_id: string; filename: string; attributes?: { [k: string]: string | boolean | number } | undefined; content: Array; }; /** @internal */ export const VectorStoreFileContent$outboundSchema: z.ZodType< VectorStoreFileContent$Outbound, z.ZodTypeDef, VectorStoreFileContent > = z.object({ fileId: z.string(), filename: z.string(), attributes: z.record(z.union([z.string(), z.boolean(), z.number()])) .optional(), content: z.array(FileContentItem$outboundSchema), }).transform((v) => { return remap$(v, { fileId: "file_id", }); }); export function vectorStoreFileContentToJSON( vectorStoreFileContent: VectorStoreFileContent, ): string { return JSON.stringify( VectorStoreFileContent$outboundSchema.parse(vectorStoreFileContent), ); } export function vectorStoreFileContentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VectorStoreFileContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VectorStoreFileContent' from JSON`, ); }