@multiplayer-app/session-recorder-browser 1.3.23 → 1.3.24

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/index.js CHANGED
@@ -24152,7 +24152,7 @@ const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
24152
24152
  const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
24153
24153
  const REMOTE_SESSION_RECORDING_START = 'remote-session-recording:start';
24154
24154
  const REMOTE_SESSION_RECORDING_STOP = 'remote-session-recording:stop';
24155
- const PACKAGE_VERSION_EXPORT = "1.3.23" || 0;
24155
+ const PACKAGE_VERSION_EXPORT = "1.3.24" || 0;
24156
24156
  // Regex patterns for OpenTelemetry ignore URLs
24157
24157
  const OTEL_IGNORE_URLS = [
24158
24158
  // Traces endpoint
@@ -24840,8 +24840,8 @@ class CrashBufferSpanProcessor {
24840
24840
  this._crashBuffer.appendSpans([
24841
24841
  {
24842
24842
  ts: span.startTime[0] * 1000 + span.startTime[1] / 1000000,
24843
- span: this._serializeSpan(span)
24844
- }
24843
+ span: this._serializeSpan(span),
24844
+ },
24845
24845
  ]);
24846
24846
  }
24847
24847
  return;
@@ -25141,25 +25141,25 @@ class TracerBrowserSDK {
25141
25141
  this.exporter = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderBrowserTraceExporter({
25142
25142
  apiKey: options.apiKey,
25143
25143
  url: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getExporterEndpoint)(options.exporterEndpoint),
25144
- usePostMessageFallback: options.usePostMessageFallback
25144
+ usePostMessageFallback: options.usePostMessageFallback,
25145
25145
  });
25146
25146
  this.batchSpanProcessor = new _opentelemetry_sdk_trace_base__WEBPACK_IMPORTED_MODULE_5__.BatchSpanProcessor(this.exporter);
25147
25147
  this.tracerProvider = new _opentelemetry_sdk_trace_web__WEBPACK_IMPORTED_MODULE_6__.WebTracerProvider({
25148
25148
  resource: (0,_opentelemetry_resources__WEBPACK_IMPORTED_MODULE_7__.resourceFromAttributes)({
25149
25149
  [_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_8__.SEMRESATTRS_SERVICE_NAME]: application,
25150
25150
  [_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_8__.SEMRESATTRS_SERVICE_VERSION]: version,
25151
- [_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_8__.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment
25151
+ [_opentelemetry_semantic_conventions__WEBPACK_IMPORTED_MODULE_8__.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment,
25152
25152
  }),
25153
25153
  idGenerator: this.idGenerator,
25154
25154
  sampler: new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderTraceIdRatioBasedSampler(this.config.sampleTraceRatio),
25155
25155
  spanProcessors: [
25156
25156
  this._getSpanSessionIdProcessor(),
25157
- new _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__.CrashBufferSpanProcessor(this.batchSpanProcessor, this.crashBuffer, this.exporter.serializeSpan.bind(this.exporter))
25158
- ]
25157
+ new _CrashBufferSpanProcessor__WEBPACK_IMPORTED_MODULE_4__.CrashBufferSpanProcessor(this.batchSpanProcessor, this.crashBuffer, this.exporter.serializeSpan.bind(this.exporter)),
25158
+ ],
25159
25159
  });
25160
25160
  this.tracerProvider.register({
25161
25161
  // contextManager: new ZoneContextManager(),
25162
- propagator: new _opentelemetry_core__WEBPACK_IMPORTED_MODULE_9__.W3CTraceContextPropagator()
25162
+ propagator: new _opentelemetry_core__WEBPACK_IMPORTED_MODULE_9__.W3CTraceContextPropagator(),
25163
25163
  });
25164
25164
  (0,_opentelemetry_instrumentation__WEBPACK_IMPORTED_MODULE_10__.registerInstrumentations)({
25165
25165
  tracerProvider: this.tracerProvider,
@@ -25187,7 +25187,7 @@ class TracerBrowserSDK {
25187
25187
  requestBody,
25188
25188
  responseBody,
25189
25189
  requestHeaders,
25190
- responseHeaders
25190
+ responseHeaders,
25191
25191
  };
25192
25192
  (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.processHttpPayload)(payload, this.config, span);
25193
25193
  }
@@ -25195,7 +25195,7 @@ class TracerBrowserSDK {
25195
25195
  // eslint-disable-next-line
25196
25196
  console.error('[MULTIPLAYER_SESSION_RECORDER] Failed to capture xml-http payload', error);
25197
25197
  }
25198
- }
25198
+ },
25199
25199
  },
