@sentry/replay 0.5.15 → 0.5.17

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 (60) hide show
  1. package/dist/index.es.js +133 -74
  2. package/dist/index.js +137 -74
  3. package/dist/index.js.map +1 -1
  4. package/dist/types/src/api/captureReplayEvent.d.ts +22 -0
  5. package/dist/types/src/createPerformanceEntry.d.ts +2 -1
  6. package/dist/types/src/index.d.ts +26 -8
  7. package/dist/types/src/types.d.ts +1 -0
  8. package/package.json +3 -1
  9. package/dist/config/types/jest.config.d.ts +0 -3
  10. package/dist/config/types/jest.setup.d.ts +0 -10
  11. package/dist/config/types/src/api/captureReplay.d.ts +0 -10
  12. package/dist/config/types/src/api/captureReplayEvent.d.ts +0 -15
  13. package/dist/config/types/src/api/captureReplayUpdate.d.ts +0 -12
  14. package/dist/config/types/src/coreHandlers/getBreadcrumbHandler.d.ts +0 -3
  15. package/dist/config/types/src/coreHandlers/getSpanHandler.d.ts +0 -5
  16. package/dist/config/types/src/coreHandlers/handleDom.d.ts +0 -1
  17. package/dist/config/types/src/coreHandlers/handleFetch.d.ts +0 -19
  18. package/dist/config/types/src/coreHandlers/handleFetch.test.d.ts +0 -1
  19. package/dist/config/types/src/coreHandlers/handleHistory.d.ts +0 -7
  20. package/dist/config/types/src/coreHandlers/handleScope-unit.test.d.ts +0 -1
  21. package/dist/config/types/src/coreHandlers/handleScope.d.ts +0 -2
  22. package/dist/config/types/src/coreHandlers/handleScope.test.d.ts +0 -1
  23. package/dist/config/types/src/coreHandlers/handleXhr.d.ts +0 -21
  24. package/dist/config/types/src/createPerformanceEntry.d.ts +0 -42
  25. package/dist/config/types/src/createPerformanceEntry.test.d.ts +0 -1
  26. package/dist/config/types/src/eventBuffer.d.ts +0 -45
  27. package/dist/config/types/src/eventBuffer.test.d.ts +0 -1
  28. package/dist/config/types/src/flags.d.ts +0 -2
  29. package/dist/config/types/src/index-captureOnlyOnError.test.d.ts +0 -1
  30. package/dist/config/types/src/index-noSticky.test.d.ts +0 -1
  31. package/dist/config/types/src/index-sampling.test.d.ts +0 -1
  32. package/dist/config/types/src/index.d.ts +0 -235
  33. package/dist/config/types/src/index.test.d.ts +0 -1
  34. package/dist/config/types/src/session/Session.d.ts +0 -63
  35. package/dist/config/types/src/session/Session.test.d.ts +0 -1
  36. package/dist/config/types/src/session/constants.d.ts +0 -5
  37. package/dist/config/types/src/session/createSession.d.ts +0 -19
  38. package/dist/config/types/src/session/createSession.test.d.ts +0 -1
  39. package/dist/config/types/src/session/deleteSession.d.ts +0 -4
  40. package/dist/config/types/src/session/fetchSession.d.ts +0 -5
  41. package/dist/config/types/src/session/fetchSession.test.d.ts +0 -1
  42. package/dist/config/types/src/session/getSession.d.ts +0 -28
  43. package/dist/config/types/src/session/getSession.test.d.ts +0 -1
  44. package/dist/config/types/src/session/index.d.ts +0 -1
  45. package/dist/config/types/src/session/saveSession.d.ts +0 -2
  46. package/dist/config/types/src/session/saveSession.test.d.ts +0 -1
  47. package/dist/config/types/src/types.d.ts +0 -97
  48. package/dist/config/types/src/util/createBreadcrumb.d.ts +0 -4
  49. package/dist/config/types/src/util/createPayload.d.ts +0 -5
  50. package/dist/config/types/src/util/isExpired.d.ts +0 -5
  51. package/dist/config/types/src/util/isExpired.test.d.ts +0 -1
  52. package/dist/config/types/src/util/isIngestHost.d.ts +0 -4
  53. package/dist/config/types/src/util/isSampled.d.ts +0 -7
  54. package/dist/config/types/src/util/isSampled.test.d.ts +0 -1
  55. package/dist/config/types/src/util/isSessionExpired.d.ts +0 -5
  56. package/dist/config/types/src/util/isSessionExpired.test.d.ts +0 -1
  57. package/dist/config/types/src/util/logger.d.ts +0 -12
  58. package/dist/config/types/test/index.d.ts +0 -3
  59. package/dist/config/types/test/mocks/mockRrweb.d.ts +0 -15
  60. package/dist/config/types/test/mocks/mockSdk.d.ts +0 -11
