///
import { SyncTable } from "../../table/synctable";
export interface Patch {
time: Date;
patch: CompressedPatch;
user_id: number;
snapshot?: string;
sent?: Date;
prev?: Date;
size: number;
}
export interface Document {
apply_patch(CompressedPatch: any): Document;
make_patch(Document: any): CompressedPatch;
is_equal(Document: any): boolean;
to_str(): string;
set(any: any): Document;
get(any?: any): any;
get_one(any?: any): any;
delete(any?: any): Document;
changes(prev?: Document): any;
count(): number;
}
export declare type CompressedPatch = any[];
export interface FileWatcher {
on: (event: string, handler: Function) => void;
close: () => void;
}
import { EventEmitter } from "events";
export interface Client extends EventEmitter {
server_time: () => Date;
is_user: () => boolean;
is_project: () => boolean;
is_connected: () => boolean;
is_signed_in: () => boolean;
dbg: (desc: string) => Function;
mark_file: (opts: {
project_id: string;
path: string;
action: string;
ttl: number;
}) => void;
log_error: (opts: {
project_id: string;
path: string;
string_id: string;
error: any;
}) => void;
query: (opts: {
query: any;
cb: Function;
}) => void;
path_access: (opts: {
path: string;
mode: string;
cb: Function;
}) => void;
path_exists: (opts: {
path: string;
cb: Function;
}) => void;
path_stat: (opts: {
path: string;
cb: Function;
}) => void;
path_read: (opts: {
path: string;
maxsize_MB?: number;
cb: Function;
}) => void;
write_file: (opts: {
path: string;
data: string;
cb: Function;
}) => void;
watch_file: (opts: {
path: string;
}) => FileWatcher;
synctable_project: (project_id: string, query: any, options: any, throttle_changes?: number, id?: string) => Promise;
synctable_database: (query: any, options: any, throttle_changes?: number) => Promise;
client_id: () => string;
is_deleted: (filename: string, project_id?: string) => boolean;
set_deleted: (filename: string, project_id?: string) => void;
}
export interface DocType {
type: string;
patch_format?: number;
opts?: {
[key: string]: any;
};
}