@llamaindex/ui
Version:
A comprehensive UI component library built with React, TypeScript, and Tailwind CSS for LlamaIndex applications
39 lines (36 loc) • 1.86 kB
TypeScript
export { c as cn } from './utils-Cbsgs0XP.js';
import { z } from 'zod/v4';
import { JSONSchema } from 'zod/v4/core';
import 'clsx';
interface JsonSchemaReformatOptions<T extends object = Record<string, never>> {
selectFields?: (keyof T)[];
firstFields?: (keyof T)[];
lastFields?: (keyof T)[];
hideFields?: (keyof T)[];
dereference?: boolean;
}
declare function zodToJsonSchema<T extends z.ZodRawShape>(zodSchema: z.ZodObject<T>, options?: Omit<JsonSchemaReformatOptions<T>, "dereference">): JSONSchema.ObjectSchema;
declare function modifyJsonSchema<T extends object = Record<string, never>>(jsonSchema: JSONSchema.BaseSchema, { selectFields, firstFields, lastFields, hideFields, dereference, }: JsonSchemaReformatOptions<T>): JSONSchema.ObjectSchema;
/**
* Type guard to check if a field is nullable (can be null)
*/
declare function isNullable(schema: JSONSchema.BaseSchema): boolean;
/**
* Determine if a schema represents a simple type (string, number, boolean)
*/
declare function isSimpleTypeSchema(schema: JSONSchema.BaseSchema): boolean;
/**
* Get the schema type for a value
*/
declare function getSchemaType(schema: JSONSchema.BaseSchema): string;
/**
* Helper functions to check schema types
*/
declare function isArraySchema(schema: JSONSchema.BaseSchema): schema is JSONSchema.ArraySchema;
declare function extractFirstNotNullableSchema(schema: JSONSchema.BaseSchema): {
isNullable: boolean;
schema?: JSONSchema.BaseSchema;
};
declare function isObjectSchema(schema: JSONSchema.BaseSchema): schema is JSONSchema.ObjectSchema;
declare function derefLocalRefs<T extends JSONSchema.BaseSchema>(schema: T): T;
export { type JsonSchemaReformatOptions, derefLocalRefs, extractFirstNotNullableSchema, getSchemaType, isArraySchema, isNullable, isObjectSchema, isSimpleTypeSchema, modifyJsonSchema, zodToJsonSchema };