declare module 'apollo-datasource-mongodb' { import { KeyValueCache } from '@apollo/utils.keyvaluecache' import { Collection as MongoCollection, ObjectId } from 'mongodb' import { Collection as MongooseCollection, Document, Model as MongooseModel, } from 'mongoose' export type Collection> = T extends Document ? MongooseCollection : U export type Model> = T extends Document ? U : undefined export type ModelOrCollection> = T extends Document ? U : Collection export interface Fields { [fieldName: string]: | string | number | boolean | ObjectId | (string | number | boolean | ObjectId)[] } export interface Options { ttl: number } export interface MongoDataSourceConfig { modelOrCollection: ModelOrCollection cache?: KeyValueCache } export class MongoDataSource { protected collection: Collection protected model: Model constructor(options: MongoDataSourceConfig) findOneById( id: ObjectId | string, options?: Options ): Promise findManyByIds( ids: (ObjectId | string)[], options?: Options ): Promise<(TData | null | undefined)[]> findByFields( fields: Fields, options?: Options ): Promise<(TData | null | undefined)[]> deleteFromCacheById(id: ObjectId | string): Promise deleteFromCacheByFields(fields: Fields): Promise } }