@sentry/replay 0.4.5 → 0.4.8-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +17 -1
  2. package/dist/dist/api/captureReplay.d.ts +7 -1
  3. package/dist/dist/api/captureReplayUpdate.d.ts +10 -0
  4. package/dist/dist/coreHandlers/handleScope.d.ts +1 -1
  5. package/dist/dist/eventBuffer.d.ts +13 -6
  6. package/dist/dist/index.d.ts +65 -8
  7. package/dist/dist/session/Session.d.ts +18 -7
  8. package/dist/dist/session/createSession.d.ts +6 -1
  9. package/dist/dist/session/getSession.d.ts +6 -1
  10. package/dist/dist/types.d.ts +22 -5
  11. package/dist/dist/util/isSampled.d.ts +7 -0
  12. package/dist/dist/util/supportsSendBeacon.d.ts +4 -0
  13. package/dist/esm/index.js +1454 -0
  14. package/dist/esm/worker-aa3eb59a.js +4 -0
  15. package/dist/index.es.js +551 -383
  16. package/dist/index.js +549 -381
  17. package/dist/index.js.map +1 -1
  18. package/dist/{config/dist/jest.config.d.ts → jest.config.d.ts} +0 -0
  19. package/dist/{config/dist/jest.setup.d.ts → jest.setup.d.ts} +0 -0
  20. package/dist/src/api/captureReplay.d.ts +3 -0
  21. package/dist/src/api/captureReplayUpdate.d.ts +2 -0
  22. package/dist/{config/dist/src → src}/coreHandlers/handleDom.d.ts +0 -0
  23. package/dist/{config/dist/src → src}/coreHandlers/handleFetch.d.ts +0 -0
  24. package/dist/{config/dist/src → src}/coreHandlers/handleFetch.test.d.ts +0 -0
  25. package/dist/{config/dist/src → src}/coreHandlers/handleScope-unit.test.d.ts +0 -0
  26. package/dist/{config/dist/src → src}/coreHandlers/handleScope.d.ts +1 -1
  27. package/dist/{config/dist/src → src}/coreHandlers/handleScope.test.d.ts +0 -0
  28. package/dist/{config/dist/src → src}/coreHandlers/handleXhr.d.ts +0 -0
  29. package/dist/{config/dist/src → src}/coreHandlers/index.d.ts +0 -0
  30. package/dist/{config/dist/src → src}/createPerformanceEntry.d.ts +0 -0
  31. package/dist/{config/dist/src → src}/createPerformanceEntry.test.d.ts +0 -0
  32. package/dist/{config/dist/src → src}/eventBuffer.d.ts +6 -6
  33. package/dist/{config/dist/src → src}/eventBuffer.test.d.ts +0 -0
  34. package/dist/{config/dist/src → src}/flags.d.ts +0 -0
  35. package/dist/{config/dist/src → src}/index-captureOnlyOnError.test.d.ts +0 -0
  36. package/dist/{config/dist/src → src}/index-noSticky.test.d.ts +0 -0
  37. package/dist/{config/dist/src/index.test.d.ts → src/index-sampling.test.d.ts} +0 -0
  38. package/dist/{config/dist/src → src}/index.d.ts +69 -8
  39. package/dist/{config/dist/src/session/Session.test.d.ts → src/index.test.d.ts} +0 -0
  40. package/dist/{config/dist/src → src}/session/Session.d.ts +18 -7
  41. package/dist/{config/dist/src/session/createSession.test.d.ts → src/session/Session.test.d.ts} +0 -0
  42. package/dist/{config/dist/src → src}/session/constants.d.ts +0 -0
  43. package/dist/{config/dist/src → src}/session/createSession.d.ts +6 -1
  44. package/dist/{config/dist/src/session/fetchSession.test.d.ts → src/session/createSession.test.d.ts} +0 -0
  45. package/dist/{config/dist/src → src}/session/fetchSession.d.ts +0 -0
  46. package/dist/{config/dist/src/session/getSession.test.d.ts → src/session/fetchSession.test.d.ts} +0 -0
  47. package/dist/{config/dist/src → src}/session/getSession.d.ts +6 -1
  48. package/dist/{config/dist/src/session/saveSession.test.d.ts → src/session/getSession.test.d.ts} +0 -0
  49. package/dist/{config/dist/src → src}/session/index.d.ts +0 -0
  50. package/dist/{config/dist/src → src}/session/saveSession.d.ts +0 -0
  51. package/dist/{config/dist/src/util/isExpired.test.d.ts → src/session/saveSession.test.d.ts} +0 -0
  52. package/dist/{config/dist/src → src}/types.d.ts +20 -5
  53. package/dist/{config/dist/src → src}/util/createBreadcrumb.d.ts +0 -0
  54. package/dist/{config/dist/src → src}/util/isExpired.d.ts +0 -0
  55. package/dist/{config/dist/src/util/isSessionExpired.test.d.ts → src/util/isExpired.test.d.ts} +0 -0
  56. package/dist/{config/dist/src → src}/util/isIngestHost.d.ts +0 -0
  57. package/dist/src/util/isSampled.d.ts +7 -0
  58. package/dist/src/util/isSampled.test.d.ts +1 -0
  59. package/dist/{config/dist/src → src}/util/isSessionExpired.d.ts +0 -0
  60. package/dist/src/util/isSessionExpired.test.d.ts +1 -0
  61. package/dist/{config/dist/src → src}/util/logger.d.ts +0 -0
  62. package/dist/src/util/supportsSendBeacon.d.ts +4 -0
  63. package/dist/{config/dist/test → test}/index.d.ts +0 -0
  64. package/dist/{config/dist/test → test}/mocks/mockRrweb.d.ts +2 -2
  65. package/dist/{config/dist/test → test}/mocks/mockSdk.d.ts +1 -1
  66. package/dist/types/jest.config.d.ts +3 -0
  67. package/dist/types/jest.setup.d.ts +10 -0
  68. package/dist/types/src/api/captureReplay.d.ts +3 -0
  69. package/dist/types/src/api/captureReplayUpdate.d.ts +2 -0
  70. package/dist/types/src/coreHandlers/handleDom.d.ts +1 -0
  71. package/dist/types/src/coreHandlers/handleFetch.d.ts +2 -0
  72. package/dist/types/src/coreHandlers/handleFetch.test.d.ts +1 -0
  73. package/dist/types/src/coreHandlers/handleScope-unit.test.d.ts +1 -0
  74. package/dist/types/src/coreHandlers/handleScope.d.ts +2 -0
  75. package/dist/types/src/coreHandlers/handleScope.test.d.ts +1 -0
  76. package/dist/types/src/coreHandlers/handleXhr.d.ts +2 -0
  77. package/dist/types/src/coreHandlers/index.d.ts +4 -0
  78. package/dist/types/src/createPerformanceEntry.d.ts +42 -0
  79. package/dist/types/src/createPerformanceEntry.test.d.ts +1 -0
  80. package/dist/types/src/eventBuffer.d.ts +31 -0
  81. package/dist/types/src/eventBuffer.test.d.ts +1 -0
  82. package/dist/types/src/flags.d.ts +2 -0
  83. package/dist/types/src/index-captureOnlyOnError.test.d.ts +1 -0
  84. package/dist/types/src/index-noSticky.test.d.ts +1 -0
  85. package/dist/types/src/index-sampling.test.d.ts +1 -0
  86. package/dist/types/src/index.d.ts +209 -0
  87. package/dist/types/src/index.test.d.ts +1 -0
  88. package/dist/types/src/session/Session.d.ts +63 -0
  89. package/dist/types/src/session/Session.test.d.ts +1 -0
  90. package/dist/types/src/session/constants.d.ts +5 -0
  91. package/dist/types/src/session/createSession.d.ts +19 -0
  92. package/dist/types/src/session/createSession.test.d.ts +1 -0
  93. package/dist/types/src/session/fetchSession.d.ts +5 -0
  94. package/dist/types/src/session/fetchSession.test.d.ts +1 -0
  95. package/dist/types/src/session/getSession.d.ts +28 -0
  96. package/dist/types/src/session/getSession.test.d.ts +1 -0
  97. package/dist/types/src/session/index.d.ts +1 -0
  98. package/dist/types/src/session/saveSession.d.ts +2 -0
  99. package/dist/types/src/session/saveSession.test.d.ts +1 -0
  100. package/dist/types/src/session/types.d.ts +0 -0
  101. package/dist/types/src/types.d.ts +76 -0
  102. package/dist/types/src/util/createBreadcrumb.d.ts +4 -0
  103. package/dist/types/src/util/isExpired.d.ts +5 -0
  104. package/dist/types/src/util/isExpired.test.d.ts +1 -0
  105. package/dist/types/src/util/isIngestHost.d.ts +4 -0
  106. package/dist/types/src/util/isSampled.d.ts +7 -0
  107. package/dist/types/src/util/isSampled.test.d.ts +1 -0
  108. package/dist/types/src/util/isSessionExpired.d.ts +5 -0
  109. package/dist/types/src/util/isSessionExpired.test.d.ts +1 -0
  110. package/dist/types/src/util/logger.d.ts +12 -0
  111. package/dist/types/src/util/supportsSendBeacon.d.ts +4 -0
  112. package/dist/types/test/index.d.ts +3 -0
  113. package/dist/types/test/mocks/mockRrweb.d.ts +15 -0
  114. package/dist/types/test/mocks/mockSdk.d.ts +11 -0
  115. package/dist/types/worker/src/Compressor.d.ts +15 -0
  116. package/dist/types/worker/src/handleMessage.d.ts +2 -0
  117. package/dist/worker-aa3eb59a.js +4 -0
  118. package/dist/worker-f4750cfb.js +7 -0
  119. package/dist/worker-f4750cfb.js.map +1 -0
  120. package/package.json +18 -6
  121. package/dist/config/dist/src/api/captureReplay.d.ts +0 -2
  122. package/dist/config/dist/src/api/captureReplayUpdate.d.ts +0 -2
  123. package/dist/config/dist/src/util/createPayload.d.ts +0 -5
