import type { BuildQueryResult, DBQueryConfig, ExtractTablesWithRelations, } from "drizzle-orm"; import type * as schema from "./schema"; type Schema = typeof schema; type TablesWithRelations = ExtractTablesWithRelations; export type IncludeRelation = DBQueryConfig< "one" | "many", boolean, TablesWithRelations, TablesWithRelations[TableName] >["with"]; export type IncludeColumns = DBQueryConfig< "one" | "many", boolean, TablesWithRelations, TablesWithRelations[TableName] >["columns"]; export type InferQueryModel< TableName extends keyof TablesWithRelations, Columns extends IncludeColumns | undefined = undefined, With extends IncludeRelation | undefined = undefined, > = BuildQueryResult< TablesWithRelations, TablesWithRelations[TableName], { columns: Columns; with: With; } >;