-
Notifications
You must be signed in to change notification settings - Fork 76
/
Stream.d.ts
43 lines (41 loc) · 922 Bytes
/
Stream.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
import Client from './Client'
import { ExprArg } from './query'
import { values } from './values'
export interface Subscription {
on: <T extends keyof SubscriptionEventHandlers>(
type: T,
callback: SubscriptionEventHandlers[T]
) => this
start: () => this
close: () => void
}
type SubscriptionEventHandlers = {
start: (type: 'start', txn: number, event: number) => void
error: (
type: 'error',
txn: number,
event: {
code: string
description: string
}
) => void
version: (
type: 'version',
txn: number,
event: {
action: 'create' | 'update' | 'delete'
document: object
diff: object
prev: object
}
) => void
history_rewrite: (
type: 'history_rewrite',
txn: number,
event: {
action: 'history_rewrite'
document: object
}
) => void
snapshot: (type: 'snapshot', txn: number, event: object) => void
}