25200
25200
  '@opentelemetry/instrumentation-fetch': {
25201
25201
  clearTimingResources: true,
@@ -25236,7 +25236,7 @@ class TracerBrowserSDK {
25236
25236
  requestBody,
25237
25237
  responseBody,
25238
25238
  requestHeaders,
25239
- responseHeaders
25239
+ responseHeaders,
25240
25240
  };
25241
25241
  (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.processHttpPayload)(payload, this.config, span);
25242
25242
  }
@@ -25244,7 +25244,7 @@ class TracerBrowserSDK {
25244
25244
  // eslint-disable-next-line
25245
25245
  console.error('[MULTIPLAYER_SESSION_RECORDER] Failed to capture fetch payload', error);
25246
25246
  }
25247
- }
25247
+ },
25248
25248
  },
25249
25249
  '@opentelemetry/instrumentation-user-interaction': {
25250
25250
  shouldPreventSpanCreation: (_event, element, span) => {
@@ -25257,10 +25257,10 @@ class TracerBrowserSDK {
25257
25257
  span.setAttribute(`target.attribute.${attribute.name}`, attribute.value);
25258
25258
  });
25259
25259
  return false;
25260
- }
25261
- }
25262
- })
25263
- ]
25260
+ },
25261
+ },
25262
+ }),
25263
+ ],
25264
25264
  });
25265
25265
  this._registerGlobalErrorListeners();
25266
25266
  }
@@ -25346,7 +25346,7 @@ class TracerBrowserSDK {
25346
25346
  if ((_a = this.sessionId) === null || _a === void 0 ? void 0 : _a.length) {
25347
25347
  span.setAttribute(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.ATTR_MULTIPLAYER_SESSION_ID, this.sessionId);
25348
25348
  }
25349
- }
25349
+ },
25350
25350
  };
25351
25351
  }
25352
25352
  _registerGlobalErrorListeners() {
@@ -25804,7 +25804,7 @@ class RecorderBrowserSDK {
25804
25804
  constructor() {
25805
25805
  this.intervals = {
25806
25806
  restart: null,
25807
- bufferSnapshot: null
25807
+ bufferSnapshot: null,
25808
25808
  };
25809
25809
  this.startedAt = '';
25810
25810
  this.stoppedAt = '';
@@ -25846,7 +25846,7 @@ class RecorderBrowserSDK {
25846
25846
  return;
25847
25847
  }
25848
25848
  this._handleLiveSessionEvent(event, ts, sessionId, sessionType);
25849
- }
25849
+ },
25850
25850
  });
25851
25851
  this.takeFullSnapshot();
25852
25852
  this._setupPeriodicSnapshots(sessionId, sessionType);
@@ -25923,8 +25923,8 @@ class RecorderBrowserSDK {
25923
25923
  event: {
25924
25924
  event: packedEvent,
25925
25925
  eventType: event.type,
25926
- timestamp: ts
25927
- }
25926
+ timestamp: ts,
25927
+ },
25928
25928
  });
25929
25929
  }
25930
25930
  catch (error) {
@@ -25949,7 +25949,7 @@ class RecorderBrowserSDK {
25949
25949
  eventType: event.type,
25950
25950
  timestamp: ts,
25951
25951
  debugSessionId: sessionId,
25952
- debugSessionType: sessionType
25952
+ debugSessionType: sessionType,
25953
25953
  });
25954
25954
  }
