/** * Relation discovery utilities for bulk relational/nested inserts. * * Inspects the PostGraphile registry to find "has many" (isReferencee) * relations for a given resource. For each qualifying relation, computes * column metadata needed to build child INSERT statements. */ import type { ColumnSpec } from './sql-builder'; /** * Metadata for a single "has many" relation eligible for nested inserts. */ export interface NestedRelationInfo { /** Registry key of the relation (e.g. "productsByCategoryId") */ relationName: string; /** GraphQL field name on the parent values item type */ fieldName: string; /** The remote (child) PgResource */ remoteResource: any; /** Registry key of the remote resource */ remoteResourceName: string; /** PK columns on the parent that the FK references */ localAttributes: string[]; /** FK columns on the child table */ remoteAttributes: string[]; /** GraphQL field name → SQL column name for child */ childFieldToAttr: Record; /** Column specs for building child INSERT SQL */ childColumnSpecs: ColumnSpec[]; /** Compiled SQL table name for the child */ childCompiledFrom: string; /** PK columns on the child table */ childPkColumns: string[]; } /** * Discover "has many" relations for a resource that qualify for nested * inserts. A relation qualifies when: * * 1. isReferencee is true (the remote table references the local table) * 2. isUnique is false (one-to-many, not one-to-one) * 3. The remote resource is a regular table (has attributes, uniques, etc.) */ export declare function discoverNestedRelations(resource: any, pgRegistry: any, inflection: any, sql: any): NestedRelationInfo[];