import type { HookableEvent } from './events.js'; import type { HookCallback, HookableEventConstructor, HookCallbackOptions, HookCleanup } from './types.js'; /** * Interface for hook registry operations. * Enables registration of hook callbacks for event-driven extensibility. */ export interface HookRegistry { /** * Register a callback function for a specific event type. * * @param eventType - The event class constructor to register the callback for * @param callback - The callback function to invoke when the event occurs * @param options - Optional configuration including execution order * @returns Cleanup function that removes the callback when invoked */ addCallback(eventType: HookableEventConstructor, callback: HookCallback, options?: HookCallbackOptions): HookCleanup; } /** * Implementation of the hook registry for managing hook callbacks. * Maintains mappings between event types and callback functions. */ export declare class HookRegistryImplementation implements HookRegistry { private readonly _callbacks; constructor(); /** {@inheritDoc HookRegistry.addCallback} */ addCallback(eventType: HookableEventConstructor, callback: HookCallback, options?: HookCallbackOptions): HookCleanup; /** * Invoke all registered callbacks for the given event. * Awaits each callback, supporting both sync and async. * * InterruptErrors are collected across callbacks rather than immediately thrown, * allowing all hooks to register their interrupts. Non-interrupt errors propagate immediately. * * @param event - The event to invoke callbacks for * @returns The event after all callbacks have been invoked * @throws InterruptError with all collected interrupts after all callbacks complete */ invokeCallbacks(event: T): Promise; /** * Get callbacks for a specific event in order. * For After* events, reverses then re-sorts by order so that lower order * still runs first, but same-order hooks run in reverse registration order. * * @param event - The event to get callbacks for * @returns Array of callbacks for the event */ private getCallbacksFor; } //# sourceMappingURL=registry.d.ts.map