import type { ColumnBaseConfig, ColumnDataType, DrizzleConfig, ExtractTablesWithRelations, Relation, Relations } from 'drizzle-orm'; import type { NodePgDatabase, NodePgQueryResultHKT } from 'drizzle-orm/node-postgres'; import type { PgColumn, PgEnum, pgEnum, PgSchema, PgTableWithColumns, PgTransaction } from 'drizzle-orm/pg-core'; import type { PgTableFn } from 'drizzle-orm/pg-core/table'; import type { Payload } from 'mzinga'; import type { BaseDatabaseAdapter } from 'mzinga/database'; import type { PayloadRequest } from 'mzinga/types'; import type { Pool, PoolConfig } from 'pg'; export type DrizzleDB = NodePgDatabase>; export type Args = { idType?: 'serial' | 'uuid'; localesSuffix?: string; logger?: DrizzleConfig['logger']; migrationDir?: string; pool: PoolConfig; push?: boolean; relationshipsSuffix?: string; schemaName?: string; versionsSuffix?: string; }; export type GenericColumn = PgColumn, Record>; export type GenericColumns = { [x: string]: GenericColumn; }; export type GenericTable = PgTableWithColumns<{ columns: GenericColumns; dialect: string; name: string; schema: undefined; }>; export type GenericEnum = PgEnum<[string, ...string[]]>; export type GenericRelation = Relations>>; export type DrizzleTransaction = PgTransaction, ExtractTablesWithRelations>>; type Schema = { enum: typeof pgEnum; table: PgTableFn; } | PgSchema; export type PostgresAdapter = { drizzle: DrizzleDB; enums: Record; /** * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name * Used for returning properly formed errors from unique fields */ fieldConstraints: Record>; idType: Args['idType']; localesSuffix?: string; logger: DrizzleConfig['logger']; pgSchema?: Schema; pool: Pool; poolOptions: Args['pool']; push: boolean; relations: Record; relationshipsSuffix?: string; schema: Record; schemaName?: Args['schemaName']; sessions: { [id: string]: { db: DrizzleTransaction; reject: () => Promise; resolve: () => Promise; }; }; tableNameMap: Map; tables: Record>; versionsSuffix?: string; } & BaseDatabaseAdapter; export type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar'; export type PostgresAdapterResult = (args: { payload: Payload; }) => PostgresAdapter; export type MigrateUpArgs = { payload: Payload; req?: Partial; }; export type MigrateDownArgs = { payload: Payload; req?: Partial; }; declare module 'mzinga' { interface DatabaseAdapter extends Omit, BaseDatabaseAdapter { drizzle: DrizzleDB; enums: Record; fieldConstraints: Record>; localeSuffix?: string; pool: Pool; push: boolean; relations: Record; relationshipsSuffix?: string; schema: Record; sessions: { [id: string]: { db: DrizzleTransaction; reject: () => Promise; resolve: () => Promise; }; }; tables: Record; versionsSuffix?: string; } } export {}; //# sourceMappingURL=types.d.ts.map