/** * Hook System for Plugin Architecture * * Provides a WordPress-like hook system for plugins to interact with the core */ type HookCallback> = (data: T, ...args: unknown[]) => Promise | T; type HookCallbackVoid> = (data: T, ...args: unknown[]) => Promise | void; /** * Hook system implementation */ export declare class HookSystem { private filters; private actions; private hookStats; /** * Add a filter hook * Filters allow plugins to modify data as it passes through the system */ addFilter(hookName: string, callback: HookCallback, priority?: number): void; /** * Apply filter hooks to data */ applyFilters(hookName: string, data: T, ...args: unknown[]): Promise; /** * Add an action hook * Actions allow plugins to execute code at specific points */ addAction(hookName: string, callback: HookCallbackVoid, priority?: number): void; /** * Execute action hooks */ doAction(hookName: string, data: T, ...args: unknown[]): Promise; /** * Emit an event (alias for doAction for semantic clarity) */ emit(eventName: string, data: T, ...args: unknown[]): Promise; /** * Remove a filter hook */ removeFilter(hookName: string, callback: HookCallback): boolean; /** * Remove an action hook */ removeAction(hookName: string, callback: HookCallbackVoid): boolean; /** * Check if a hook has any callbacks */ hasHook(hookName: string): boolean; /** * Get all registered hooks */ getAllHooks(): { filters: string[]; actions: string[]; }; /** * Record hook execution statistics */ private recordHookStats; /** * Get hook execution statistics */ getHookStats(): Record; /** * Clear all hooks (useful for testing) */ clear(): void; /** * Get hook count */ getHookCount(): { filters: number; actions: number; }; } declare global { var __HOOK_SYSTEM__: HookSystem | undefined; } /** * Create or get the global hook system * Uses globalThis to persist across module reloads in Next.js (Turbopack/Webpack) */ export declare function createHookSystem(): HookSystem; /** * Get the global hook system */ export declare function getGlobalHooks(): HookSystem; export declare const addFilter: (hookName: string, callback: HookCallback, priority?: number) => void; export declare const applyFilters: (hookName: string, data: T, ...args: unknown[]) => Promise; export declare const addAction: (hookName: string, callback: HookCallbackVoid, priority?: number) => void; export declare const doAction: (hookName: string, data: T, ...args: unknown[]) => Promise; export declare const emit: (eventName: string, data: T, ...args: unknown[]) => Promise; export declare const removeFilter: (hookName: string, callback: HookCallback) => boolean; export declare const removeAction: (hookName: string, callback: HookCallbackVoid) => boolean; export declare const hasHook: (hookName: string) => boolean; export declare const getAllHooks: () => { filters: string[]; actions: string[]; }; export declare const getHookStats: () => Record; export {}; //# sourceMappingURL=hook-system.d.ts.map