@sentry/replay 7.67.0 → 7.68.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.
- package/package.json +6 -6
- package/types-ts3.8/constants.d.ts +25 -0
- package/types-ts3.8/coreHandlers/handleAfterSendEvent.d.ts +9 -0
- package/types-ts3.8/coreHandlers/handleClick.d.ts +39 -0
- package/types-ts3.8/coreHandlers/handleDom.d.ts +13 -0
- package/types-ts3.8/coreHandlers/handleFetch.d.ts +9 -0
- package/types-ts3.8/coreHandlers/handleGlobalEvent.d.ts +7 -0
- package/types-ts3.8/coreHandlers/handleHistory.d.ts +11 -0
- package/types-ts3.8/coreHandlers/handleKeyboardEvent.d.ts +7 -0
- package/types-ts3.8/coreHandlers/handleNetworkBreadcrumbs.d.ts +17 -0
- package/types-ts3.8/coreHandlers/handleScope.d.ts +13 -0
- package/types-ts3.8/coreHandlers/handleXhr.d.ts +9 -0
- package/types-ts3.8/coreHandlers/performanceObserver.d.ts +6 -0
- package/types-ts3.8/coreHandlers/util/addBreadcrumbEvent.d.ts +7 -0
- package/types-ts3.8/coreHandlers/util/addNetworkBreadcrumb.d.ts +4 -0
- package/types-ts3.8/coreHandlers/util/domUtils.d.ts +19 -0
- package/types-ts3.8/coreHandlers/util/fetchUtils.d.ts +23 -0
- package/types-ts3.8/coreHandlers/util/getAttributesToRecord.d.ts +5 -0
- package/types-ts3.8/coreHandlers/util/networkUtils.d.ts +23 -0
- package/types-ts3.8/coreHandlers/util/onWindowOpen.d.ts +8 -0
- package/types-ts3.8/coreHandlers/util/shouldSampleForBufferEvent.d.ts +9 -0
- package/types-ts3.8/coreHandlers/util/xhrUtils.d.ts +22 -0
- package/types-ts3.8/eventBuffer/EventBufferArray.d.ts +28 -0
- package/types-ts3.8/eventBuffer/EventBufferCompressionWorker.d.ts +50 -0
- package/types-ts3.8/eventBuffer/EventBufferProxy.d.ts +42 -0
- package/types-ts3.8/eventBuffer/WorkerHandler.d.ts +27 -0
- package/types-ts3.8/eventBuffer/error.d.ts +5 -0
- package/types-ts3.8/eventBuffer/index.d.ts +10 -0
- package/types-ts3.8/index.d.ts +4 -0
- package/types-ts3.8/integration.d.ts +73 -0
- package/types-ts3.8/replay.d.ts +308 -0
- package/types-ts3.8/session/Session.d.ts +8 -0
- package/types-ts3.8/session/clearSession.d.ts +6 -0
- package/types-ts3.8/session/createSession.d.ts +14 -0
- package/types-ts3.8/session/fetchSession.d.ts +6 -0
- package/types-ts3.8/session/index.d.ts +2 -0
- package/types-ts3.8/session/loadOrCreateSession.d.ts +11 -0
- package/types-ts3.8/session/maybeRefreshSession.d.ts +12 -0
- package/types-ts3.8/session/saveSession.d.ts +6 -0
- package/types-ts3.8/types/deprecated.d.ts +16 -0
- package/types-ts3.8/types/index.d.ts +6 -0
- package/types-ts3.8/types/performance.d.ts +124 -0
- package/types-ts3.8/types/replay.d.ts +422 -0
- package/types-ts3.8/types/replayFrame.d.ts +173 -0
- package/types-ts3.8/types/request.d.ts +15 -0
- package/types-ts3.8/types/rrweb.d.ts +37 -0
- package/types-ts3.8/util/addEvent.d.ts +7 -0
- package/types-ts3.8/util/addGlobalListeners.d.ts +6 -0
- package/types-ts3.8/util/addMemoryEntry.d.ts +7 -0
- package/types-ts3.8/util/createBreadcrumb.d.ts +6 -0
- package/types-ts3.8/util/createPerformanceEntries.d.ts +6 -0
- package/types-ts3.8/util/createPerformanceSpans.d.ts +6 -0
- package/types-ts3.8/util/createReplayEnvelope.d.ts +7 -0
- package/types-ts3.8/util/debounce.d.ts +30 -0
- package/types-ts3.8/util/dedupePerformanceEntries.d.ts +11 -0
- package/types-ts3.8/util/eventUtils.d.ts +8 -0
- package/types-ts3.8/util/getPrivacyOptions.d.ts +19 -0
- package/types-ts3.8/util/handleRecordingEmit.d.ts +14 -0
- package/types-ts3.8/util/hasSessionStorage.d.ts +3 -0
- package/types-ts3.8/util/isBrowser.d.ts +5 -0
- package/types-ts3.8/util/isExpired.d.ts +6 -0
- package/types-ts3.8/util/isRrwebError.d.ts +6 -0
- package/types-ts3.8/util/isSampled.d.ts +8 -0
- package/types-ts3.8/util/isSessionExpired.d.ts +10 -0
- package/types-ts3.8/util/log.d.ts +10 -0
- package/types-ts3.8/util/prepareRecordingData.d.ts +9 -0
- package/types-ts3.8/util/prepareReplayEvent.d.ts +15 -0
- package/types-ts3.8/util/sendReplay.d.ts +9 -0
- package/types-ts3.8/util/sendReplayRequest.d.ts +13 -0
- package/types-ts3.8/util/shouldFilterRequest.d.ts +7 -0
- package/types-ts3.8/util/throttle.d.ts +12 -0
- package/types-ts3.8/util/timestamp.d.ts +9 -0
- package/types-ts3.8/util/truncateJson/completeJson.d.ts +9 -0
- package/types-ts3.8/util/truncateJson/constants.d.ts +12 -0
- package/types-ts3.8/util/truncateJson/evaluateJson.d.ts +6 -0
- package/types-ts3.8/util/truncateJson/fixJson.d.ts +6 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { Breadcrumb, FetchBreadcrumbHint, HandlerDataFetch, ReplayRecordingData, ReplayRecordingMode, SentryWrappedXMLHttpRequest, Transaction, XhrBreadcrumbHint } from '@sentry/types';
|
|
2
|
+
import { SKIPPED, THROTTLED } from '../util/throttle';
|
|
3
|
+
import { AllPerformanceEntry } from './performance';
|
|
4
|
+
import { ReplayFrameEvent } from './replayFrame';
|
|
5
|
+
import { ReplayNetworkRequestOrResponse } from './request';
|
|
6
|
+
import { ReplayEventWithTime, RrwebRecordOptions } from './rrweb';
|
|
7
|
+
export type RecordingEvent = ReplayFrameEvent | ReplayEventWithTime;
|
|
8
|
+
export type RecordingOptions = RrwebRecordOptions;
|
|
9
|
+
export interface SendReplayData {
|
|
10
|
+
recordingData: ReplayRecordingData;
|
|
11
|
+
replayId: string;
|
|
12
|
+
segmentId: number;
|
|
13
|
+
eventContext: PopEventContext;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
session: Session;
|
|
16
|
+
options: ReplayPluginOptions;
|
|
17
|
+
}
|
|
18
|
+
export interface Timeouts {
|
|
19
|
+
sessionIdlePause: number;
|
|
20
|
+
sessionIdleExpire: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The request payload to worker
|
|
24
|
+
*/
|
|
25
|
+
export interface WorkerRequest {
|
|
26
|
+
id: number;
|
|
27
|
+
method: 'clear' | 'addEvent' | 'finish';
|
|
28
|
+
arg?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The response from the worker
|
|
32
|
+
*/
|
|
33
|
+
export interface WorkerResponse {
|
|
34
|
+
id: number;
|
|
35
|
+
method: string;
|
|
36
|
+
success: boolean;
|
|
37
|
+
response: unknown;
|
|
38
|
+
}
|
|
39
|
+
export type AddEventResult = void;
|
|
40
|
+
export interface BeforeAddRecordingEvent {
|
|
41
|
+
(event: ReplayFrameEvent): ReplayFrameEvent | null | undefined;
|
|
42
|
+
}
|
|
43
|
+
export interface ReplayNetworkOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Capture request/response details for XHR/Fetch requests that match the given URLs.
|
|
46
|
+
* The URLs can be strings or regular expressions.
|
|
47
|
+
* When provided a string, we will match any URL that contains the given string.
|
|
48
|
+
* You can use a Regex to handle exact matches or more complex matching.
|
|
49
|
+
*
|
|
50
|
+
* Only URLs matching these patterns will have bodies & additional headers captured.
|
|
51
|
+
*/
|
|
52
|
+
networkDetailAllowUrls: (string | RegExp)[];
|
|
53
|
+
/**
|
|
54
|
+
* Deny request/response details for XHR/Fetch requests that match the given URLs.
|
|
55
|
+
* The URLs can be strings or regular expressions.
|
|
56
|
+
* When provided a string, we will deny any URL that contains the given string.
|
|
57
|
+
* You can use a Regex to handle exact matches or more complex matching.
|
|
58
|
+
* URLs matching these patterns will not have bodies & additional headers captured.
|
|
59
|
+
*/
|
|
60
|
+
networkDetailDenyUrls: (string | RegExp)[];
|
|
61
|
+
/**
|
|
62
|
+
* If request & response bodies should be captured.
|
|
63
|
+
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
|
|
64
|
+
* Defaults to true.
|
|
65
|
+
*/
|
|
66
|
+
networkCaptureBodies: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Capture the following request headers, in addition to the default ones.
|
|
69
|
+
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
|
|
70
|
+
* Any headers defined here will be captured in addition to the default headers.
|
|
71
|
+
*/
|
|
72
|
+
networkRequestHeaders: string[];
|
|
73
|
+
/**
|
|
74
|
+
* Capture the following response headers, in addition to the default ones.
|
|
75
|
+
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
|
|
76
|
+
* Any headers defined here will be captured in addition to the default headers.
|
|
77
|
+
*/
|
|
78
|
+
networkResponseHeaders: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface ReplayPluginOptions extends ReplayNetworkOptions {
|
|
81
|
+
/**
|
|
82
|
+
* The sample rate for session-long replays. 1.0 will record all sessions and
|
|
83
|
+
* 0 will record none.
|
|
84
|
+
*/
|
|
85
|
+
sessionSampleRate: number;
|
|
86
|
+
/**
|
|
87
|
+
* The sample rate for sessions that has had an error occur. This is
|
|
88
|
+
* independent of `sessionSampleRate`.
|
|
89
|
+
*/
|
|
90
|
+
errorSampleRate: number;
|
|
91
|
+
/**
|
|
92
|
+
* If false, will create a new session per pageload. Otherwise, saves session
|
|
93
|
+
* to Session Storage.
|
|
94
|
+
*/
|
|
95
|
+
stickySession: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* The amount of time to wait before sending a replay
|
|
98
|
+
*/
|
|
99
|
+
flushMinDelay: number;
|
|
100
|
+
/**
|
|
101
|
+
* The max amount of time to wait before sending a replay
|
|
102
|
+
*/
|
|
103
|
+
flushMaxDelay: number;
|
|
104
|
+
/**
|
|
105
|
+
* Attempt to use compression when web workers are available
|
|
106
|
+
*
|
|
107
|
+
* (default is true)
|
|
108
|
+
*/
|
|
109
|
+
useCompression: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Block all media (e.g. images, svg, video) in recordings.
|
|
112
|
+
*/
|
|
113
|
+
blockAllMedia: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Mask all inputs in recordings
|
|
116
|
+
*/
|
|
117
|
+
maskAllInputs: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Mask all text in recordings
|
|
120
|
+
*/
|
|
121
|
+
maskAllText: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* A high number of DOM mutations (in a single event loop) can cause
|
|
124
|
+
* performance regressions in end-users' browsers. This setting will create
|
|
125
|
+
* a breadcrumb in the recording when the limit has been reached.
|
|
126
|
+
*/
|
|
127
|
+
mutationBreadcrumbLimit: number;
|
|
128
|
+
/**
|
|
129
|
+
* A high number of DOM mutations (in a single event loop) can cause
|
|
130
|
+
* performance regressions in end-users' browsers. This setting will cause
|
|
131
|
+
* recording to stop when the limit has been reached.
|
|
132
|
+
*/
|
|
133
|
+
mutationLimit: number;
|
|
134
|
+
/**
|
|
135
|
+
* The max. time in ms to wait for a slow click to finish.
|
|
136
|
+
* After this amount of time we stop waiting for actions after a click happened.
|
|
137
|
+
* Set this to 0 to disable slow click capture.
|
|
138
|
+
*
|
|
139
|
+
* Default: 7000ms
|
|
140
|
+
*/
|
|
141
|
+
slowClickTimeout: number;
|
|
142
|
+
/**
|
|
143
|
+
* Ignore clicks on elements matching the given selectors for slow click detection.
|
|
144
|
+
*/
|
|
145
|
+
slowClickIgnoreSelectors: string[];
|
|
146
|
+
/**
|
|
147
|
+
* The min. duration (in ms) a replay has to have before it is sent to Sentry.
|
|
148
|
+
* Whenever attempting to flush a session that is shorter than this, it will not actually send it to Sentry.
|
|
149
|
+
* Note that this is capped at max. 15s.
|
|
150
|
+
*/
|
|
151
|
+
minReplayDuration: number;
|
|
152
|
+
/**
|
|
153
|
+
* The max. duration (in ms) a replay session may be.
|
|
154
|
+
* This is capped at max. 60min.
|
|
155
|
+
*/
|
|
156
|
+
maxReplayDuration: number;
|
|
157
|
+
/**
|
|
158
|
+
* Callback before adding a custom recording event
|
|
159
|
+
*
|
|
160
|
+
* Events added by the underlying DOM recording library can *not* be modified,
|
|
161
|
+
* only custom recording events from the Replay integration will trigger the
|
|
162
|
+
* callback listeners. This can be used to scrub certain fields in an event (e.g. URLs from navigation events).
|
|
163
|
+
*
|
|
164
|
+
* Returning a `null` will drop the event completely. Note, dropping a recording
|
|
165
|
+
* event is not the same as dropping the replay, the replay will still exist and
|
|
166
|
+
* continue to function.
|
|
167
|
+
*/
|
|
168
|
+
beforeAddRecordingEvent?: BeforeAddRecordingEvent;
|
|
169
|
+
/**
|
|
170
|
+
* _experiments allows users to enable experimental or internal features.
|
|
171
|
+
* We don't consider such features as part of the public API and hence we don't guarantee semver for them.
|
|
172
|
+
* Experimental features can be added, changed or removed at any time.
|
|
173
|
+
*
|
|
174
|
+
* Default: undefined
|
|
175
|
+
*/
|
|
176
|
+
_experiments: Partial<{
|
|
177
|
+
captureExceptions: boolean;
|
|
178
|
+
traceInternals: boolean;
|
|
179
|
+
}>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Session options that are configurable by the integration configuration
|
|
183
|
+
*/
|
|
184
|
+
export interface SessionOptions extends Pick<ReplayPluginOptions, 'sessionSampleRate' | 'stickySession'> {
|
|
185
|
+
/**
|
|
186
|
+
* Should buffer recordings to be saved later either by error sampling, or by
|
|
187
|
+
* manually calling `flush()`. This is only a factor if not sampled for a
|
|
188
|
+
* session-based replay.
|
|
189
|
+
*/
|
|
190
|
+
allowBuffering: boolean;
|
|
191
|
+
}
|
|
192
|
+
export interface ReplayIntegrationPrivacyOptions {
|
|
193
|
+
/**
|
|
194
|
+
* Mask text content for elements that match the CSS selectors in the list.
|
|
195
|
+
*/
|
|
196
|
+
mask?: string[];
|
|
197
|
+
/**
|
|
198
|
+
* Unmask text content for elements that match the CSS selectors in the list.
|
|
199
|
+
*/
|
|
200
|
+
unmask?: string[];
|
|
201
|
+
/**
|
|
202
|
+
* Block elements that match the CSS selectors in the list. Blocking replaces
|
|
203
|
+
* the element with an empty placeholder with the same dimensions.
|
|
204
|
+
*/
|
|
205
|
+
block?: string[];
|
|
206
|
+
/**
|
|
207
|
+
* Unblock elements that match the CSS selectors in the list. This is useful when using `blockAllMedia`.
|
|
208
|
+
*/
|
|
209
|
+
unblock?: string[];
|
|
210
|
+
/**
|
|
211
|
+
* Ignore input events for elements that match the CSS selectors in the list.
|
|
212
|
+
*/
|
|
213
|
+
ignore?: string[];
|
|
214
|
+
/**
|
|
215
|
+
* A callback function to customize how your text is masked.
|
|
216
|
+
*/
|
|
217
|
+
maskFn?: (s: string) => string;
|
|
218
|
+
}
|
|
219
|
+
type OptionalReplayPluginOptions = Partial<ReplayPluginOptions>;
|
|
220
|
+
export interface DeprecatedPrivacyOptions {
|
|
221
|
+
/**
|
|
222
|
+
* @deprecated Use `block` which accepts an array of CSS selectors
|
|
223
|
+
*/
|
|
224
|
+
blockSelector?: RecordingOptions['blockSelector'];
|
|
225
|
+
/**
|
|
226
|
+
* @deprecated Use `block` which accepts an array of CSS selectors
|
|
227
|
+
*/
|
|
228
|
+
blockClass?: RecordingOptions['blockClass'];
|
|
229
|
+
/**
|
|
230
|
+
* @deprecated Use `ignore` which accepts an array of CSS selectors
|
|
231
|
+
*/
|
|
232
|
+
ignoreClass?: RecordingOptions['ignoreClass'];
|
|
233
|
+
/**
|
|
234
|
+
* @deprecated Use `mask` which accepts an array of CSS selectors
|
|
235
|
+
*/
|
|
236
|
+
maskInputOptions?: RecordingOptions['maskInputOptions'];
|
|
237
|
+
/**
|
|
238
|
+
* @deprecated Use `mask` which accepts an array of CSS selectors
|
|
239
|
+
*/
|
|
240
|
+
maskTextClass?: RecordingOptions['maskTextClass'];
|
|
241
|
+
/**
|
|
242
|
+
* @deprecated Use `mask` which accepts an array of CSS selectors
|
|
243
|
+
*/
|
|
244
|
+
maskTextSelector?: RecordingOptions['maskTextSelector'];
|
|
245
|
+
}
|
|
246
|
+
export interface ReplayConfiguration extends ReplayIntegrationPrivacyOptions, OptionalReplayPluginOptions, DeprecatedPrivacyOptions, Pick<RecordingOptions, 'maskAllText' | 'maskAllInputs'> {
|
|
247
|
+
}
|
|
248
|
+
interface CommonEventContext {
|
|
249
|
+
/**
|
|
250
|
+
* The initial URL of the session
|
|
251
|
+
*/
|
|
252
|
+
initialUrl: string;
|
|
253
|
+
/**
|
|
254
|
+
* The initial starting timestamp in ms of the session.
|
|
255
|
+
*/
|
|
256
|
+
initialTimestamp: number;
|
|
257
|
+
/**
|
|
258
|
+
* Ordered list of URLs that have been visited during a replay segment
|
|
259
|
+
*/
|
|
260
|
+
urls: string[];
|
|
261
|
+
}
|
|
262
|
+
export interface PopEventContext extends CommonEventContext {
|
|
263
|
+
/**
|
|
264
|
+
* List of Sentry error ids that have occurred during a replay segment
|
|
265
|
+
*/
|
|
266
|
+
errorIds: Array<string>;
|
|
267
|
+
/**
|
|
268
|
+
* List of Sentry trace ids that have occurred during a replay segment
|
|
269
|
+
*/
|
|
270
|
+
traceIds: Array<string>;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Additional context that will be sent w/ `replay_event`
|
|
274
|
+
*/
|
|
275
|
+
export interface InternalEventContext extends CommonEventContext {
|
|
276
|
+
/**
|
|
277
|
+
* Set of Sentry error ids that have occurred during a replay segment
|
|
278
|
+
*/
|
|
279
|
+
errorIds: Set<string>;
|
|
280
|
+
/**
|
|
281
|
+
* Set of Sentry trace ids that have occurred during a replay segment
|
|
282
|
+
*/
|
|
283
|
+
traceIds: Set<string>;
|
|
284
|
+
}
|
|
285
|
+
export type Sampled = false | 'session' | 'buffer';
|
|
286
|
+
export interface Session {
|
|
287
|
+
id: string;
|
|
288
|
+
/**
|
|
289
|
+
* Start time of current session (in ms)
|
|
290
|
+
*/
|
|
291
|
+
started: number;
|
|
292
|
+
/**
|
|
293
|
+
* Last known activity of the session (in ms)
|
|
294
|
+
*/
|
|
295
|
+
lastActivity: number;
|
|
296
|
+
/**
|
|
297
|
+
* Segment ID for replay events
|
|
298
|
+
*/
|
|
299
|
+
segmentId: number;
|
|
300
|
+
/**
|
|
301
|
+
* The ID of the previous session.
|
|
302
|
+
* If this is empty, there was no previous session.
|
|
303
|
+
*/
|
|
304
|
+
previousSessionId?: string;
|
|
305
|
+
/**
|
|
306
|
+
* Is the session sampled? `false` if not sampled, otherwise, `session` or `buffer`
|
|
307
|
+
*/
|
|
308
|
+
sampled: Sampled;
|
|
309
|
+
/**
|
|
310
|
+
* If this is false, the session should not be refreshed when it was inactive.
|
|
311
|
+
* This can be the case if you had a buffered session which is now recording because an error happened.
|
|
312
|
+
*/
|
|
313
|
+
shouldRefresh: boolean;
|
|
314
|
+
}
|
|
315
|
+
export type EventBufferType = 'sync' | 'worker';
|
|
316
|
+
export interface EventBuffer {
|
|
317
|
+
/**
|
|
318
|
+
* If any events have been added to the buffer.
|
|
319
|
+
*/
|
|
320
|
+
readonly hasEvents: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* The buffer type
|
|
323
|
+
*/
|
|
324
|
+
readonly type: EventBufferType;
|
|
325
|
+
/**
|
|
326
|
+
* If the event buffer contains a checkout event.
|
|
327
|
+
*/
|
|
328
|
+
hasCheckout: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Destroy the event buffer.
|
|
331
|
+
*/
|
|
332
|
+
destroy(): void;
|
|
333
|
+
/**
|
|
334
|
+
* Clear the event buffer.
|
|
335
|
+
*/
|
|
336
|
+
clear(): void;
|
|
337
|
+
/**
|
|
338
|
+
* Add an event to the event buffer.
|
|
339
|
+
*
|
|
340
|
+
* Returns a promise that resolves if the event was successfully added, else rejects.
|
|
341
|
+
*/
|
|
342
|
+
addEvent(event: RecordingEvent): Promise<AddEventResult>;
|
|
343
|
+
/**
|
|
344
|
+
* Clears and returns the contents of the buffer.
|
|
345
|
+
*/
|
|
346
|
+
finish(): Promise<ReplayRecordingData>;
|
|
347
|
+
/**
|
|
348
|
+
* Get the earliest timestamp in ms of any event currently in the buffer.
|
|
349
|
+
*/
|
|
350
|
+
getEarliestTimestamp(): number | null;
|
|
351
|
+
}
|
|
352
|
+
export type AddUpdateCallback = () => boolean | void;
|
|
353
|
+
export interface SendBufferedReplayOptions {
|
|
354
|
+
continueRecording?: boolean;
|
|
355
|
+
}
|
|
356
|
+
export interface ReplayClickDetector {
|
|
357
|
+
addListeners(): void;
|
|
358
|
+
removeListeners(): void;
|
|
359
|
+
handleClick(breadcrumb: Breadcrumb, node: HTMLElement): void;
|
|
360
|
+
}
|
|
361
|
+
export interface ReplayContainer {
|
|
362
|
+
eventBuffer: EventBuffer | null;
|
|
363
|
+
clickDetector: ReplayClickDetector | undefined;
|
|
364
|
+
performanceEvents: AllPerformanceEntry[];
|
|
365
|
+
session: Session | undefined;
|
|
366
|
+
recordingMode: ReplayRecordingMode;
|
|
367
|
+
timeouts: Timeouts;
|
|
368
|
+
lastTransaction?: Transaction;
|
|
369
|
+
throttledAddEvent: (event: RecordingEvent, isCheckout?: boolean) => typeof THROTTLED | typeof SKIPPED | Promise<AddEventResult | null>;
|
|
370
|
+
isEnabled(): boolean;
|
|
371
|
+
isPaused(): boolean;
|
|
372
|
+
getContext(): InternalEventContext;
|
|
373
|
+
initializeSampling(): void;
|
|
374
|
+
start(): void;
|
|
375
|
+
stop(options?: {
|
|
376
|
+
reason?: string;
|
|
377
|
+
forceflush?: boolean;
|
|
378
|
+
}): Promise<void>;
|
|
379
|
+
pause(): void;
|
|
380
|
+
resume(): void;
|
|
381
|
+
startRecording(): void;
|
|
382
|
+
stopRecording(): boolean;
|
|
383
|
+
sendBufferedReplayOrFlush(options?: SendBufferedReplayOptions): Promise<void>;
|
|
384
|
+
conditionalFlush(): Promise<void>;
|
|
385
|
+
flush(): Promise<void>;
|
|
386
|
+
flushImmediate(): Promise<void>;
|
|
387
|
+
cancelFlush(): void;
|
|
388
|
+
triggerUserActivity(): void;
|
|
389
|
+
updateUserActivity(): void;
|
|
390
|
+
addUpdate(cb: AddUpdateCallback): void;
|
|
391
|
+
getOptions(): ReplayPluginOptions;
|
|
392
|
+
getSessionId(): string | undefined;
|
|
393
|
+
checkAndHandleExpiredSession(): boolean | void;
|
|
394
|
+
setInitialState(): void;
|
|
395
|
+
getCurrentRoute(): string | undefined;
|
|
396
|
+
}
|
|
397
|
+
type RequestBody = null | Blob | BufferSource | FormData | URLSearchParams | string;
|
|
398
|
+
export type XhrHint = XhrBreadcrumbHint & {
|
|
399
|
+
xhr: XMLHttpRequest & SentryWrappedXMLHttpRequest;
|
|
400
|
+
input?: RequestBody;
|
|
401
|
+
};
|
|
402
|
+
export type FetchHint = FetchBreadcrumbHint & {
|
|
403
|
+
input: HandlerDataFetch['args'];
|
|
404
|
+
response: Response;
|
|
405
|
+
};
|
|
406
|
+
export type ReplayNetworkRequestData = {
|
|
407
|
+
startTimestamp: number;
|
|
408
|
+
endTimestamp: number;
|
|
409
|
+
url: string;
|
|
410
|
+
method?: string;
|
|
411
|
+
statusCode: number;
|
|
412
|
+
request?: ReplayNetworkRequestOrResponse;
|
|
413
|
+
response?: ReplayNetworkRequestOrResponse;
|
|
414
|
+
};
|
|
415
|
+
export interface SlowClickConfig {
|
|
416
|
+
threshold: number;
|
|
417
|
+
timeout: number;
|
|
418
|
+
scrollTimeout: number;
|
|
419
|
+
ignoreSelector: string;
|
|
420
|
+
}
|
|
421
|
+
export {};
|
|
422
|
+
//# sourceMappingURL=replay.d.ts.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Breadcrumb } from '@sentry/types';
|
|
2
|
+
import { HistoryData, LargestContentfulPaintData, MemoryData, NavigationData, NetworkRequestData, PaintData, ResourceData } from './performance';
|
|
3
|
+
import { ReplayEventTypeCustom } from './rrweb';
|
|
4
|
+
type AnyRecord = Record<string, any>;
|
|
5
|
+
interface ReplayBaseBreadcrumbFrame {
|
|
6
|
+
timestamp: number;
|
|
7
|
+
/**
|
|
8
|
+
* For compatibility reasons
|
|
9
|
+
*/
|
|
10
|
+
type: string;
|
|
11
|
+
category: string;
|
|
12
|
+
data?: AnyRecord;
|
|
13
|
+
message?: string;
|
|
14
|
+
}
|
|
15
|
+
interface ReplayBaseDomFrameData {
|
|
16
|
+
nodeId?: number;
|
|
17
|
+
node?: {
|
|
18
|
+
id: number;
|
|
19
|
+
tagName: string;
|
|
20
|
+
textContent: string;
|
|
21
|
+
attributes: AnyRecord;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface ReplayConsoleFrameData {
|
|
25
|
+
logger: string;
|
|
26
|
+
arguments?: unknown[];
|
|
27
|
+
}
|
|
28
|
+
interface ReplayConsoleFrame extends ReplayBaseBreadcrumbFrame {
|
|
29
|
+
category: 'console';
|
|
30
|
+
level: Breadcrumb['level'];
|
|
31
|
+
message: string;
|
|
32
|
+
data: ReplayConsoleFrameData;
|
|
33
|
+
}
|
|
34
|
+
type ReplayClickFrameData = ReplayBaseDomFrameData;
|
|
35
|
+
interface ReplayClickFrame extends ReplayBaseBreadcrumbFrame {
|
|
36
|
+
category: 'ui.click';
|
|
37
|
+
message: string;
|
|
38
|
+
data: ReplayClickFrameData;
|
|
39
|
+
}
|
|
40
|
+
interface ReplayInputFrame extends ReplayBaseBreadcrumbFrame {
|
|
41
|
+
category: 'ui.input';
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
interface ReplayMutationFrameData {
|
|
45
|
+
count: number;
|
|
46
|
+
limit: boolean;
|
|
47
|
+
}
|
|
48
|
+
interface ReplayMutationFrame extends ReplayBaseBreadcrumbFrame {
|
|
49
|
+
category: 'replay.mutations';
|
|
50
|
+
data: ReplayMutationFrameData;
|
|
51
|
+
}
|
|
52
|
+
interface ReplayKeyboardEventFrameData extends ReplayBaseDomFrameData {
|
|
53
|
+
metaKey: boolean;
|
|
54
|
+
shiftKey: boolean;
|
|
55
|
+
ctrlKey: boolean;
|
|
56
|
+
altKey: boolean;
|
|
57
|
+
key: string;
|
|
58
|
+
}
|
|
59
|
+
interface ReplayKeyboardEventFrame extends ReplayBaseBreadcrumbFrame {
|
|
60
|
+
category: 'ui.keyDown';
|
|
61
|
+
data: ReplayKeyboardEventFrameData;
|
|
62
|
+
}
|
|
63
|
+
interface ReplayBlurFrame extends ReplayBaseBreadcrumbFrame {
|
|
64
|
+
category: 'ui.blur';
|
|
65
|
+
}
|
|
66
|
+
interface ReplayFocusFrame extends ReplayBaseBreadcrumbFrame {
|
|
67
|
+
category: 'ui.focus';
|
|
68
|
+
}
|
|
69
|
+
interface ReplaySlowClickFrameData extends ReplayClickFrameData {
|
|
70
|
+
url: string;
|
|
71
|
+
route?: string;
|
|
72
|
+
timeAfterClickMs: number;
|
|
73
|
+
endReason: string;
|
|
74
|
+
clickCount?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface ReplaySlowClickFrame extends ReplayBaseBreadcrumbFrame {
|
|
77
|
+
category: 'ui.slowClickDetected';
|
|
78
|
+
data: ReplaySlowClickFrameData;
|
|
79
|
+
}
|
|
80
|
+
interface ReplayMultiClickFrameData extends ReplayClickFrameData {
|
|
81
|
+
url: string;
|
|
82
|
+
route?: string;
|
|
83
|
+
clickCount: number;
|
|
84
|
+
metric: true;
|
|
85
|
+
}
|
|
86
|
+
export interface ReplayMultiClickFrame extends ReplayBaseBreadcrumbFrame {
|
|
87
|
+
category: 'ui.multiClick';
|
|
88
|
+
data: ReplayMultiClickFrameData;
|
|
89
|
+
}
|
|
90
|
+
interface ReplayOptionFrame {
|
|
91
|
+
blockAllMedia: boolean;
|
|
92
|
+
errorSampleRate: number;
|
|
93
|
+
maskAllInputs: boolean;
|
|
94
|
+
maskAllText: boolean;
|
|
95
|
+
networkCaptureBodies: boolean;
|
|
96
|
+
networkDetailHasUrls: boolean;
|
|
97
|
+
networkRequestHasHeaders: boolean;
|
|
98
|
+
networkResponseHasHeaders: boolean;
|
|
99
|
+
sessionSampleRate: number;
|
|
100
|
+
useCompression: boolean;
|
|
101
|
+
useCompressionOption: boolean;
|
|
102
|
+
}
|
|
103
|
+
export type ReplayBreadcrumbFrame = ReplayConsoleFrame | ReplayClickFrame | ReplayInputFrame | ReplayKeyboardEventFrame | ReplayBlurFrame | ReplayFocusFrame | ReplaySlowClickFrame | ReplayMultiClickFrame | ReplayMutationFrame | ReplayBaseBreadcrumbFrame;
|
|
104
|
+
interface ReplayBaseSpanFrame {
|
|
105
|
+
op: string;
|
|
106
|
+
description: string;
|
|
107
|
+
startTimestamp: number;
|
|
108
|
+
endTimestamp: number;
|
|
109
|
+
data?: undefined | AnyRecord;
|
|
110
|
+
}
|
|
111
|
+
interface ReplayHistoryFrame extends ReplayBaseSpanFrame {
|
|
112
|
+
data: HistoryData;
|
|
113
|
+
op: 'navigation.push';
|
|
114
|
+
}
|
|
115
|
+
interface ReplayLargestContentfulPaintFrame extends ReplayBaseSpanFrame {
|
|
116
|
+
data: LargestContentfulPaintData;
|
|
117
|
+
op: 'largest-contentful-paint';
|
|
118
|
+
}
|
|
119
|
+
interface ReplayMemoryFrame extends ReplayBaseSpanFrame {
|
|
120
|
+
data: MemoryData;
|
|
121
|
+
op: 'memory';
|
|
122
|
+
}
|
|
123
|
+
interface ReplayNavigationFrame extends ReplayBaseSpanFrame {
|
|
124
|
+
data: NavigationData;
|
|
125
|
+
op: 'navigation.navigate' | 'navigation.reload' | 'navigation.back_forward';
|
|
126
|
+
}
|
|
127
|
+
interface ReplayPaintFrame extends ReplayBaseSpanFrame {
|
|
128
|
+
data: PaintData;
|
|
129
|
+
op: 'paint';
|
|
130
|
+
}
|
|
131
|
+
interface ReplayRequestFrame extends ReplayBaseSpanFrame {
|
|
132
|
+
data: NetworkRequestData;
|
|
133
|
+
op: 'resource.fetch' | 'resource.xhr';
|
|
134
|
+
}
|
|
135
|
+
interface ReplayResourceFrame extends ReplayBaseSpanFrame {
|
|
136
|
+
data: ResourceData;
|
|
137
|
+
op: 'resource.css' | 'resource.ReplayiFrame' | 'resource.img' | 'resource.link' | 'resource.other' | 'resource.script';
|
|
138
|
+
}
|
|
139
|
+
export type ReplaySpanFrame = ReplayBaseSpanFrame | ReplayHistoryFrame | ReplayRequestFrame | ReplayLargestContentfulPaintFrame | ReplayMemoryFrame | ReplayNavigationFrame | ReplayPaintFrame | ReplayResourceFrame;
|
|
140
|
+
export type ReplayFrame = ReplayBreadcrumbFrame | ReplaySpanFrame;
|
|
141
|
+
interface RecordingCustomEvent {
|
|
142
|
+
type: typeof ReplayEventTypeCustom;
|
|
143
|
+
timestamp: number;
|
|
144
|
+
data: {
|
|
145
|
+
tag: string;
|
|
146
|
+
payload: unknown;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export interface ReplayBreadcrumbFrameEvent extends RecordingCustomEvent {
|
|
150
|
+
data: {
|
|
151
|
+
tag: 'breadcrumb';
|
|
152
|
+
payload: ReplayBreadcrumbFrame;
|
|
153
|
+
/**
|
|
154
|
+
* This will indicate to backend to additionally log as a metric
|
|
155
|
+
*/
|
|
156
|
+
metric?: boolean;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
export interface ReplaySpanFrameEvent extends RecordingCustomEvent {
|
|
160
|
+
data: {
|
|
161
|
+
tag: 'performanceSpan';
|
|
162
|
+
payload: ReplaySpanFrame;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export interface ReplayOptionFrameEvent extends RecordingCustomEvent {
|
|
166
|
+
data: {
|
|
167
|
+
tag: 'options';
|
|
168
|
+
payload: ReplayOptionFrame;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export type ReplayFrameEvent = ReplayBreadcrumbFrameEvent | ReplaySpanFrameEvent | ReplayOptionFrameEvent;
|
|
172
|
+
export {};
|
|
173
|
+
//# sourceMappingURL=replayFrame.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type JsonObject = Record<string, unknown>;
|
|
2
|
+
type JsonArray = unknown[];
|
|
3
|
+
export type NetworkBody = JsonObject | JsonArray | string;
|
|
4
|
+
export type NetworkMetaWarning = 'JSON_TRUNCATED' | 'TEXT_TRUNCATED' | 'INVALID_JSON' | 'URL_SKIPPED';
|
|
5
|
+
interface NetworkMeta {
|
|
6
|
+
warnings?: NetworkMetaWarning[];
|
|
7
|
+
}
|
|
8
|
+
export interface ReplayNetworkRequestOrResponse {
|
|
9
|
+
size?: number;
|
|
10
|
+
body?: NetworkBody;
|
|
11
|
+
headers: Record<string, string>;
|
|
12
|
+
_meta?: NetworkMeta;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
type ClassOption = string | RegExp;
|
|
2
|
+
/** Duplicate this from @sentry-internal/rrweb so we can export this as well. */
|
|
3
|
+
export declare const ReplayEventTypeDomContentLoaded = 0;
|
|
4
|
+
export declare const ReplayEventTypeLoad = 1;
|
|
5
|
+
export declare const ReplayEventTypeFullSnapshot = 2;
|
|
6
|
+
export declare const ReplayEventTypeIncrementalSnapshot = 3;
|
|
7
|
+
export declare const ReplayEventTypeMeta = 4;
|
|
8
|
+
export declare const ReplayEventTypeCustom = 5;
|
|
9
|
+
export declare const ReplayEventTypePlugin = 6;
|
|
10
|
+
export type ReplayEventType = typeof ReplayEventTypeDomContentLoaded | typeof ReplayEventTypeLoad | typeof ReplayEventTypeFullSnapshot | typeof ReplayEventTypeIncrementalSnapshot | typeof ReplayEventTypeMeta | typeof ReplayEventTypeCustom | typeof ReplayEventTypePlugin;
|
|
11
|
+
/**
|
|
12
|
+
* This is a partial copy of rrweb's eventWithTime type which only contains the properties
|
|
13
|
+
* we specifcally need in the SDK.
|
|
14
|
+
*/
|
|
15
|
+
export type ReplayEventWithTime = {
|
|
16
|
+
type: ReplayEventType;
|
|
17
|
+
data: unknown;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
delay?: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* This is a partial copy of rrweb's recording options which only contains the properties
|
|
23
|
+
* we specifically us in the SDK. Users can specify additional properties, hence we add the
|
|
24
|
+
* Record<string, unknown> union type.
|
|
25
|
+
*/
|
|
26
|
+
export type RrwebRecordOptions = {
|
|
27
|
+
maskAllText?: boolean;
|
|
28
|
+
maskAllInputs?: boolean;
|
|
29
|
+
blockClass?: ClassOption;
|
|
30
|
+
ignoreClass?: string;
|
|
31
|
+
maskTextClass?: ClassOption;
|
|
32
|
+
maskTextSelector?: string;
|
|
33
|
+
blockSelector?: string;
|
|
34
|
+
maskInputOptions?: Record<string, boolean>;
|
|
35
|
+
} & Record<string, unknown>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=rrweb.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AddEventResult, RecordingEvent, ReplayContainer } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Add an event to the event buffer.
|
|
4
|
+
* `isCheckout` is true if this is either the very first event, or an event triggered by `checkoutEveryNms`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function addEvent(replay: ReplayContainer, event: RecordingEvent, isCheckout?: boolean): Promise<AddEventResult | null>;
|
|
7
|
+
//# sourceMappingURL=addEvent.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AddEventResult, ReplayContainer } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a "span" for the total amount of memory being used by JS objects
|
|
4
|
+
* (including v8 internal objects).
|
|
5
|
+
*/
|
|
6
|
+
export declare function addMemoryEntry(replay: ReplayContainer): Promise<Array<AddEventResult | null>>;
|
|
7
|
+
//# sourceMappingURL=addMemoryEntry.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReplayBreadcrumbFrame } from '../types/replayFrame';
|
|
2
|
+
/**
|
|
3
|
+
* Create a breadcrumb for a replay.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createBreadcrumb(breadcrumb: Pick<ReplayBreadcrumbFrame, Exclude<keyof ReplayBreadcrumbFrame, 'timestamp' | 'type'>> & Partial<Pick<ReplayBreadcrumbFrame, 'timestamp'>>): ReplayBreadcrumbFrame;
|
|
6
|
+
//# sourceMappingURL=createBreadcrumb.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AllPerformanceEntry, AllPerformanceEntryData, ReplayPerformanceEntry } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create replay performance entries from the browser performance entries.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createPerformanceEntries(entries: AllPerformanceEntry[]): ReplayPerformanceEntry<AllPerformanceEntryData>[];
|
|
6
|
+
//# sourceMappingURL=createPerformanceEntries.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AddEventResult, AllEntryData, ReplayContainer, ReplayPerformanceEntry } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a "span" for each performance entry.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createPerformanceSpans(replay: ReplayContainer, entries: ReplayPerformanceEntry<AllEntryData>[]): Promise<AddEventResult | null>[];
|
|
6
|
+
//# sourceMappingURL=createPerformanceSpans.d.ts.map
|