Skip to content

Commit 2c65f63

Browse files
committed
do not sessionToJSON
1 parent 607b2bb commit 2c65f63

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

packages/hub/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export type { Carrier, Layer } from './hub';
22

33
export { addGlobalEventProcessor, Scope } from './scope';
4-
export { updateSession, closeSession, sessionToJSON } from './session';
4+
export { updateSession, closeSession } from './session';
55
export { SessionFlusher } from './sessionflusher';
66
export { getCurrentHub, getHubFromCarrier, getMainCarrier, Hub, makeMain, setHubOnCarrier } from './hub';
77
export {

packages/hub/src/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export function closeSession(session: Session, status?: Exclude<SessionStatus, '
133133
*
134134
* @returns a JSON object of the passed session
135135
*/
136-
export function sessionToJSON(session: Session): SerializedSession {
136+
function sessionToJSON(session: Session): SerializedSession {
137137
return dropUndefinedKeys({
138138
sid: `${session.sid}`,
139139
init: session.init !== undefined ? session.init : true,

packages/hub/test/session.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { SessionContext } from '@sentry/types';
22
import { timestampInSeconds } from '@sentry/utils';
33

4-
import { closeSession, makeSession, sessionToJSON, updateSession } from '../src/session';
4+
import { closeSession, makeSession, updateSession } from '../src/session';
55

66
describe('Session', () => {
77
it('initializes with the proper defaults', () => {
88
const newSession = makeSession();
9-
const session = sessionToJSON(newSession);
9+
const session = newSession.toJSON();
1010

1111
// Grab current year to check if we are converting from sec -> ms correctly
1212
const currentYear = new Date(timestampInSeconds() * 1000).toISOString().slice(0, 4);
@@ -84,10 +84,10 @@ describe('Session', () => {
8484
const DEFAULT_OUT = { duration: expect.any(Number), timestamp: expect.any(String) };
8585

8686
const session = makeSession();
87-
const initSessionProps = sessionToJSON(session);
87+
const initSessionProps = session.toJSON();
8888

8989
updateSession(session, test[1]);
90-
const updatedSessionProps = sessionToJSON(session);
90+
const updatedSessionProps = session.toJSON();
9191

9292
expect(updatedSessionProps).toEqual({ ...initSessionProps, ...DEFAULT_OUT, ...test[2] });
9393
});

0 commit comments

Comments
 (0)