UNPKG

1.8 kBTypeScriptView Raw
1import type { Session, SessionContext, SessionStatus } from '@sentry/types';
2/**
3 * Creates a new `Session` object by setting certain default parameters. If optional @param context
4 * is passed, the passed properties are applied to the session object.
5 *
6 * @param context (optional) additional properties to be applied to the returned session object
7 *
8 * @returns a new `Session` object
9 */
10export declare function makeSession(context?: Omit<SessionContext, 'started' | 'status'>): Session;
11/**
12 * Updates a session object with the properties passed in the context.
13 *
14 * Note that this function mutates the passed object and returns void.
15 * (Had to do this instead of returning a new and updated session because closing and sending a session
16 * makes an update to the session after it was passed to the sending logic.
17 * @see BaseClient.captureSession )
18 *
19 * @param session the `Session` to update
20 * @param context the `SessionContext` holding the properties that should be updated in @param session
21 */
22export declare function updateSession(session: Session, context?: SessionContext): void;
23/**
24 * Closes a session by setting its status and updating the session object with it.
25 * Internally calls `updateSession` to update the passed session object.
26 *
27 * Note that this function mutates the passed session (@see updateSession for explanation).
28 *
29 * @param session the `Session` object to be closed
30 * @param status the `SessionStatus` with which the session was closed. If you don't pass a status,
31 * this function will keep the previously set status, unless it was `'ok'` in which case
32 * it is changed to `'exited'`.
33 */
34export declare function closeSession(session: Session, status?: Exclude<SessionStatus, 'ok'>): void;
35//# sourceMappingURL=session.d.ts.map
\No newline at end of file