import { FlowCtxOf, FlowInputOf, FlowName, FlowStagesOf, HookEntry, HookRecord, HookRegistryInterface, HookType, ScopeEntry, Token } from "@frontmcp/sdk"; import { RegistryAbstract, RegistryBuildMapResult } from "../regsitry"; import ProviderRegistry from "../provider/provider.registry"; export default class HookRegistry extends RegistryAbstract implements HookRegistryInterface { scope: ScopeEntry; /** Historical records by class (kept if you still want access to raw records) */ recordsByCls: Map; /** Fast O(1) indexes of *instances*, sorted by priority (desc) */ private entriesByCls; private hooksByFlow; private hooksByFlowStage; constructor(providers: ProviderRegistry, list: HookType[]); protected buildMap(): RegistryBuildMapResult; protected buildGraph(): void; initialize(): Promise; /** Priority helper (default 0) */ private getPriority; /** Binary insert by priority (desc). Stable for equal priorities. */ private insertSorted; private upsert; private indexByClass; private indexByFlow; private indexByFlowStage; private initializeOne; registerHooks(embedded: boolean, ...records: HookRecord[]): Promise; /** Hooks defined on a given *class* (metadata.target), sorted by priority (desc). */ getClsHooks(token: Token): HookEntry[]; /** All hooks (instances, unordered) */ getHooks(): HookEntry[]; /** Hooks for a given *flow*, sorted by priority (desc). */ getFlowHooks(flow: Name): HookEntry, Name, FlowStagesOf, FlowCtxOf>[]; /** Hooks for a specific *flow + stage*, sorted by priority (desc). */ getFlowStageHooks(flow: Name, stage: FlowStagesOf | string): HookEntry, Name, FlowStagesOf, FlowCtxOf>[]; }