@@ -0,0 +1,3 @@
1
+ import type { Session } from '@/session/Session';
2
+ import { InitialState } from '@/types';
3
+ export declare function captureReplay(session: Session, initialState: InitialState): void;
@@ -0,0 +1,2 @@
1
+ import type { Session } from '@/session/Session';
2
+ export declare function captureReplayUpdate(session: Session, timestamp: number): void;
@@ -1,2 +1,2 @@
1
- import { Scope, Breadcrumb } from '@sentry/types';
1
+ import { Breadcrumb, Scope } from '@sentry/types';
2
2
  export declare function handleScope(scope: Scope): Breadcrumb;
@@ -1,4 +1,4 @@
1
- import { RRWebEvent } from './types';
1
+ import { RecordingEvent } from './types';
2
2
  interface CreateEventBufferParams {
3
3
  useCompression: boolean;
4
4
  }
@@ -6,15 +6,15 @@ export declare function createEventBuffer({ useCompression }: CreateEventBufferP
6
6
  export interface IEventBuffer {
7
7
  get length(): number;
8
8
  destroy(): void;
9
- addEvent(event: RRWebEvent, isCheckout?: boolean): void;
9
+ addEvent(event: RecordingEvent, isCheckout?: boolean): void;
10
10
  finish(): Promise<string | Uint8Array>;
11
11
  }
12
12
  declare class EventBufferArray implements IEventBuffer {
13
- events: RRWebEvent[];
13
+ events: RecordingEvent[];
14
14
  constructor();
15
15
  destroy(): void;
16
16
  get length(): number;
17
- addEvent(event: RRWebEvent, isCheckout?: boolean): void;
17
+ addEvent(event: RecordingEvent, isCheckout?: boolean): void;
18
18
  finish(): Promise<string>;
19
19
  }
20
20
  export declare class EventBufferCompressionWorker implements IEventBuffer {
@@ -24,8 +24,8 @@ export declare class EventBufferCompressionWorker implements IEventBuffer {
24
24
  init(): void;
25
25
  destroy(): void;
26
26
  get length(): number;
27
- addEvent(event: RRWebEvent, isCheckout?: boolean): void;
28
- sendEventToWorker(event: RRWebEvent): void;
27
+ addEvent(event: RecordingEvent, isCheckout?: boolean): void;
28
+ sendEventToWorker(event: RecordingEvent): void;
29
29
  finish(): Promise<Uint8Array>;
30
30
  }
31
31
  export {};
File without changes
@@ -1,8 +1,8 @@
1
- import { DsnComponents, Integration, Breadcrumb } from '@sentry/types';
1
+ import { Breadcrumb, DsnComponents, Event, Integration } from '@sentry/types';
2
+ import { Session } from './session/Session';
2
3
  import { ReplayPerformanceEntry } from './createPerformanceEntry';
3
4
  import { IEventBuffer } from './eventBuffer';
4
- import type { RRWebOptions, ReplaySpan, ReplayRequest, InstrumentationType, SentryReplayPluginOptions, SentryReplayConfiguration } from './types';
5
- import { Session } from './session/Session';
5
+ import type { InstrumentationType, RecordingConfig, RecordingEvent, ReplayRequest, ReplaySpan, SentryReplayConfiguration, SentryReplayPluginOptions } from './types';
6
6
  /**
7
7
  * Returns true to return control to calling function, otherwise continue with normal batching
8
8
  */
@@ -32,7 +32,7 @@ export declare class SentryReplay implements Integration {
32
32
  /**
33
33
  * Options to pass to `rrweb.record()`
34
34
  */
35
- readonly rrwebRecordOptions: RRWebOptions;
35
+ readonly recordingOptions: RecordingConfig;
36
36
  readonly options: SentryReplayPluginOptions;
37
37
  /**
38
38
  * setTimeout id used for debouncing sending rrweb attachments
@@ -54,11 +54,33 @@ export declare class SentryReplay implements Integration {
54
54
  * immediately before sending recording)
55
55
  */
56
56
  private needsCaptureReplay;
57
+ /**
58
+ * Captured state when integration is first initialized
59
+ */
60
+ private initialState;
61
+ /**
62
+ * List of error events that should be associated with the replay
63
+ */
64
+ errorIds: number[];
57
65
  session: Session | undefined;
58
66
  static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string): string;
59
67
  constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, // TBD: Making this opt-in for now
60
- useCompression, rrwebConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...rrwebRecordOptions }, }?: SentryReplayConfiguration);
68
+ useCompression, captureOnlyOnError, replaysSamplingRate, recordingConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...recordingOptions }, }?: SentryReplayConfiguration);
69
+ /**
70
+ * Because we create a transaction in `setupOnce`, we can potentially create a
71
+ * transaction before some native SDK integrations have run and applied their
72
+ * own global event processor. An example is:
73
+ * https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts
74
+ *
75
+ * So we call `this.setup` in next event loop as a workaround to wait for
76
+ * other global event processors to finish
77
+ */
61
78
  setupOnce(): void;
