UNPKG

jdb-lite

Version:

A lightweight schema-based JSON database library with validation

43 lines 1.32 kB
import { DatabaseManager } from './database'; import { Schema } from './schema'; import { ObjectId } from './objectid'; import { Document, Model, Connection } from './types'; declare class EventEmitter { private events; on(event: string, listener: Function): this; emit(event: string, ...args: any[]): boolean; off(event: string, listener: Function): this; } declare class JsonSchemaDBConnection extends EventEmitter implements Connection { readyState: number; name: string; host: string; port: number; models: { [key: string]: Model<any>; }; collections: { [key: string]: any; }; private db; constructor(dbPath: string); close(): Promise<void>; getDatabase(): DatabaseManager; } declare class JsonSchemaDBStatic { connection: JsonSchemaDBConnection; Schema: typeof Schema; Types: { ObjectId: typeof ObjectId; }; private _models; constructor(); connect(uri?: string, options?: any): Promise<Connection>; disconnect(): Promise<void>; model<T extends Document>(name: string, schema?: Schema<T>): Model<T>; } declare const jsonDB: JsonSchemaDBStatic; export default jsonDB; export { JsonSchemaDBStatic as JsonSchemaDB, Schema, ObjectId }; export * from './types'; //# sourceMappingURL=index.d.ts.map