import { type CompileAndRunLogicOptions, type DependentChange, type EvaluateDependentsOptions, type EvaluateDependentsSubformOptions, type EvaluateOptions, type EvaluateSubformOptions, type GetEvaluatedSchemaSubformOptions, type GetEvaluatedParamsSubformOptions, type GetEvaluatedSchemaByPathSubformOptions, type GetEvaluatedSchemaByPathsSubformOptions, type GetFieldOptionsOptions, type GetSchemaByPathOptions, type GetSchemaByPathSubformOptions, type GetSchemaByPathsOptions, type GetSchemaByPathsSubformOptions, type GetSchemaValueSubformOptions, type GetValueByPathOptions, type GetValueByPathsOptions, type JSONEvalOptions, type ReloadSchemaOptions, type ResolveLayoutSubformOptions, type SchemaValueItem, type ValidateOptions, type ValidatePathsOptions, type ValidateSubformOptions, type ValidationResult } from "@json-eval-rs/common"; export { DependentChange, EvaluateDependentsOptions, EvaluateDependentsSubformOptions, EvaluateOptions, EvaluateSubformOptions, GetEvaluatedSchemaByPathSubformOptions, GetEvaluatedSchemaByPathsSubformOptions, GetEvaluatedSchemaSubformOptions, GetEvaluatedParamsSubformOptions, GetFieldOptionsOptions, GetSchemaByPathOptions, GetSchemaByPathSubformOptions, GetSchemaByPathsOptions, GetSchemaByPathsSubformOptions, GetSchemaValueSubformOptions, GetValueByPathOptions, GetValueByPathsOptions, JSONEvalOptions, LayoutOverlayEntry, ReloadSchemaOptions, ResolveLayoutSubformOptions, ReturnFormat, SchemaValueItem, ValidateOptions, ValidatePathsOptions, ValidateSubformOptions, ValidationError, ValidationResult, extractErrorMessage, mergeLayoutOverlay, parseValue, resolveEvaluatedLayout, stringifyOrNull, stringifyValue, } from "@json-eval-rs/common"; /** * @json-eval-rs/webcore * High-level JavaScript API for JSON Eval RS WASM bindings * * This package provides a clean, ergonomic API that works with any WASM target: */ /** * Get the library version from the WASM module * @param wasmModule - WASM module * @returns Version string */ export declare function getVersion(wasmModule: any): string; /** * JSONEval - High-level JavaScript API for JSON Eval RS * * This is an internal abstraction layer. Use specific packages instead: * - @json-eval-rs/bundler (for bundlers like Webpack, Vite, Next.js) * - @json-eval-rs/vanilla (for direct browser usage) * - @json-eval-rs/node (for Node.js/SSR) * * @example * ```js * import { JSONEval } from '@json-eval-rs/webcore'; * * const evaluator = new JSONEval({ * schema: { type: 'object', properties: { ... } } * }); * * await evaluator.init(); * const result = await evaluator.validate({ data: { name: 'John' } }); * ``` */ export declare class JSONEvalCore { /** Internal storage for the schema (JSON, MsgPack, or Cache Key) */ private _schema; /** Reference to the loaded WASM module */ private _wasmModule; /** Current context data */ private _context; /** Current evaluation data */ private _data; /** The underlying WASM JSONEval instance */ private _instance; /** Initialization state flag */ private _ready; /** Flag indicating if schema provided is binary MessagePack */ private _isMsgpackSchema; /** Flag indicating if schema is a cache key reference */ private _isFromCache; /** * Create a new JSONEval Core instance. * Does not initialize WASM immediately; wait for `init()` or call async methods. * * @param wasmModule - The loaded WASM module (provided by wrapper packages like @json-eval-rs/node or /vanilla) * @param options - Configuration options containing schema, data, and context */ constructor(wasmModule: any, { schema, context, data, fromCache }: JSONEvalOptions); /** * Initialize the WASM instance * Call this before using other methods, or use the async methods which call it automatically */ init(): Promise; /** * Create a new JSONEval instance from a cached ParsedSchema */ static fromCache(wasmModule: any, cacheKey: string, context?: any, data?: any): JSONEvalCore; /** * Create a new JSONEval instance from a MessagePack schema */ static fromMsgpack(wasmModule: any, schemaMsgpack: Uint8Array, context?: any, data?: any): JSONEvalCore; /** * Get the WASM library version */ static version(wasmModule: any): string; /** * Evaluate logic expression without creating an instance */ static evaluateLogic(wasmModule: any, logicStr: string | object, data?: any, context?: any): any; /** * Validate data against schema (returns parsed JavaScript object) * Uses validateJS for Worker-safe serialization */ validate({ data, context, validateReadonly, includeSubforms, }: ValidateOptions): Promise; /** * Evaluate schema with data (returns parsed JavaScript object) */ evaluate({ data, context, paths }: EvaluateOptions): Promise; /** * Evaluate schema with data (only updates internal state, returns void) */ evaluateOnly({ data, context, paths }: EvaluateOptions): Promise; /** * Evaluate dependent fields (returns parsed JavaScript object, processes transitively) */ evaluateDependents({ changedPaths, data, context, reEvaluate, includeSubforms, }: EvaluateDependentsOptions): Promise; /** * Evaluate dependents (returns JSON string) */ evaluateDependentsString({ changedPath, data, context, reEvaluate, includeSubforms, }: { changedPath: string; data?: any; context?: any; reEvaluate?: boolean; includeSubforms?: boolean; }): Promise; /** * Get evaluated schema (compact, without $layout resolution) */ getEvaluatedSchema(): Promise; /** * Get resolved layout overlay entries */ getResolvedLayout(): Promise; /** * Get evaluated schema with layout fully resolved */ getEvaluatedSchemaResolved(): Promise; /** * Get evaluated schema as MessagePack binary data */ getEvaluatedSchemaMsgpack(): Promise; /** * Get layout-resolved evaluated schema as MessagePack binary data. * * Bytes are produced by Rust from the same resolved schema merger used by * the native resolved getter. */ getEvaluatedSchemaResolvedMsgpack(): Promise; /** * Get schema values (evaluations ending with .value) * @param includeSubforms - Optional flag to also include subforms */ getSchemaValue(includeSubforms?: boolean): Promise; /** * Get all schema values as array of path-value pairs */ getSchemaValueArray(): Promise; /** * Get all schema values as object with dotted path keys */ getSchemaValueObject(): Promise>; /** * Get evaluated schema without $params field (compact) */ getEvaluatedSchemaWithoutParams(): Promise; /** * Get plain schema $params (without static array data) */ getPlainParams(): Promise; /** * Get evaluated schema $params * @param withStaticArray - whether to include static array data (default: false) */ getEvaluatedParams(withStaticArray?: boolean): Promise; /** * Get a value from the evaluated schema using dotted path notation (compact) */ getEvaluatedSchemaByPath({ path, }: GetValueByPathOptions): Promise; /** * Get values from the evaluated schema using multiple dotted path notations (compact) */ getEvaluatedSchemaByPaths({ paths, format, }: GetValueByPathsOptions): Promise; /** * Get a value from the schema using dotted path notation */ getSchemaByPath({ path }: GetSchemaByPathOptions): Promise; /** * Get a value from the schema using dotted path notation * Alias for getSchemaByPath to match React Native API */ get(path: string): Promise; /** * Get values from the schema using multiple dotted path notations */ getSchemaByPaths({ paths, format, }: GetSchemaByPathsOptions): Promise; /** * Reload schema with new data */ reloadSchema({ schema, context, data, }: ReloadSchemaOptions): Promise; /** * Reload schema from MessagePack bytes */ reloadSchemaMsgpack(schemaMsgpack: Uint8Array, context?: any, data?: any): Promise; /** * Reload schema from ParsedSchemaCache using a cache key */ reloadSchemaFromCache(cacheKey: string, context?: any, data?: any): Promise; /** * Resolve layout with optional evaluation, returning overlay entries */ resolveLayout(options?: { evaluate?: boolean; }): Promise; /** * Set timezone offset for datetime operations (TODAY, NOW) */ setTimezoneOffset(offsetMinutes: number | null | undefined): void; /** * Compile and run JSON logic from a JSON logic string */ compileAndRunLogic({ logicStr, data, context, }: CompileAndRunLogicOptions): Promise; /** * Compile JSON logic and return a global ID */ compileLogic(logicStr: string | object): Promise; /** * Run pre-compiled logic by ID */ runLogic(logicId: number, data?: any, context?: any): Promise; /** * Validate data against schema rules with optional path filtering */ validatePaths({ data, context, paths, validateReadonly, includeSubforms, }: ValidatePathsOptions): Promise; /** * Validate data with path filtering (returns WASM ValidationResult object) * Note: You must call .free() on the returned object when done. */ validatePathsOnly({ data, context, paths, validateReadonly, includeSubforms, }: ValidatePathsOptions): Promise; /** * Cancel any running evaluation */ cancel(): Promise; /** * Evaluate a subform with data */ evaluateSubform({ subformPath, data, context, paths, }: EvaluateSubformOptions): Promise; /** * Validate subform data against its schema rules */ validateSubform({ subformPath, data, context, validateReadonly, }: ValidateSubformOptions): Promise; /** * Evaluate dependent fields in subform */ evaluateDependentsSubform({ subformPath, changedPaths, data, context, reEvaluate, includeSubforms, }: EvaluateDependentsSubformOptions): Promise; /** * Evaluate dependent fields in subform (returns JSON string) */ evaluateDependentsSubformString({ subformPath, changedPaths, data, context, includeSubforms, }: EvaluateDependentsSubformOptions): Promise; /** * Resolve layout for subform, returning overlay entries */ resolveLayoutSubform({ subformPath, evaluate, }: ResolveLayoutSubformOptions): Promise; /** * Get evaluated schema from subform (compact, without $layout resolution) */ getEvaluatedSchemaSubform({ subformPath, }: GetEvaluatedSchemaSubformOptions): Promise; /** * Get resolved layout overlay entries for subform */ getResolvedLayoutSubform({ subformPath, }: GetEvaluatedSchemaSubformOptions): Promise; /** * Get evaluated schema with layout fully resolved for subform */ getEvaluatedSchemaResolvedSubform({ subformPath, }: GetEvaluatedSchemaSubformOptions): Promise; /** * Get schema value from subform */ getSchemaValueSubform({ subformPath, }: GetSchemaValueSubformOptions): Promise; /** * Get schema values from subform as array of path-value pairs */ getSchemaValueArraySubform({ subformPath, }: GetSchemaValueSubformOptions): Promise; /** * Get schema values from subform as object with dotted path keys */ getSchemaValueObjectSubform({ subformPath, }: GetSchemaValueSubformOptions): Promise>; /** * Get evaluated schema without $params from subform (compact) */ getEvaluatedSchemaWithoutParamsSubform({ subformPath, }: GetEvaluatedSchemaSubformOptions): Promise; /** * Get plain schema $params from subform (without static array data) */ getPlainParamsSubform({ subformPath, }: GetEvaluatedSchemaSubformOptions): Promise; /** * Get evaluated schema $params from subform * @param options - Options including subform path and optional withStaticArray flag */ getEvaluatedParamsSubform({ subformPath, withStaticArray, }: GetEvaluatedParamsSubformOptions): Promise; /** * Get evaluated schema by specific path from subform (compact) */ getEvaluatedSchemaByPathSubform({ subformPath, schemaPath, }: GetEvaluatedSchemaByPathSubformOptions): Promise; /** * Get evaluated schema by multiple paths from subform (compact) */ getEvaluatedSchemaByPathsSubform({ subformPath, schemaPaths, format, }: GetEvaluatedSchemaByPathsSubformOptions): Promise; /** * Get list of available subform paths */ getSubformPaths(): Promise; /** * Get schema by specific path from subform */ getSchemaByPathSubform({ subformPath, schemaPath, }: GetSchemaByPathSubformOptions): Promise; /** * Get schema by multiple paths from subform */ getSchemaByPathsSubform({ subformPath, schemaPaths, format, }: GetSchemaByPathsSubformOptions): Promise; /** * Check if a subform exists at the given path */ hasSubform(subformPath: string): Promise; /** * Evaluate and return the options for a specific field on demand. * * The field is identified by `path`, which can be: * - Dotted notation: `"form.occupation"` * - JSON pointer: `"/properties/form/properties/occupation"` * - Schema ref: `"#/properties/form/properties/occupation"` * * @returns Resolved options value (array or URL string), or null if the field has no options */ getFieldOptions({ path }: GetFieldOptionsOptions): Promise; /** * Free WASM resources */ free(): void; /** * Alias for free() to match React Native API */ dispose(): void; } export default JSONEvalCore;