import { type ModelsWithDbNamesAndReadWrite, type MainDbName } from './cache/dbs/index.generated.js'; import { DaoMethodsBaseWithoutCtxMongo, DaoMethodsMongo } from './databases/mongo/types/mongoDaoTypes.js'; import { ModelAdditionalFields, ModelsConfigCache } from './databases/mongo/initMongoDb.js'; import { GD_serverBlacklistModel } from './security/userAndConnexion/GD_serverBlackList.model.js'; import { GD_deviceModel } from './security/userAndConnexion/GD_device.model.js'; import type { DefinitionObjChild, InferTypeRead, InferTypeWrite } from './lib/good-cop//definitionTypes.js'; import { ModelReadWrite } from './types/models.types.js'; type InferTypeRW = { Read: InferTypeRead; Write: InferTypeWrite; }; export declare const dbCache: ModelsConfigCache; export type Dbs = { [K in keyof ModelsWithDbNamesAndReadWrite]: { [L in keyof ModelsWithDbNamesAndReadWrite[K]]: L extends 'GD_serverBlackList' ? DaoMethodsMongo> : L extends 'GD_device' ? DaoMethodsMongo> : ModelsWithDbNamesAndReadWrite[K][L] extends ModelReadWrite ? DaoMethodsMongo : never; } & ModelAdditionalFields; }; export type Db = Dbs[MainDbName]; export type DbsWithoutCtx = { [K in keyof ModelsWithDbNamesAndReadWrite]: { [L in keyof ModelsWithDbNamesAndReadWrite[K]]: L extends 'GD_serverBlackList' ? DaoMethodsBaseWithoutCtxMongo> : L extends 'GD_device' ? DaoMethodsBaseWithoutCtxMongo> : ModelsWithDbNamesAndReadWrite[K][L] extends ModelReadWrite ? DaoMethodsBaseWithoutCtxMongo : never; } & ModelAdditionalFields; }; export type DbWithoutCtx = DbsWithoutCtx[MainDbName]; export declare function initDbs(resetCache?: boolean): Promise; /** Use that in your backend app has the main DB entry point of any database operations. * @example ```db.myDbName.myModelName.count(ctx, { status: 'success' })``` */ export declare const dbs: Dbs; export declare const db: { [x: string]: DaoMethodsMongo; } & ModelAdditionalFields; /** This mean to exist for performances reason to avoid initiating two databases when there is two execution contexts (the client app / the green_dot module), TODO In Progress not fully tested / implemented */ export declare function updateCacheFromOutside(cache2: ModelsConfigCache): void; export {};