UNPKG

@wavequery/conductor

Version:
27 lines (26 loc) 834 B
import { z } from "zod"; export interface ConfigOptions { schema?: z.ZodSchema; defaultValues?: Record<string, any>; onUpdate?: (config: Record<string, any>) => void; persist?: boolean; storage?: Storage; } export declare class ConfigManager { private config; private options; private static instance; constructor(options?: ConfigOptions); static getInstance(options?: ConfigOptions): ConfigManager; get<T = any>(key: string): T; set(key: string, value: any): void; update(updates: Record<string, any>): void; reset(): void; private validateUpdates; private handleConfigUpdate; private get storageKey(); private loadConfig; private saveConfig; getSnapshot(): Record<string, any>; watchKey<T>(key: string, callback: (value: T) => void): () => void; }