UNPKG

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