UNPKG

@hashgraphonline/standards-agent-kit

Version:

A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication. https://hol.org

95 lines (94 loc) 4.59 kB
import { ZodType } from 'zod'; import { RenderConfigSchema, EnhancedRenderConfig, ZodSchemaWithRender, FormFieldType, FieldMetadata, SelectOption } from './types'; /** * Extends a Zod schema with render configuration capabilities */ export declare function extendZodSchema<TSchema>(schema: ZodType<TSchema>): ZodSchemaWithRender<TSchema>; /** * Checks if a schema has render configuration */ export declare function hasRenderConfig(schema: unknown): schema is ZodSchemaWithRender; /** * Extracts render configuration from a schema */ export declare function getRenderConfig(schema: ZodType<unknown>): EnhancedRenderConfig | undefined; /** * Infers form field type from Zod schema type with enhanced field detection */ export declare function inferFieldTypeFromSchema(schema: ZodType<unknown>): FormFieldType; /** * Extracts options from enum, union, or literal schemas */ export declare function extractOptionsFromSchema(schema: ZodType<unknown>): SelectOption[] | undefined; /** * Checks if a schema is optional */ export declare function isOptionalSchema(schema: ZodType<unknown>): boolean; /** * Gets the inner schema from optional/default wrappers */ export declare function getInnerSchema(schema: ZodType<unknown>): ZodType<unknown>; /** * Extracts validation constraints from a schema with enhanced support */ export declare function extractValidationConstraints(schema: ZodType<unknown>): Record<string, unknown>; /** * Gets default value from schema with comprehensive type support */ export declare function getDefaultValue(schema: ZodType<unknown>): unknown; /** * Extracts field metadata from schema including render configuration */ export declare function extractFieldMetadata(schema: ZodType<unknown>): FieldMetadata; /** * Helper function to create common render configurations */ export declare const renderConfigs: { text: (label: string, placeholder?: string, priority?: "essential" | "common" | "advanced" | "expert") => EnhancedRenderConfig; number: (label: string, min?: number, max?: number, priority?: "essential" | "common" | "advanced" | "expert") => EnhancedRenderConfig; select: (label: string, options: SelectOption[], priority?: "essential" | "common" | "advanced" | "expert") => EnhancedRenderConfig; textarea: (label: string, rows?: number, priority?: "essential" | "common" | "advanced" | "expert") => EnhancedRenderConfig; currency: (label: string, symbol?: string, priority?: "essential" | "common" | "advanced" | "expert") => EnhancedRenderConfig; array: (label: string, itemLabel?: string, priority?: "essential" | "common" | "advanced" | "expert") => EnhancedRenderConfig; essential: { text: (label: string, placeholder?: string) => EnhancedRenderConfig; number: (label: string, min?: number, max?: number) => EnhancedRenderConfig; select: (label: string, options: SelectOption[]) => EnhancedRenderConfig; textarea: (label: string, rows?: number) => EnhancedRenderConfig; }; advanced: { text: (label: string, placeholder?: string) => EnhancedRenderConfig; number: (label: string, min?: number, max?: number) => EnhancedRenderConfig; select: (label: string, options: SelectOption[]) => EnhancedRenderConfig; textarea: (label: string, rows?: number) => EnhancedRenderConfig; array: (label: string, itemLabel?: string) => EnhancedRenderConfig; }; expert: { text: (label: string, placeholder?: string) => EnhancedRenderConfig; number: (label: string, min?: number, max?: number) => EnhancedRenderConfig; select: (label: string, options: SelectOption[]) => EnhancedRenderConfig; textarea: (label: string, rows?: number) => EnhancedRenderConfig; }; }; /** * Extends Zod prototype to add withRender functionality globally */ export declare function installZodRenderExtensions(): void; /** * Creates a progressive form schema with grouped fields */ export declare function createProgressiveSchema<TSchema>(baseSchema: ZodType<TSchema>, groups: Record<string, { priority: 'essential' | 'common' | 'advanced' | 'expert'; fields: string[]; }>): ZodSchemaWithRender<TSchema>; /** * Utility to convert legacy render configs to enhanced configs */ export declare function enhanceRenderConfig(config: RenderConfigSchema): EnhancedRenderConfig; /** * Helper to extract progressive disclosure information from schema */ export declare function extractProgressiveInfo(schema: ZodType<unknown>): { priority: 'essential' | 'common' | 'advanced' | 'expert'; group?: string; };