-
Notifications
You must be signed in to change notification settings - Fork 254
/
Copy pathclient.d.ts
79 lines (66 loc) · 2.15 KB
/
client.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
import { Client, OnErrorCallback, Config, Breadcrumb, Session, OnSessionCallback, OnBreadcrumbCallback, Plugin, Device, App, User, FeatureFlag } from './types'
import EventWithInternals from './event'
interface LoggerConfig {
debug: (msg: any) => void
info: (msg: any) => void
warn: (msg: any) => void
error: (msg: any) => void
}
interface Notifier {
name: string
version: string
url: string
}
interface EventDeliveryPayload {
apiKey: string
notifier: Notifier
events: EventWithInternals[]
}
interface SessionDeliveryPayload {
notifier?: Notifier
device?: Device
app?: App
sessions?: Session[]
}
interface Delivery {
sendEvent(payload: EventDeliveryPayload, cb: (err?: Error | null) => void): void
sendSession(session: SessionDeliveryPayload, cb: (err?: Error | null) => void): void
}
/**
* Extend the public type definitions with internal declarations.
*
* This is currently used by the unit tests. These will be rolled into the
* module itself once it is converted to TypeScript.
*/
export default class ClientWithInternals<T extends Config = Config> extends Client {
public constructor(opts: T, schema?: {[key: string]: any}, internalPlugins?: Plugin[], notifier?: Notifier)
_config: T
_depth: number
_logger: LoggerConfig
_breadcrumbs: Breadcrumb[]
_delivery: Delivery
_setDelivery: (handler: (client: Client) => Delivery) => void
_clientContext: any
_user: User
_metadata: { [key: string]: any }
_features: Array<FeatureFlag | null>
_featuresIndex: { [key: string]: number }
startSession(): ClientWithInternals
resumeSession(): ClientWithInternals
_session: Session | null
_pausedSession: Session | null
_sessionDelegate: {
startSession: (client: ClientWithInternals, session: Session) => ClientWithInternals
pauseSession: (client: ClientWithInternals) => void
resumeSession: (client: ClientWithInternals) => ClientWithInternals
}
_addOnSessionPayload: (cb: (sessionPayload: Session) => void) => void
_cbs: {
e: OnErrorCallback[]
s: OnSessionCallback[]
sp: any[]
b: OnBreadcrumbCallback[]
}
_loadPlugin(plugin: Plugin): void
_isBreadcrumbTypeEnabled(type: string): boolean
}