@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
44 lines • 2.06 kB
TypeScript
import type { EntityKind } from './types.ts';
export interface MongoFindOptions {
limit?: number;
sort?: Record<string, 1 | -1>;
projection?: Record<string, unknown>;
skip?: number;
}
export interface MongoIterOptions {
filter?: Record<string, unknown>;
sort?: Record<string, 1 | -1>;
projection?: Record<string, unknown>;
batchSize?: number;
}
export interface MongoCollectionSpec {
name: string;
type?: string;
options?: {
validator?: {
$jsonSchema?: unknown;
} | Record<string, unknown>;
};
}
export interface MongoDriver {
listDatabases(): Promise<string[]>;
listCollections(database: string, kind?: EntityKind | null): Promise<string[]>;
listCollectionsDetailed(database: string, filter?: {
name?: string;
}): Promise<MongoCollectionSpec[]>;
findDocuments<T = Record<string, unknown>>(database: string, collection: string, filter?: Record<string, unknown>, options?: MongoFindOptions): Promise<T[]>;
iterDocuments<T = Record<string, unknown>>(database: string, collection: string, options?: MongoIterOptions): AsyncIterableIterator<T>;
/**
* Documents read at one snapshot, and that snapshot's cluster time: a change
* stream started after it holds each insert the read does not, and none it
* does. Null from a server outside a replica set, which takes no snapshot
* read and has no change stream.
*/
findSnapshot<T = Record<string, unknown>>(database: string, collection: string, options: MongoFindOptions): Promise<[T[], unknown] | null>;
/** Each inserted document, after the cluster time `after` when given. */
iterInserts<T = Record<string, unknown>>(database: string, collection: string, after?: unknown): AsyncIterableIterator<T>;
countDocuments(database: string, collection: string, filter?: Record<string, unknown>): Promise<number>;
listIndexes(database: string, collection: string): Promise<Record<string, unknown>[]>;
close(): Promise<void>;
}
//# sourceMappingURL=_driver.d.ts.map