/** * Field Path Resolver * Utilities for traversing and modifying nested objects using dot notation * Supports wildcards like 'user.*.email' or '*.ssn' */ import type { FieldPath } from '@plyaz/types/api'; /** * Parse field path into segments * Example: 'user.address.city' -> ['user', 'address', 'city'] */ export declare function parseFieldPath(path: FieldPath): string[]; /** * Check if a path segment is a wildcard */ export declare function isWildcard(segment: string): boolean; /** * Match a field path against a pattern * Supports wildcards: 'user.*.email' matches 'user.home.email' and 'user.work.email' */ export declare function matchFieldPath(path: string[], pattern: string[]): boolean; /** * Get all field paths in an object (flattened with dot notation) * Example: { user: { name: 'John', address: { city: 'NYC' } } } * -> ['user', 'user.name', 'user.address', 'user.address.city'] */ export declare function getAllFieldPaths(obj: unknown, prefix?: string): string[]; /** * Get value at field path in object * Example: getFieldValue({ user: { name: 'John' } }, 'user.name') -> 'John' */ export declare function getFieldValue(obj: unknown, path: FieldPath): unknown; /** * Set value at field path in object (mutates object) * Example: setFieldValue({ user: {} }, 'user.name', 'John') -> { user: { name: 'John' } } */ export declare function setFieldValue(obj: unknown, path: FieldPath, value: unknown): void; /** * Find all matching field paths in an object * Supports wildcards * * Example: * findMatchingPaths({ user: { home: { email: 'a' }, work: { email: 'b' } } }, 'user.*.email') * -> ['user.home.email', 'user.work.email'] */ export declare function findMatchingPaths(obj: unknown, pattern: FieldPath): string[]; /** * Apply a function to all matching field paths in an object * Returns a new object with transformations applied (immutable) * * @param obj - Object to transform * @param patterns - Field path patterns (supports wildcards) * @param transform - Function to transform matched values (can be async) * @param excludePatterns - Patterns to exclude from transformation * @returns New object with transformations applied */ export declare function transformFields(obj: T, patterns: FieldPath[], transform: (value: string | number | boolean | object | null, path: string) => unknown | Promise, excludePatterns?: FieldPath[]): Promise; /** * Extract specific fields from an object based on patterns * Returns a new object with only matching fields * * @param obj - Source object * @param patterns - Field path patterns to include * @returns New object with only matching fields */ export declare function extractFields(obj: T, patterns: FieldPath[]): Partial; /** * Check if an object has any fields matching the patterns */ export declare function hasMatchingFields(obj: unknown, patterns: FieldPath[]): boolean; /** * Validate field path syntax */ export declare function isValidFieldPath(path: FieldPath): boolean; //# sourceMappingURL=field-path.d.ts.map