/** * AST transform that applies an {@link ExtensionRouter}. * * Unlike the schema transform — which only rewrites string *fields* already * present on a node — moving an extension changes the **shape** of the AST: * * - `CREATE EXTENSION ` with no `SCHEMA` clause must gain one, which means * constructing a new `DefElem` node and attaching it to a (possibly absent) * `options` array; the reverse strips the `DefElem` (and empties `options`). * - a bare `crypt(...)` reference gains a schema qualifier (a `String` node is * prepended to `funcname`), and the reverse removes it. * * All rewrites are AST-precise and driven by the router's version-aware symbol * inventory, so built-ins that merely share a name with an extension symbol * (and symbols that have graduated into core) are left untouched. */ import type { ExtensionRouterOptions, ExtensionRouteSpec } from './extension-router'; import { ExtensionRouter } from './extension-router'; /** What an extension transform changed. */ export interface ExtensionTransformResult { /** Extensions whose install schema was rewritten: extname -> target (null = unqualified). */ installsMoved: Map; /** Symbol references rewritten, counted by bare symbol name. */ symbolsRewritten: Map; } /** Create a fresh result tracker. */ export declare function createExtensionResult(): ExtensionTransformResult; /** * Create a SQL AST visitor that applies extension routing. Composable with the * walkers used by the core transform and by PL/pgSQL body traversal. */ export declare function createExtensionVisitor(router: ExtensionRouter, result: ExtensionTransformResult): { CreateExtensionStmt: (path: any) => void; AlterObjectSchemaStmt: (path: any) => void; FuncCall: (path: any) => void; CallStmt: (path: any) => void; TypeName: (path: any) => void; CreateFunctionStmt: (path: any) => void; }; /** * Apply extension routing to a SQL string: parse -> walk -> deparse, including * PL/pgSQL and `LANGUAGE sql` bodies. Returns the rewritten SQL and a summary * of what changed. */ export declare function transformExtensions(sql: string, router: ExtensionRouter | ExtensionRouteSpec, options?: ExtensionRouterOptions): { sql: string; result: ExtensionTransformResult; };