import * as _apibara_indexer_plugins from '@apibara/indexer/plugins'; import { Db, ClientSession, Document, CollectionOptions, Collection, OptionalUnlessRequiredId, InsertOneOptions, InsertOneResult, BulkWriteOptions, InsertManyResult, Filter, UpdateFilter, UpdateOptions, UpdateResult, DeleteOptions, FindOptions, WithId, FindCursor, MongoClient, DbOptions } from 'mongodb'; import { Cursor } from '@apibara/protocol'; declare class MongoStorage { private db; private session; private endCursor?; constructor(db: Db, session: ClientSession, endCursor?: Cursor | undefined); collection(name: string, options?: CollectionOptions): MongoCollection; } declare class MongoCollection { private session; private collection; private endCursor?; constructor(session: ClientSession, collection: Collection, endCursor?: Cursor | undefined); insertOne(doc: OptionalUnlessRequiredId, options?: InsertOneOptions): Promise>; insertMany(docs: ReadonlyArray>, options?: BulkWriteOptions): Promise>; updateOne(filter: Filter, update: UpdateFilter, options?: UpdateOptions): Promise>; updateMany(filter: Filter, update: UpdateFilter, options?: UpdateOptions): Promise>; deleteOne(filter: Filter, options?: DeleteOptions): Promise>; deleteMany(filter?: Filter, options?: DeleteOptions): Promise>; findOne(filter: Filter, options?: Omit): Promise | null>; find(filter: Filter, options?: FindOptions): FindCursor>; } declare function useMongoStorage(): MongoStorage; interface MongoStorageOptions { client: MongoClient; dbName: string; dbOptions?: DbOptions; collections: string[]; persistState?: boolean; indexerName?: string; } /** * Creates a plugin that uses MongoDB as the storage layer. * * Supports storing the indexer's state and provides a simple Key-Value store. * @param options.client - The MongoDB client instance. * @param options.dbName - The name of the database. * @param options.dbOptions - The database options. * @param options.collections - The collections to use. * @param options.persistState - Whether to persist the indexer's state. Defaults to true. * @param options.indexerName - The name of the indexer. Defaults value is 'default'. */ declare function mongoStorage({ client, dbName, dbOptions, collections, persistState: enablePersistence, indexerName: identifier, }: MongoStorageOptions): _apibara_indexer_plugins.IndexerPlugin; export { MongoCollection, MongoStorage, mongoStorage, useMongoStorage }; export type { MongoStorageOptions };