import type { EntityData , EntityMetadata , EntityProperty , AnyEntity , FilterQuery , Primary , Dictionary , QBFilterQuery , IPrimaryKey , PopulateOptions , EntityDictionary , ExpandProperty , AutoPath , } from '../typings' ; import type { Connection , QueryResult , Transaction } from '../connections' ; import type { FlushMode , LockMode , QueryOrderMap , QueryFlag , LoadStrategy } from '../enums' ; import type { Platform } from '../platforms' ; import type { MetadataStorage } from '../metadata' ; import type { Collection } from '../entity' ; import type { EntityManager } from '../EntityManager' ; import type { DriverException } from '../exceptions' ; export const EntityManagerType = Symbol ( 'EntityManagerType' ) ; export interface IDatabaseDriver < C extends Connection = Connection > { [ EntityManagerType ] : EntityManager < this > ; createEntityManager < D extends IDatabaseDriver = IDatabaseDriver > ( useContext ? ) : D [ typeof EntityManagerType ] ; connect ( ) : Promise < C > ; close ( force ? ) : Promise < void > ; reconnect ( ) : Promise < C > ; getConnection ( type ? ) : C ; /**
     * Finds selection of entities
     */ find < T extends AnyEntity < T > , P extends string = never > ( entityName , where , options ? ) : Promise < EntityData < T > [ ] > ; /**
     * Finds single entity (table row, document)
     */ findOne < T extends AnyEntity < T > , P extends string = never > ( entityName , where , options ? ) : Promise < EntityData < T > | null > ; nativeInsert < T extends AnyEntity < T > > ( entityName , data , options ? ) : Promise < QueryResult < T > > ; nativeInsertMany < T extends AnyEntity < T > > ( entityName , data , options ? ) : Promise < QueryResult < T > > ; nativeUpdate < T extends AnyEntity < T > > ( entityName , where , data , options ? ) : Promise < QueryResult < T > > ; nativeUpdateMany < T extends AnyEntity < T > > ( entityName , where , data , options ? ) : Promise < QueryResult < T > > ; nativeDelete < T extends AnyEntity < T > > ( entityName , where , options ? ) : Promise < QueryResult < T > > ; syncCollection < T , O > ( collection , options ? ) : Promise < void > ; count < T extends AnyEntity < T > , P extends string = never > ( entityName , where , options ? ) : Promise < number > ; aggregate ( entityName , pipeline ) : Promise < any [ ] > ; mapResult < T extends AnyEntity < T > > ( result , meta , populate ? ) : EntityData < T > | null ; /**
     * When driver uses pivot tables for M:N, this method will load identifiers for given collections from them
     */ loadFromPivotTable < T extends AnyEntity < T > , O extends AnyEntity < O > > ( prop , owners , where ? , orderBy ? , ctx ? , options ? ) : Promise < Dictionary < T [ ] > > ; getPlatform ( ) : Platform ; setMetadata ( metadata ) : void ; ensureIndexes ( ) : Promise < void > ; /**
     * Returns name of the underlying database dependencies (e.g. `mongodb` or `mysql2`)
     * for SQL drivers it also returns `knex` in the array as connectors are not used directly there
     */ getDependencies ( ) : string [ ] ; lockPessimistic < T extends AnyEntity < T > > ( entity , options ) : Promise < void > ; /**
     * Converts native db errors to standardized driver exceptions
     */ convertException ( exception ) : DriverException ; } type FieldsMap < T , P extends string = never > = { [ K in keyof T ] ? : EntityField < ExpandProperty < T [ K ] > > [ ] ; } ; export type EntityField < T , P extends string = never > = keyof T | AutoPath < T , P > | FieldsMap < T , P > ; export interface FindOptions < T , P extends string = never > { populate ? : readonly AutoPath < T , P > [ ] | boolean ; orderBy ? : QueryOrderMap < T > | QueryOrderMap < T > [ ] ; cache ? : boolean | number | [ string , number ] ; limit ? : number ; offset ? : number ; refresh ? : boolean ; convertCustomTypes ? : boolean ; disableIdentityMap ? : boolean ; fields ? : readonly EntityField < T , P > [ ] ; schema ? : string ; flags ? : QueryFlag [ ] ; groupBy ? : string | string [ ] ; having ? : QBFilterQuery < T > ; strategy ? : LoadStrategy ; flushMode ? : FlushMode ; filters ? : Dictionary < boolean | Dictionary > | string [ ] | boolean ; lockMode ? : Exclude < LockMode , LockMode . OPTIMISTIC > ; lockTableAliases ? : string [ ] ; ctx ? : Transaction ; } export interface FindOneOptions < T , P extends string = never > extends Omit < FindOptions < T , P > , 'limit' | 'offset' | 'lockMode' > { lockMode ? : LockMode ; lockVersion ? : number | Date ; } export interface FindOneOrFailOptions < T , P extends string = never > extends FindOneOptions < T , P > { failHandler ? : ( entityName : string , where : Dictionary | IPrimaryKey | any ) => Error ; } export interface NativeInsertUpdateOptions < T > { convertCustomTypes ? : boolean ; ctx ? : Transaction ; schema ? : string ; } export interface NativeInsertUpdateManyOptions < T > extends NativeInsertUpdateOptions < T > { processCollections ? : boolean ; } export interface CountOptions < T , P extends string = never > { filters ? : Dictionary < boolean | Dictionary > | string [ ] | boolean ; schema ? : string ; groupBy ? : string | readonly string [ ] ; having ? : QBFilterQuery < T > ; cache ? : boolean | number | [ string , number ] ; populate ? : readonly AutoPath < T , P > [ ] | boolean ; ctx ? : Transaction ; } export interface InsertOptions < T > { schema ? : string ; ctx ? : Transaction ; } export interface UpdateOptions < T > { filters ? : Dictionary < boolean | Dictionary > | string [ ] | boolean ; schema ? : string ; ctx ? : Transaction ; } export interface DeleteOptions < T > extends DriverMethodOptions { filters ? : Dictionary < boolean | Dictionary > | string [ ] | boolean ; } export interface NativeDeleteOptions < T > extends DriverMethodOptions { filters ? : Dictionary < boolean | Dictionary > | string [ ] | boolean ; } export interface LockOptions extends DriverMethodOptions { lockMode ? : LockMode ; lockVersion ? : number | Date ; lockTableAliases ? : string [ ] ; } export interface DriverMethodOptions { ctx ? : Transaction ; schema ? : string ; } export interface GetReferenceOptions { wrapped ? : boolean ; convertCustomTypes ? : boolean ; schema ? : string ; }