/** * Base utility class for tool managers with enhanced type safety */ import { WordPressId, DeepReadonly, Result } from "../types/enhanced.js"; export interface ParameterValidationRule { readonly key: string; readonly required: boolean; readonly type?: string; readonly validator?: (value: unknown) => value is T; readonly transformer?: (value: unknown) => T; readonly errorMessage?: string; } export interface CacheKeyOptions { readonly namespace?: string; readonly includeTimestamp?: boolean; readonly customHasher?: (params: Record) => string; } export declare class BaseToolUtils { /** * Validate required parameters with enhanced type safety */ static validateParams>(params: unknown, rules: readonly ParameterValidationRule[]): Result; /** * Validate ID parameter with WordPress ID branding */ static validateId(id: unknown, name?: string): Result; /** * Validate multiple IDs at once */ static validateIds(ids: unknown[], name?: string): Result; /** * Handle errors consistently with enhanced error context */ static handleError(error: unknown, operation: string, context?: Record | undefined): Error; /** * Generate cache keys with enhanced options */ static generateCacheKey(operation: string, params: DeepReadonly>, options?: CacheKeyOptions): string; /** * Format consistent success response messages */ static formatSuccessMessage(operation: string, details?: string, count?: number): string; /** * Validate string parameters with enhanced checks */ static validateString(value: unknown, name: string, options?: { readonly required?: boolean; readonly minLength?: number; readonly maxLength?: number; readonly pattern?: RegExp; readonly allowEmpty?: boolean; }): Result; /** * Type-safe parameter extraction */ static extractParam(params: DeepReadonly>, key: string, defaultValue?: T): T | undefined; /** * Safe array extraction with type validation */ static extractArray(params: DeepReadonly>, key: string, itemValidator?: (item: unknown) => item is T): readonly T[]; } //# sourceMappingURL=BaseToolManager.d.ts.map