import type { EntityFieldInfo, EntityRelationInfo } from '@dudousxd/nestjs-filter';
import { type Column, Table } from 'drizzle-orm';
/**
 * A relation of a table, resolved from the `relations()` declarations in the
 * schema into the pair of column lists that correlate the two sides.
 *
 * `sourceColumns[i]` (on the table that declares the relation) matches
 * `targetColumns[i]` (on {@link target}) — for a `one()` that owns the FK these
 * are `fields` → `references`; for a `many()` they are read off its inverse
 * `one()` and swapped, which is what drizzle's own `normalizeRelation` does.
 */
export interface ResolvedRelation {
    /** Relation property name (`posts`, `author`). */
    name: string;
    /** Cardinality, in the core's vocabulary. */
    kind: EntityRelationInfo['type'];
    /** The referenced table (always the ORIGINAL table object, never an alias). */
    target: Table;
    /** The schema key of the referenced table (`posts`), used as `targetEntity`. */
    targetName: string;
    sourceColumns: Column[];
    targetColumns: Column[];
}
/**
 * Everything the adapter knows about the schema, read once from the objects the
 * application already declares — Drizzle has no metadata registry to ask.
 *
 * - Columns come straight off the table (`getTableColumns`), so a filter works
 *   with no schema registered at all.
 * - Relations come from the `relations()` objects in the schema passed to
 *   `drizzle(client, { schema })` (or handed to the adapter directly). Without
 *   them the adapter still filters, sorts, paginates and searches; relation
 *   features (includes, dot-notation, `whereHas`, aggregates) report the
 *   relation as unknown.
 *
 * Results are memoized per table: schema objects are immutable after bootstrap.
 */
export declare class DrizzleSchemaMetadata {
    private readonly tablesConfig;
    private readonly tableNamesMap;
    /** Original table object → its schema key. */
    private readonly schemaKeyByTable;
    private readonly relationCache;
    private readonly fieldCache;
    private readonly keyByColumn;
    private readonly pkCache;
    constructor(schema?: Record<string, unknown>);
    /** True when the schema carries at least one `relations()` declaration. */
    get hasRelations(): boolean;
    /** The schema key for a table (`users`), falling back to its SQL name. */
    tableDisplayName(table: Table): string;
    /** Property key → column, exactly as `getTableColumns` reports it. */
    columnsOf(table: Table): Record<string, Column>;
    /** The property key a column is declared under on its (original) table. */
    keyOf(table: Table, column: Column): string | undefined;
    fields(table: Table): EntityFieldInfo[];
    /** Primary-key property keys (single or composite), `[]` when none is declared. */
    primaryKeys(table: Table): string[];
    /**
     * The table's relations, keyed by name — or `null` when the table is not part
     * of the registered schema (so the runner can tell "no relations" from
     * "relations unknown").
     */
    relations(table: Table): Map<string, ResolvedRelation> | null;
    relation(table: Table, name: string): ResolvedRelation | undefined;
    private resolve;
}
/**
 * The column declared under `key` on `table` (or an alias of it) — an OWN
 * property lookup, so a client-supplied name like `constructor` or `__proto__`
 * (both pass the identifier grammar) never resolves to something inherited from
 * `Object.prototype`.
 */
export declare function columnOf(table: Table, key: string): Column | undefined;
/**
 * Maps a drizzle column onto the core's simplified type vocabulary. `dataType`
 * is drizzle's own runtime classification; `columnType` refines the few cases
 * where the JS-side representation hides the SQL meaning (a Postgres `numeric`
 * is a `string` in JS but a number to filter on; a `timestamp` in `mode:
 * 'string'` is still a date column).
 */
export declare function classifyColumn(column: Column): EntityFieldInfo['type'];
//# sourceMappingURL=schema-metadata.d.ts.map