@sentry/replay 11.0.0-alpha.1 → 11.0.0-alpha.2
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/build/npm/cjs/index.js +29 -9
- package/build/npm/cjs/index.js.map +1 -1
- package/build/npm/esm/index.js +30 -10
- package/build/npm/esm/index.js.map +1 -1
- package/build/npm/esm/package.json +1 -1
- package/build/npm/types/coreHandlers/handleBeforeSendEvent.d.ts.map +1 -1
- package/build/npm/types/coreHandlers/handleDom.d.ts +2 -1
- package/build/npm/types/coreHandlers/handleDom.d.ts.map +1 -1
- package/build/npm/types/coreHandlers/handleHistory.d.ts +1 -1
- package/build/npm/types/coreHandlers/handleHistory.d.ts.map +1 -1
- package/build/npm/types/coreHandlers/util/getAttributesToRecord.d.ts +6 -0
- package/build/npm/types/coreHandlers/util/getAttributesToRecord.d.ts.map +1 -1
- package/build/npm/types/eventBuffer/EventBufferProxy.d.ts.map +1 -1
- package/build/npm/types/eventBuffer/WorkerHandler.d.ts.map +1 -1
- package/build/npm/types/eventBuffer/error.d.ts +4 -0
- package/build/npm/types/eventBuffer/error.d.ts.map +1 -1
- package/build/npm/types/replay.d.ts.map +1 -1
- package/build/npm/types/util/handleRecordingEmit.d.ts.map +1 -1
- package/package.json +5 -4
package/build/npm/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GLOBAL_OBJ, normalize, isObjectLike, fill, browserPerformanceTimeOrigin, debug as debug$1, severityLevelFromString, captureException, addBreadcrumb, uuid4, getClient,
|
|
2
|
-
import { setTimeout as setTimeout$3, htmlTreeAsString, addPerformanceInstrumentationHandler, addLcpInstrumentationHandler, addClsInstrumentationHandler, addInpInstrumentationHandler, serializeFormData, getFetchRequestArgBody, getBodyString, SENTRY_XHR_DATA_KEY, parseXhrResponseHeaders, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler } from '@sentry/browser-utils';
|
|
1
|
+
import { GLOBAL_OBJ, normalize, isObjectLike, fill, browserPerformanceTimeOrigin, debug as debug$1, severityLevelFromString, captureException, addBreadcrumb, uuid4, getClient, getCurrentScope, getActiveSpan, getDynamicSamplingContextFromSpan, isSentryRequestUrl, stringMatchesSomePattern, addEventProcessor, debounce as debounce$1, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, prepareEvent, getIsolationScope, updateRateLimits, isRateLimited, setContext, getRootSpan, spanToJSON, isBrowser, safeSetSpanJSONAttributes, parseSampleRate, consoleSandbox } from '@sentry/core';
|
|
2
|
+
import { setTimeout as setTimeout$3, htmlTreeAsString, addPerformanceInstrumentationHandler, addLcpInstrumentationHandler, addClsInstrumentationHandler, addInpInstrumentationHandler, getLocationHref, serializeFormData, getFetchRequestArgBody, getBodyString, SENTRY_XHR_DATA_KEY, parseXhrResponseHeaders, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler } from '@sentry/browser-utils';
|
|
3
3
|
|
|
4
4
|
const WINDOW = GLOBAL_OBJ;
|
|
5
5
|
const REPLAY_SESSION_KEY = "sentryReplaySession";
|
|
@@ -21,6 +21,8 @@ const MIN_REPLAY_DURATION = 4999;
|
|
|
21
21
|
const MIN_REPLAY_DURATION_LIMIT = 5e4;
|
|
22
22
|
const MAX_REPLAY_DURATION = 36e5;
|
|
23
23
|
|
|
24
|
+
const jd="sentry.segment.name.source";
|
|
25
|
+
|
|
24
26
|
var __defProp = Object.defineProperty;
|
|
25
27
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
26
28
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -4915,11 +4917,9 @@ const ATTRIBUTES_TO_RECORD = /* @__PURE__ */ new Set([
|
|
|
4915
4917
|
"aria-disabled",
|
|
4916
4918
|
"data-sentry-component"
|
|
4917
4919
|
]);
|
|
4920
|
+
const BREADCRUMB_RELEVANT_ATTRIBUTES = /* @__PURE__ */ new Set([...ATTRIBUTES_TO_RECORD, "data-sentry-element"]);
|
|
4918
4921
|
function getAttributesToRecord(attributes) {
|
|
4919
4922
|
const obj = {};
|
|
4920
|
-
if (!attributes["data-sentry-component"] && attributes["data-sentry-element"]) {
|
|
4921
|
-
attributes["data-sentry-component"] = attributes["data-sentry-element"];
|
|
4922
|
-
}
|
|
4923
4923
|
for (const key in attributes) {
|
|
4924
4924
|
if (ATTRIBUTES_TO_RECORD.has(key)) {
|
|
4925
4925
|
let normalizedKey = key;
|
|
@@ -4929,6 +4929,9 @@ function getAttributesToRecord(attributes) {
|
|
|
4929
4929
|
obj[normalizedKey] = attributes[key];
|
|
4930
4930
|
}
|
|
4931
4931
|
}
|
|
4932
|
+
if (!obj["data-sentry-component"] && attributes["data-sentry-element"]) {
|
|
4933
|
+
obj["data-sentry-component"] = attributes["data-sentry-element"];
|
|
4934
|
+
}
|
|
4932
4935
|
return obj;
|
|
4933
4936
|
}
|
|
4934
4937
|
|
|
@@ -5289,6 +5292,11 @@ class EventBufferSizeExceededError extends Error {
|
|
|
5289
5292
|
super(`Event buffer exceeded maximum size of ${REPLAY_MAX_EVENT_BUFFER_SIZE}.`);
|
|
5290
5293
|
}
|
|
5291
5294
|
}
|
|
5295
|
+
class WorkerDestroyedError extends Error {
|
|
5296
|
+
constructor() {
|
|
5297
|
+
super("Worker destroyed");
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5292
5300
|
|
|
5293
5301
|
class EventBufferArray {
|
|
5294
5302
|
constructor() {
|
|
@@ -5408,7 +5416,7 @@ class WorkerHandler {
|
|
|
5408
5416
|
destroy() {
|
|
5409
5417
|
DEBUG_BUILD && debug.log("Destroying compression worker");
|
|
5410
5418
|
this._worker.removeEventListener("message", this._onMessage);
|
|
5411
|
-
this._pending.forEach((pending) => pending.reject(new
|
|
5419
|
+
this._pending.forEach((pending) => pending.reject(new WorkerDestroyedError()));
|
|
5412
5420
|
this._pending.clear();
|
|
5413
5421
|
this._worker.terminate();
|
|
5414
5422
|
}
|
|
@@ -5605,6 +5613,9 @@ class EventBufferProxy {
|
|
|
5605
5613
|
await Promise.all(addEventPromises);
|
|
5606
5614
|
this._fallback.clear();
|
|
5607
5615
|
} catch (error) {
|
|
5616
|
+
if (error instanceof WorkerDestroyedError) {
|
|
5617
|
+
return;
|
|
5618
|
+
}
|
|
5608
5619
|
DEBUG_BUILD && debug.exception(error, "Failed to add events when switching buffers.");
|
|
5609
5620
|
}
|
|
5610
5621
|
}
|
|
@@ -6906,15 +6917,24 @@ function syncMirrorAttributesFromMutationEvent(event) {
|
|
|
6906
6917
|
for (const mutation of data.attributes) {
|
|
6907
6918
|
const node = record.mirror.getNode(mutation.id);
|
|
6908
6919
|
const meta = node && record.mirror.getMeta(node);
|
|
6909
|
-
if (meta?.type !== NodeType.Element) {
|
|
6920
|
+
if (!node || meta?.type !== NodeType.Element) {
|
|
6910
6921
|
continue;
|
|
6911
6922
|
}
|
|
6923
|
+
const attributes = { ...meta.attributes };
|
|
6924
|
+
let changed = false;
|
|
6912
6925
|
for (const [attributeName, value] of Object.entries(mutation.attributes)) {
|
|
6926
|
+
if (!BREADCRUMB_RELEVANT_ATTRIBUTES.has(attributeName)) {
|
|
6927
|
+
continue;
|
|
6928
|
+
}
|
|
6913
6929
|
if (value === null) {
|
|
6914
|
-
delete
|
|
6930
|
+
delete attributes[attributeName];
|
|
6915
6931
|
} else {
|
|
6916
|
-
|
|
6932
|
+
attributes[attributeName] = value;
|
|
6917
6933
|
}
|
|
6934
|
+
changed = true;
|
|
6935
|
+
}
|
|
6936
|
+
if (changed) {
|
|
6937
|
+
record.mirror.add(node, { ...meta, attributes });
|
|
6918
6938
|
}
|
|
6919
6939
|
}
|
|
6920
6940
|
}
|
|
@@ -7675,7 +7695,7 @@ class ReplayContainer {
|
|
|
7675
7695
|
return void 0;
|
|
7676
7696
|
}
|
|
7677
7697
|
const spanJson = spanToJSON(lastRootSpan);
|
|
7678
|
-
const source = spanJson.attributes[
|
|
7698
|
+
const source = spanJson.attributes[jd];
|
|
7679
7699
|
if (!source || !["route", "custom"].includes(source)) {
|
|
7680
7700
|
return void 0;
|
|
7681
7701
|
}
|