UNPKG

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