-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.d.ts
More file actions
44 lines (37 loc) · 1.14 KB
/
server.d.ts
File metadata and controls
44 lines (37 loc) · 1.14 KB
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
import { IncomingMessage, ServerResponse } from 'http'
interface PutCallbackParams {
old_val: string
patches: Array<{ unit: string; range: string; content: string }> | null
version: string[]
parents: string[]
}
interface ServeOptions {
key?: string
put_cb?: (key: string, val: string, params: PutCallbackParams) => void
}
interface GetResult {
version: string[]
body: string | Uint8Array
}
interface Resource {
key: string
val: string
version: string[]
}
interface BraidText {
verbose: boolean
db_folder: string | null
cors: boolean
cache: Record<string, Promise<Resource>>
serve(req: IncomingMessage, res: ServerResponse, options?: ServeOptions): Promise<void>
get(key: string): Promise<string | null>
get(key: string, options: Record<string, any>): Promise<GetResult>
put(key: string, options: Record<string, any>): Promise<{ change_count: number }>
delete(key: string): Promise<void>
list(): Promise<string[]>
sync(a: string, b: string | URL, options?: Record<string, any>): Promise<void>
free_cors(res: ServerResponse): void
create_braid_text(): BraidText
}
declare const braidText: BraidText
export = braidText