import type { MetadataStorage } from '../metadata/MetadataStorage.js'; import type { Dictionary, FilterDef } from '../typings.js'; /** An `rls`-flagged filter definition together with the entity it is declared on. @internal */ export interface RlsFilterEntry { filter: FilterDef; entityName: string; } /** * Collects all `rls`-flagged filter definitions with the given name (only entity-scoped filters can be `rls`). * The full name -> defs lookup is built once and cached on the shared (immutable) MetadataStorage, so repeated * `setFilterParams` calls and forks reuse it instead of walking every entity each time. * @internal */ export declare function findRlsFilterDefs(metadata: MetadataStorage, name: string): RlsFilterEntry[]; /** * Drops the cached `rls` filter lookup — `MikroORM.discoverEntity()` mutates the shared MetadataStorage, * so a lookup built before the call would miss the newly discovered filters. * * @internal */ export declare function clearRlsFilterDefsCache(metadata: MetadataStorage): void; /** * Computes the `rls` session variables a set of same-named filter defs stages for the given args, mirroring the * policy compilation (`current_setting` names and custom `setting` binding). Shared by staging and `fork({ session })`. * @internal */ export declare function computeRlsFilterVariables(filters: RlsFilterEntry[], args: Dictionary): Dictionary; /** * Computes which staged session variables a `setFilterParams` call may prune: the variables the OLD args staged for * this filter that the new args no longer set, minus any variable another filter's current params still stage * (a custom `setting` name can be shared by differently named filters). Recomputing from the old args rather than * matching by prefix keeps a filter named `tenant` from also pruning a `tenant.x` filter's `mikro.tenant.x.*` variables. * @internal */ export declare function computeRemovedRlsVariables(metadata: MetadataStorage, name: string, filters: RlsFilterEntry[], previousArgs: Dictionary, nextVariables: Dictionary, allFilterParams: Dictionary): string[];