UNPKG

2.32 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}
50/**
51 * Session Status
52 */
53export declare enum SessionStatus {
54 /** JSDoc */
55 Ok = "ok",
56 /** JSDoc */
57 Exited = "exited",
58 /** JSDoc */
59 Crashed = "crashed",
60 /** JSDoc */
61 Abnormal = "abnormal"
62}
63export declare enum RequestSessionStatus {
64 /** JSDoc */
65 Ok = "ok",
66 /** JSDoc */
67 Errored = "errored",
68 /** JSDoc */
69 Crashed = "crashed"
70}
71/** JSDoc */
72export interface SessionAggregates {
73 attrs?: {
74 environment?: string;
75 release?: string;
76 };
77 aggregates: Array<AggregationCounts>;
78}
79export interface SessionFlusherLike {
80 /**
81 * Increments the Session Status bucket in SessionAggregates Object corresponding to the status of the session
82 * captured
83 */
84 incrementSessionStatusCount(): void;
85 /** Submits the aggregates request mode sessions to Sentry */
86 sendSessionAggregates(sessionAggregates: SessionAggregates): void;
87 /** Empties Aggregate Buckets and Sends them to Transport Buffer */
88 flush(): void;
89 /** Clears setInterval and calls flush */
90 close(): void;
91}
92export interface AggregationCounts {
93 started: string;
94 errored?: number;
95 exited?: number;
96 crashed?: number;
97}
98//# sourceMappingURL=session.d.ts.map
\No newline at end of file