/** * Role-name routing for the core transform. * * Two databases can express the *same* access model with *different* role * names — one calls the unauthenticated role `anonymous`, another `anon`; one * calls the privileged role `administrator`, another something else. Portable * SQL must be able to translate role identifiers between these conventions. * * Scope, deliberately narrow: a {@link RoleRouter} only renames role * *identifiers* in the AST positions where a role name legitimately appears * (grants, ownership, policies, default privileges, role membership, role * settings). It does **not** alter role *attributes* (`BYPASSRLS`, `LOGIN`, * ...): two roles that share a name across conventions do not necessarily * share privilege scope, and inventing attribute changes would silently * misrepresent the security model. Privilege-semantics reconciliation is a * downstream, policy-level concern; the router restricts itself to the * deterministic, reversible part — the name. * * Renaming is a pure identifier substitution, so a router is trivially * invertible ({@link RoleRouter.invert}) for bidirectional translation. */ /** Role-rename specification: source role name -> target role name. */ export type RoleRouteSpec = Record; /** Resolves a target role name for a source role name. */ export declare class RoleRouter { private readonly map; constructor(routes?: RoleRouteSpec | Map); /** Coerce a spec, map, or existing router into a router. */ static from(source: RoleRouter | RoleRouteSpec | Map): RoleRouter; /** Number of configured renames. */ get size(): number; /** * Resolve the target name for `role`, or `undefined` when it is not routed * or already at its destination. */ resolve(role: string | undefined | null): string | undefined; /** * The inverse router (target -> source), for translating in the opposite * direction. Throws if the mapping is not one-to-one. */ invert(): RoleRouter; }