import { PersistenceAdapter } from "@flue/runtime/adapter"; //#region src/mongodb-runner.d.ts type MongoDocument = Record; type MongoFilter = Record; type MongoUpdate = Record | Record[]; interface MongoCursorOptions { sort?: Record; limit?: number; projection?: Record; collation?: { locale: string; [key: string]: unknown; }; } interface MongoWriteResult { acknowledged: boolean; matchedCount?: number; modifiedCount?: number; deletedCount?: number; upsertedId?: unknown; } interface MongoCollection { findOne(filter: MongoFilter, options?: { sort?: Record; projection?: Record; collation?: { locale: 'simple'; }; }): Promise; find(filter?: MongoFilter, options?: MongoCursorOptions): Promise; insertOne(document: MongoDocument): Promise; insertMany(documents: MongoDocument[]): Promise; updateOne(filter: MongoFilter, update: MongoUpdate, options?: { upsert?: boolean; }): Promise; updateMany(filter: MongoFilter, update: MongoUpdate): Promise; findOneAndUpdate(filter: MongoFilter, update: MongoUpdate, options?: { upsert?: boolean; returnDocument?: 'before' | 'after'; sort?: Record; }): Promise; deleteOne(filter: MongoFilter): Promise; deleteMany(filter: MongoFilter): Promise; } interface MongoIndexSpec { name: string; key: Record; unique?: boolean; partialFilterExpression?: MongoFilter; collation?: { locale: string; [key: string]: unknown; }; } interface MongoCollectionSpec { name: string; validator: MongoDocument; validationLevel: 'strict'; validationAction: 'error'; indexes: MongoIndexSpec[]; } interface MongoTopology { kind: 'replica_set' | 'sharded' | 'standalone' | 'unknown'; transactions: boolean; } interface MongoOperations { collection(name: string): MongoCollection; } interface MongoRunner extends MongoOperations { transaction(fn: (tx: MongoOperations) => Promise): Promise; topology(): Promise; ensureCollection(spec: MongoCollectionSpec): Promise; inspectCollection(name: string): Promise<{ validator: MongoDocument; validationLevel: 'strict'; validationAction: 'error'; indexes: MongoIndexSpec[]; } | null>; close(): void | Promise; } interface MongoTransactionSession { start(): void; commit(): Promise; abort(): Promise; end(): Promise; operations: MongoOperations; } interface MongoTransactionRetryOptions { maxTransactionAttempts?: number; maxCommitAttempts?: number; hasErrorLabel(error: unknown, label: 'TransientTransactionError' | 'UnknownTransactionCommitResult'): boolean; } declare function runMongoTransactionWithRetry(createSession: () => MongoTransactionSession, fn: (operations: MongoOperations) => Promise, options: MongoTransactionRetryOptions): Promise; interface MongoOptions { collectionPrefix?: string; } //#endregion //#region src/mongodb-adapter.d.ts declare function mongodb(runner: MongoRunner, options?: MongoOptions): PersistenceAdapter; //#endregion export { type MongoCollection, type MongoCollectionSpec, type MongoCursorOptions, type MongoDocument, type MongoFilter, type MongoIndexSpec, type MongoOperations, type MongoOptions, type MongoRunner, type MongoTopology, type MongoTransactionRetryOptions, type MongoTransactionSession, type MongoUpdate, type MongoWriteResult, mongodb, runMongoTransactionWithRetry };