79
+ /**
80
+ * Initializes the plugin.
81
+ *
82
+ * Creates or loads a session, attaches listeners to varying events (DOM, PerformanceObserver, Recording, Sentry SDK, etc)
83
+ */
62
84
  setup(): void;
63
85
  /**
64
86
  * We want to batch uploads of replay events. Save events only if
@@ -81,8 +103,26 @@ export declare class SentryReplay implements Integration {
81
103
  loadSession({ expiry }: {
82
104
  expiry: number;
83
105
  }): void;
106
+ /**
107
+ * Adds listeners to record events for the replay
108
+ */
84
109
  addListeners(): void;
110
+ /**
111
+ * Cleans up listeners that were created in `addListeners`
112
+ */
85
113
  removeListeners(): void;
114
+ /**
115
+ * Core Sentry SDK global event handler. Attaches `replayId` to all [non-replay]
116
+ * events as a tag. Also handles the case where we only want to capture a reply
117
+ * when an error occurs.
118
+ **/
119
+ handleGlobalEvent: (event: Event) => Event;
120
+ /**
121
+ * Handler for recording events.
122
+ *
123
+ * Adds to event buffer, and has varying flushing behaviors if the event was a checkout.
124
+ */
125
+ handleRecordingEmit: (event: RecordingEvent, isCheckout?: boolean) => void;
86
126
  /**
87
127
  * Handle when visibility of the page content changes. Opening a new tab will
88
128
  * cause the state to change to hidden because of content of current page will
@@ -98,7 +138,16 @@ export declare class SentryReplay implements Integration {
98
138
  * Handle when page is focused
99
139
  */
