-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
101 lines (91 loc) · 2.58 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
declare module 'basd' {
export function _(arg: any): any;
export function log(arg: any): void;
export class Readable {
constructor(opts: any);
}
export class Pipe {}
export class Evented {
static mixin(...args: any[]): any;
}
}
declare module '@plaindb/storage' {
export default class Storage {
put(key: any, value: any): Promise<any>;
get(key: any): Promise<any>;
del(key: any): Promise<any>;
sub(path: string | string[]): Storage;
}
}
declare module '@basd/nested' {
class Nested {
static mixin(...args: any[]): any;
}
export = Nested;
}
interface Options {
comparator?: (key1: any, key2: any) => number;
map?: Map<any, any>;
separator?: string;
}
declare class Node {
constructor(key: any, value: any);
key: any;
value: any;
prev: Node | null;
next: Node | null;
}
declare class Sorted {
constructor(opts?: Options);
put(key: any, value: any): void;
get(key: any): any;
del(key: any): void;
iterator(opts?: any): Generator<[any, any], void, undefined>;
createReadStream(opts?: any, mode?: string): Readable;
createKeyStream(opts?: any): Readable;
createValueStream(opts?: any): Readable;
listAll(): void;
}
declare class SortedTree {
constructor(opts?: any, ...args: any[]);
put(key: any, value: any): void;
get(key: any): any;
del(key: any): void;
sub(path: any, opts?: object): SortedTree;
iterator(opts?: object): Generator<[any, any], void, undefined>;
listAll(opts?: object): void;
}
declare class MemoryDB {
constructor(opts?: object, ...args: any[]);
isReady(): Promise<void>;
put(key: any, value: any): Promise<void>;
get(key: any): Promise<any>;
del(key: any): Promise<void>;
setOpts(opts: object): this;
static parseOptions(opts?: object, defaultOpts?: object): object;
collect(type: any, opts?: object): Promise<any[]>;
batch(ops?: any): any;
}
export interface Operation {
path?: string;
type: 'put' | 'del';
key: any;
value?: any;
}
export class BatchExecutor {
constructor(storage: Storage, performingUndo?: boolean);
execute(ops: Operation[]): Promise<any[]>;
createUndoOps(ops?: Operation[]): Promise<Operation[]>;
getDb(path?: string): Storage;
buildPromises(ops: Operation[]): Promise<any[]>;
createUndoOp(op: Operation): Promise<Operation>;
static execute(storage: Storage, ops: Operation[]): Promise<any[]>;
}
export class Batch {
constructor(storage: Storage);
put(key: any, value: any, sub?: string): this;
del(key: any, sub?: string): this;
build(): Operation[];
exec(): Promise<any[]>;
static execute(storage: Storage, arr: Operation[]): Promise<any[]>;
}