@sentry/replay 0.5.17 → 0.5.18
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/README.md +3 -2
- package/dist/config/types/jest.config.d.ts +3 -0
- package/dist/config/types/jest.setup.d.ts +10 -0
- package/dist/config/types/src/api/captureReplayEvent.d.ts +37 -0
- package/dist/config/types/src/coreHandlers/getBreadcrumbHandler.d.ts +3 -0
- package/dist/config/types/src/coreHandlers/getSpanHandler.d.ts +5 -0
- package/dist/config/types/src/coreHandlers/handleDom.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/handleFetch.d.ts +19 -0
- package/dist/config/types/src/coreHandlers/handleFetch.test.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/handleHistory.d.ts +7 -0
- package/dist/config/types/src/coreHandlers/handleScope-unit.test.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/handleScope.d.ts +2 -0
- package/dist/config/types/src/coreHandlers/handleScope.test.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/handleXhr.d.ts +21 -0
- package/dist/config/types/src/createPerformanceEntry.d.ts +43 -0
- package/dist/config/types/src/createPerformanceEntry.test.d.ts +1 -0
- package/dist/config/types/src/eventBuffer.d.ts +45 -0
- package/dist/config/types/src/eventBuffer.test.d.ts +1 -0
- package/dist/config/types/src/flags.d.ts +2 -0
- package/dist/config/types/src/flush.test.d.ts +1 -0
- package/dist/config/types/src/index-captureOnlyOnError.test.d.ts +1 -0
- package/dist/config/types/src/index-noSticky.test.d.ts +1 -0
- package/dist/config/types/src/index-sampling.test.d.ts +1 -0
- package/dist/config/types/src/index.d.ts +253 -0
- package/dist/config/types/src/index.test.d.ts +1 -0
- package/dist/config/types/src/session/Session.d.ts +63 -0
- package/dist/config/types/src/session/Session.test.d.ts +1 -0
- package/dist/config/types/src/session/constants.d.ts +5 -0
- package/dist/config/types/src/session/createSession.d.ts +19 -0
- package/dist/config/types/src/session/createSession.test.d.ts +1 -0
- package/dist/config/types/src/session/deleteSession.d.ts +4 -0
- package/dist/config/types/src/session/deleteSession.test.d.ts +1 -0
- package/dist/config/types/src/session/fetchSession.d.ts +5 -0
- package/dist/config/types/src/session/fetchSession.test.d.ts +1 -0
- package/dist/config/types/src/session/getSession.d.ts +28 -0
- package/dist/config/types/src/session/getSession.test.d.ts +1 -0
- package/dist/config/types/src/session/index.d.ts +1 -0
- package/dist/config/types/src/session/saveSession.d.ts +2 -0
- package/dist/config/types/src/session/saveSession.test.d.ts +1 -0
- package/dist/config/types/src/stop.test.d.ts +1 -0
- package/dist/config/types/src/types.d.ts +102 -0
- package/dist/config/types/src/util/createBreadcrumb.d.ts +4 -0
- package/dist/config/types/src/util/createPayload.d.ts +5 -0
- package/dist/config/types/src/util/isExpired.d.ts +5 -0
- package/dist/config/types/src/util/isExpired.test.d.ts +1 -0
- package/dist/config/types/src/util/isIngestHost.d.ts +4 -0
- package/dist/config/types/src/util/isSampled.d.ts +7 -0
- package/dist/config/types/src/util/isSampled.test.d.ts +1 -0
- package/dist/config/types/src/util/isSessionExpired.d.ts +5 -0
- package/dist/config/types/src/util/isSessionExpired.test.d.ts +1 -0
- package/dist/config/types/src/util/logger.d.ts +12 -0
- package/dist/config/types/test/index.d.ts +3 -0
- package/dist/config/types/test/mocks/mockRrweb.d.ts +15 -0
- package/dist/config/types/test/mocks/mockSdk.d.ts +11 -0
- package/dist/index.es.js +8 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Session } from './Session';
|
|
2
|
+
interface GetSessionParams {
|
|
3
|
+
/**
|
|
4
|
+
* The length of time (in ms) which we will consider the session to be expired.
|
|
5
|
+
*/
|
|
6
|
+
expiry: number;
|
|
7
|
+
/**
|
|
8
|
+
* Should save session to sessionStorage?
|
|
9
|
+
*/
|
|
10
|
+
stickySession: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The current session (e.g. if stickySession is off)
|
|
13
|
+
*/
|
|
14
|
+
currentSession?: Session;
|
|
15
|
+
/**
|
|
16
|
+
* The sampling rate of the Session. See integration configuration comments
|
|
17
|
+
* for `replaysSamplingRate`.
|
|
18
|
+
*/
|
|
19
|
+
samplingRate?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get or create a session
|
|
23
|
+
*/
|
|
24
|
+
export declare function getSession({ expiry, currentSession, stickySession, samplingRate, }: GetSessionParams): {
|
|
25
|
+
type: string;
|
|
26
|
+
session: Session;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createSession';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { record } from 'rrweb';
|
|
2
|
+
import type { eventWithTime } from 'rrweb/typings/types';
|
|
3
|
+
export declare type RecordingEvent = eventWithTime;
|
|
4
|
+
export declare type RecordingConfig = Parameters<typeof record>[0];
|
|
5
|
+
export declare type RecordedEvents = Uint8Array | string;
|
|
6
|
+
export declare type AllPerformanceEntry = PerformancePaintTiming | PerformanceResourceTiming | PerformanceNavigationTiming;
|
|
7
|
+
export interface ReplayRequest {
|
|
8
|
+
endpoint: string;
|
|
9
|
+
events: RecordedEvents;
|
|
10
|
+
replayId: string;
|
|
11
|
+
segmentId: number;
|
|
12
|
+
}
|
|
13
|
+
export declare type InstrumentationTypeBreadcrumb = 'dom' | 'scope';
|
|
14
|
+
export declare type InstrumentationTypeSpan = 'fetch' | 'xhr' | 'history';
|
|
15
|
+
export declare type InstrumentationType = InstrumentationTypeBreadcrumb | InstrumentationTypeSpan | 'console' | 'error' | 'unhandledrejection';
|
|
16
|
+
/**
|
|
17
|
+
* The request payload to worker
|
|
18
|
+
*/
|
|
19
|
+
export interface WorkerRequest {
|
|
20
|
+
id: number;
|
|
21
|
+
method: string;
|
|
22
|
+
args: any[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The response from the worker
|
|
26
|
+
*/
|
|
27
|
+
export interface WorkerResponse {
|
|
28
|
+
id: number;
|
|
29
|
+
method: string;
|
|
30
|
+
success: boolean;
|
|
31
|
+
response: string | Uint8Array;
|
|
32
|
+
}
|
|
33
|
+
export interface SentryReplayPluginOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The amount of time to wait before sending a replay
|
|
36
|
+
*/
|
|
37
|
+
flushMinDelay?: number;
|
|
38
|
+
/**
|
|
39
|
+
* The max amount of time to wait before sending a replay
|
|
40
|
+
*/
|
|
41
|
+
flushMaxDelay?: number;
|
|
42
|
+
/**
|
|
43
|
+
* The amount of time to buffer the initial snapshot
|
|
44
|
+
*/
|
|
45
|
+
initialFlushDelay?: number;
|
|
46
|
+
/**
|
|
47
|
+
* If false, will create a new session per pageload
|
|
48
|
+
*/
|
|
49
|
+
stickySession?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Attempt to use compression when web workers are available
|
|
52
|
+
*
|
|
53
|
+
* (default is true)
|
|
54
|
+
*/
|
|
55
|
+
useCompression?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Only capture replays when an error happens
|
|
58
|
+
*/
|
|
59
|
+
captureOnlyOnError?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The sampling rate for replays. 1.0 will record all replays, 0 will record none.
|
|
62
|
+
*/
|
|
63
|
+
replaysSamplingRate?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Mask all text in recordings. All text will be replaced with asterisks by default.
|
|
66
|
+
*/
|
|
67
|
+
maskAllText?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface SentryReplayConfiguration extends SentryReplayPluginOptions {
|
|
70
|
+
/**
|
|
71
|
+
* Options for `rrweb.record()`
|
|
72
|
+
*/
|
|
73
|
+
recordingConfig?: RecordingConfig;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Some initial state captured before creating a root replay event
|
|
77
|
+
*/
|
|
78
|
+
export interface InitialState {
|
|
79
|
+
timestamp: number;
|
|
80
|
+
url: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Additional context that will be sent w/ `replay_event`
|
|
84
|
+
*/
|
|
85
|
+
export interface ReplayEventContext {
|
|
86
|
+
/**
|
|
87
|
+
* Set of Sentry error ids that have occurred during a replay segment
|
|
88
|
+
*/
|
|
89
|
+
errorIds: Set<string>;
|
|
90
|
+
/**
|
|
91
|
+
* Set of Sentry trace ids that have occurred during a replay segment
|
|
92
|
+
*/
|
|
93
|
+
traceIds: Set<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Ordered list of URLs that have been visited during a replay segment
|
|
96
|
+
*/
|
|
97
|
+
urls: string[];
|
|
98
|
+
/**
|
|
99
|
+
* The timestamp of the earliest event that has been added to event buffer. This can happen due to the Performance Observer which buffers events.
|
|
100
|
+
*/
|
|
101
|
+
earliestEvent: number | null;
|
|
102
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Breadcrumb } from '@sentry/types';
|
|
2
|
+
declare type RequiredProperties = 'category' | 'message';
|
|
3
|
+
export default function createBreadcrumb(breadcrumb: Pick<Breadcrumb, RequiredProperties> & Partial<Omit<Breadcrumb, RequiredProperties>>): Breadcrumb;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const logger: {
|
|
2
|
+
error: (...args: any[]) => any;
|
|
3
|
+
warn: (...args: any[]) => any;
|
|
4
|
+
log: (...args: any[]) => any;
|
|
5
|
+
disable(): void;
|
|
6
|
+
enable(): void;
|
|
7
|
+
debug: (...args: unknown[]) => void;
|
|
8
|
+
info: (...args: unknown[]) => void;
|
|
9
|
+
assert: (...args: unknown[]) => void;
|
|
10
|
+
trace: (...args: unknown[]) => void;
|
|
11
|
+
};
|
|
12
|
+
export { logger };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { RecordingEvent } from '@/types';
|
|
3
|
+
declare type RecordAdditionalProperties = {
|
|
4
|
+
takeFullSnapshot: jest.Mock;
|
|
5
|
+
addCustomEvent: () => void;
|
|
6
|
+
freezePage: () => void;
|
|
7
|
+
mirror: unknown;
|
|
8
|
+
_emitter: (event: RecordingEvent, ...args: any[]) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare type RecordMock = jest.MockedFunction<typeof rrweb.record> & RecordAdditionalProperties;
|
|
11
|
+
import * as rrweb from 'rrweb';
|
|
12
|
+
export declare function mockRrweb(): {
|
|
13
|
+
record: RecordMock;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BrowserOptions } from '@sentry/browser';
|
|
2
|
+
import { SentryReplay } from '@';
|
|
3
|
+
import { SentryReplayConfiguration } from '@/types';
|
|
4
|
+
interface MockSdkParams {
|
|
5
|
+
replayOptions?: SentryReplayConfiguration;
|
|
6
|
+
sentryOptions?: BrowserOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare function mockSdk({ replayOptions, sentryOptions, }?: MockSdkParams): {
|
|
9
|
+
replay: SentryReplay;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
package/dist/index.es.js
CHANGED
|
@@ -797,7 +797,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
797
797
|
function SentryReplay(_a) {
|
|
798
798
|
if (_a === void 0) { _a = {}; }
|
|
799
799
|
var _this = this;
|
|
800
|
-
var _b = _a.flushMinDelay, flushMinDelay = _b === void 0 ? 5000 : _b, _c = _a.flushMaxDelay, flushMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.initialFlushDelay, initialFlushDelay = _d === void 0 ? 5000 : _d, _e = _a.stickySession, stickySession = _e === void 0 ? true : _e, _f = _a.useCompression, useCompression = _f === void 0 ? true : _f, _g = _a.captureOnlyOnError, captureOnlyOnError = _g === void 0 ? false : _g, _h = _a.replaysSamplingRate, replaysSamplingRate = _h === void 0 ? 1.0 : _h, _j = _a.
|
|
800
|
+
var _b = _a.flushMinDelay, flushMinDelay = _b === void 0 ? 5000 : _b, _c = _a.flushMaxDelay, flushMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.initialFlushDelay, initialFlushDelay = _d === void 0 ? 5000 : _d, _e = _a.stickySession, stickySession = _e === void 0 ? true : _e, _f = _a.useCompression, useCompression = _f === void 0 ? true : _f, _g = _a.captureOnlyOnError, captureOnlyOnError = _g === void 0 ? false : _g, _h = _a.replaysSamplingRate, replaysSamplingRate = _h === void 0 ? 1.0 : _h, _j = _a.maskAllText, maskAllText = _j === void 0 ? false : _j, _k = _a.recordingConfig, _l = _k === void 0 ? {} : _k, _m = _l.maskAllInputs, maskAllInputs = _m === void 0 ? true : _m, _o = _l.blockClass, blockClass = _o === void 0 ? 'sr-block' : _o, _p = _l.ignoreClass, ignoreClass = _p === void 0 ? 'sr-ignore' : _p, _q = _l.maskTextClass, maskTextClass = _q === void 0 ? 'sr-mask' : _q, recordingOptions = __rest(_l, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
|
|
801
801
|
/**
|
|
802
802
|
* @inheritDoc
|
|
803
803
|
*/
|
|
@@ -1089,12 +1089,19 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1089
1089
|
captureOnlyOnError: captureOnlyOnError,
|
|
1090
1090
|
replaysSamplingRate: replaysSamplingRate,
|
|
1091
1091
|
useCompression: useCompression,
|
|
1092
|
+
maskAllText: maskAllText,
|
|
1092
1093
|
};
|
|
1093
1094
|
// Modify rrweb options to checkoutEveryNthSecond if this is defined, as we don't know when an error occurs, so we want to try to minimize the number of events captured.
|
|
1094
1095
|
if (this.options.captureOnlyOnError) {
|
|
1095
1096
|
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
|
|
1096
1097
|
this.recordingOptions.checkoutEveryNms = 60000;
|
|
1097
1098
|
}
|
|
1099
|
+
if (this.options.maskAllText) {
|
|
1100
|
+
// `maskAllText` is a more user friendly option to configure
|
|
1101
|
+
// `maskTextSelector`. This means that all nodes will have their text
|
|
1102
|
+
// content masked.
|
|
1103
|
+
this.recordingOptions.maskTextSelector = '*';
|
|
1104
|
+
}
|
|
1098
1105
|
}
|
|
1099
1106
|
/**
|
|
1100
1107
|
* Because we create a transaction in `setupOnce`, we can potentially create a
|
package/dist/index.js
CHANGED
|
@@ -805,7 +805,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
805
805
|
function SentryReplay(_a) {
|
|
806
806
|
if (_a === void 0) { _a = {}; }
|
|
807
807
|
var _this = this;
|
|
808
|
-
var _b = _a.flushMinDelay, flushMinDelay = _b === void 0 ? 5000 : _b, _c = _a.flushMaxDelay, flushMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.initialFlushDelay, initialFlushDelay = _d === void 0 ? 5000 : _d, _e = _a.stickySession, stickySession = _e === void 0 ? true : _e, _f = _a.useCompression, useCompression = _f === void 0 ? true : _f, _g = _a.captureOnlyOnError, captureOnlyOnError = _g === void 0 ? false : _g, _h = _a.replaysSamplingRate, replaysSamplingRate = _h === void 0 ? 1.0 : _h, _j = _a.
|
|
808
|
+
var _b = _a.flushMinDelay, flushMinDelay = _b === void 0 ? 5000 : _b, _c = _a.flushMaxDelay, flushMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.initialFlushDelay, initialFlushDelay = _d === void 0 ? 5000 : _d, _e = _a.stickySession, stickySession = _e === void 0 ? true : _e, _f = _a.useCompression, useCompression = _f === void 0 ? true : _f, _g = _a.captureOnlyOnError, captureOnlyOnError = _g === void 0 ? false : _g, _h = _a.replaysSamplingRate, replaysSamplingRate = _h === void 0 ? 1.0 : _h, _j = _a.maskAllText, maskAllText = _j === void 0 ? false : _j, _k = _a.recordingConfig, _l = _k === void 0 ? {} : _k, _m = _l.maskAllInputs, maskAllInputs = _m === void 0 ? true : _m, _o = _l.blockClass, blockClass = _o === void 0 ? 'sr-block' : _o, _p = _l.ignoreClass, ignoreClass = _p === void 0 ? 'sr-ignore' : _p, _q = _l.maskTextClass, maskTextClass = _q === void 0 ? 'sr-mask' : _q, recordingOptions = __rest(_l, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
|
|
809
809
|
/**
|
|
810
810
|
* @inheritDoc
|
|
811
811
|
*/
|
|
@@ -1097,12 +1097,19 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1097
1097
|
captureOnlyOnError: captureOnlyOnError,
|
|
1098
1098
|
replaysSamplingRate: replaysSamplingRate,
|
|
1099
1099
|
useCompression: useCompression,
|
|
1100
|
+
maskAllText: maskAllText,
|
|
1100
1101
|
};
|
|
1101
1102
|
// Modify rrweb options to checkoutEveryNthSecond if this is defined, as we don't know when an error occurs, so we want to try to minimize the number of events captured.
|
|
1102
1103
|
if (this.options.captureOnlyOnError) {
|
|
1103
1104
|
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
|
|
1104
1105
|
this.recordingOptions.checkoutEveryNms = 60000;
|
|
1105
1106
|
}
|
|
1107
|
+
if (this.options.maskAllText) {
|
|
1108
|
+
// `maskAllText` is a more user friendly option to configure
|
|
1109
|
+
// `maskTextSelector`. This means that all nodes will have their text
|
|
1110
|
+
// content masked.
|
|
1111
|
+
this.recordingOptions.maskTextSelector = '*';
|
|
1112
|
+
}
|
|
1106
1113
|
}
|
|
1107
1114
|
/**
|
|
1108
1115
|
* Because we create a transaction in `setupOnce`, we can potentially create a
|