import type { Schema } from "@featurevisor/types"; import { type MutationOperation, type PathPart } from "../builder/mutator"; export type { MutationOperation, PathPart }; export type PathSegment = PathPart; export interface ParsedMutationKey { rootKey: string; pathSegments: PathSegment[]; allSegments: PathSegment[]; operation: MutationOperation; } /** * Returns true if the key looks like mutation notation (contains path or operation). */ export declare function isMutationKey(key: string): boolean; /** * Parse a full variable key (e.g. "config.width", "items[1].name", "tags:append") * into root variable name, path segments within the variable, and operation. * Uses the shared parseNotation from the mutator. */ export declare function parseMutationKey(key: string): ParsedMutationKey | null; /** * Resolve the schema at a path within a variable schema. * pathSegments are the path *within* the variable (e.g. for variable "config", path [ {key:"width"} ]; * for variable "items", path [ {index:0}, {key:"name"} ]). * Returns the schema at that path, or null if the path is invalid. * Does not descend through oneOf (path through oneOf is considered invalid for mutation targets). */ export declare function resolveSchemaAtPath(variableSchema: Schema | null, pathSegments: PathSegment[], schemasByKey?: Record): Schema | null; export interface MutationValidationResult { valid: boolean; rootKey: string; pathSegments: PathSegment[]; operation: MutationOperation; valueSchema: Schema | null; error?: string; } /** * Validate mutation key against variable schema: root exists, path valid, operation allowed. * Returns valueSchema to validate the value against (for set: schema at path; for append/prepend/after/before: item schema). * Uses Schema from @featurevisor/types; validates required (no :remove on required props) and does not allow path through oneOf. */ export declare function validateMutationKey(key: string, variableSchemaByKey: Record, schemasByKey?: Record): MutationValidationResult; /** * Parse a path-map key (relative to a variable) into path segments for resolveSchemaAtPath. * e.g. "display.fontSize" -> [{key:"display"},{key:"fontSize"}], "[0].name" -> [{key:"",index:0},{key:"name"}]. */ export declare function parsePathMapKey(relativePath: string): PathSegment[] | null;