UNPKG

2.06 kBTypeScriptView Raw
1import type { User } from './user';
2export interface RequestSession {
3 status?: RequestSessionStatus;
4}
5export interface Session {
6 sid: string;
7 did?: string;
8 init: boolean;
9 timestamp: number;
10 started: number;
11 duration?: number;
12 status: SessionStatus;
13 release?: string;
14 environment?: string;
15 userAgent?: string;
16 ipAddress?: string;
17 errors: number;
18 user?: User | null;
19 ignoreDuration: boolean;
20 /**
21 * Overrides default JSON serialization of the Session because
22 * the Sentry servers expect a slightly different schema of a session
23 * which is described in the interface @see SerializedSession in this file.
24 *
25 * @return a Sentry-backend conforming JSON object of the session
26 */
27 toJSON(): SerializedSession;
28}
29export declare type SessionContext = Partial<Session>;
30export declare type SessionStatus = 'ok' | 'exited' | 'crashed' | 'abnormal';
31export declare type RequestSessionStatus = 'ok' | 'errored' | 'crashed';
32/** JSDoc */
33export interface SessionAggregates {
34 attrs?: {
35 environment?: string;
36 release?: string;
37 };
38 aggregates: Array<AggregationCounts>;
39}
40export interface SessionFlusherLike {
41 /**
42 * Increments the Session Status bucket in SessionAggregates Object corresponding to the status of the session
43 * captured
44 */
45 incrementSessionStatusCount(): void;
46 /** Empties Aggregate Buckets and Sends them to Transport Buffer */
47 flush(): void;
48 /** Clears setInterval and calls flush */
49 close(): void;
50}
51export interface AggregationCounts {
52 started: string;
53 errored?: number;
54 exited?: number;
55 crashed?: number;
56}
57export interface SerializedSession {
58 init: boolean;
59 sid: string;
60 did?: string;
61 timestamp: string;
62 started: string;
63 duration?: number;
64 status: SessionStatus;
65 errors: number;
66 attrs?: {
67 release?: string;
68 environment?: string;
69 user_agent?: string;
70 ip_address?: string;
71 };
72}
73//# sourceMappingURL=session.d.ts.map
\No newline at end of file