@sentry/replay 0.5.10 → 0.5.13

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.
@@ -0,0 +1,15 @@
1
+ import { InitialState } from '@/types';
2
+ export interface CaptureReplayEventParams {
3
+ initialState: InitialState;
4
+ includeReplayStartTimestamp: boolean;
5
+ errorIds: string[];
6
+ replayId: string;
7
+ segmentId: number;
8
+ /**
9
+ * Timestamp of the event in milliseconds
10
+ */
11
+ timestamp: number;
12
+ traceIds: string[];
13
+ urls: string[];
14
+ }
15
+ export declare function captureReplayEvent({ initialState, includeReplayStartTimestamp, errorIds, replayId: replay_id, segmentId: segment_id, timestamp, traceIds, urls, }: CaptureReplayEventParams): void;
@@ -1,6 +1,5 @@
1
1
  import { Breadcrumb, Event, Integration } from '@sentry/types';
2
- import { CaptureReplayParams } from './api/captureReplay';
3
- import { CaptureReplayUpdateParams } from './api/captureReplayUpdate';
2
+ import { CaptureReplayEventParams } from './api/captureReplayEvent';
4
3
  import { Session } from './session/Session';
5
4
  import { ReplayPerformanceEntry } from './createPerformanceEntry';
6
5
  import { IEventBuffer } from './eventBuffer';
@@ -18,11 +17,7 @@ export declare class SentryReplay implements Integration {
18
17
  * @inheritDoc
19
18
  */
20
19
  name: string;
21
- eventBuffer: IEventBuffer;
22
- /**
23
- * Buffer of breadcrumbs to be uploaded
24
- */
25
- breadcrumbs: Breadcrumb[];
20
+ eventBuffer: IEventBuffer | null;
26
21
  /**
27
22
  * List of PerformanceEntry from PerformanceObserver
28
23
  */
@@ -46,12 +41,23 @@ export declare class SentryReplay implements Integration {
46
41
  private retryCount;
47
42
  private retryInterval;
48
43
  /**
49
- * Flag to make sure we only create a replay event when
50
- * necessary (i.e. we only want to have a single replay
51
- * event per session and it should only be created
52
- * immediately before sending recording)
44
+ * Flag when a new session has been created. Captured replay events behave
45
+ * slightly differently in this case: `replay_start_timestamp` is included.
46
+ */
47
+ private newSessionCreated;
48
+ /**
49
+ * Is the integration currently active?
50
+ */
51
+ private isEnabled;
52
+ /**
53
+ * Have we attached listeners to the core SDK?
54
+ * Note we have to track this as there is no way to remove instrumentation handlers.
55
+ */
56
+ private hasInitializedCoreListeners;
57
+ /**
58
+ * Function to stop recording
53
59
  */
54
- private needsCaptureReplay;
60
+ private stopRecording;
55
61
  /**
56
62
  * Captured state when integration is first initialized
57
63
  */
@@ -208,7 +214,7 @@ export declare class SentryReplay implements Integration {
208
214
  */
209
215
  popEventContext({ timestamp, }?: {
210
216
  timestamp?: number;
211
- }): CaptureReplayParams & CaptureReplayUpdateParams;
217
+ }): CaptureReplayEventParams;
212
218
  /**
213
219
  * Flushes replay event buffer to Sentry.
214
220
  *
@@ -219,11 +225,11 @@ export declare class SentryReplay implements Integration {
219
225
  /**
220
226
  * Send replay attachment using `fetch()`
221
227
  */
222
- sendReplayRequest({ endpoint, events }: ReplayRequest): Promise<void>;
228
+ sendReplayRequest({ endpoint, events, replayId: event_id, segmentId: segment_id, }: ReplayRequest): Promise<void>;
223
229
  resetRetries(): void;
224
230
  /**
225
231
  * Finalize and send the current replay event to Sentry
226
232
  */
227
- sendReplay(eventId: string, events: RecordedEvents): Promise<boolean | undefined>;
233
+ sendReplay(replayId: string, events: RecordedEvents, segmentId: number): Promise<true | undefined>;
228
234
  }
229
235
  export {};
@@ -6,6 +6,8 @@ export declare type RecordedEvents = Uint8Array | string;
6
6
  export interface ReplayRequest {
7
7
  endpoint: string;
8
8
  events: RecordedEvents;
9
+ replayId: string;
10
+ segmentId: number;
9
11
  }
10
12
  export declare type InstrumentationTypeBreadcrumb = 'dom' | 'scope';
11
13
  export declare type InstrumentationTypeSpan = 'fetch' | 'xhr' | 'history';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/replay",
3
- "version": "0.5.10",
3
+ "version": "0.5.13",
4
4
  "description": "User replays for Sentry",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -1,10 +0,0 @@
1
- import type { Session } from '@/session/Session';
2
- import { InitialState } from '@/types';
3
- export interface CaptureReplayParams {
4
- session: Session;
5
- initialState: InitialState;
6
- errorIds: string[];
7
- traceIds: string[];
8
- urls: string[];
9
- }
10
- export declare function captureReplay({ session, initialState, errorIds, traceIds, urls, }: CaptureReplayParams): void;
@@ -1,12 +0,0 @@
1
- import type { Session } from '@/session/Session';
2
- export interface CaptureReplayUpdateParams {
3
- session: Session;
4
- /**
5
- * Timestamp of the event in milliseconds
6
- */
7
- timestamp: number;
8
- errorIds: string[];
9
- traceIds: string[];
10
- urls: string[];
11
- }
12
- export declare function captureReplayUpdate({ session, timestamp, errorIds, traceIds, urls, }: CaptureReplayUpdateParams): void;