25955
25955
  /**
@@ -25963,7 +25963,7 @@ class RecorderBrowserSDK {
25963
25963
  sampling: { canvas: 5 },
25964
25964
  recordCanvas: (_c = this.config) === null || _c === void 0 ? void 0 : _c.recordCanvas,
25965
25965
  dataURLOptions: { type: 'image/webp', quality: 0.1 },
25966
- plugins: [(0,_rrweb_rrweb_plugin_console_record__WEBPACK_IMPORTED_MODULE_3__.getRecordConsolePlugin)({ level: ['log', 'error'] })]
25966
+ plugins: [(0,_rrweb_rrweb_plugin_console_record__WEBPACK_IMPORTED_MODULE_3__.getRecordConsolePlugin)({ level: ['log', 'error'] })],
25967
25967
  };
25968
25968
  if (maskingConfig.maskInputOptions) {
25969
25969
  options.maskInputOptions = maskingConfig.maskInputOptions;
@@ -26023,7 +26023,7 @@ class ApiService {
26023
26023
  this.config = {
26024
26024
  apiKey: '',
26025
26025
  apiBaseUrl: '',
26026
- exporterEndpoint: ''
26026
+ exporterEndpoint: '',
26027
26027
  };
26028
26028
  }
26029
26029
  /**
@@ -26033,7 +26033,7 @@ class ApiService {
26033
26033
  init(config) {
26034
26034
  this.config = {
26035
26035
  ...this.config,
26036
- ...config
26036
+ ...config,
26037
26037
  };
26038
26038
  }
26039
26039
  /**
@@ -26127,14 +26127,14 @@ class ApiService {
26127
26127
  body: body ? JSON.stringify(body) : null,
26128
26128
  headers: {
26129
26129
  'Content-Type': 'application/json',
26130
- ...(this.config.apiKey && { 'X-Api-Key': this.config.apiKey })
26131
- }
26130
+ ...(this.config.apiKey && { 'X-Api-Key': this.config.apiKey }),
26131
+ },
26132
26132
  };
26133
26133
  try {
26134
26134
  const response = await fetch(url, {
26135
26135
  ...params,
26136
26136
  credentials: 'include',
26137
- signal
26137
+ signal,
26138
26138
  });
26139
26139
  if (!response.ok) {
26140
26140
  throw new Error('Network response was not ok: ' + response.statusText);
@@ -26207,7 +26207,7 @@ class CrashBufferService {
26207
26207
  await this._safe(async () => {
26208
26208
  await this.db.setAttrs({
26209
26209
  tabId: this.tabId,
26210
- ...attrs
26210
+ ...attrs,
26211
26211
  });
26212
26212
  }, undefined);
26213
26213
  }
@@ -26225,7 +26225,7 @@ class CrashBufferService {
26225
26225
  tabId: this.tabId,
26226
26226
  ts: payload.ts,
26227
26227
  isFullSnapshot: payload.isFullSnapshot,
26228
- event: payload.event
26228
+ event: payload.event,
26229
26229
  });
26230
26230
  }, undefined);
26231
26231
  if (isFullSnapshot && this.requiresFullSnapshot) {
@@ -26255,7 +26255,7 @@ class CrashBufferService {
26255
26255
  return {
26256
26256
  tabId: this.tabId,
26257
26257
  ts: p.ts,
26258
- span: p.span
26258
+ span: p.span,
26259
26259
  };
26260
26260
  });
26261
26261
  await this.db.appendSpans(records);
@@ -26304,7 +26304,7 @@ class CrashBufferService {
26304
26304
  const [rrweb, spans, attrs] = await Promise.all([
26305
26305
  this._safe(() => this.db.getRrwebEventsWindow(this.tabId, rrwebFromTs, toTs), []),
26306
26306
  this._safe(() => this.db.getOtelSpansWindow(this.tabId, fromTs, toTs), []),
26307
- this._safe(() => this.db.getAttrs(this.tabId), null)
26307
+ this._safe(() => this.db.getAttrs(this.tabId), null),
26308
26308
  ]);
26309
26309
  const rrwebSorted = rrweb
26310
26310
  .sort((a, b) => a.ts - b.ts)
@@ -26325,12 +26325,12 @@ class CrashBufferService {
26325
26325
  ? {
26326
26326
  sessionAttributes: attrs.sessionAttributes,
26327
26327
  resourceAttributes: attrs.resourceAttributes,
26328
- userAttributes: attrs.userAttributes
26328
+ userAttributes: attrs.userAttributes,
26329
26329
  }
26330
26330
  : null,
26331
26331
  windowMs: this.windowMs,
26332
26332
  fromTs: replayStartTs,
26333
- toTs
26333
+ toTs,
26334
26334
  };
26335
26335
  }
26336
26336
  async clear() {
@@ -26482,7 +26482,7 @@ class IndexedDBService {
26482
26482
  const db = await this.dbPromise;
26483
26483
  const payload = {
26484
26484
  ...attrs,
26485
- updatedAt: (_a = attrs.updatedAt) !== null && _a !== void 0 ? _a : Date.now()
26485
+ updatedAt: (_a = attrs.updatedAt) !== null && _a !== void 0 ? _a : Date.now(),
26486
26486
  };
26487
26487
  return new Promise((resolve, reject) => {
26488
26488
  const tx = db.transaction(attrsStore, 'readwrite');
@@ -26725,7 +26725,7 @@ class IndexedDBService {
26725
26725
  const r = attr.delete(tabId);
26726
26726
  r.onsuccess = () => res();
26727
26727
  r.onerror = () => rej(r.error);
26728
- })
26728
+ }),
26729
26729
  ])
26730
26730
  .then(() => {
26731
26731
  // noop
@@ -29972,13 +29972,13 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
29972
29972
  this.generateShortId = (0,_sdk__WEBPACK_IMPORTED_MODULE_1__.getIdGenerator)(8);
29973
29973
  this.sessionShortId = '';
29974
29974
  this.clientId = '';
29975
- this.sessionType = _type__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL;
29975
+ this.sessionType;
29976
29976
  }
29977
29977
  SessionRecorderIdGenerator.prototype.generateTraceId = function () {
29978
29978
  var traceId = this.generateLongId();
29979
- if (!this.sessionShortId
29980
- && !this.sessionType
29981
- && !this.clientId) {
29979
+ if ((!this.sessionShortId
29980
+ && !this.clientId)
29981
+ || !this.sessionType) {
29982
29982
  return traceId;
29983
29983
  }
29984
29984
  var sessionTypePrefix = _constants_constants_base__WEBPACK_IMPORTED_MODULE_2__.MULTIPLAYER_TRACE_PREFIX_MAP[this.sessionType];
@@ -29990,7 +29990,6 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
29990
29990
  return this.generateShortId();
29991
29991
  };
29992
29992
  SessionRecorderIdGenerator.prototype.setSessionId = function (sessionShortId, sessionType, clientId) {
29993
- if (sessionType === void 0) { sessionType = _type__WEBPACK_IMPORTED_MODULE_0__.SessionType.MANUAL; }
29994
29993
  if (clientId === void 0) { clientId = ''; }
29995
29994
  if (!clientId &&
29996
29995
  [
@@ -30350,7 +30349,7 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
30350
30349
  window.postMessage({
30351
30350
  action: 'traces',
30352
30351
  type: this.postMessageType,
30353
- payload: spans.map(function (span) { return _this.serializeSpan(span); })
30352
+ payload: spans.map(function (span) { return _this.serializeSpan(span); }),
30354
30353
  }, this.postMessageTargetOrigin);
30355
30354
  resultCallback({ code: 0 });
30356
30355
  }
@@ -30368,7 +30367,7 @@ var SessionRecorderBrowserTraceExporter = /** @class */ (function () {
30368
30367
  headers: __assign(__assign({ 'Content-Type': 'application/json' }, (this.config.apiKey ? { Authorization: this.config.apiKey } : {})), (this.config.headers || {})),
30369
30368
  timeoutMillis: this.config.timeoutMillis,
30370
30369
  keepAlive: this.config.keepAlive,
30371
- concurrencyLimit: this.config.concurrencyLimit
30370
+ concurrencyLimit: this.config.concurrencyLimit,
30372
30371
  });
30373
30372
  };
30374
30373
  SessionRecorderBrowserTraceExporter.prototype.setApiKey = function (apiKey) {