export class Persistr { constructor(); connect(options?: { environment?: string, credentials?: { apikey: string } | { email: string, password: string }, server?: string }): Promise; } declare namespace Persistr { export interface Account { db(name: string): Database; database(name: string): Database; dbs(): Databases; databases(): Databases; } export interface Annotation { destroy(): Promise; read(): Promise; } export interface Database { create(): Promise; clone(to: string): Promise; destroy(): Promise; rename(to: string): Promise; grant(access: { role: string, email: string }): Promise; revoke(access: { role: string, email: string }): Promise; namespace(name: string): Namespace; namespaces(): Namespaces; } export interface Databases { each(callback: (db: string) => void): Promise; all(): Promise; } export interface Event { destroy(): Promise; read(): Promise; } type EventObject = { data: any, meta?: any } export interface Events { each(callback: (event: EventObject, subscription?: Subscription) => void): Promise; write(events: string | EventObject | Array, data?: any): Promise; } export interface Namespace { create(): Promise; destroy(): Promise; truncate(): Promise; rename(to: string): Promise; stream(name: string): Stream; streams(): Streams; events(options?: string | { types?: string | string[], from?: string, to?: string, after?: string, until?: string, limit?: number }): Events; } export interface Namespaces { each(callback: (ns: string) => void): Promise; } export interface Stream { annotate(annotation: any): Promise; annotation(): Annotation; event(id: string): Event; events(options?: string | { types?: string | string[], from?: string, to?: string, after?: string, until?: string, limit?: number }): Events; destroy(): Promise; } export interface Streams { stream(name: string): Stream; each(callback: (stream: Stream) => void): Promise; } export interface Subscription { cancel(): Promise; } } export declare var persistr: Persistr;