@multiplayer-app/session-recorder-browser 1.2.34 → 1.2.35
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/browser/index.js +72 -79
- package/dist/browser/index.js.map +1 -1
- package/dist/exporters/index.js +1 -1
- package/dist/index.js +72 -79
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +72 -79
- package/dist/index.umd.js.map +1 -1
- package/dist/patch/fetch.js +71 -78
- package/dist/patch/fetch.js.map +1 -1
- package/package.json +2 -2
package/dist/exporters/index.js
CHANGED
|
@@ -9978,7 +9978,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
|
|
|
9978
9978
|
const SESSION_RESPONSE = 'multiplayer-debug-session-response';
|
|
9979
9979
|
const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
9980
9980
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
9981
|
-
const PACKAGE_VERSION_EXPORT = "1.2.
|
|
9981
|
+
const PACKAGE_VERSION_EXPORT = "1.2.35" || 0;
|
|
9982
9982
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
9983
9983
|
const OTEL_IGNORE_URLS = [
|
|
9984
9984
|
// Traces endpoint
|
package/dist/index.js
CHANGED
|
@@ -24143,7 +24143,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
|
|
|
24143
24143
|
const SESSION_RESPONSE = 'multiplayer-debug-session-response';
|
|
24144
24144
|
const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
24145
24145
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
24146
|
-
const PACKAGE_VERSION_EXPORT = "1.2.
|
|
24146
|
+
const PACKAGE_VERSION_EXPORT = "1.2.35" || 0;
|
|
24147
24147
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
24148
24148
|
const OTEL_IGNORE_URLS = [
|
|
24149
24149
|
// Traces endpoint
|
|
@@ -25376,91 +25376,84 @@ function _headersInitToObject(headersInit) {
|
|
|
25376
25376
|
return result;
|
|
25377
25377
|
}
|
|
25378
25378
|
if (typeof window !== 'undefined' && typeof window.fetch !== 'undefined') {
|
|
25379
|
-
//
|
|
25380
|
-
|
|
25381
|
-
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
|
|
25387
|
-
|
|
25388
|
-
const
|
|
25389
|
-
//
|
|
25390
|
-
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
|
|
25394
|
-
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25399
|
-
|
|
25400
|
-
|
|
25401
|
-
|
|
25402
|
-
networkRequest.requestHeaders = _headersToObject(requestForMetadata.headers);
|
|
25403
|
-
}
|
|
25404
|
-
else if (inputIsRequest) {
|
|
25405
|
-
networkRequest.requestHeaders = _headersToObject(input.headers);
|
|
25406
|
-
}
|
|
25407
|
-
else {
|
|
25408
|
-
networkRequest.requestHeaders = _headersInitToObject(init === null || init === void 0 ? void 0 : init.headers);
|
|
25409
|
-
}
|
|
25410
|
-
}
|
|
25411
|
-
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.shouldRecordBody) {
|
|
25412
|
-
// Prefer reading from the safely constructed Request; else fallback to init.body
|
|
25413
|
-
const urlStr = inputIsRequest
|
|
25414
|
-
? input.url
|
|
25415
|
-
: (typeof input === 'string' || input instanceof URL ? String(input) : '');
|
|
25416
|
-
const candidateBody = requestForMetadata
|
|
25417
|
-
? requestForMetadata.body
|
|
25418
|
-
: (inputIsRequest ? init === null || init === void 0 ? void 0 : init.body : init === null || init === void 0 ? void 0 : init.body);
|
|
25419
|
-
if (!(0,_utils_type_utils__WEBPACK_IMPORTED_MODULE_0__.isNullish)(candidateBody)) {
|
|
25420
|
-
const requestBody = _tryReadFetchBody({
|
|
25421
|
-
body: candidateBody,
|
|
25422
|
-
url: urlStr,
|
|
25423
|
-
});
|
|
25424
|
-
if ((requestBody === null || requestBody === void 0 ? void 0 : requestBody.length) &&
|
|
25425
|
-
new Blob([requestBody]).size <= _configs__WEBPACK_IMPORTED_MODULE_2__.configs.maxCapturingHttpPayloadSize) {
|
|
25426
|
-
networkRequest.requestBody = requestBody;
|
|
25379
|
+
// Idempotency guard: avoid double-patching
|
|
25380
|
+
// @ts-ignore
|
|
25381
|
+
if (window.fetch.__mp_session_recorder_patched__) {
|
|
25382
|
+
// Already patched; do nothing
|
|
25383
|
+
}
|
|
25384
|
+
else {
|
|
25385
|
+
// @ts-ignore
|
|
25386
|
+
window.fetch.__mp_session_recorder_patched__ = true;
|
|
25387
|
+
// Store original fetch
|
|
25388
|
+
const originalFetch = window.fetch;
|
|
25389
|
+
// Override fetch
|
|
25390
|
+
window.fetch = async function (input,
|
|
25391
|
+
// eslint-disable-next-line
|
|
25392
|
+
init) {
|
|
25393
|
+
const networkRequest = {};
|
|
25394
|
+
// Capture request data
|
|
25395
|
+
const inputIsRequest = typeof Request !== 'undefined' && input instanceof Request;
|
|
25396
|
+
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.recordRequestHeaders) {
|
|
25397
|
+
if (inputIsRequest) {
|
|
25398
|
+
networkRequest.requestHeaders = _headersToObject(input.headers);
|
|
25399
|
+
}
|
|
25400
|
+
else {
|
|
25401
|
+
networkRequest.requestHeaders = _headersInitToObject(init === null || init === void 0 ? void 0 : init.headers);
|
|
25427
25402
|
}
|
|
25428
|
-
}
|
|
25429
|
-
}
|
|
25430
|
-
try {
|
|
25431
|
-
// Make the actual fetch request
|
|
25432
|
-
const response = await originalFetch(input, init);
|
|
25433
|
-
// Capture response data
|
|
25434
|
-
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.recordResponseHeaders) {
|
|
25435
|
-
networkRequest.responseHeaders = _headersToObject(response.headers);
|
|
25436
25403
|
}
|
|
25437
25404
|
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.shouldRecordBody) {
|
|
25438
|
-
const
|
|
25439
|
-
|
|
25440
|
-
|
|
25441
|
-
|
|
25405
|
+
const urlStr = inputIsRequest
|
|
25406
|
+
? input.url
|
|
25407
|
+
: (typeof input === 'string' || input instanceof URL ? String(input) : '');
|
|
25408
|
+
// Only attempt to read the body from init (safe); avoid constructing/cloning Requests
|
|
25409
|
+
// If the caller passed a Request as input, we do not attempt to read its body here
|
|
25410
|
+
const candidateBody = init === null || init === void 0 ? void 0 : init.body;
|
|
25411
|
+
if (!(0,_utils_type_utils__WEBPACK_IMPORTED_MODULE_0__.isNullish)(candidateBody)) {
|
|
25412
|
+
const requestBody = _tryReadFetchBody({
|
|
25413
|
+
body: candidateBody,
|
|
25414
|
+
url: urlStr,
|
|
25415
|
+
});
|
|
25416
|
+
if ((requestBody === null || requestBody === void 0 ? void 0 : requestBody.length) &&
|
|
25417
|
+
new Blob([requestBody]).size <= _configs__WEBPACK_IMPORTED_MODULE_2__.configs.maxCapturingHttpPayloadSize) {
|
|
25418
|
+
networkRequest.requestBody = requestBody;
|
|
25419
|
+
}
|
|
25442
25420
|
}
|
|
25443
25421
|
}
|
|
25444
|
-
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
|
|
25451
|
-
|
|
25452
|
-
|
|
25453
|
-
|
|
25422
|
+
try {
|
|
25423
|
+
// Make the actual fetch request
|
|
25424
|
+
const response = await originalFetch(input, init);
|
|
25425
|
+
// Capture response data
|
|
25426
|
+
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.recordResponseHeaders) {
|
|
25427
|
+
networkRequest.responseHeaders = _headersToObject(response.headers);
|
|
25428
|
+
}
|
|
25429
|
+
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.shouldRecordBody) {
|
|
25430
|
+
const responseBody = await _tryReadResponseBody(response);
|
|
25431
|
+
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.length) &&
|
|
25432
|
+
new Blob([responseBody]).size <= _configs__WEBPACK_IMPORTED_MODULE_2__.configs.maxCapturingHttpPayloadSize) {
|
|
25433
|
+
networkRequest.responseBody = responseBody;
|
|
25434
|
+
}
|
|
25435
|
+
}
|
|
25436
|
+
// Attach network request data to the response for later access
|
|
25454
25437
|
// @ts-ignore
|
|
25455
|
-
|
|
25438
|
+
response.networkRequest = networkRequest;
|
|
25439
|
+
return response;
|
|
25456
25440
|
}
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
|
|
25460
|
-
|
|
25461
|
-
|
|
25462
|
-
|
|
25463
|
-
|
|
25441
|
+
catch (error) {
|
|
25442
|
+
// Even if the fetch fails, we can still capture the request data
|
|
25443
|
+
// Attach captured request data to the thrown error for downstream handling
|
|
25444
|
+
// @ts-ignore
|
|
25445
|
+
if (error && typeof error === 'object') {
|
|
25446
|
+
// @ts-ignore
|
|
25447
|
+
error.networkRequest = networkRequest;
|
|
25448
|
+
}
|
|
25449
|
+
throw error;
|
|
25450
|
+
}
|
|
25451
|
+
};
|
|
25452
|
+
// Preserve the original fetch function's properties
|
|
25453
|
+
Object.setPrototypeOf(window.fetch, originalFetch);
|
|
25454
|
+
Object.defineProperty(window.fetch, 'name', { value: 'fetch' });
|
|
25455
|
+
Object.defineProperty(window.fetch, 'length', { value: originalFetch.length });
|
|
25456
|
+
}
|
|
25464
25457
|
}
|
|
25465
25458
|
|
|
25466
25459
|
|