100
140
  handleWindowFocus: () => void;
141
+ /**
142
+ * Handle when page is closed
143
+ */
101
144
  handleWindowUnload: () => void;
145
+ /**
146
+ * Handler for Sentry Core SDK events.
147
+ *
148
+ * Transforms core SDK events into replay events.
149
+ *
150
+ */
102
151
  handleCoreListener: (type: InstrumentationType) => (handlerData: any) => void;
103
152
  /**
104
153
  * Keep a list of performance entries that will be sent with a replay
@@ -117,7 +166,13 @@ export declare class SentryReplay implements Integration {
117
166
  * create a new Replay event.
118
167
  */
119
168
  triggerFullSnapshot(): void;
169
+ /**
170
+ * Updates the session's last activity timestamp
171
+ */
120
172
  updateLastActivity(lastActivity?: number): void;
173
+ /**
174
+ * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
175
+ */
121
176
  createCustomBreadcrumb(breadcrumb: Breadcrumb): void;
122
177
  /**
123
178
  * Create a span for each performance entry. The parent transaction is `this.replayEvent`.
@@ -134,11 +189,17 @@ export declare class SentryReplay implements Integration {
134
189
  * Returns true if session is not expired, false otherwise.
135
190
  */
136
191
  checkAndHandleExpiredSession(expiry?: number): boolean;
