/** * Object identity — the canonical, Postgres-native answer to "what object is * this statement about?". * * Identity is the key used by dependency graphs, semantic diffing, and any * downstream naming scheme. It is a pure function of classifier facts — * grounded in the parser's node taxonomy (`CreateStmt`, `CreateTrigStmt`, * `IndexStmt`, ...), never in surface syntax like RangeVars. Rendering an * identity to a change path (e.g. a pgpm module layout) is deliberately NOT * defined here: paths are derived projections that belong to whichever * packaging layer consumes the identity, so nothing is ever attached to them. * * Identity tuple: `(kind, schema, name, table?)` — `table` scopes objects * that are only unique per table (triggers, policies, indexes, constraints, * seed data). Function overloads share an identity for now (signature * disambiguation is a planned refinement). */ import { StatementFacts } from './facts'; /** The kinds of objects an identity can describe. */ export type ObjectIdentityKind = 'schema' | 'extension' | 'role' | 'table' | 'view' | 'sequence' | 'type' | 'function' | 'index' | 'trigger' | 'policy' | 'constraint' | 'seed_dml' | 'other'; /** * The identity of a database object. Identity is the diff/dependency key; * any path or name is only a downstream rendering of it. */ export interface ObjectIdentity { kind: ObjectIdentityKind; /** Owning schema (`null` for non-schema objects: roles, extensions). */ schema: string | null; /** Object name, unqualified (for table-scoped kinds: without the table). */ name: string; /** Owning table, for objects only unique per table (trigger/policy/index/constraint/seed). */ table?: string; } /** * Derive the identity of the object a statement primarily creates or * targets, or `null` when the statement creates nothing (grants, comments — * such statements ride with the change of the object they attach to). * * Table-scoped kinds are recovered from the classifier's table-qualified * names (`table.trigger`) and, for indexes and constraints, from the * targeted relation. */ export declare function identityOf(facts: StatementFacts): ObjectIdentity | null;