/** * Gate event observers — process-wide pub/sub for authorization * decisions made through `Gate.allows()`, `Gate.denies()`, and * `Gate.authorize()`. * * Used today by `@rudderjs/telescope`'s GateCollector to record * authorization checks into the dashboard. */ export interface GateEvent { ability: string; userId: string | null; allowed: boolean; /** What resolved the decision */ resolvedVia: 'ability' | 'policy' | 'before' | 'default'; /** Policy class name (if resolved via policy) */ policy?: string | undefined; /** Model class name (if a model was passed) */ model?: string | undefined; /** Arguments passed to the check (excluding the user) — JSON-safe snapshot */ args?: unknown[] | undefined; /** Duration of the check in ms */ duration: number; } export type GateObserver = (event: GateEvent) => void; export declare class GateObserverRegistry { private observers; /** Subscribe; returns an unsubscribe function. */ subscribe(fn: GateObserver): () => void; /** * Called by `Gate.allows()` after each authorization check. * Errors thrown by observers are swallowed — observability must never * break authorization. */ emit(event: GateEvent): void; /** * Drop every observer subscription. Test-cleanup hook — kept on the * public API because `@rudderjs/telescope`'s test suite imports * `gateObservers` across the package boundary to reset between cases. */ reset(): void; } export declare const gateObservers: GateObserverRegistry; //# sourceMappingURL=gate-observers.d.ts.map