@multiplayer-app/session-recorder-browser 1.1.0 → 1.1.1-alpha.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.
@@ -25245,7 +25245,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
25245
25245
  const SESSION_RESPONSE = 'multiplayer-debug-session-response';
25246
25246
  const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
25247
25247
  const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
25248
- const PACKAGE_VERSION_EXPORT = "1.1.0" || 0;
25248
+ const PACKAGE_VERSION_EXPORT = "1.1.1-alpha.0" || 0;
25249
25249
  // Regex patterns for OpenTelemetry ignore URLs
25250
25250
  const OTEL_IGNORE_URLS = [
25251
25251
  // Traces endpoint
@@ -25836,12 +25836,24 @@ async function extractResponseBody(response) {
25836
25836
  if (!response.body) {
25837
25837
  return null;
25838
25838
  }
25839
- if (response.body instanceof ReadableStream) {
25840
- const responseClone = response.clone();
25841
- return await responseClone.text();
25839
+ try {
25840
+ if (response.body instanceof ReadableStream) {
25841
+ // Check if response body is already consumed
25842
+ if (response.bodyUsed) {
25843
+ return null;
25844
+ }
25845
+ const responseClone = response.clone();
25846
+ return responseClone.text();
25847
+ }
25848
+ else {
25849
+ return JSON.stringify(response.body);
25850
+ }
25842
25851
  }
25843
- else {
25844
- return JSON.stringify(response.body);
25852
+ catch (error) {
25853
+ // If cloning fails (body already consumed), return null
25854
+ // eslint-disable-next-line no-console
25855
+ console.warn('[DEBUGGER_LIB] Failed to extract response body:', error);
25856
+ return null;
25845
25857
  }
25846
25858
  }
25847
25859
  const getExporterEndpoint = (exporterEndpoint) => {
@@ -29580,6 +29592,7 @@ var __assign = (undefined && undefined.__assign) || function () {
29580
29592
  */
29581
29593
  var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
29582
29594
  function SessionRecorderBrowserTraceExporter(config) {
29595
+ if (config === void 0) { config = {}; }
29583
29596
  this.usePostMessage = false;
29584
29597
  var _a = config.url, url = _a === void 0 ? _constants_constants_base__WEBPACK_IMPORTED_MODULE_0__.MULTIPLAYER_OTEL_DEFAULT_TRACES_EXPORTER_HTTP_URL : _a, apiKey = config.apiKey, _b = config.headers, headers = _b === void 0 ? {} : _b, _c = config.timeoutMillis, timeoutMillis = _c === void 0 ? 30000 : _c, _d = config.keepAlive, keepAlive = _d === void 0 ? true : _d, _e = config.concurrencyLimit, concurrencyLimit = _e === void 0 ? 20 : _e, _f = config.postMessageType, postMessageType = _f === void 0 ? 'MULTIPLAYER_SESSION_DEBUGGER_LIB' : _f, _g = config.postMessageTargetOrigin, postMessageTargetOrigin = _g === void 0 ? '*' : _g;
29585
29598
  this.config = __assign(__assign({}, config), { url: url, apiKey: apiKey, headers: headers, timeoutMillis: timeoutMillis, keepAlive: keepAlive, concurrencyLimit: concurrencyLimit });
@@ -29666,7 +29679,7 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
29666
29679
  SessionRecorderBrowserTraceExporter.prototype._createExporter = function () {
29667
29680
  return new _opentelemetry_exporter_trace_otlp_http__WEBPACK_IMPORTED_MODULE_1__.OTLPTraceExporter({
29668
29681
  url: this.config.url,
29669
- headers: __assign({ 'Content-Type': 'application/json', 'User-Agent': '@multiplayer-app/session-recorder-common/1.0.0', 'Authorization': this.config.apiKey }, (this.config.headers || {})),
29682
+ headers: __assign(__assign({ 'Content-Type': 'application/json' }, (this.config.apiKey ? { 'Authorization': this.config.apiKey } : {})), (this.config.headers || {})),
29670
29683
  timeoutMillis: this.config.timeoutMillis,
29671
29684
  keepAlive: this.config.keepAlive,
29672
29685
  concurrencyLimit: this.config.concurrencyLimit,