137
- flushUpdate(lastActivity?: number): Promise<void>;
138
192
  /**
139
- * Determine if there is browser support for `navigator.sendBeacon`
193
+ * Only flush if `captureOnlyOnError` is false.
140
194
  */
141
- hasSendBeacon(): boolean;
195
+ conditionalFlush(lastActivity?: number): Promise<void>;
196
+ /**
197
+ * Flushes replay event buffer to Sentry.
198
+ *
199
+ * Performance events are only added right before flushing - this is probably
200
+ * due to the buffered performance observer events.
201
+ */
202
+ flushUpdate(lastActivity?: number): Promise<void>;
142
203
  /**
143
204
  * Send replay attachment using either `sendBeacon()` or `fetch()`
144
205
  */
@@ -9,12 +9,17 @@ interface SessionObject {
9
9
  */
10
10
  lastActivity: number;
11
11
  /**
12
- * Sequence ID specific to replay updates
12
+ * Segment ID for replay events
13
+ */
14
+ segmentId: number;
15
+ /**
16
+ * Is the session sampled?
13
17
  */
14
- sequenceId: number;
18
+ sampled: boolean;
15
19
  }
16
20
  interface SessionOptions {
17
21
  stickySession?: boolean;
22
+ samplingRate?: number;
18
23
  }
19
24
  export declare class Session {
20
25
  /**
@@ -32,21 +37,27 @@ export declare class Session {
32
37
  /**
33
38
  * Sequence ID specific to replay updates
34
39
  */
35
- private _sequenceId;
40
+ private _segmentId;
36
41
  /**
37
42
  * Previous session ID
38
43
  */
39
44
  private _previousSessionId;
40
- readonly options: Required<SessionOptions>;
41
- constructor(session?: Partial<SessionObject>, { stickySession }?: SessionOptions);
45
+ /**
46
+ * Is the Session sampled?
47
+ */
48
+ private _sampled;
49
+ readonly options: Required<Pick<SessionOptions, 'stickySession'>>;
50
+ constructor(session?: Partial<SessionObject>, { stickySession, samplingRate }?: SessionOptions);
42
51
  get id(): string;
43
52
  get started(): number;
44
53
  get lastActivity(): number;
45
54
  set lastActivity(newDate: number);
46
- get sequenceId(): number;
47
- set sequenceId(id: number);
55
+ get segmentId(): number;
56
+ set segmentId(id: number);
48
57
  get previousSessionId(): string;
49
58
  set previousSessionId(id: string);
59
+ get sampled(): boolean;
60
+ set sampled(_isSampled: boolean);
50
61
  toJSON(): SessionObject;
51
62
  }
52
63
  export {};
@@ -4,11 +4,16 @@ interface CreateSessionParams {
4
4
  * Should save to sessionStorage?
5
5
  */
6
6
  stickySession: boolean;
7
+ /**
8
+ * The sampling rate of the Session. See integration configuration comments
9
+ * for `replaysSamplingRate`.
10
+ */
11
+ samplingRate?: number;
7
12
  }
8
13
  /**
9
14
  * Create a new session, which in its current implementation is a Sentry event
10
15
  * that all replays will be saved to as attachments. Currently, we only expect
11
16
  * one of these Sentry events per "replay session".
12
17
  */
