UNPKG

@mastra/core

Version:
29 lines • 1.57 kB
import type { JSONSchema7 } from 'json-schema'; import type { BatchValidationResult } from './errors.js'; /** Compile every `pattern` / `patternProperties` key up front so unsupported syntax fails at schema compile time */ export declare function assertSupportedPatterns(node: unknown, isSchemaMap?: boolean): void; /** Schema validator with compilation caching */ export declare class SchemaValidator { private cache; /** * Get or compile validator for schema. A cached entry is only reused if it was compiled from the same schema; * the schema is serialized at compile time so in-place mutations of the schema object are detected. */ private getValidator; /** Evict the cached validator for a cache key */ clearCache(cacheKey: string): void; /** Validate data against schema */ validate(data: unknown, schema: JSONSchema7, field: 'input' | 'groundTruth', cacheKey: string): void; /** Validate multiple items, returning valid/invalid split */ validateBatch(items: Array<{ input: unknown; groundTruth?: unknown; }>, inputSchema: JSONSchema7 | null | undefined, outputSchema: JSONSchema7 | null | undefined, cacheKeyPrefix: string, maxErrors?: number): BatchValidationResult; /** Format Zod errors to FieldError array */ private formatErrors; } /** Get or create validator instance */ export declare function getSchemaValidator(): SchemaValidator; /** Create new validator (for testing) */ export declare function createValidator(): SchemaValidator; //# sourceMappingURL=validator.d.ts.map