@@ -1,15 +1,37 @@
1
1
  import { InitialState } from '@/types';
2
2
  export interface CaptureReplayEventParams {
3
+ /**
4
+ * Initial state of the replay
5
+ */
3
6
  initialState: InitialState;
7
+ /**
8
+ * Include a timestamp that should be deemed as the "starting" timestamp of the
9
+ * replay. This usually comes from a `window.performance` entry.
10
+ */
4
11
  includeReplayStartTimestamp: boolean;
12
+ /**
13
+ * List of error ids contained in current recording segment
14
+ */
5
15
  errorIds: string[];
16
+ /**
17
+ * The current replay id
18
+ */
6
19
  replayId: string;
20
+ /**
21
+ * The current recording segment id
22
+ */
7
23
  segmentId: number;
8
24
  /**
9
25
  * Timestamp of the event in milliseconds
10
26
  */
11
27
  timestamp: number;
28
+ /**
29
+ * List of trace ids contained in current recording segment
30
+ */
12
31
  traceIds: string[];
32
+ /**
33
+ * List of URLs visisted in current recording segment
34
+ */
13
35
  urls: string[];
14
36
  }
15
37
  export declare function captureReplayEvent({ initialState, includeReplayStartTimestamp, errorIds, replayId: replay_id, segmentId: segment_id, timestamp, traceIds, urls, }: CaptureReplayEventParams): void;
