import { Code } from "@/components/code"; export const metadata = { title: "@json-render/core API | json-render", }; export default function CoreApiPage() { return (

@json-render/core

Core types, schemas, and utilities.

createCatalog

Creates a catalog definition.

{`function createCatalog(config: CatalogConfig): Catalog interface CatalogConfig { components: Record; actions?: Record; validationFunctions?: Record; } interface ComponentDefinition { props: ZodObject; hasChildren?: boolean; description?: string; } interface ActionDefinition { params?: ZodObject; description?: string; }`}

generateCatalogPrompt

Generates a system prompt for AI models.

{`function generateCatalogPrompt(catalog: Catalog): string`}

evaluateVisibility

Evaluates a visibility condition against data and auth state.

{`function evaluateVisibility( condition: VisibilityCondition | undefined, data: Record, auth?: AuthState ): boolean type VisibilityCondition = | { path: string } | { auth: 'signedIn' | 'signedOut' | string } | { and: VisibilityCondition[] } | { or: VisibilityCondition[] } | { not: VisibilityCondition } | { eq: [DynamicValue, DynamicValue] } | { gt: [DynamicValue, DynamicValue] } | { gte: [DynamicValue, DynamicValue] } | { lt: [DynamicValue, DynamicValue] } | { lte: [DynamicValue, DynamicValue] };`}

Types

UIElement

{`interface UIElement { key: string; type: string; props: Record; children?: UIElement[]; visible?: VisibilityCondition; validation?: ValidationSchema; }`}

UITree

{`interface UITree { root: UIElement | null; elements: Record; }`}

Action

{`interface Action { name: string; params?: Record; confirm?: { title: string; message: string; variant?: 'default' | 'danger'; }; onSuccess?: { set: Record }; onError?: { set: Record }; }`}

ValidationSchema

{`interface ValidationSchema { checks: ValidationCheck[]; validateOn?: 'change' | 'blur' | 'submit'; } interface ValidationCheck { fn: string; args?: Record; message: string; }`}
); }