@sentry/replay 7.88.0 → 7.90.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/cjs/index.js +92 -32
- package/cjs/index.js.map +1 -1
- package/esm/index.js +93 -33
- package/esm/index.js.map +1 -1
- package/package.json +6 -6
- package/types/constants.d.ts +29 -0
- package/types/constants.d.ts.map +1 -1
- package/types/coreHandlers/handleGlobalEvent.d.ts.map +1 -1
- package/types/coreHandlers/handleNetworkBreadcrumbs.d.ts.map +1 -1
- package/types/coreHandlers/util/addBreadcrumbEvent.d.ts.map +1 -1
- package/types/coreHandlers/util/addFeedbackBreadcrumb.d.ts.map +1 -1
- package/types/eventBuffer/EventBufferCompressionWorker.d.ts.map +1 -1
- package/types/replay.d.ts.map +1 -1
- package/types/types/replay.d.ts +1 -2
- package/types/types/replay.d.ts.map +1 -1
- package/types/util/addEvent.d.ts.map +1 -1
- package/types/util/addGlobalListeners.d.ts.map +1 -1
- package/types/util/handleRecordingEmit.d.ts.map +1 -1
- package/types/util/sendReplayRequest.d.ts.map +1 -1
- package/types-ts3.8/constants.d.ts +29 -0
- package/types-ts3.8/types/replay.d.ts +1 -2
package/cjs/index.js
CHANGED
|
@@ -54,6 +54,36 @@ const MIN_REPLAY_DURATION_LIMIT = 15000;
|
|
|
54
54
|
/** The max. length of a replay. */
|
|
55
55
|
const MAX_REPLAY_DURATION = 3600000; // 60 minutes in ms;
|
|
56
56
|
|
|
57
|
+
const CANVAS_QUALITY = {
|
|
58
|
+
low: {
|
|
59
|
+
sampling: {
|
|
60
|
+
canvas: 1,
|
|
61
|
+
},
|
|
62
|
+
dataURLOptions: {
|
|
63
|
+
type: 'image/webp',
|
|
64
|
+
quality: 0.25,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
medium: {
|
|
68
|
+
sampling: {
|
|
69
|
+
canvas: 2,
|
|
70
|
+
},
|
|
71
|
+
dataURLOptions: {
|
|
72
|
+
type: 'image/webp',
|
|
73
|
+
quality: 0.4,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
high: {
|
|
77
|
+
sampling: {
|
|
78
|
+
canvas: 4,
|
|
79
|
+
},
|
|
80
|
+
dataURLOptions: {
|
|
81
|
+
type: 'image/webp',
|
|
82
|
+
quality: 0.5,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
57
87
|
var NodeType$1;
|
|
58
88
|
(function (NodeType) {
|
|
59
89
|
NodeType[NodeType["Document"] = 0] = "Document";
|
|
@@ -3916,7 +3946,9 @@ function addBreadcrumbEvent(replay, breadcrumb) {
|
|
|
3916
3946
|
}
|
|
3917
3947
|
|
|
3918
3948
|
replay.addUpdate(() => {
|
|
3919
|
-
|
|
3949
|
+
// This should never reject
|
|
3950
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
3951
|
+
replay.throttledAddEvent({
|
|
3920
3952
|
type: EventType.Custom,
|
|
3921
3953
|
// TODO: We were converting from ms to seconds for breadcrumbs, spans,
|
|
3922
3954
|
// but maybe we should just keep them as milliseconds
|
|
@@ -4739,7 +4771,7 @@ function logInfo(message, shouldAddBreadcrumb) {
|
|
|
4739
4771
|
utils.logger.info(message);
|
|
4740
4772
|
|
|
4741
4773
|
if (shouldAddBreadcrumb) {
|
|
4742
|
-
|
|
4774
|
+
addLogBreadcrumb(message);
|
|
4743
4775
|
}
|
|
4744
4776
|
}
|
|
4745
4777
|
|
|
@@ -4758,14 +4790,13 @@ function logInfoNextTick(message, shouldAddBreadcrumb) {
|
|
|
4758
4790
|
// Wait a tick here to avoid race conditions for some initial logs
|
|
4759
4791
|
// which may be added before replay is initialized
|
|
4760
4792
|
setTimeout(() => {
|
|
4761
|
-
|
|
4793
|
+
addLogBreadcrumb(message);
|
|
4762
4794
|
}, 0);
|
|
4763
4795
|
}
|
|
4764
4796
|
}
|
|
4765
4797
|
|
|
4766
|
-
function
|
|
4767
|
-
|
|
4768
|
-
hub.addBreadcrumb(
|
|
4798
|
+
function addLogBreadcrumb(message) {
|
|
4799
|
+
core.addBreadcrumb(
|
|
4769
4800
|
{
|
|
4770
4801
|
category: 'console',
|
|
4771
4802
|
data: {
|
|
@@ -5031,7 +5062,9 @@ class EventBufferCompressionWorker {
|
|
|
5031
5062
|
this.hasCheckout = false;
|
|
5032
5063
|
|
|
5033
5064
|
// We do not wait on this, as we assume the order of messages is consistent for the worker
|
|
5034
|
-
|
|
5065
|
+
this._worker.postMessage('clear').then(null, e => {
|
|
5066
|
+
DEBUG_BUILD && utils.logger.warn('[Replay] Sending "clear" message to worker failed', e);
|
|
5067
|
+
});
|
|
5035
5068
|
}
|
|
5036
5069
|
|
|
5037
5070
|
/** @inheritdoc */
|
|
@@ -5467,7 +5500,9 @@ function addEventSync(replay, event, isCheckout) {
|
|
|
5467
5500
|
return false;
|
|
5468
5501
|
}
|
|
5469
5502
|
|
|
5470
|
-
|
|
5503
|
+
// This should never reject
|
|
5504
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5505
|
+
_addEvent(replay, event, isCheckout);
|
|
5471
5506
|
|
|
5472
5507
|
return true;
|
|
5473
5508
|
}
|
|
@@ -5664,7 +5699,9 @@ function handleErrorEvent(replay, event) {
|
|
|
5664
5699
|
|
|
5665
5700
|
setTimeout(() => {
|
|
5666
5701
|
// Capture current event buffer as new replay
|
|
5667
|
-
|
|
5702
|
+
// This should never reject
|
|
5703
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5704
|
+
replay.sendBufferedReplayOrFlush();
|
|
5668
5705
|
});
|
|
5669
5706
|
}
|
|
5670
5707
|
|
|
@@ -5708,8 +5745,9 @@ function handleHydrationError(replay, event) {
|
|
|
5708
5745
|
// Example https://reactjs.org/docs/error-decoder.html?invariant=423
|
|
5709
5746
|
exceptionValue.match(/reactjs\.org\/docs\/error-decoder\.html\?invariant=(418|419|422|423|425)/) ||
|
|
5710
5747
|
// Development builds of react-dom
|
|
5711
|
-
//
|
|
5712
|
-
|
|
5748
|
+
// Error 1: Hydration failed because the initial UI does not match what was rendered on the server.
|
|
5749
|
+
// Error 2: Text content does not match server-rendered HTML. Warning: Text content did not match.
|
|
5750
|
+
exceptionValue.match(/(does not match server-rendered HTML|Hydration failed because)/i)
|
|
5713
5751
|
) {
|
|
5714
5752
|
const breadcrumb = createBreadcrumb({
|
|
5715
5753
|
category: 'replay.hydrate-error',
|
|
@@ -5746,7 +5784,9 @@ function addFeedbackBreadcrumb(replay, event) {
|
|
|
5746
5784
|
return true;
|
|
5747
5785
|
}
|
|
5748
5786
|
|
|
5749
|
-
|
|
5787
|
+
// This should never reject
|
|
5788
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5789
|
+
replay.throttledAddEvent({
|
|
5750
5790
|
type: EventType.Custom,
|
|
5751
5791
|
timestamp: event.timestamp * 1000,
|
|
5752
5792
|
data: {
|
|
@@ -5824,7 +5864,9 @@ function handleGlobalEventListener(
|
|
|
5824
5864
|
}
|
|
5825
5865
|
|
|
5826
5866
|
if (isFeedbackEvent(event)) {
|
|
5827
|
-
|
|
5867
|
+
// This should never reject
|
|
5868
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5869
|
+
replay.flush();
|
|
5828
5870
|
event.contexts.feedback.replay_id = replay.getSessionId();
|
|
5829
5871
|
// Add a replay breadcrumb for this piece of feedback
|
|
5830
5872
|
addFeedbackBreadcrumb(replay, event);
|
|
@@ -5945,7 +5987,7 @@ function shouldFilterRequest(replay, url) {
|
|
|
5945
5987
|
return false;
|
|
5946
5988
|
}
|
|
5947
5989
|
|
|
5948
|
-
return core.isSentryRequestUrl(url, core.
|
|
5990
|
+
return core.isSentryRequestUrl(url, core.getClient());
|
|
5949
5991
|
}
|
|
5950
5992
|
|
|
5951
5993
|
/** Add a performance entry breadcrumb */
|
|
@@ -6878,7 +6920,9 @@ function beforeAddNetworkBreadcrumb(
|
|
|
6878
6920
|
// So any async mutations to it will not be reflected in the final breadcrumb
|
|
6879
6921
|
enrichXhrBreadcrumb(breadcrumb, hint, options);
|
|
6880
6922
|
|
|
6881
|
-
|
|
6923
|
+
// This call should not reject
|
|
6924
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6925
|
+
captureXhrBreadcrumbToReplay(breadcrumb, hint, options);
|
|
6882
6926
|
}
|
|
6883
6927
|
|
|
6884
6928
|
if (_isFetchBreadcrumb(breadcrumb) && _isFetchHint(hint)) {
|
|
@@ -6887,7 +6931,9 @@ function beforeAddNetworkBreadcrumb(
|
|
|
6887
6931
|
// So any async mutations to it will not be reflected in the final breadcrumb
|
|
6888
6932
|
enrichFetchBreadcrumb(breadcrumb, hint, options);
|
|
6889
6933
|
|
|
6890
|
-
|
|
6934
|
+
// This call should not reject
|
|
6935
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6936
|
+
captureFetchBreadcrumbToReplay(breadcrumb, hint, options);
|
|
6891
6937
|
}
|
|
6892
6938
|
} catch (e) {
|
|
6893
6939
|
DEBUG_BUILD && utils.logger.warn('Error when enriching network breadcrumb');
|
|
@@ -7023,7 +7069,7 @@ function normalizeConsoleBreadcrumb(
|
|
|
7023
7069
|
*/
|
|
7024
7070
|
function addGlobalListeners(replay) {
|
|
7025
7071
|
// Listeners from core SDK //
|
|
7026
|
-
const scope = core.
|
|
7072
|
+
const scope = core.getCurrentScope();
|
|
7027
7073
|
const client = core.getClient();
|
|
7028
7074
|
|
|
7029
7075
|
scope.addScopeListener(handleScopeListener(replay));
|
|
@@ -7070,7 +7116,9 @@ function addGlobalListeners(replay) {
|
|
|
7070
7116
|
client.on('beforeSendFeedback', (feedbackEvent, options) => {
|
|
7071
7117
|
const replayId = replay.getSessionId();
|
|
7072
7118
|
if (options && options.includeReplay && replay.isEnabled() && replayId) {
|
|
7073
|
-
|
|
7119
|
+
// This should never reject
|
|
7120
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
7121
|
+
replay.flush();
|
|
7074
7122
|
if (feedbackEvent.contexts && feedbackEvent.contexts.feedback) {
|
|
7075
7123
|
feedbackEvent.contexts.feedback.replay_id = replayId;
|
|
7076
7124
|
}
|
|
@@ -7276,6 +7324,9 @@ function getHandleRecordingEmit(replay) {
|
|
|
7276
7324
|
// a previous session ID. In this case, we want to buffer events
|
|
7277
7325
|
// for a set amount of time before flushing. This can help avoid
|
|
7278
7326
|
// capturing replays of users that immediately close the window.
|
|
7327
|
+
|
|
7328
|
+
// This should never reject
|
|
7329
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
7279
7330
|
void replay.flush();
|
|
7280
7331
|
}
|
|
7281
7332
|
|
|
@@ -7456,9 +7507,8 @@ async function sendReplayRequest({
|
|
|
7456
7507
|
|
|
7457
7508
|
const { urls, errorIds, traceIds, initialTimestamp } = eventContext;
|
|
7458
7509
|
|
|
7459
|
-
const
|
|
7460
|
-
const
|
|
7461
|
-
const scope = hub.getScope();
|
|
7510
|
+
const client = core.getClient();
|
|
7511
|
+
const scope = core.getCurrentScope();
|
|
7462
7512
|
const transport = client && client.getTransport();
|
|
7463
7513
|
const dsn = client && client.getDsn();
|
|
7464
7514
|
|
|
@@ -7959,12 +8009,12 @@ class ReplayContainer {
|
|
|
7959
8009
|
...(this.recordingMode === 'buffer' && { checkoutEveryNms: BUFFER_CHECKOUT_TIME }),
|
|
7960
8010
|
emit: getHandleRecordingEmit(this),
|
|
7961
8011
|
onMutation: this._onMutationHandler,
|
|
7962
|
-
...(canvas &&
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
8012
|
+
...(canvas &&
|
|
8013
|
+
canvas.manager && {
|
|
8014
|
+
recordCanvas: true,
|
|
8015
|
+
getCanvasManager: canvas.manager,
|
|
8016
|
+
...(CANVAS_QUALITY[canvas.quality || 'medium'] || CANVAS_QUALITY.medium),
|
|
8017
|
+
}),
|
|
7968
8018
|
});
|
|
7969
8019
|
} catch (err) {
|
|
7970
8020
|
this._handleException(err);
|
|
@@ -8317,7 +8367,7 @@ class ReplayContainer {
|
|
|
8317
8367
|
* This is only available if performance is enabled, and if an instrumented router is used.
|
|
8318
8368
|
*/
|
|
8319
8369
|
getCurrentRoute() {
|
|
8320
|
-
const lastTransaction = this.lastTransaction || core.
|
|
8370
|
+
const lastTransaction = this.lastTransaction || core.getCurrentScope().getTransaction();
|
|
8321
8371
|
if (!lastTransaction || !['route', 'custom'].includes(lastTransaction.metadata.source)) {
|
|
8322
8372
|
return undefined;
|
|
8323
8373
|
}
|
|
@@ -8404,7 +8454,9 @@ class ReplayContainer {
|
|
|
8404
8454
|
maxReplayDuration: this._options.maxReplayDuration,
|
|
8405
8455
|
})
|
|
8406
8456
|
) {
|
|
8407
|
-
|
|
8457
|
+
// This should never reject
|
|
8458
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8459
|
+
this._refreshSession(currentSession);
|
|
8408
8460
|
return false;
|
|
8409
8461
|
}
|
|
8410
8462
|
|
|
@@ -8543,6 +8595,8 @@ class ReplayContainer {
|
|
|
8543
8595
|
// Send replay when the page/tab becomes hidden. There is no reason to send
|
|
8544
8596
|
// replay if it becomes visible, since no actions we care about were done
|
|
8545
8597
|
// while it was hidden
|
|
8598
|
+
// This should never reject
|
|
8599
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8546
8600
|
void this.conditionalFlush();
|
|
8547
8601
|
}
|
|
8548
8602
|
|
|
@@ -8591,7 +8645,9 @@ class ReplayContainer {
|
|
|
8591
8645
|
*/
|
|
8592
8646
|
_createCustomBreadcrumb(breadcrumb) {
|
|
8593
8647
|
this.addUpdate(() => {
|
|
8594
|
-
|
|
8648
|
+
// This should never reject
|
|
8649
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8650
|
+
this.throttledAddEvent({
|
|
8595
8651
|
type: EventType.Custom,
|
|
8596
8652
|
timestamp: breadcrumb.timestamp || 0,
|
|
8597
8653
|
data: {
|
|
@@ -8732,7 +8788,9 @@ class ReplayContainer {
|
|
|
8732
8788
|
// This means we retried 3 times and all of them failed,
|
|
8733
8789
|
// or we ran into a problem we don't want to retry, like rate limiting.
|
|
8734
8790
|
// In this case, we want to completely stop the replay - otherwise, we may get inconsistent segments
|
|
8735
|
-
|
|
8791
|
+
// This should never reject
|
|
8792
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8793
|
+
this.stop({ reason: 'sendReplay' });
|
|
8736
8794
|
|
|
8737
8795
|
const client = core.getClient();
|
|
8738
8796
|
|
|
@@ -8851,7 +8909,9 @@ class ReplayContainer {
|
|
|
8851
8909
|
|
|
8852
8910
|
// Stop replay if over the mutation limit
|
|
8853
8911
|
if (overMutationLimit) {
|
|
8854
|
-
|
|
8912
|
+
// This should never reject
|
|
8913
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8914
|
+
this.stop({ reason: 'mutationLimit', forceFlush: this.recordingMode === 'session' });
|
|
8855
8915
|
return false;
|
|
8856
8916
|
}
|
|
8857
8917
|
|