@sentry/replay 0.6.14-3 → 0.6.14-4
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.
- package/LICENSE +11 -198
- package/dist/index.es.js +28 -24
- package/dist/index.js +28 -24
- package/dist/index.js.map +1 -1
- package/dist/types/src/index.d.ts +4 -13
- package/dist/types/src/types.d.ts +25 -11
- package/package.json +3 -3
- package/dist/config/types/jest.config.d.ts +0 -3
- package/dist/config/types/jest.setup.d.ts +0 -32
- package/dist/config/types/src/blockAllMedia.test.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/getBreadcrumbHandler.d.ts +0 -3
- package/dist/config/types/src/coreHandlers/getSpanHandler.d.ts +0 -5
- package/dist/config/types/src/coreHandlers/handleDom.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/handleFetch.d.ts +0 -19
- package/dist/config/types/src/coreHandlers/handleFetch.test.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/handleHistory.d.ts +0 -7
- package/dist/config/types/src/coreHandlers/handleScope-unit.test.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/handleScope.d.ts +0 -2
- package/dist/config/types/src/coreHandlers/handleScope.test.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/handleXhr.d.ts +0 -21
- package/dist/config/types/src/createPerformanceEntry.d.ts +0 -43
- package/dist/config/types/src/createPerformanceEntry.test.d.ts +0 -1
- package/dist/config/types/src/eventBuffer.d.ts +0 -45
- package/dist/config/types/src/eventBuffer.test.d.ts +0 -1
- package/dist/config/types/src/flags.d.ts +0 -2
- package/dist/config/types/src/flush.test.d.ts +0 -1
- package/dist/config/types/src/index-errorSampleRate.test.d.ts +0 -1
- package/dist/config/types/src/index-noSticky.test.d.ts +0 -1
- package/dist/config/types/src/index-sampling.test.d.ts +0 -1
- package/dist/config/types/src/index.d.ts +0 -291
- package/dist/config/types/src/index.test.d.ts +0 -1
- package/dist/config/types/src/multiple-instances.test.d.ts +0 -1
- package/dist/config/types/src/session/Session.d.ts +0 -63
- package/dist/config/types/src/session/Session.test.d.ts +0 -1
- package/dist/config/types/src/session/constants.d.ts +0 -11
- package/dist/config/types/src/session/createSession.d.ts +0 -8
- package/dist/config/types/src/session/createSession.test.d.ts +0 -1
- package/dist/config/types/src/session/deleteSession.d.ts +0 -4
- package/dist/config/types/src/session/deleteSession.test.d.ts +0 -1
- package/dist/config/types/src/session/fetchSession.d.ts +0 -6
- package/dist/config/types/src/session/fetchSession.test.d.ts +0 -1
- package/dist/config/types/src/session/getSession.d.ts +0 -20
- package/dist/config/types/src/session/getSession.test.d.ts +0 -1
- package/dist/config/types/src/session/index.d.ts +0 -1
- package/dist/config/types/src/session/saveSession.d.ts +0 -2
- package/dist/config/types/src/session/saveSession.test.d.ts +0 -1
- package/dist/config/types/src/stop.test.d.ts +0 -1
- package/dist/config/types/src/types.d.ts +0 -130
- package/dist/config/types/src/util/addInternalBreadcrumb.d.ts +0 -5
- package/dist/config/types/src/util/captureInternalException.d.ts +0 -4
- package/dist/config/types/src/util/createBreadcrumb.d.ts +0 -4
- package/dist/config/types/src/util/createPayload.d.ts +0 -5
- package/dist/config/types/src/util/dedupePerformanceEntries.d.ts +0 -10
- package/dist/config/types/src/util/dedupePerformanceEntries.test.d.ts +0 -1
- package/dist/config/types/src/util/isExpired.d.ts +0 -5
- package/dist/config/types/src/util/isExpired.test.d.ts +0 -1
- package/dist/config/types/src/util/isIngestHost.d.ts +0 -4
- package/dist/config/types/src/util/isInternal.d.ts +0 -5
- package/dist/config/types/src/util/isSampled.d.ts +0 -7
- package/dist/config/types/src/util/isSampled.test.d.ts +0 -1
- package/dist/config/types/src/util/isSessionExpired.d.ts +0 -5
- package/dist/config/types/src/util/isSessionExpired.test.d.ts +0 -1
- package/dist/config/types/src/util/logger.d.ts +0 -12
- package/dist/config/types/test/fixtures/performanceEntry/lcp.d.ts +0 -1
- package/dist/config/types/test/fixtures/performanceEntry/navigation.d.ts +0 -1
- package/dist/config/types/test/fixtures/performanceEntry/resource.d.ts +0 -1
- package/dist/config/types/test/index.d.ts +0 -3
- package/dist/config/types/test/mocks/mockRrweb.d.ts +0 -15
- package/dist/config/types/test/mocks/mockSdk.d.ts +0 -10
|
@@ -2,7 +2,7 @@ import { Breadcrumb, Event, Integration } from '@sentry/types';
|
|
|
2
2
|
import { Session } from './session/Session';
|
|
3
3
|
import { ReplayPerformanceEntry } from './createPerformanceEntry';
|
|
4
4
|
import { IEventBuffer } from './eventBuffer';
|
|
5
|
-
import type { AllPerformanceEntry,
|
|
5
|
+
import type { AllPerformanceEntry, InstrumentationTypeBreadcrumb, InstrumentationTypeSpan, PopEventContext, RecordingEvent, RecordingOptions, ReplayConfiguration, ReplayPluginOptions, SendReplay } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Returns true to return control to calling function, otherwise continue with normal batching
|
|
8
8
|
*/
|
|
@@ -59,10 +59,6 @@ export declare class Replay implements Integration {
|
|
|
59
59
|
* Function to stop recording
|
|
60
60
|
*/
|
|
61
61
|
private stopRecording;
|
|
62
|
-
/**
|
|
63
|
-
* Captured state when integration is first initialized
|
|
64
|
-
*/
|
|
65
|
-
private initialState;
|
|
66
62
|
private context;
|
|
67
63
|
session: Session | undefined;
|
|
68
64
|
constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, useCompression, sessionSampleRate, errorSampleRate, maskAllText, maskAllInputs, blockAllMedia, blockClass, ignoreClass, maskTextClass, blockSelector, replaysSamplingRate, captureOnlyOnError, ...recordingOptions }?: ReplayConfiguration);
|
|
@@ -251,12 +247,7 @@ export declare class Replay implements Integration {
|
|
|
251
247
|
/**
|
|
252
248
|
* Return and clear context
|
|
253
249
|
*/
|
|
254
|
-
popEventContext():
|
|
255
|
-
initialState: InitialState;
|
|
256
|
-
errorIds: string[];
|
|
257
|
-
traceIds: string[];
|
|
258
|
-
urls: string[];
|
|
259
|
-
};
|
|
250
|
+
popEventContext(): PopEventContext;
|
|
260
251
|
/**
|
|
261
252
|
* Flushes replay event buffer to Sentry.
|
|
262
253
|
*
|
|
@@ -281,11 +272,11 @@ export declare class Replay implements Integration {
|
|
|
281
272
|
/**
|
|
282
273
|
* Send replay attachment using `fetch()`
|
|
283
274
|
*/
|
|
284
|
-
sendReplayRequest({ events, replayId: event_id, segmentId: segment_id, includeReplayStartTimestamp, }: SendReplay): Promise<void | undefined>;
|
|
275
|
+
sendReplayRequest({ events, replayId: event_id, segmentId: segment_id, includeReplayStartTimestamp, eventContext, }: SendReplay): Promise<void | undefined>;
|
|
285
276
|
resetRetries(): void;
|
|
286
277
|
/**
|
|
287
278
|
* Finalize and send the current replay event to Sentry
|
|
288
279
|
*/
|
|
289
|
-
sendReplay({ replayId, events, segmentId, includeReplayStartTimestamp, }: SendReplay): Promise<unknown>;
|
|
280
|
+
sendReplay({ replayId, events, segmentId, includeReplayStartTimestamp, eventContext, }: SendReplay): Promise<unknown>;
|
|
290
281
|
}
|
|
291
282
|
export {};
|
|
@@ -8,6 +8,7 @@ export interface SendReplay {
|
|
|
8
8
|
replayId: string;
|
|
9
9
|
segmentId: number;
|
|
10
10
|
includeReplayStartTimestamp: boolean;
|
|
11
|
+
eventContext: PopEventContext;
|
|
11
12
|
}
|
|
12
13
|
export declare type InstrumentationTypeBreadcrumb = 'dom' | 'scope';
|
|
13
14
|
export declare type InstrumentationTypeSpan = 'fetch' | 'xhr' | 'history';
|
|
@@ -99,17 +100,34 @@ export interface ReplayPluginOptions extends SessionOptions {
|
|
|
99
100
|
declare type OptionalReplayPluginOptions = Partial<ReplayPluginOptions>;
|
|
100
101
|
export interface ReplayConfiguration extends OptionalReplayPluginOptions, RecordingOptions {
|
|
101
102
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
interface CommonEventContext {
|
|
104
|
+
/**
|
|
105
|
+
* The initial URL of the session
|
|
106
|
+
*/
|
|
107
|
+
initialUrl: string;
|
|
108
|
+
/**
|
|
109
|
+
* The initial starting timestamp of the session
|
|
110
|
+
*/
|
|
111
|
+
initialTimestamp: number;
|
|
112
|
+
/**
|
|
113
|
+
* Ordered list of URLs that have been visited during a replay segment
|
|
114
|
+
*/
|
|
115
|
+
urls: string[];
|
|
116
|
+
}
|
|
117
|
+
export interface PopEventContext extends CommonEventContext {
|
|
118
|
+
/**
|
|
119
|
+
* List of Sentry error ids that have occurred during a replay segment
|
|
120
|
+
*/
|
|
121
|
+
errorIds: Array<string>;
|
|
122
|
+
/**
|
|
123
|
+
* List of Sentry trace ids that have occurred during a replay segment
|
|
124
|
+
*/
|
|
125
|
+
traceIds: Array<string>;
|
|
108
126
|
}
|
|
109
127
|
/**
|
|
110
128
|
* Additional context that will be sent w/ `replay_event`
|
|
111
129
|
*/
|
|
112
|
-
export interface
|
|
130
|
+
export interface InternalEventContext extends CommonEventContext {
|
|
113
131
|
/**
|
|
114
132
|
* Set of Sentry error ids that have occurred during a replay segment
|
|
115
133
|
*/
|
|
@@ -118,10 +136,6 @@ export interface ReplayEventContext {
|
|
|
118
136
|
* Set of Sentry trace ids that have occurred during a replay segment
|
|
119
137
|
*/
|
|
120
138
|
traceIds: Set<string>;
|
|
121
|
-
/**
|
|
122
|
-
* Ordered list of URLs that have been visited during a replay segment
|
|
123
|
-
*/
|
|
124
|
-
urls: string[];
|
|
125
139
|
/**
|
|
126
140
|
* The timestamp of the earliest event that has been added to event buffer. This can happen due to the Performance Observer which buffers events.
|
|
127
141
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/replay",
|
|
3
|
-
"version": "0.6.14-
|
|
3
|
+
"version": "0.6.14-4",
|
|
4
4
|
"description": "User replays for Sentry",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"url": "git+https://github.com/getsentry/sentry-replay.git"
|
|
31
31
|
},
|
|
32
32
|
"author": "Sentry",
|
|
33
|
-
"license": "
|
|
33
|
+
"license": "MIT",
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/getsentry/sentry-replay/issues"
|
|
36
36
|
},
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
}
|
|
91
91
|
],
|
|
92
92
|
"volta": {
|
|
93
|
-
"node": "
|
|
93
|
+
"node": "14.21.1",
|
|
94
94
|
"yarn": "1.22.19"
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Session } from './src/session/Session';
|
|
2
|
-
declare type SentReplayExpected = {
|
|
3
|
-
envelopeHeader?: {
|
|
4
|
-
event_id: string;
|
|
5
|
-
sent_at: string;
|
|
6
|
-
sdk: {
|
|
7
|
-
name: string;
|
|
8
|
-
version?: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
replayEventHeader?: {
|
|
12
|
-
type: 'replay_event';
|
|
13
|
-
};
|
|
14
|
-
replayEventPayload?: Record<string, any>;
|
|
15
|
-
recordingHeader?: {
|
|
16
|
-
type: 'replay_recording';
|
|
17
|
-
length: number;
|
|
18
|
-
};
|
|
19
|
-
recordingPayloadHeader?: Record<string, any>;
|
|
20
|
-
events?: string | Uint8Array;
|
|
21
|
-
};
|
|
22
|
-
declare module 'expect' {
|
|
23
|
-
interface AsymmetricMatchers {
|
|
24
|
-
toHaveSentReplay(expected?: SentReplayExpected): void;
|
|
25
|
-
toHaveSameSession(expected: undefined | Session): void;
|
|
26
|
-
}
|
|
27
|
-
interface Matchers<R> {
|
|
28
|
-
toHaveSentReplay(expected?: SentReplayExpected): R;
|
|
29
|
-
toHaveSameSession(expected: undefined | Session): R;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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,43 +0,0 @@
|
|
|
1
|
-
import { AllPerformanceEntry } from './types';
|
|
2
|
-
export interface ReplayPerformanceEntry {
|
|
3
|
-
/**
|
|
4
|
-
* One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType
|
|
5
|
-
*/
|
|
6
|
-
type: string;
|
|
7
|
-
/**
|
|
8
|
-
* A more specific description of the performance entry
|
|
9
|
-
*/
|
|
10
|
-
name: string;
|
|
11
|
-
/**
|
|
12
|
-
* The start timestamp in seconds
|
|
13
|
-
*/
|
|
14
|
-
start: number;
|
|
15
|
-
/**
|
|
16
|
-
* The end timestamp in seconds
|
|
17
|
-
*/
|
|
18
|
-
end: number;
|
|
19
|
-
/**
|
|
20
|
-
* Additional unstructured data to be included
|
|
21
|
-
*/
|
|
22
|
-
data?: Record<string, unknown>;
|
|
23
|
-
}
|
|
24
|
-
interface MemoryInfo {
|
|
25
|
-
jsHeapSizeLimit: number;
|
|
26
|
-
totalJSHeapSize: number;
|
|
27
|
-
usedJSHeapSize: number;
|
|
28
|
-
}
|
|
29
|
-
export declare function createPerformanceEntries(entries: AllPerformanceEntry[]): ReplayPerformanceEntry[];
|
|
30
|
-
export declare function createMemoryEntry(memoryEntry: MemoryInfo): {
|
|
31
|
-
type: string;
|
|
32
|
-
name: string;
|
|
33
|
-
start: number;
|
|
34
|
-
end: number;
|
|
35
|
-
data: {
|
|
36
|
-
memory: {
|
|
37
|
-
jsHeapSizeLimit: number;
|
|
38
|
-
totalJSHeapSize: number;
|
|
39
|
-
usedJSHeapSize: number;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { Breadcrumb, Event, Integration } from '@sentry/types';
|
|
2
|
-
import { Session } from './session/Session';
|
|
3
|
-
import { ReplayPerformanceEntry } from './createPerformanceEntry';
|
|
4
|
-
import { IEventBuffer } from './eventBuffer';
|
|
5
|
-
import type { AllPerformanceEntry, InitialState, InstrumentationTypeBreadcrumb, InstrumentationTypeSpan, RecordingEvent, RecordingOptions, ReplayConfiguration, ReplayPluginOptions, SendReplay } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Returns true to return control to calling function, otherwise continue with normal batching
|
|
8
|
-
*/
|
|
9
|
-
declare type AddUpdateCallback = () => boolean | void;
|
|
10
|
-
export declare class Replay implements Integration {
|
|
11
|
-
/**
|
|
12
|
-
* @inheritDoc
|
|
13
|
-
*/
|
|
14
|
-
static id: string;
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
name: string;
|
|
19
|
-
eventBuffer: IEventBuffer | null;
|
|
20
|
-
/**
|
|
21
|
-
* List of PerformanceEntry from PerformanceObserver
|
|
22
|
-
*/
|
|
23
|
-
performanceEvents: AllPerformanceEntry[];
|
|
24
|
-
/**
|
|
25
|
-
* Options to pass to `rrweb.record()`
|
|
26
|
-
*/
|
|
27
|
-
readonly recordingOptions: RecordingOptions;
|
|
28
|
-
readonly options: ReplayPluginOptions;
|
|
29
|
-
private performanceObserver;
|
|
30
|
-
private retryCount;
|
|
31
|
-
private retryInterval;
|
|
32
|
-
private debouncedFlush;
|
|
33
|
-
private flushLock;
|
|
34
|
-
/**
|
|
35
|
-
* Timestamp of the last user activity. This lives across sessions.
|
|
36
|
-
*/
|
|
37
|
-
private lastActivity;
|
|
38
|
-
/**
|
|
39
|
-
* Is the integration currently active?
|
|
40
|
-
*/
|
|
41
|
-
private isEnabled;
|
|
42
|
-
/**
|
|
43
|
-
* Paused is a state where:
|
|
44
|
-
* - DOM Recording is not listening at all
|
|
45
|
-
* - Nothing will be added to event buffer (e.g. core SDK events)
|
|
46
|
-
*/
|
|
47
|
-
private isPaused;
|
|
48
|
-
/**
|
|
49
|
-
* Integration will wait until an error occurs before creating and sending a
|
|
50
|
-
* replay.
|
|
51
|
-
*/
|
|
52
|
-
private waitForError;
|
|
53
|
-
/**
|
|
54
|
-
* Have we attached listeners to the core SDK?
|
|
55
|
-
* Note we have to track this as there is no way to remove instrumentation handlers.
|
|
56
|
-
*/
|
|
57
|
-
private hasInitializedCoreListeners;
|
|
58
|
-
/**
|
|
59
|
-
* Function to stop recording
|
|
60
|
-
*/
|
|
61
|
-
private stopRecording;
|
|
62
|
-
/**
|
|
63
|
-
* Captured state when integration is first initialized
|
|
64
|
-
*/
|
|
65
|
-
private initialState;
|
|
66
|
-
private context;
|
|
67
|
-
session: Session | undefined;
|
|
68
|
-
constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, useCompression, sessionSampleRate, errorSampleRate, maskAllText, maskAllInputs, blockAllMedia, blockClass, ignoreClass, maskTextClass, blockSelector, replaysSamplingRate, captureOnlyOnError, ...recordingOptions }?: ReplayConfiguration);
|
|
69
|
-
/**
|
|
70
|
-
* We previously used to create a transaction in `setupOnce` and it would
|
|
71
|
-
* potentially create a transaction before some native SDK integrations have run
|
|
72
|
-
* and applied their 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 other
|
|
76
|
-
* global event processors to finish. This is no longer needed, but keeping it
|
|
77
|
-
* here to avoid any future issues.
|
|
78
|
-
*/
|
|
79
|
-
setupOnce(): void;
|
|
80
|
-
/**
|
|
81
|
-
* Initializes the plugin.
|
|
82
|
-
*
|
|
83
|
-
* Creates or loads a session, attaches listeners to varying events (DOM,
|
|
84
|
-
* PerformanceObserver, Recording, Sentry SDK, etc)
|
|
85
|
-
*/
|
|
86
|
-
start(): void;
|
|
87
|
-
/**
|
|
88
|
-
* Start recording.
|
|
89
|
-
*
|
|
90
|
-
* Note that this will cause a new DOM checkout
|
|
91
|
-
*/
|
|
92
|
-
startRecording(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK
|
|
95
|
-
* does not support a teardown
|
|
96
|
-
*/
|
|
97
|
-
stop(): void;
|
|
98
|
-
/**
|
|
99
|
-
* Pause some replay functionality. See comments for `isPaused`.
|
|
100
|
-
* This differs from stop as this only stops DOM recording, it is
|
|
101
|
-
* not as thorough of a shutdown as `stop()`. */
|
|
102
|
-
pause(): void;
|
|
103
|
-
/**
|
|
104
|
-
* Resumes recording, see notes for `pause().
|
|
105
|
-
*
|
|
106
|
-
* Note that calling `startRecording()` here will cause a
|
|
107
|
-
* new DOM checkout.`
|
|
108
|
-
*/
|
|
109
|
-
resume(): void;
|
|
110
|
-
clearSession(): void;
|
|
111
|
-
/**
|
|
112
|
-
* Loads a session from storage, or creates a new one if it does not exist or
|
|
113
|
-
* is expired.
|
|
114
|
-
*/
|
|
115
|
-
loadSession({ expiry }: {
|
|
116
|
-
expiry: number;
|
|
117
|
-
}): void;
|
|
118
|
-
/**
|
|
119
|
-
* Capture some initial state that can change throughout the lifespan of the
|
|
120
|
-
* replay. This is required because otherwise they would be captured at the
|
|
121
|
-
* first flush.
|
|
122
|
-
*/
|
|
123
|
-
setInitialState(): void;
|
|
124
|
-
/**
|
|
125
|
-
* Adds listeners to record events for the replay
|
|
126
|
-
*/
|
|
127
|
-
addListeners(): void;
|
|
128
|
-
/**
|
|
129
|
-
* Cleans up listeners that were created in `addListeners`
|
|
130
|
-
*/
|
|
131
|
-
removeListeners(): void;
|
|
132
|
-
/**
|
|
133
|
-
* We want to batch uploads of replay events. Save events only if
|
|
134
|
-
* `<flushMinDelay>` milliseconds have elapsed since the last event
|
|
135
|
-
* *OR* if `<flushMaxDelay>` milliseconds have elapsed.
|
|
136
|
-
*
|
|
137
|
-
* Accepts a callback to perform side-effects and returns true to stop batch
|
|
138
|
-
* processing and hand back control to caller.
|
|
139
|
-
*/
|
|
140
|
-
addUpdate(cb?: AddUpdateCallback): void;
|
|
141
|
-
/**
|
|
142
|
-
* Core Sentry SDK global event handler. Attaches `replayId` to all [non-replay]
|
|
143
|
-
* events as a tag. Also handles the case where we only want to capture a reply
|
|
144
|
-
* when an error occurs.
|
|
145
|
-
**/
|
|
146
|
-
handleGlobalEvent: (event: Event) => Event;
|
|
147
|
-
/**
|
|
148
|
-
* Handler for recording events.
|
|
149
|
-
*
|
|
150
|
-
* Adds to event buffer, and has varying flushing behaviors if the event was a checkout.
|
|
151
|
-
*/
|
|
152
|
-
handleRecordingEmit: (event: RecordingEvent, isCheckout?: boolean) => void;
|
|
153
|
-
/**
|
|
154
|
-
* Handle when visibility of the page content changes. Opening a new tab will
|
|
155
|
-
* cause the state to change to hidden because of content of current page will
|
|
156
|
-
* be hidden. Likewise, moving a different window to cover the contents of the
|
|
157
|
-
* page will also trigger a change to a hidden state.
|
|
158
|
-
*/
|
|
159
|
-
handleVisibilityChange: () => void;
|
|
160
|
-
/**
|
|
161
|
-
* Handle when page is blurred
|
|
162
|
-
*/
|
|
163
|
-
handleWindowBlur: () => void;
|
|
164
|
-
/**
|
|
165
|
-
* Handle when page is focused
|
|
166
|
-
*/
|
|
167
|
-
handleWindowFocus: () => void;
|
|
168
|
-
/**
|
|
169
|
-
* Handler for Sentry Core SDK events.
|
|
170
|
-
*
|
|
171
|
-
* These specific events will create span-like objects in the recording.
|
|
172
|
-
*/
|
|
173
|
-
handleCoreSpanListener: (type: InstrumentationTypeSpan) => (handlerData: any) => void;
|
|
174
|
-
/**
|
|
175
|
-
* Handler for Sentry Core SDK events.
|
|
176
|
-
*
|
|
177
|
-
* These events will create breadcrumb-like objects in the recording.
|
|
178
|
-
*/
|
|
179
|
-
handleCoreBreadcrumbListener: (type: InstrumentationTypeBreadcrumb) => (handlerData: any) => void;
|
|
180
|
-
/**
|
|
181
|
-
* Keep a list of performance entries that will be sent with a replay
|
|
182
|
-
*/
|
|
183
|
-
handlePerformanceObserver: (list: PerformanceObserverEntryList) => void;
|
|
184
|
-
/**
|
|
185
|
-
* Tasks to run when we consider a page to be hidden (via blurring and/or visibility)
|
|
186
|
-
*/
|
|
187
|
-
doChangeToBackgroundTasks(breadcrumb?: Breadcrumb): void;
|
|
188
|
-
/**
|
|
189
|
-
* Tasks to run when we consider a page to be visible (via focus and/or visibility)
|
|
190
|
-
*/
|
|
191
|
-
doChangeToForegroundTasks(breadcrumb?: Breadcrumb): void;
|
|
192
|
-
/**
|
|
193
|
-
* Trigger rrweb to take a full snapshot which will cause this plugin to
|
|
194
|
-
* create a new Replay event.
|
|
195
|
-
*/
|
|
196
|
-
triggerFullSnapshot(): void;
|
|
197
|
-
/**
|
|
198
|
-
* Add an event to the event buffer
|
|
199
|
-
*/
|
|
200
|
-
addEvent(event: RecordingEvent, isCheckout?: boolean): void;
|
|
201
|
-
/**
|
|
202
|
-
* Update user activity (across session lifespans)
|
|
203
|
-
*/
|
|
204
|
-
updateUserActivity(lastActivity?: number): void;
|
|
205
|
-
/**
|
|
206
|
-
* Updates the session's last activity timestamp
|
|
207
|
-
*/
|
|
208
|
-
updateSessionActivity(lastActivity?: number): void;
|
|
209
|
-
/**
|
|
210
|
-
* Updates the user activity timestamp and resumes recording. This should be
|
|
211
|
-
* called in an event handler for a user action that we consider as the user
|
|
212
|
-
* being "active" (e.g. a mouse click).
|
|
213
|
-
*/
|
|
214
|
-
triggerUserActivity(): Promise<void>;
|
|
215
|
-
/**
|
|
216
|
-
* Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
|
|
217
|
-
*/
|
|
218
|
-
createCustomBreadcrumb(breadcrumb: Breadcrumb): void;
|
|
219
|
-
/**
|
|
220
|
-
* Create a "span" for each performance entry. The parent transaction is `this.replayEvent`.
|
|
221
|
-
*/
|
|
222
|
-
createPerformanceSpans(entries: ReplayPerformanceEntry[]): Promise<void[]>;
|
|
223
|
-
/**
|
|
224
|
-
* Observed performance events are added to `this.performanceEvents`. These
|
|
225
|
-
* are included in the replay event before it is finished and sent to Sentry.
|
|
226
|
-
*/
|
|
227
|
-
addPerformanceEntries(): Promise<void[]>;
|
|
228
|
-
/**
|
|
229
|
-
* Create a "span" for the total amount of memory being used by JS objects
|
|
230
|
-
* (including v8 internal objects).
|
|
231
|
-
*/
|
|
232
|
-
addMemoryEntry(): Promise<void[]> | undefined;
|
|
233
|
-
/**
|
|
234
|
-
* Checks if recording should be stopped due to user inactivity. Otherwise
|
|
235
|
-
* check if session is expired and create a new session if so. Triggers a new
|
|
236
|
-
* full snapshot on new session.
|
|
237
|
-
*
|
|
238
|
-
* Returns true if session is not expired, false otherwise.
|
|
239
|
-
*/
|
|
240
|
-
checkAndHandleExpiredSession({ expiry, }?: {
|
|
241
|
-
expiry?: number;
|
|
242
|
-
}): boolean | undefined;
|
|
243
|
-
/**
|
|
244
|
-
* Only flush if `this.waitForError` is false.
|
|
245
|
-
*/
|
|
246
|
-
conditionalFlush(): void;
|
|
247
|
-
/**
|
|
248
|
-
* Clear context
|
|
249
|
-
*/
|
|
250
|
-
clearContext(): void;
|
|
251
|
-
/**
|
|
252
|
-
* Return and clear context
|
|
253
|
-
*/
|
|
254
|
-
popEventContext(): {
|
|
255
|
-
initialState: InitialState;
|
|
256
|
-
errorIds: string[];
|
|
257
|
-
traceIds: string[];
|
|
258
|
-
urls: string[];
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Flushes replay event buffer to Sentry.
|
|
262
|
-
*
|
|
263
|
-
* Performance events are only added right before flushing - this is
|
|
264
|
-
* due to the buffered performance observer events.
|
|
265
|
-
*
|
|
266
|
-
* Should never be called directly, only by `flush`
|
|
267
|
-
*/
|
|
268
|
-
runFlush(): Promise<void>;
|
|
269
|
-
/**
|
|
270
|
-
* Flush recording data to Sentry. Creates a lock so that only a single flush
|
|
271
|
-
* can be active at a time. Do not call this directly.
|
|
272
|
-
*/
|
|
273
|
-
flush: () => Promise<void>;
|
|
274
|
-
/**
|
|
275
|
-
*
|
|
276
|
-
* Always flush via `debouncedFlush` so that we do not have flushes triggered
|
|
277
|
-
* from calling both `flush` and `debouncedFlush`. Otherwise, there could be
|
|
278
|
-
* cases of mulitple flushes happening closely together.
|
|
279
|
-
*/
|
|
280
|
-
flushImmediate(): any;
|
|
281
|
-
/**
|
|
282
|
-
* Send replay attachment using `fetch()`
|
|
283
|
-
*/
|
|
284
|
-
sendReplayRequest({ events, replayId: event_id, segmentId: segment_id, includeReplayStartTimestamp, }: SendReplay): Promise<void | undefined>;
|
|
285
|
-
resetRetries(): void;
|
|
286
|
-
/**
|
|
287
|
-
* Finalize and send the current replay event to Sentry
|
|
288
|
-
*/
|
|
289
|
-
sendReplay({ replayId, events, segmentId, includeReplayStartTimestamp, }: SendReplay): Promise<unknown>;
|
|
290
|
-
}
|
|
291
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|