@sentry/replay 0.6.7 → 0.6.9
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/dist/config/types/jest.config.d.ts +3 -0
- package/dist/config/types/jest.setup.d.ts +32 -0
- package/dist/config/types/src/blockAllMedia.test.d.ts +1 -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 +252 -0
- package/dist/config/types/src/index.test.d.ts +1 -0
- package/dist/config/types/src/multiple-instances.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 +6 -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 +105 -0
- package/dist/config/types/src/util/addInternalBreadcrumb.d.ts +5 -0
- package/dist/config/types/src/util/captureInternalException.d.ts +4 -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/dedupePerformanceEntries.d.ts +10 -0
- package/dist/config/types/src/util/dedupePerformanceEntries.test.d.ts +1 -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/isInternal.d.ts +5 -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/fixtures/performanceEntry/lcp.d.ts +1 -0
- package/dist/config/types/test/fixtures/performanceEntry/navigation.d.ts +1 -0
- package/dist/config/types/test/fixtures/performanceEntry/resource.d.ts +1 -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 +10 -0
- package/dist/index.es.js +31 -26
- package/dist/index.js +31 -26
- package/dist/index.js.map +1 -1
- package/dist/types/src/index.d.ts +9 -2
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { eventWithTime, recordOptions } from 'rrweb/typings/types';
|
|
2
|
+
export declare type RecordingEvent = eventWithTime;
|
|
3
|
+
export declare type RecordingOptions = recordOptions<eventWithTime>;
|
|
4
|
+
export declare type RecordedEvents = Uint8Array | string;
|
|
5
|
+
export declare type AllPerformanceEntry = PerformancePaintTiming | PerformanceResourceTiming | PerformanceNavigationTiming;
|
|
6
|
+
export interface SendReplayRequest {
|
|
7
|
+
endpoint: string;
|
|
8
|
+
events: RecordedEvents;
|
|
9
|
+
replayId: string;
|
|
10
|
+
segmentId: number;
|
|
11
|
+
includeReplayStartTimestamp: boolean;
|
|
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
|
+
declare global {
|
|
25
|
+
const __SENTRY_REPLAY_VERSION__: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The response from the worker
|
|
29
|
+
*/
|
|
30
|
+
export interface WorkerResponse {
|
|
31
|
+
id: number;
|
|
32
|
+
method: string;
|
|
33
|
+
success: boolean;
|
|
34
|
+
response: string | Uint8Array;
|
|
35
|
+
}
|
|
36
|
+
export interface ReplayPluginOptions {
|
|
37
|
+
/**
|
|
38
|
+
* The amount of time to wait before sending a replay
|
|
39
|
+
*/
|
|
40
|
+
flushMinDelay?: number;
|
|
41
|
+
/**
|
|
42
|
+
* The max amount of time to wait before sending a replay
|
|
43
|
+
*/
|
|
44
|
+
flushMaxDelay?: number;
|
|
45
|
+
/**
|
|
46
|
+
* The amount of time to buffer the initial snapshot
|
|
47
|
+
*/
|
|
48
|
+
initialFlushDelay?: number;
|
|
49
|
+
/**
|
|
50
|
+
* If false, will create a new session per pageload
|
|
51
|
+
*/
|
|
52
|
+
stickySession?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Attempt to use compression when web workers are available
|
|
55
|
+
*
|
|
56
|
+
* (default is true)
|
|
57
|
+
*/
|
|
58
|
+
useCompression?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Only capture replays when an error happens
|
|
61
|
+
*/
|
|
62
|
+
captureOnlyOnError?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The sampling rate for replays. 1.0 will record all replays, 0 will record none.
|
|
65
|
+
*/
|
|
66
|
+
replaysSamplingRate?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Mask all text in recordings. All text will be replaced with asterisks by default.
|
|
69
|
+
*/
|
|
70
|
+
maskAllText?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Block all media (e.g. images, svg, video) in recordings.
|
|
73
|
+
*/
|
|
74
|
+
blockAllMedia?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface ReplayConfiguration extends ReplayPluginOptions, RecordingOptions {
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Some initial state captured before creating a root replay event
|
|
80
|
+
*/
|
|
81
|
+
export interface InitialState {
|
|
82
|
+
timestamp: number;
|
|
83
|
+
url: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Additional context that will be sent w/ `replay_event`
|
|
87
|
+
*/
|
|
88
|
+
export interface ReplayEventContext {
|
|
89
|
+
/**
|
|
90
|
+
* Set of Sentry error ids that have occurred during a replay segment
|
|
91
|
+
*/
|
|
92
|
+
errorIds: Set<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Set of Sentry trace ids that have occurred during a replay segment
|
|
95
|
+
*/
|
|
96
|
+
traceIds: Set<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Ordered list of URLs that have been visited during a replay segment
|
|
99
|
+
*/
|
|
100
|
+
urls: string[];
|
|
101
|
+
/**
|
|
102
|
+
* The timestamp of the earliest event that has been added to event buffer. This can happen due to the Performance Observer which buffers events.
|
|
103
|
+
*/
|
|
104
|
+
earliestEvent: number | null;
|
|
105
|
+
}
|
|
@@ -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,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* There are some difficulties diagnosing why there are duplicate navigation
|
|
3
|
+
* entries. We've witnessed several intermittent results:
|
|
4
|
+
* - duplicate entries have duration = 0
|
|
5
|
+
* - duplicate entries are the same object reference
|
|
6
|
+
* - none of the above
|
|
7
|
+
*
|
|
8
|
+
* Compare the values of several keys to determine if the entries are duplicates or not.
|
|
9
|
+
*/
|
|
10
|
+
export declare function dedupePerformanceEntries(currentList: PerformanceEntryList, newList: PerformanceEntryList): PerformancePaintTiming[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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
|
+
info: (...args: unknown[]) => void;
|
|
8
|
+
debug: (...args: unknown[]) => void;
|
|
9
|
+
assert: (...args: unknown[]) => void;
|
|
10
|
+
trace: (...args: unknown[]) => void;
|
|
11
|
+
};
|
|
12
|
+
export { logger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PerformanceEntryLcp(obj?: Partial<PerformancePaintTiming>): PerformancePaintTiming;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PerformanceEntryNavigation(obj?: Partial<PerformanceNavigationTiming>): PerformanceNavigationTiming;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PerformanceEntryResource(obj?: Partial<PerformanceResourceTiming>): PerformanceResourceTiming;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { RecordingEvent } from '../../src/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,10 @@
|
|
|
1
|
+
import { BrowserOptions } from '@sentry/browser';
|
|
2
|
+
import { ReplayConfiguration } from '../../src/types';
|
|
3
|
+
interface MockSdkParams {
|
|
4
|
+
replayOptions?: ReplayConfiguration;
|
|
5
|
+
sentryOptions?: BrowserOptions;
|
|
6
|
+
}
|
|
7
|
+
export declare function mockSdk({ replayOptions, sentryOptions, }?: MockSdkParams): Promise<{
|
|
8
|
+
replay: import("../../src").Replay;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
package/dist/index.es.js
CHANGED
|
@@ -962,12 +962,10 @@ var Replay = /** @class */ (function () {
|
|
|
962
962
|
// XXX: Is it safe to assume that all other events are error events?
|
|
963
963
|
// @ts-expect-error: Type 'undefined' is not assignable to type 'string'.ts(2345)
|
|
964
964
|
_this.context.errorIds.add(event.event_id);
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
});
|
|
970
|
-
}
|
|
965
|
+
var exc = (_d = (_c = event.exception) === null || _c === void 0 ? void 0 : _c.values) === null || _d === void 0 ? void 0 : _d[0];
|
|
966
|
+
addInternalBreadcrumb({
|
|
967
|
+
message: "Tagging event (".concat(event.event_id, ") - ").concat(event.message, " - ").concat((exc === null || exc === void 0 ? void 0 : exc.type) || 'Unknown', ": ").concat((exc === null || exc === void 0 ? void 0 : exc.value) || 'n/a'),
|
|
968
|
+
});
|
|
971
969
|
// Need to be very careful that this does not cause an infinite loop
|
|
972
970
|
if (_this.options.captureOnlyOnError &&
|
|
973
971
|
event.exception &&
|
|
@@ -975,7 +973,7 @@ var Replay = /** @class */ (function () {
|
|
|
975
973
|
) {
|
|
976
974
|
// TODO: Do we continue to record after?
|
|
977
975
|
// TODO: What happens if another error happens? Do we record in the same session?
|
|
978
|
-
setTimeout(function () { return _this.
|
|
976
|
+
setTimeout(function () { return _this.flushImmediate(); });
|
|
979
977
|
}
|
|
980
978
|
return event;
|
|
981
979
|
};
|
|
@@ -1136,7 +1134,7 @@ var Replay = /** @class */ (function () {
|
|
|
1136
1134
|
};
|
|
1137
1135
|
/**
|
|
1138
1136
|
* Flush recording data to Sentry. Creates a lock so that only a single flush
|
|
1139
|
-
* can be active at a time.
|
|
1137
|
+
* can be active at a time. Do not call this directly.
|
|
1140
1138
|
*/
|
|
1141
1139
|
this.flush = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1142
1140
|
var err_1;
|
|
@@ -1600,7 +1598,7 @@ var Replay = /** @class */ (function () {
|
|
|
1600
1598
|
if (this.options.captureOnlyOnError) {
|
|
1601
1599
|
return;
|
|
1602
1600
|
}
|
|
1603
|
-
|
|
1601
|
+
this.flushImmediate();
|
|
1604
1602
|
};
|
|
1605
1603
|
/**
|
|
1606
1604
|
* Clear context
|
|
@@ -1639,40 +1637,36 @@ var Replay = /** @class */ (function () {
|
|
|
1639
1637
|
* Should never be called directly, only by `flush`
|
|
1640
1638
|
*/
|
|
1641
1639
|
Replay.prototype.runFlush = function () {
|
|
1642
|
-
var _a
|
|
1640
|
+
var _a;
|
|
1643
1641
|
return __awaiter(this, void 0, void 0, function () {
|
|
1644
|
-
var
|
|
1645
|
-
return __generator(this, function (
|
|
1646
|
-
switch (
|
|
1642
|
+
var replayId, newSessionCreated, segmentId, recordingData, err_2;
|
|
1643
|
+
return __generator(this, function (_b) {
|
|
1644
|
+
switch (_b.label) {
|
|
1647
1645
|
case 0:
|
|
1648
|
-
stack = ((_a = new Error('trace').stack) === null || _a === void 0 ? void 0 : _a.split('\n')) || [];
|
|
1649
|
-
addInternalBreadcrumb({
|
|
1650
|
-
message: "runFlush (".concat((_b = this.session) === null || _b === void 0 ? void 0 : _b.segmentId, ")\n\n").concat(stack.slice(1).join('\n')),
|
|
1651
|
-
});
|
|
1652
1646
|
if (!this.session) {
|
|
1653
1647
|
console.error(new Error('[Sentry]: No transaction, no replay'));
|
|
1654
1648
|
return [2 /*return*/];
|
|
1655
1649
|
}
|
|
1656
1650
|
return [4 /*yield*/, this.addPerformanceEntries()];
|
|
1657
1651
|
case 1:
|
|
1658
|
-
|
|
1659
|
-
if (!((
|
|
1652
|
+
_b.sent();
|
|
1653
|
+
if (!((_a = this.eventBuffer) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1660
1654
|
return [2 /*return*/];
|
|
1661
1655
|
}
|
|
1662
1656
|
// Only attach memory event if eventBuffer is not empty
|
|
1663
1657
|
return [4 /*yield*/, this.addMemoryEntry()];
|
|
1664
1658
|
case 2:
|
|
1665
1659
|
// Only attach memory event if eventBuffer is not empty
|
|
1666
|
-
|
|
1660
|
+
_b.sent();
|
|
1667
1661
|
replayId = this.session.id;
|
|
1668
1662
|
newSessionCreated = this.newSessionCreated;
|
|
1669
1663
|
segmentId = this.session.segmentId++;
|
|
1670
|
-
|
|
1664
|
+
_b.label = 3;
|
|
1671
1665
|
case 3:
|
|
1672
|
-
|
|
1666
|
+
_b.trys.push([3, 6, , 7]);
|
|
1673
1667
|
return [4 /*yield*/, this.eventBuffer.finish()];
|
|
1674
1668
|
case 4:
|
|
1675
|
-
recordingData =
|
|
1669
|
+
recordingData = _b.sent();
|
|
1676
1670
|
return [4 /*yield*/, this.sendReplay({
|
|
1677
1671
|
replayId: replayId,
|
|
1678
1672
|
events: recordingData,
|
|
@@ -1680,11 +1674,11 @@ var Replay = /** @class */ (function () {
|
|
|
1680
1674
|
includeReplayStartTimestamp: newSessionCreated,
|
|
1681
1675
|
})];
|
|
1682
1676
|
case 5:
|
|
1683
|
-
|
|
1677
|
+
_b.sent();
|
|
1684
1678
|
this.newSessionCreated = false;
|
|
1685
1679
|
return [3 /*break*/, 7];
|
|
1686
1680
|
case 6:
|
|
1687
|
-
err_2 =
|
|
1681
|
+
err_2 = _b.sent();
|
|
1688
1682
|
captureInternalException(err_2);
|
|
1689
1683
|
console.error(err_2);
|
|
1690
1684
|
return [3 /*break*/, 7];
|
|
@@ -1693,6 +1687,17 @@ var Replay = /** @class */ (function () {
|
|
|
1693
1687
|
});
|
|
1694
1688
|
});
|
|
1695
1689
|
};
|
|
1690
|
+
/**
|
|
1691
|
+
*
|
|
1692
|
+
* Always flush via `debouncedFlush` so that we do not have flushes triggered
|
|
1693
|
+
* from calling both `flush` and `debouncedFlush`. Otherwise, there could be
|
|
1694
|
+
* cases of mulitple flushes happening closely together.
|
|
1695
|
+
*/
|
|
1696
|
+
Replay.prototype.flushImmediate = function () {
|
|
1697
|
+
this.debouncedFlush();
|
|
1698
|
+
// `.flush` is provided by lodash.debounce
|
|
1699
|
+
this.debouncedFlush.flush();
|
|
1700
|
+
};
|
|
1696
1701
|
/**
|
|
1697
1702
|
* Send replay attachment using `fetch()`
|
|
1698
1703
|
*/
|
|
@@ -1715,7 +1720,7 @@ var Replay = /** @class */ (function () {
|
|
|
1715
1720
|
timestamp = new Date().getTime();
|
|
1716
1721
|
sdkInfo = {
|
|
1717
1722
|
name: 'sentry.javascript.integration.replay',
|
|
1718
|
-
version: "0.6.
|
|
1723
|
+
version: "0.6.9",
|
|
1719
1724
|
};
|
|
1720
1725
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1721
1726
|
var _a;
|
package/dist/index.js
CHANGED
|
@@ -970,12 +970,10 @@ var Replay = /** @class */ (function () {
|
|
|
970
970
|
// XXX: Is it safe to assume that all other events are error events?
|
|
971
971
|
// @ts-expect-error: Type 'undefined' is not assignable to type 'string'.ts(2345)
|
|
972
972
|
_this.context.errorIds.add(event.event_id);
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
});
|
|
978
|
-
}
|
|
973
|
+
var exc = (_d = (_c = event.exception) === null || _c === void 0 ? void 0 : _c.values) === null || _d === void 0 ? void 0 : _d[0];
|
|
974
|
+
addInternalBreadcrumb({
|
|
975
|
+
message: "Tagging event (".concat(event.event_id, ") - ").concat(event.message, " - ").concat((exc === null || exc === void 0 ? void 0 : exc.type) || 'Unknown', ": ").concat((exc === null || exc === void 0 ? void 0 : exc.value) || 'n/a'),
|
|
976
|
+
});
|
|
979
977
|
// Need to be very careful that this does not cause an infinite loop
|
|
980
978
|
if (_this.options.captureOnlyOnError &&
|
|
981
979
|
event.exception &&
|
|
@@ -983,7 +981,7 @@ var Replay = /** @class */ (function () {
|
|
|
983
981
|
) {
|
|
984
982
|
// TODO: Do we continue to record after?
|
|
985
983
|
// TODO: What happens if another error happens? Do we record in the same session?
|
|
986
|
-
setTimeout(function () { return _this.
|
|
984
|
+
setTimeout(function () { return _this.flushImmediate(); });
|
|
987
985
|
}
|
|
988
986
|
return event;
|
|
989
987
|
};
|
|
@@ -1144,7 +1142,7 @@ var Replay = /** @class */ (function () {
|
|
|
1144
1142
|
};
|
|
1145
1143
|
/**
|
|
1146
1144
|
* Flush recording data to Sentry. Creates a lock so that only a single flush
|
|
1147
|
-
* can be active at a time.
|
|
1145
|
+
* can be active at a time. Do not call this directly.
|
|
1148
1146
|
*/
|
|
1149
1147
|
this.flush = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1150
1148
|
var err_1;
|
|
@@ -1608,7 +1606,7 @@ var Replay = /** @class */ (function () {
|
|
|
1608
1606
|
if (this.options.captureOnlyOnError) {
|
|
1609
1607
|
return;
|
|
1610
1608
|
}
|
|
1611
|
-
|
|
1609
|
+
this.flushImmediate();
|
|
1612
1610
|
};
|
|
1613
1611
|
/**
|
|
1614
1612
|
* Clear context
|
|
@@ -1647,40 +1645,36 @@ var Replay = /** @class */ (function () {
|
|
|
1647
1645
|
* Should never be called directly, only by `flush`
|
|
1648
1646
|
*/
|
|
1649
1647
|
Replay.prototype.runFlush = function () {
|
|
1650
|
-
var _a
|
|
1648
|
+
var _a;
|
|
1651
1649
|
return __awaiter(this, void 0, void 0, function () {
|
|
1652
|
-
var
|
|
1653
|
-
return __generator(this, function (
|
|
1654
|
-
switch (
|
|
1650
|
+
var replayId, newSessionCreated, segmentId, recordingData, err_2;
|
|
1651
|
+
return __generator(this, function (_b) {
|
|
1652
|
+
switch (_b.label) {
|
|
1655
1653
|
case 0:
|
|
1656
|
-
stack = ((_a = new Error('trace').stack) === null || _a === void 0 ? void 0 : _a.split('\n')) || [];
|
|
1657
|
-
addInternalBreadcrumb({
|
|
1658
|
-
message: "runFlush (".concat((_b = this.session) === null || _b === void 0 ? void 0 : _b.segmentId, ")\n\n").concat(stack.slice(1).join('\n')),
|
|
1659
|
-
});
|
|
1660
1654
|
if (!this.session) {
|
|
1661
1655
|
console.error(new Error('[Sentry]: No transaction, no replay'));
|
|
1662
1656
|
return [2 /*return*/];
|
|
1663
1657
|
}
|
|
1664
1658
|
return [4 /*yield*/, this.addPerformanceEntries()];
|
|
1665
1659
|
case 1:
|
|
1666
|
-
|
|
1667
|
-
if (!((
|
|
1660
|
+
_b.sent();
|
|
1661
|
+
if (!((_a = this.eventBuffer) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1668
1662
|
return [2 /*return*/];
|
|
1669
1663
|
}
|
|
1670
1664
|
// Only attach memory event if eventBuffer is not empty
|
|
1671
1665
|
return [4 /*yield*/, this.addMemoryEntry()];
|
|
1672
1666
|
case 2:
|
|
1673
1667
|
// Only attach memory event if eventBuffer is not empty
|
|
1674
|
-
|
|
1668
|
+
_b.sent();
|
|
1675
1669
|
replayId = this.session.id;
|
|
1676
1670
|
newSessionCreated = this.newSessionCreated;
|
|
1677
1671
|
segmentId = this.session.segmentId++;
|
|
1678
|
-
|
|
1672
|
+
_b.label = 3;
|
|
1679
1673
|
case 3:
|
|
1680
|
-
|
|
1674
|
+
_b.trys.push([3, 6, , 7]);
|
|
1681
1675
|
return [4 /*yield*/, this.eventBuffer.finish()];
|
|
1682
1676
|
case 4:
|
|
1683
|
-
recordingData =
|
|
1677
|
+
recordingData = _b.sent();
|
|
1684
1678
|
return [4 /*yield*/, this.sendReplay({
|
|
1685
1679
|
replayId: replayId,
|
|
1686
1680
|
events: recordingData,
|
|
@@ -1688,11 +1682,11 @@ var Replay = /** @class */ (function () {
|
|
|
1688
1682
|
includeReplayStartTimestamp: newSessionCreated,
|
|
1689
1683
|
})];
|
|
1690
1684
|
case 5:
|
|
1691
|
-
|
|
1685
|
+
_b.sent();
|
|
1692
1686
|
this.newSessionCreated = false;
|
|
1693
1687
|
return [3 /*break*/, 7];
|
|
1694
1688
|
case 6:
|
|
1695
|
-
err_2 =
|
|
1689
|
+
err_2 = _b.sent();
|
|
1696
1690
|
captureInternalException(err_2);
|
|
1697
1691
|
console.error(err_2);
|
|
1698
1692
|
return [3 /*break*/, 7];
|
|
@@ -1701,6 +1695,17 @@ var Replay = /** @class */ (function () {
|
|
|
1701
1695
|
});
|
|
1702
1696
|
});
|
|
1703
1697
|
};
|
|
1698
|
+
/**
|
|
1699
|
+
*
|
|
1700
|
+
* Always flush via `debouncedFlush` so that we do not have flushes triggered
|
|
1701
|
+
* from calling both `flush` and `debouncedFlush`. Otherwise, there could be
|
|
1702
|
+
* cases of mulitple flushes happening closely together.
|
|
1703
|
+
*/
|
|
1704
|
+
Replay.prototype.flushImmediate = function () {
|
|
1705
|
+
this.debouncedFlush();
|
|
1706
|
+
// `.flush` is provided by lodash.debounce
|
|
1707
|
+
this.debouncedFlush.flush();
|
|
1708
|
+
};
|
|
1704
1709
|
/**
|
|
1705
1710
|
* Send replay attachment using `fetch()`
|
|
1706
1711
|
*/
|
|
@@ -1723,7 +1728,7 @@ var Replay = /** @class */ (function () {
|
|
|
1723
1728
|
timestamp = new Date().getTime();
|
|
1724
1729
|
sdkInfo = {
|
|
1725
1730
|
name: 'sentry.javascript.integration.replay',
|
|
1726
|
-
version: "0.6.
|
|
1731
|
+
version: "0.6.9",
|
|
1727
1732
|
};
|
|
1728
1733
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1729
1734
|
var _a;
|