@@ -1,3 +1,4 @@
1
+ import { AllPerformanceEntry } from './types';
1
2
  export interface ReplayPerformanceEntry {
2
3
  /**
3
4
  * One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType
@@ -25,7 +26,7 @@ interface MemoryInfo {
25
26
  totalJSHeapSize: number;
26
27
  usedJSHeapSize: number;
27
28
  }
28
- export declare function createPerformanceEntries(entries: PerformanceEntry[]): ReplayPerformanceEntry[];
29
+ export declare function createPerformanceEntries(entries: AllPerformanceEntry[]): ReplayPerformanceEntry[];
29
30
  export declare function createMemoryEntry(memoryEntry: MemoryInfo): {
30
31
  type: string;
31
32
  name: string;
@@ -1,9 +1,10 @@
1
+ /// <reference types="lodash" />
1
2
  import { Breadcrumb, Event, Integration } from '@sentry/types';
2
3
  import { CaptureReplayEventParams } from './api/captureReplayEvent';
3
4
  import { Session } from './session/Session';
4
5
  import { ReplayPerformanceEntry } from './createPerformanceEntry';
5
6
  import { IEventBuffer } from './eventBuffer';
6
- import type { InstrumentationTypeBreadcrumb, InstrumentationTypeSpan, RecordedEvents, RecordingConfig, RecordingEvent, ReplayRequest, SentryReplayConfiguration, SentryReplayPluginOptions } from './types';
7
+ import type { AllPerformanceEntry, InstrumentationTypeBreadcrumb, InstrumentationTypeSpan, RecordedEvents, RecordingConfig, RecordingEvent, ReplayRequest, SentryReplayConfiguration, SentryReplayPluginOptions } from './types';
7
8
  /**
8
9
  * Returns true to return control to calling function, otherwise continue with normal batching
9
10
  */
@@ -21,7 +22,7 @@ export declare class SentryReplay implements Integration {
21
22
  /**
22
23
  * List of PerformanceEntry from PerformanceObserver
23
24
  */
24
- performanceEvents: PerformanceEntry[];
25
+ performanceEvents: AllPerformanceEntry[];
25
26
  /**
26
27
  * Options to pass to `rrweb.record()`
27
28
  */
@@ -45,6 +46,7 @@ export declare class SentryReplay implements Integration {
45
46
  * slightly differently in this case: `replay_start_timestamp` is included.
46
47
  */
47
48
  private newSessionCreated;
49
+ private flushLock;
48
50
  /**
49
51
  * Is the integration currently active?
50
52
  */
@@ -209,19 +211,35 @@ export declare class SentryReplay implements Integration {
209
211
  * Only flush if `captureOnlyOnError` is false.
210
212
  */
211
213
  conditionalFlush(): Promise<void> | undefined;
214
+ /**
215
+ * Clear context
216
+ */
217
+ clearContext(): void;
212
218
  /**
213
219
  * Return and clear context
214
220
  */
215
- popEventContext({ timestamp, }?: {
216
- timestamp?: number;
217
- }): CaptureReplayEventParams;
221
+ popEventContext({ timestamp, }: {
222
+ timestamp: number;
223
+ }): Omit<CaptureReplayEventParams, 'includeReplayStartTimestamp' | 'segmentId' | 'replayId'>;
218
224
  /**
219
225
  * Flushes replay event buffer to Sentry.
220
226
  *
221
- * Performance events are only added right before flushing - this is probably
227
+ * Performance events are only added right before flushing - this is
222
228
  * due to the buffered performance observer events.
223
229
  */
224
- flushUpdate(): Promise<void>;
230
+ runFlush(): Promise<void>;
231
+ /**
232
+ * Flush recording data to Sentry. Creates a lock so that only a single flush
233
+ * can be active at a time.
234
+ */
235
+ flush: () => Promise<void>;
236
+ /**
237
+ * A throttled `flush()` that is called after a flush is completed and there
238
+ * are other queued flushes.
239
+ *
240
+ * Instead of calling a flush for every <n> queued flush, condense it to a single call
241
+ */
242
+ throttledFlush: import("lodash").DebouncedFunc<() => Promise<void>>;
225
243
  /**
226
244
  * Send replay attachment using `fetch()`
227
245
  */
@@ -230,6 +248,6 @@ export declare class SentryReplay implements Integration {
230
248
  /**
231
249
  * Finalize and send the current replay event to Sentry
232
250
  */
233
- sendReplay(replayId: string, events: RecordedEvents, segmentId: number): Promise<true | undefined>;
251
+ sendReplay(replayId: string, events: RecordedEvents, segmentId: number): Promise<unknown>;
234
252
  }
235
253
  export {};
@@ -3,6 +3,7 @@ import type { eventWithTime } from 'rrweb/typings/types';
3
3
  export declare type RecordingEvent = eventWithTime;
4
4
  export declare type RecordingConfig = Parameters<typeof record>[0];
5
5
  export declare type RecordedEvents = Uint8Array | string;
6
+ export declare type AllPerformanceEntry = PerformancePaintTiming | PerformanceResourceTiming | PerformanceNavigationTiming;
6
7
  export interface ReplayRequest {
7
8
  endpoint: string;
8
9
  events: RecordedEvents;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/replay",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "description": "User replays for Sentry",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -44,6 +44,7 @@
44
44
  "@sentry/browser": "^7.7.0",
45
45
  "@size-limit/preset-big-lib": "^7.0.8",
46
46
  "@types/jest": "^28.1.1",
47
+ "@types/lodash.throttle": "^4.1.7",
47
48
  "@types/node": "^16.0.0",
48
49
  "@types/pako": "^2.0.0",
49
50
  "@typescript-eslint/eslint-plugin": "^5.31.0",
@@ -71,6 +72,7 @@
71
72
  "@sentry/core": "^7.7.0",
72
73
  "@sentry/types": "^7.7.0",
73
74
  "@sentry/utils": "^7.7.0",
75
+ "lodash.throttle": "^4.1.1",
74
76
  "pako": "^2.0.4",
75
77
  "rrweb": "^1.1.3"
76
78
  },
@@ -1,3 +0,0 @@
1
- import type { Config } from '@jest/types';
2
- declare const _default: () => Promise<Config.InitialOptions>;
3
- export default _default;
@@ -1,10 +0,0 @@
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: undefined | Session): CustomMatcherResult;
8
- }
9
- }
10
- }
@@ -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,15 +0,0 @@
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,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;
@@ -1,3 +0,0 @@
1
- import { InstrumentationTypeBreadcrumb } from '@/types';
2
- import { handleScope } from './handleScope';
3
- export declare function getBreadcrumbHandler(type: InstrumentationTypeBreadcrumb): typeof handleScope;
@@ -1,5 +0,0 @@
1
- import { InstrumentationTypeSpan } from '@/types';
2
- import { handleFetch } from './handleFetch';
3
- import { handleHistory } from './handleHistory';
4
- import { handleXhr } from './handleXhr';
5
- export declare function getSpanHandler(type: InstrumentationTypeSpan): typeof handleFetch | typeof handleXhr | typeof handleHistory;
@@ -1 +0,0 @@
1
- export declare function handleDom(handlerData: any): import("@sentry/types").Breadcrumb | null;
@@ -1,19 +0,0 @@
1
- import { ReplayPerformanceEntry } from '@/createPerformanceEntry';
2
- interface FetchHandlerData {
3
- args: Parameters<typeof fetch>;
4
- fetchData: {
5
- method: string;
6
- url: string;
7
- };
8
- response: {
9
- type: string;
10
- url: string;
11
- redirected: boolean;
12
- status: number;
13
- ok: boolean;
14
- };
15
- startTimestamp: number;
16
- endTimestamp?: number;
17
- }
18
- export declare function handleFetch(handlerData: FetchHandlerData): null | ReplayPerformanceEntry;
19
- export {};
@@ -1,7 +0,0 @@
1
- import { ReplayPerformanceEntry } from '@/createPerformanceEntry';
2
- interface HistoryHandlerData {
3
- from: string;
4
- to: string;
5
- }
6
- export declare function handleHistory(handlerData: HistoryHandlerData): ReplayPerformanceEntry;
7
- export {};
@@ -1,2 +0,0 @@
1
- import { Breadcrumb, Scope } from '@sentry/types';
2
- export declare function handleScope(scope: Scope): Breadcrumb | null;
@@ -1,21 +0,0 @@
1
- import { ReplayPerformanceEntry } from '@/createPerformanceEntry';
2
- declare type XHRSendInput = null | Blob | BufferSource | FormData | URLSearchParams | string;
3
- interface SentryWrappedXMLHttpRequest extends XMLHttpRequest {
4
- [key: string]: unknown;
5
- __sentry_xhr__?: {
6
- method?: string;
7
- url?: string;
8
- status_code?: number;
9
- body?: XHRSendInput;
10
- startTimestamp?: number;
11
- };
12
- __sentry_own_request__?: boolean;
13
- }
14
- interface XhrHandlerData {
15
- args: [method: string, url: string];
16
- xhr: SentryWrappedXMLHttpRequest;
17
- startTimestamp: number;
18
- endTimestamp?: number;
19
- }
20
- export declare function handleXhr(handlerData: XhrHandlerData): ReplayPerformanceEntry | null;
21
- export {};
@@ -1,42 +0,0 @@
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[]): 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 {};
@@ -1,45 +0,0 @@
1
- import { RecordingEvent, WorkerRequest, WorkerResponse } from './types';
2
- interface CreateEventBufferParams {
3
- useCompression: boolean;
4
- }
5
- export declare function createEventBuffer({ useCompression }: CreateEventBufferParams): 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
- private _id;
24
- constructor(worker: Worker);
25
- /**
26
- * Read-only incrementing counter
27
- */
28
- get id(): number;
29
- /**
30
- * Post message to worker and wait for response before resolving promise.
31
- */
32
- postMessage({ id, method, args, }: WorkerRequest): Promise<WorkerResponse['response']>;
33
- init(): void;
34
- destroy(): void;
35
- /**
36
- * Note that this may not reflect what is actually in the event buffer. This
37
- * is only a local count of the buffer size since `addEvent` is async.
38
- */
39
- get length(): number;
40
- addEvent(event: RecordingEvent, isCheckout?: boolean): Promise<string | Uint8Array>;
41
- sendEventToWorker: (event: RecordingEvent) => Promise<string | Uint8Array>;
42
- finishRequest: (id: number) => Promise<Uint8Array>;
43
- finish(): Promise<Uint8Array>;
44
- }
45
- export {};
@@ -1 +0,0 @@
1
- import 'jsdom-worker';
@@ -1,2 +0,0 @@
1
- /** Flag that is true for debug builds, false otherwise. */
2
- export declare const IS_DEBUG_BUILD: boolean;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,235 +0,0 @@
1
- import { Breadcrumb, Event, Integration } from '@sentry/types';
2
- import { CaptureReplayEventParams } from './api/captureReplayEvent';
3
- import { Session } from './session/Session';
4
- import { ReplayPerformanceEntry } from './createPerformanceEntry';
5
- import { IEventBuffer } from './eventBuffer';
6
- import type { InstrumentationTypeBreadcrumb, InstrumentationTypeSpan, RecordedEvents, RecordingConfig, RecordingEvent, ReplayRequest, SentryReplayConfiguration, SentryReplayPluginOptions } from './types';
7
- /**
8
- * Returns true to return control to calling function, otherwise continue with normal batching
9
- */
10
- declare type AddUpdateCallback = () => boolean | void;
11
- export declare class SentryReplay implements Integration {
12
- /**
13
- * @inheritDoc
14
- */
15
- static id: string;
16
- /**
17
- * @inheritDoc
18
- */
19
- name: string;
20
- eventBuffer: IEventBuffer | null;
21
- /**
22
- * List of PerformanceEntry from PerformanceObserver
23
- */
24
- performanceEvents: PerformanceEntry[];
25
- /**
26
- * Options to pass to `rrweb.record()`
27
- */
28
- readonly recordingOptions: RecordingConfig;
29
- readonly options: SentryReplayPluginOptions;
30
- /**
31
- * setTimeout id used for debouncing sending rrweb attachments
32
- */
33
- private timeout;
34
- /**
35
- * The timestamp of the first event since the last flush. This is used to
36
- * determine if the maximum allowed time has passed before events should be
37
- * flushed again.
38
- */
39
- private initialEventTimestampSinceFlush;
40
- private performanceObserver;
41
- private retryCount;
42
- private retryInterval;
43
- /**
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
59
- */
60
- private stopRecording;
61
- /**
62
- * Captured state when integration is first initialized
63
- */
64
- private initialState;
65
- private context;
66
- session: Session | undefined;
67
- constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, useCompression, captureOnlyOnError, replaysSamplingRate, recordingConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...recordingOptions }, }?: SentryReplayConfiguration);
68
- /**
69
- * Because we create a transaction in `setupOnce`, we can potentially create a
70
- * transaction before some native SDK integrations have run and applied their
71
- * own global event processor. An example is:
72
- * https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts
73
- *
74
- * So we call `this.setup` in next event loop as a workaround to wait for
75
- * other global event processors to finish
76
- */
77
- setupOnce(): void;
78
- /**
79
- * Initializes the plugin.
80
- *
81
- * Creates or loads a session, attaches listeners to varying events (DOM, PerformanceObserver, Recording, Sentry SDK, etc)
82
- */
83
- setup(): void;
84
- /**
85
- * We want to batch uploads of replay events. Save events only if
86
- * `<flushMinDelay>` milliseconds have elapsed since the last event
87
- * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
88
- *
89
- * Accepts a callback to perform side-effects and returns true to stop batch
90
- * processing and hand back control to caller.
91
- */
92
- addUpdate(cb?: AddUpdateCallback): void;
93
- /**
94
- * Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
95
- */
96
- destroy(): void;
97
- clearSession(): void;
98
- /**
99
- * Loads a session from storage, or creates a new one if it does not exist or
100
- * is expired.
101
- */
102
- loadSession({ expiry }: {
103
- expiry: number;
104
- }): void;
105
- /**
106
- * Capture some initial state that can change throughout the lifespan of the
107
- * replay. This is required because otherwise they would be captured at the
108
- * first flush.
109
- */
110
- setInitialState(): void;
111
- /**
112
- * Adds listeners to record events for the replay
113
- */
114
- addListeners(): void;
115
- /**
116
- * Cleans up listeners that were created in `addListeners`
117
- */
118
- removeListeners(): void;
119
- /**
120
- * Core Sentry SDK global event handler. Attaches `replayId` to all [non-replay]
121
- * events as a tag. Also handles the case where we only want to capture a reply
122
- * when an error occurs.
123
- **/
124
- handleGlobalEvent: (event: Event) => Event;
125
- /**
126
- * Handler for recording events.
127
- *
128
- * Adds to event buffer, and has varying flushing behaviors if the event was a checkout.
129
- */
130
- handleRecordingEmit: (event: RecordingEvent, isCheckout?: boolean) => void;
131
- /**
132
- * Handle when visibility of the page content changes. Opening a new tab will
133
- * cause the state to change to hidden because of content of current page will
134
- * be hidden. Likewise, moving a different window to cover the contents of the
135
- * page will also trigger a change to a hidden state.
136
- */
137
- handleVisibilityChange: () => void;
138
- /**
139
- * Handle when page is blurred
140
- */
141
- handleWindowBlur: () => void;
142
- /**
143
- * Handle when page is focused
144
- */
145
- handleWindowFocus: () => void;
146
- /**
147
- * Handler for Sentry Core SDK events.
148
- *
149
- * These specific events will create span-like objects in the recording.
150
- *
151
- */
152
- handleCoreSpanListener: (type: InstrumentationTypeSpan) => (handlerData: any) => void;
153
- /**
154
- * Handler for Sentry Core SDK events.
155
- *
156
- * These events will create breadcrumb-like objects in the recording.
157
- */
158
- handleCoreBreadcrumbListener: (type: InstrumentationTypeBreadcrumb) => (handlerData: any) => void;
159
- /**
160
- * Keep a list of performance entries that will be sent with a replay
161
- */
162
- handlePerformanceObserver: (list: PerformanceObserverEntryList) => void;
163
- /**
164
- * Tasks to run when we consider a page to be hidden (via blurring and/or visibility)
165
- */
166
- doChangeToBackgroundTasks(breadcrumb?: Breadcrumb): void;
167
- /**
168
- * Tasks to run when we consider a page to be visible (via focus and/or visibility)
169
- */
170
- doChangeToForegroundTasks(breadcrumb?: Breadcrumb): void;
171
- /**
172
- * Trigger rrweb to take a full snapshot which will cause this plugin to
173
- * create a new Replay event.
174
- */
175
- triggerFullSnapshot(): void;
176
- /**
177
- * Add an event to the event buffer
178
- */
179
- addEvent(event: RecordingEvent, isCheckout?: boolean): void;
180
- /**
181
- * Updates the session's last activity timestamp
182
- */
183
- updateLastActivity(lastActivity?: number): void;
184
- /**
185
- * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
186
- */
187
- createCustomBreadcrumb(breadcrumb: Breadcrumb): void;
188
- /**
189
- * Create a "span" for each performance entry. The parent transaction is `this.replayEvent`.
190
- */
191
- createPerformanceSpans(entries: ReplayPerformanceEntry[]): Promise<void[]>;
192
- /**
193
- * Observed performance events are added to `this.performanceEvents`. These
194
- * are included in the replay event before it is finished and sent to Sentry.
195
- */
196
- addPerformanceEntries(): Promise<void[]>;
197
- /**
198
- * Create a "span" for the total amount of memory being used by JS objects
199
- * (including v8 internal objects).
200
- */
201
- addMemoryEntry(): Promise<void[]> | undefined;
202
- /**
203
- *
204
- *
205
- * Returns true if session is not expired, false otherwise.
206
- */
207
- checkAndHandleExpiredSession(expiry?: number): boolean;
208
- /**
209
- * Only flush if `captureOnlyOnError` is false.
210
- */
211
- conditionalFlush(): Promise<void> | undefined;
212
- /**
213
- * Return and clear context
214
- */
215
- popEventContext({ timestamp, }?: {
216
- timestamp?: number;
217
- }): CaptureReplayEventParams;
218
- /**
219
- * Flushes replay event buffer to Sentry.
220
- *
221
- * Performance events are only added right before flushing - this is probably
222
- * due to the buffered performance observer events.
223
- */
224
- flushUpdate(): Promise<void>;
225
- /**
226
- * Send replay attachment using `fetch()`
227
- */
228
- sendReplayRequest({ endpoint, events, replayId: event_id, segmentId: segment_id, }: ReplayRequest): Promise<void>;
229
- resetRetries(): void;
230
- /**
231
- * Finalize and send the current replay event to Sentry
232
- */
233
- sendReplay(replayId: string, events: RecordedEvents, segmentId: number): Promise<true | undefined>;
234
- }
235
- export {};
@@ -1 +0,0 @@
1
- export {};