13
- export declare function createSession({ stickySession, }: CreateSessionParams): Session;
18
+ export declare function createSession({ stickySession, samplingRate, }: CreateSessionParams): Session;
14
19
  export {};
@@ -12,11 +12,16 @@ interface GetSessionParams {
12
12
  * The current session (e.g. if stickySession is off)
13
13
  */
14
14
  currentSession?: Session;
15
+ /**
16
+ * The sampling rate of the Session. See integration configuration comments
17
+ * for `replaysSamplingRate`.
18
+ */
19
+ samplingRate?: number;
15
20
  }
16
21
  /**
17
22
  * Get or create a session
18
23
  */
19
- export declare function getSession({ expiry, currentSession, stickySession, }: GetSessionParams): {
24
+ export declare function getSession({ expiry, currentSession, stickySession, samplingRate, }: GetSessionParams): {
20
25
  type: string;
21
26
  session: Session;
22
27
  };
File without changes
@@ -1,7 +1,7 @@
1
- import type { eventWithTime } from 'rrweb/typings/types';
2
1
  import { record } from 'rrweb';
3
- export declare type RRWebEvent = eventWithTime;
4
- export declare type RRWebOptions = Parameters<typeof record>[0];
2
+ import type { eventWithTime } from 'rrweb/typings/types';
3
+ export declare type RecordingEvent = eventWithTime;
4
+ export declare type RecordingConfig = Parameters<typeof record>[0];
5
5
  export interface ReplaySpan {
6
6
  description: string;
7
7
  op: string;
@@ -52,10 +52,25 @@ export interface SentryReplayPluginOptions {
52
52
  * (default is true)
53
53
  */
54
54
  useCompression?: boolean;
55
+ /**
56
+ * Only capture replays when an error happens
57
+ */
58
+ captureOnlyOnError?: boolean;
59
+ /**
60
+ * The sampling rate for replays. 1.0 will record all replays, 0 will record none.
61
+ */
62
+ replaysSamplingRate?: number;
55
63
  }
56
64
  export interface SentryReplayConfiguration extends SentryReplayPluginOptions {
57
65
  /**
58
- * Options for `rrweb.recordsetup
66
+ * Options for `rrweb.record()`
59
67
  */
60
- rrwebConfig?: RRWebOptions;
68
+ recordingConfig?: RecordingConfig;
69
+ }
70
+ /**
71
+ * Some initial state captured before creating a root replay event
72
+ */
73
+ export interface InitialState {
74
+ timestamp: number;
75
+ url: string;
61
76
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Given a sample rate, returns true if replay should be sampled.
3
+ *
4
+ * 1.0 = 100% sampling
5
+ * 0.0 = 0% sampling
6
+ */
7
+ export declare function isSampled(sampleRate: number): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Determine if there is browser support for `navigator.sendBeacon`
3
+ */
4
+ export declare function supportsSendBeacon(): boolean;
File without changes
@@ -1,11 +1,11 @@
1
1
  /// <reference types="jest" />
2
- import { RRWebEvent } from '@/types';
2
+ import { RecordingEvent } from '@/types';
3
3
  declare type RecordAdditionalProperties = {
4
4
  takeFullSnapshot: jest.Mock;
5
5
  addCustomEvent: () => void;
6
6
  freezePage: () => void;
7
7
  mirror: unknown;
8
- _emitter: (event: RRWebEvent, ...args: any[]) => void;
8
+ _emitter: (event: RecordingEvent, ...args: any[]) => void;
9
9
  };
10
10
  export declare type RecordMock = jest.MockedFunction<typeof rrweb.record> & RecordAdditionalProperties;
11
11
  import * as rrweb from 'rrweb';
@@ -1,6 +1,6 @@
1
1
  import { BrowserOptions } from '@sentry/browser';
2
- import { SentryReplayConfiguration } from '@/types';
3
2
  import { SentryReplay } from '@';
3
+ import { SentryReplayConfiguration } from '@/types';
4
4
  interface MockSdkParams {
5
5
  replayOptions?: SentryReplayConfiguration;
6
6
  sentryOptions?: BrowserOptions;
@@ -0,0 +1,3 @@
1
+ import type { Config } from '@jest/types';
2
+ declare const _default: () => Promise<Config.InitialOptions>;
3
+ export default _default;
@@ -0,0 +1,10 @@
1
+ /// <reference types="jest" />
2
+ import { Session } from '@/session/Session';
3
+ declare global {
4
+ namespace jest {
5
+ interface Matchers<R> {
6
+ toHaveSentReplay(expected?: string | Uint8Array): CustomMatcherResult;
7
+ toHaveSameSession(expected: Session): CustomMatcherResult;
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ import type { Session } from '@/session/Session';
2
+ import { InitialState } from '@/types';
3
+ export declare function captureReplay(session: Session, initialState: InitialState): void;
@@ -0,0 +1,2 @@
1
+ import type { Session } from '@/session/Session';
2
+ export declare function captureReplayUpdate(session: Session, timestamp: number): void;
@@ -0,0 +1 @@
1
+ export declare function handleDom(handlerData: any): Promise<import("@sentry/types").Breadcrumb>;
@@ -0,0 +1,2 @@
1
+ import { ReplaySpan } from '@/types';
2
+ export declare function handleFetch(handlerData: any): Promise<ReplaySpan>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Breadcrumb, Scope } from '@sentry/types';
2
+ export declare function handleScope(scope: Scope): Promise<Breadcrumb>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ReplaySpan } from '@/types';
2
+ export declare function handleXhr(handlerData: any): Promise<ReplaySpan>;
@@ -0,0 +1,4 @@
1
+ export * from './handleDom';
2
+ export * from './handleFetch';
3
+ export * from './handleScope';
4
+ export * from './handleXhr';
@@ -0,0 +1,42 @@
1
+ export interface ReplayPerformanceEntry {
2
+ /**
3
+ * One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType
4
+ */
5
+ type: string;
6
+ /**
7
+ * A more specific description of the performance entry
8
+ */
9
+ name: string;
10
+ /**
11
+ * The start timestamp in seconds
12
+ */
13
+ start: number;
14
+ /**
15
+ * The end timestamp in seconds
16
+ */
17
+ end: number;
18
+ /**
19
+ * Additional unstructured data to be included
20
+ */
21
+ data?: Record<string, unknown>;
22
+ }
23
+ interface MemoryInfo {
24
+ jsHeapSizeLimit: number;
25
+ totalJSHeapSize: number;
26
+ usedJSHeapSize: number;
27
+ }
28
+ export declare function createPerformanceEntries(entries: PerformanceEntry[]): Promise<ReplayPerformanceEntry[]>;
29
+ export declare function createMemoryEntry(memoryEntry: MemoryInfo): {
30
+ type: string;
31
+ name: string;
32
+ start: number;
33
+ end: number;
34
+ data: {
35
+ memory: {
36
+ jsHeapSizeLimit: number;
37
+ totalJSHeapSize: number;
38
+ usedJSHeapSize: number;
39
+ };
40
+ };
41
+ };
42
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import { RecordingEvent } from './types';
2
+ interface CreateEventBufferParams {
3
+ useCompression: boolean;
4
+ }
5
+ export declare function createEventBuffer({ useCompression, }: CreateEventBufferParams): Promise<EventBufferCompressionWorker | EventBufferArray>;
6
+ export interface IEventBuffer {
7
+ get length(): number;
8
+ destroy(): void;
9
+ addEvent(event: RecordingEvent, isCheckout?: boolean): void;
10
+ finish(): Promise<string | Uint8Array>;
11
+ }
12
+ declare class EventBufferArray implements IEventBuffer {
13
+ events: RecordingEvent[];
14
+ constructor();
15
+ destroy(): void;
16
+ get length(): number;
17
+ addEvent(event: RecordingEvent, isCheckout?: boolean): void;
18
+ finish(): Promise<string>;
19
+ }
20
+ export declare class EventBufferCompressionWorker implements IEventBuffer {
21
+ private worker;
22
+ private eventBufferItemLength;
23
+ constructor(worker: Worker);
24
+ init(): void;
25
+ destroy(): void;
26
+ get length(): number;
27
+ addEvent(event: RecordingEvent, isCheckout?: boolean): void;
28
+ sendEventToWorker(event: RecordingEvent): void;
29
+ finish(): Promise<Uint8Array>;
30
+ }
31
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ /** Flag that is true for debug builds, false otherwise. */
2
+ export declare const IS_DEBUG_BUILD: boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};