@sentry/replay 7.35.0 → 7.36.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 +16 -50
- package/cjs/index.js.map +1 -1
- package/esm/index.js +17 -51
- package/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/types/integration.d.ts +1 -1
- package/types/integration.d.ts.map +1 -1
- package/types/replay.d.ts +0 -4
- package/types/replay.d.ts.map +1 -1
- package/types/types/rrweb.d.ts +1 -0
- package/types/types/rrweb.d.ts.map +1 -1
- package/types/types.d.ts +8 -4
- package/types/types.d.ts.map +1 -1
- package/types/util/getPrivacyOptions.d.ts +1 -1
- package/types/util/getPrivacyOptions.d.ts.map +1 -1
- package/types/util/prepareReplayEvent.d.ts +4 -1
- package/types/util/prepareReplayEvent.d.ts.map +1 -1
- package/types/util/sendReplayRequest.d.ts +0 -8
- package/types/util/sendReplayRequest.d.ts.map +1 -1
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getCurrentHub, addBreadcrumb, addGlobalEventProcessor, prepareEvent, setContext, captureException } from '@sentry/core';
|
|
2
|
-
import { GLOBAL_OBJ, logger, uuid4, htmlTreeAsString, addInstrumentationHandler, browserPerformanceTimeOrigin, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader,
|
|
2
|
+
import { GLOBAL_OBJ, logger, uuid4, htmlTreeAsString, addInstrumentationHandler, browserPerformanceTimeOrigin, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, isNodeEnv, dropUndefinedKeys } from '@sentry/utils';
|
|
3
3
|
|
|
4
4
|
// exporting a separate copy of `WINDOW` rather than exporting the one from `@sentry/browser`
|
|
5
5
|
// prevents the browser package from being bundled in the CDN bundle, and avoids a
|
|
@@ -4858,7 +4858,16 @@ async function prepareReplayEvent({
|
|
|
4858
4858
|
}
|
|
4859
4859
|
|
|
4860
4860
|
) {
|
|
4861
|
-
const
|
|
4861
|
+
const integrations =
|
|
4862
|
+
typeof client._integrations === 'object' && client._integrations !== null && !Array.isArray(client._integrations)
|
|
4863
|
+
? Object.keys(client._integrations)
|
|
4864
|
+
: undefined;
|
|
4865
|
+
const preparedEvent = (await prepareEvent(
|
|
4866
|
+
client.getOptions(),
|
|
4867
|
+
event,
|
|
4868
|
+
{ event_id, integrations },
|
|
4869
|
+
scope,
|
|
4870
|
+
)) ;
|
|
4862
4871
|
|
|
4863
4872
|
// If e.g. a global event processor returned null
|
|
4864
4873
|
if (!preparedEvent) {
|
|
@@ -4999,11 +5008,6 @@ async function sendReplayRequest({
|
|
|
4999
5008
|
return response;
|
|
5000
5009
|
}
|
|
5001
5010
|
|
|
5002
|
-
const rateLimits = updateRateLimits({}, response);
|
|
5003
|
-
if (isRateLimited(rateLimits, 'replay')) {
|
|
5004
|
-
throw new RateLimitError(rateLimits);
|
|
5005
|
-
}
|
|
5006
|
-
|
|
5007
5011
|
// If the status code is invalid, we want to immediately stop & not retry
|
|
5008
5012
|
if (typeof response.statusCode === 'number' && (response.statusCode < 200 || response.statusCode >= 300)) {
|
|
5009
5013
|
throw new TransportStatusCodeError(response.statusCode);
|
|
@@ -5012,17 +5016,6 @@ async function sendReplayRequest({
|
|
|
5012
5016
|
return response;
|
|
5013
5017
|
}
|
|
5014
5018
|
|
|
5015
|
-
/**
|
|
5016
|
-
* This error indicates that we hit a rate limit API error.
|
|
5017
|
-
*/
|
|
5018
|
-
class RateLimitError extends Error {
|
|
5019
|
-
|
|
5020
|
-
constructor(rateLimits) {
|
|
5021
|
-
super('Rate limit hit');
|
|
5022
|
-
this.rateLimits = rateLimits;
|
|
5023
|
-
}
|
|
5024
|
-
}
|
|
5025
|
-
|
|
5026
5019
|
/**
|
|
5027
5020
|
* This error indicates that the transport returned an invalid status code.
|
|
5028
5021
|
*/
|
|
@@ -5053,7 +5046,7 @@ async function sendReplay(
|
|
|
5053
5046
|
await sendReplayRequest(replayData);
|
|
5054
5047
|
return true;
|
|
5055
5048
|
} catch (err) {
|
|
5056
|
-
if (err instanceof
|
|
5049
|
+
if (err instanceof TransportStatusCodeError) {
|
|
5057
5050
|
throw err;
|
|
5058
5051
|
}
|
|
5059
5052
|
|
|
@@ -5517,8 +5510,8 @@ class ReplayContainer {
|
|
|
5517
5510
|
this._handleException(err);
|
|
5518
5511
|
}
|
|
5519
5512
|
|
|
5520
|
-
//
|
|
5521
|
-
if (!('
|
|
5513
|
+
// PerformanceObserver //
|
|
5514
|
+
if (!('PerformanceObserver' in WINDOW)) {
|
|
5522
5515
|
return;
|
|
5523
5516
|
}
|
|
5524
5517
|
|
|
@@ -5850,11 +5843,6 @@ class ReplayContainer {
|
|
|
5850
5843
|
} catch (err) {
|
|
5851
5844
|
this._handleException(err);
|
|
5852
5845
|
|
|
5853
|
-
if (err instanceof RateLimitError) {
|
|
5854
|
-
this._handleRateLimit(err.rateLimits);
|
|
5855
|
-
return;
|
|
5856
|
-
}
|
|
5857
|
-
|
|
5858
5846
|
// This means we retried 3 times, and all of them failed
|
|
5859
5847
|
// In this case, we want to completely stop the replay - otherwise, we may get inconsistent segments
|
|
5860
5848
|
this.stop();
|
|
@@ -5914,31 +5902,6 @@ class ReplayContainer {
|
|
|
5914
5902
|
saveSession(this.session);
|
|
5915
5903
|
}
|
|
5916
5904
|
}
|
|
5917
|
-
|
|
5918
|
-
/**
|
|
5919
|
-
* Pauses the replay and resumes it after the rate-limit duration is over.
|
|
5920
|
-
*/
|
|
5921
|
-
_handleRateLimit(rateLimits) {
|
|
5922
|
-
// in case recording is already paused, we don't need to do anything, as we might have already paused because of a
|
|
5923
|
-
// rate limit
|
|
5924
|
-
if (this.isPaused()) {
|
|
5925
|
-
return;
|
|
5926
|
-
}
|
|
5927
|
-
|
|
5928
|
-
const rateLimitEnd = disabledUntil(rateLimits, 'replay');
|
|
5929
|
-
const rateLimitDuration = rateLimitEnd - Date.now();
|
|
5930
|
-
|
|
5931
|
-
if (rateLimitDuration > 0) {
|
|
5932
|
-
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.warn('[Replay]', `Rate limit hit, pausing replay for ${rateLimitDuration}ms`);
|
|
5933
|
-
this.pause();
|
|
5934
|
-
this._debouncedFlush.cancel();
|
|
5935
|
-
|
|
5936
|
-
setTimeout(() => {
|
|
5937
|
-
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.info('[Replay]', 'Resuming replay after rate limit');
|
|
5938
|
-
this.resume();
|
|
5939
|
-
}, rateLimitDuration);
|
|
5940
|
-
}
|
|
5941
|
-
}
|
|
5942
5905
|
}
|
|
5943
5906
|
|
|
5944
5907
|
function getOption(
|
|
@@ -6088,6 +6051,8 @@ class Replay {
|
|
|
6088
6051
|
// eslint-disable-next-line deprecation/deprecation
|
|
6089
6052
|
blockSelector,
|
|
6090
6053
|
// eslint-disable-next-line deprecation/deprecation
|
|
6054
|
+
maskInputOptions,
|
|
6055
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
6091
6056
|
maskTextClass,
|
|
6092
6057
|
// eslint-disable-next-line deprecation/deprecation
|
|
6093
6058
|
maskTextSelector,
|
|
@@ -6096,6 +6061,7 @@ class Replay {
|
|
|
6096
6061
|
} = {}) {Replay.prototype.__init.call(this);
|
|
6097
6062
|
this._recordingOptions = {
|
|
6098
6063
|
maskAllInputs,
|
|
6064
|
+
maskInputOptions: { ...(maskInputOptions || {}), password: true },
|
|
6099
6065
|
maskTextFn: maskFn,
|
|
6100
6066
|
maskInputFn: maskFn,
|
|
6101
6067
|
|