@sailfish-ai/recorder 1.8.7 → 1.8.8
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 +15 -1
- package/dist/recorder.cjs +19 -13
- package/dist/recorder.js +19 -13
- package/dist/recorder.js.br +0 -0
- package/dist/recorder.js.gz +0 -0
- package/dist/recorder.umd.cjs +19 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -403,6 +403,11 @@ function setupXMLHttpRequestInterceptor(domainsToNotPropagateHeaderTo = []) {
|
|
|
403
403
|
let finished = false;
|
|
404
404
|
const requestBody = args[0]; // Capture the request body/payload
|
|
405
405
|
const requestHeaders = { ...this._capturedRequestHeaders }; // Capture request headers
|
|
406
|
+
// Filter out internal Sailfish headers from the captured headers
|
|
407
|
+
delete requestHeaders[xSf3RidHeader];
|
|
408
|
+
if (funcSpanHeader) {
|
|
409
|
+
delete requestHeaders[funcSpanHeader.name];
|
|
410
|
+
}
|
|
406
411
|
// 4️⃣ Helper to emit networkRequestFinished
|
|
407
412
|
const emitFinished = (success, status, errorMsg, responseData, responseHeaders) => {
|
|
408
413
|
if (finished)
|
|
@@ -521,7 +526,8 @@ function setupFetchInterceptor(domainsToNotPropagateHeadersTo = []) {
|
|
|
521
526
|
if (!sessionId) {
|
|
522
527
|
return target.apply(thisArg, args);
|
|
523
528
|
}
|
|
524
|
-
|
|
529
|
+
// Generate a fresh UUID for this request attempt
|
|
530
|
+
let networkUUID = uuidv4();
|
|
525
531
|
const urlAndStoredUuids = getUrlAndStoredUuids();
|
|
526
532
|
const method = init.method || "GET";
|
|
527
533
|
const startTime = Date.now();
|
|
@@ -569,12 +575,20 @@ function setupFetchInterceptor(domainsToNotPropagateHeadersTo = []) {
|
|
|
569
575
|
console.warn("[Sailfish] Failed to capture request data:", e);
|
|
570
576
|
}
|
|
571
577
|
}
|
|
578
|
+
// Filter out internal Sailfish headers from captured headers
|
|
579
|
+
delete requestHeaders[xSf3RidHeader];
|
|
580
|
+
const funcSpanHeaderName = getFuncSpanHeader()?.name;
|
|
581
|
+
if (funcSpanHeaderName) {
|
|
582
|
+
delete requestHeaders[funcSpanHeaderName];
|
|
583
|
+
}
|
|
572
584
|
try {
|
|
573
585
|
let response = await injectHeader(target, thisArg, input, init, sessionId, urlAndStoredUuids.page_visit_uuid, networkUUID);
|
|
574
586
|
let isRetry = false;
|
|
575
587
|
// Retry logic for 400/403 before logging finished event
|
|
576
588
|
if (BAD_HTTP_STATUS.includes(response.status)) {
|
|
577
589
|
DEBUG && console.log("Perform retry as status was fail:", response);
|
|
590
|
+
// Generate a NEW UUID for the retry request so each request has a unique ID
|
|
591
|
+
networkUUID = uuidv4();
|
|
578
592
|
response = await retryWithoutPropagateHeaders(target, thisArg, args, url);
|
|
579
593
|
isRetry = true;
|
|
580
594
|
}
|
package/dist/recorder.cjs
CHANGED
|
@@ -428,7 +428,7 @@ function initializeWebSocket(e, a, u) {
|
|
|
428
428
|
const a2 = document.createElement("a");
|
|
429
429
|
return a2.href = e2, `${a2.hostname}${a2.port ? `:${a2.port}` : ""}`;
|
|
430
430
|
})(e), w2 = new URL(e).protocol;
|
|
431
|
-
return te = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.
|
|
431
|
+
return te = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.8`, [], { connectionTimeout: 3e4 }), te.addEventListener("open", () => {
|
|
432
432
|
Q && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (se ? "ENABLED" : "DISABLED"))), (async () => {
|
|
433
433
|
try {
|
|
434
434
|
ne = true, await flushNotifyQueue(), await flushBufferedEvents();
|
|
@@ -7178,9 +7178,10 @@ function setupFetchInterceptor(e = []) {
|
|
|
7178
7178
|
C2 = x2.href;
|
|
7179
7179
|
}
|
|
7180
7180
|
return shouldSkipHeadersPropagation(C2, e) ? a2.apply(m2, w2) : (async function injectHeaderWrapper(e2, a3, u2, m3, w3, C3, x3) {
|
|
7181
|
-
var _a2, _b;
|
|
7181
|
+
var _a2, _b, _c2;
|
|
7182
7182
|
if (!C3) return e2.apply(a3, u2);
|
|
7183
|
-
|
|
7183
|
+
let I3 = v4();
|
|
7184
|
+
const _2 = getUrlAndStoredUuids(), O2 = w3.method || "GET", E2 = Date.now();
|
|
7184
7185
|
let D2, F2 = {};
|
|
7185
7186
|
try {
|
|
7186
7187
|
if (m3 instanceof Request) {
|
|
@@ -7201,8 +7202,11 @@ function setupFetchInterceptor(e = []) {
|
|
|
7201
7202
|
} catch (e3) {
|
|
7202
7203
|
up && console.warn("[Sailfish] Failed to capture request data:", e3);
|
|
7203
7204
|
}
|
|
7205
|
+
delete F2[b];
|
|
7206
|
+
const U2 = (_a2 = getFuncSpanHeader()) == null ? void 0 : _a2.name;
|
|
7207
|
+
U2 && delete F2[U2];
|
|
7204
7208
|
try {
|
|
7205
|
-
let
|
|
7209
|
+
let U3 = await (async function injectHeader(e3, a4, u3, m4, w4, C4, x4) {
|
|
7206
7210
|
const I4 = getFuncSpanHeader();
|
|
7207
7211
|
if (u3 instanceof Request) {
|
|
7208
7212
|
const _3 = u3.clone(), O3 = new Headers(_3.headers);
|
|
@@ -7215,7 +7219,7 @@ function setupFetchInterceptor(e = []) {
|
|
|
7215
7219
|
return O3.set(b, `${w4}/${C4}/${x4}`), I4 && (O3.set(I4.name, I4.value), up && console.log("[Sailfish] Added funcspan header to HTTP fetch:", { url: "string" == typeof u3 ? u3 : u3.href, header: I4.name })), _3.headers = O3, await e3.call(a4, u3, _3);
|
|
7216
7220
|
}
|
|
7217
7221
|
})(e2, a3, m3, w3, C3, _2.page_visit_uuid, I3), B2 = false;
|
|
7218
|
-
dp.includes(
|
|
7222
|
+
dp.includes(U3.status) && (up && console.log("Perform retry as status was fail:", U3), I3 = v4(), U3 = await (async function retryWithoutPropagateHeaders(e3, a4, u3, m4) {
|
|
7219
7223
|
try {
|
|
7220
7224
|
let m5 = u3[0], w4 = u3[1] || {};
|
|
7221
7225
|
if ("string" == typeof m5 || m5 instanceof URL) {
|
|
@@ -7234,27 +7238,27 @@ function setupFetchInterceptor(e = []) {
|
|
|
7234
7238
|
throw up && console.log(`Retry without ${b} for ${m4} also failed:`, e4), e4;
|
|
7235
7239
|
}
|
|
7236
7240
|
})(e2, a3, u2, x3), B2 = true);
|
|
7237
|
-
const $2 = Date.now(), z2 =
|
|
7241
|
+
const $2 = Date.now(), z2 = U3.status, j2 = U3.ok, V2 = j2 ? "" : `Request Error: ${U3.statusText}`;
|
|
7238
7242
|
let q2;
|
|
7239
7243
|
try {
|
|
7240
|
-
const e3 =
|
|
7244
|
+
const e3 = U3.clone();
|
|
7241
7245
|
q2 = await e3.text();
|
|
7242
7246
|
} catch (e3) {
|
|
7243
7247
|
up && console.warn("[Sailfish] Failed to capture response data:", e3), q2 = null;
|
|
7244
7248
|
}
|
|
7245
7249
|
let H2 = null;
|
|
7246
7250
|
try {
|
|
7247
|
-
H2 = {},
|
|
7251
|
+
H2 = {}, U3.headers.forEach((e3, a4) => {
|
|
7248
7252
|
H2[a4] = e3;
|
|
7249
7253
|
});
|
|
7250
7254
|
} catch (e3) {
|
|
7251
7255
|
up && console.warn("[Sailfish] Failed to capture response headers:", e3), H2 = null;
|
|
7252
7256
|
}
|
|
7253
|
-
return sendEvent({ type: 27, timestamp: $2, sessionId: C3, data: { request_id: I3, session_id: C3, timestamp_start: E2, timestamp_end: $2, response_code: z2, success: j2, error: V2, method: O2, url: x3, retry_without_trace_id: B2, request_headers: F2, request_body: D2, response_headers: H2, response_body: q2 }, ..._2 }),
|
|
7257
|
+
return sendEvent({ type: 27, timestamp: $2, sessionId: C3, data: { request_id: I3, session_id: C3, timestamp_start: E2, timestamp_end: $2, response_code: z2, success: j2, error: V2, method: O2, url: x3, retry_without_trace_id: B2, request_headers: F2, request_body: D2, response_headers: H2, response_body: q2 }, ..._2 }), U3;
|
|
7254
7258
|
} catch (m4) {
|
|
7255
|
-
const w4 = Date.now(), b2 = false,
|
|
7256
|
-
if (m4 instanceof TypeError && ((
|
|
7257
|
-
throw sendEvent({ type: 27, timestamp: w4, sessionId: C3, data: { request_id: I3, session_id: C3, timestamp_start: E2, timestamp_end: w4, response_code:
|
|
7259
|
+
const w4 = Date.now(), b2 = false, U3 = ((_b = m4.response) == null ? void 0 : _b.status) || 500, B2 = m4.message || "Fetch request failed";
|
|
7260
|
+
if (m4 instanceof TypeError && ((_c2 = m4 == null ? void 0 : m4.message) == null ? void 0 : _c2.toLowerCase().includes(hp.toLowerCase()))) return e2.apply(a3, u2);
|
|
7261
|
+
throw sendEvent({ type: 27, timestamp: w4, sessionId: C3, data: { request_id: I3, session_id: C3, timestamp_start: E2, timestamp_end: w4, response_code: U3, success: b2, error: B2, method: O2, url: x3, request_headers: F2, request_body: D2, response_body: null }, ..._2 }), m4;
|
|
7258
7262
|
}
|
|
7259
7263
|
})(a2, m2, w2, x2, I2, u, C2);
|
|
7260
7264
|
} });
|
|
@@ -7319,7 +7323,9 @@ async function startRecording({ apiKey: e, backendApi: a = "https://api-service.
|
|
|
7319
7323
|
}
|
|
7320
7324
|
const O3 = Date.now();
|
|
7321
7325
|
let E3 = false;
|
|
7322
|
-
const D3 = a3[0], F3 = { ...this._capturedRequestHeaders }
|
|
7326
|
+
const D3 = a3[0], F3 = { ...this._capturedRequestHeaders };
|
|
7327
|
+
delete F3[b], _3 && delete F3[_3.name];
|
|
7328
|
+
const emitFinished = (e3, a4, u3, b2, C4) => {
|
|
7323
7329
|
if (E3) return;
|
|
7324
7330
|
E3 = true;
|
|
7325
7331
|
const I4 = Date.now();
|
package/dist/recorder.js
CHANGED
|
@@ -427,7 +427,7 @@ function initializeWebSocket(e, a, u) {
|
|
|
427
427
|
const a2 = document.createElement("a");
|
|
428
428
|
return a2.href = e2, `${a2.hostname}${a2.port ? `:${a2.port}` : ""}`;
|
|
429
429
|
})(e), w2 = new URL(e).protocol;
|
|
430
|
-
return ne = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.
|
|
430
|
+
return ne = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.8`, [], { connectionTimeout: 3e4 }), ne.addEventListener("open", () => {
|
|
431
431
|
ee && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (ie ? "ENABLED" : "DISABLED"))), (async () => {
|
|
432
432
|
try {
|
|
433
433
|
re = true, await flushNotifyQueue(), await flushBufferedEvents();
|
|
@@ -7191,9 +7191,10 @@ function setupFetchInterceptor(e = []) {
|
|
|
7191
7191
|
C2 = x2.href;
|
|
7192
7192
|
}
|
|
7193
7193
|
return shouldSkipHeadersPropagation(C2, e) ? a2.apply(m2, w2) : (async function injectHeaderWrapper(e2, a3, u2, m3, w3, C3, x3) {
|
|
7194
|
-
var _a2, _b;
|
|
7194
|
+
var _a2, _b, _c2;
|
|
7195
7195
|
if (!C3) return e2.apply(a3, u2);
|
|
7196
|
-
|
|
7196
|
+
let I3 = v4();
|
|
7197
|
+
const _2 = getUrlAndStoredUuids(), O2 = w3.method || "GET", E2 = Date.now();
|
|
7197
7198
|
let D2, F2 = {};
|
|
7198
7199
|
try {
|
|
7199
7200
|
if (m3 instanceof Request) {
|
|
@@ -7214,8 +7215,11 @@ function setupFetchInterceptor(e = []) {
|
|
|
7214
7215
|
} catch (e3) {
|
|
7215
7216
|
pp && console.warn("[Sailfish] Failed to capture request data:", e3);
|
|
7216
7217
|
}
|
|
7218
|
+
delete F2[b];
|
|
7219
|
+
const U2 = (_a2 = getFuncSpanHeader()) == null ? void 0 : _a2.name;
|
|
7220
|
+
U2 && delete F2[U2];
|
|
7217
7221
|
try {
|
|
7218
|
-
let
|
|
7222
|
+
let U3 = await (async function injectHeader(e3, a4, u3, m4, w4, C4, x4) {
|
|
7219
7223
|
const I4 = getFuncSpanHeader();
|
|
7220
7224
|
if (u3 instanceof Request) {
|
|
7221
7225
|
const _3 = u3.clone(), O3 = new Headers(_3.headers);
|
|
@@ -7228,7 +7232,7 @@ function setupFetchInterceptor(e = []) {
|
|
|
7228
7232
|
return O3.set(b, `${w4}/${C4}/${x4}`), I4 && (O3.set(I4.name, I4.value), pp && console.log("[Sailfish] Added funcspan header to HTTP fetch:", { url: "string" == typeof u3 ? u3 : u3.href, header: I4.name })), _3.headers = O3, await e3.call(a4, u3, _3);
|
|
7229
7233
|
}
|
|
7230
7234
|
})(e2, a3, m3, w3, C3, _2.page_visit_uuid, I3), B2 = false;
|
|
7231
|
-
hp.includes(
|
|
7235
|
+
hp.includes(U3.status) && (pp && console.log("Perform retry as status was fail:", U3), I3 = v4(), U3 = await (async function retryWithoutPropagateHeaders(e3, a4, u3, m4) {
|
|
7232
7236
|
try {
|
|
7233
7237
|
let m5 = u3[0], w4 = u3[1] || {};
|
|
7234
7238
|
if ("string" == typeof m5 || m5 instanceof URL) {
|
|
@@ -7247,27 +7251,27 @@ function setupFetchInterceptor(e = []) {
|
|
|
7247
7251
|
throw pp && console.log(`Retry without ${b} for ${m4} also failed:`, e4), e4;
|
|
7248
7252
|
}
|
|
7249
7253
|
})(e2, a3, u2, x3), B2 = true);
|
|
7250
|
-
const $2 = Date.now(), z2 =
|
|
7254
|
+
const $2 = Date.now(), z2 = U3.status, j2 = U3.ok, V2 = j2 ? "" : `Request Error: ${U3.statusText}`;
|
|
7251
7255
|
let q2;
|
|
7252
7256
|
try {
|
|
7253
|
-
const e3 =
|
|
7257
|
+
const e3 = U3.clone();
|
|
7254
7258
|
q2 = await e3.text();
|
|
7255
7259
|
} catch (e3) {
|
|
7256
7260
|
pp && console.warn("[Sailfish] Failed to capture response data:", e3), q2 = null;
|
|
7257
7261
|
}
|
|
7258
7262
|
let H2 = null;
|
|
7259
7263
|
try {
|
|
7260
|
-
H2 = {},
|
|
7264
|
+
H2 = {}, U3.headers.forEach((e3, a4) => {
|
|
7261
7265
|
H2[a4] = e3;
|
|
7262
7266
|
});
|
|
7263
7267
|
} catch (e3) {
|
|
7264
7268
|
pp && console.warn("[Sailfish] Failed to capture response headers:", e3), H2 = null;
|
|
7265
7269
|
}
|
|
7266
|
-
return sendEvent({ type: 27, timestamp: $2, sessionId: C3, data: { request_id: I3, session_id: C3, timestamp_start: E2, timestamp_end: $2, response_code: z2, success: j2, error: V2, method: O2, url: x3, retry_without_trace_id: B2, request_headers: F2, request_body: D2, response_headers: H2, response_body: q2 }, ..._2 }),
|
|
7270
|
+
return sendEvent({ type: 27, timestamp: $2, sessionId: C3, data: { request_id: I3, session_id: C3, timestamp_start: E2, timestamp_end: $2, response_code: z2, success: j2, error: V2, method: O2, url: x3, retry_without_trace_id: B2, request_headers: F2, request_body: D2, response_headers: H2, response_body: q2 }, ..._2 }), U3;
|
|
7267
7271
|
} catch (m4) {
|
|
7268
|
-
const w4 = Date.now(), b2 = false,
|
|
7269
|
-
if (m4 instanceof TypeError && ((
|
|
7270
|
-
throw sendEvent({ type: 27, timestamp: w4, sessionId: C3, data: { request_id: I3, session_id: C3, timestamp_start: E2, timestamp_end: w4, response_code:
|
|
7272
|
+
const w4 = Date.now(), b2 = false, U3 = ((_b = m4.response) == null ? void 0 : _b.status) || 500, B2 = m4.message || "Fetch request failed";
|
|
7273
|
+
if (m4 instanceof TypeError && ((_c2 = m4 == null ? void 0 : m4.message) == null ? void 0 : _c2.toLowerCase().includes(fp.toLowerCase()))) return e2.apply(a3, u2);
|
|
7274
|
+
throw sendEvent({ type: 27, timestamp: w4, sessionId: C3, data: { request_id: I3, session_id: C3, timestamp_start: E2, timestamp_end: w4, response_code: U3, success: b2, error: B2, method: O2, url: x3, request_headers: F2, request_body: D2, response_body: null }, ..._2 }), m4;
|
|
7271
7275
|
}
|
|
7272
7276
|
})(a2, m2, w2, x2, I2, u, C2);
|
|
7273
7277
|
} });
|
|
@@ -7332,7 +7336,9 @@ async function startRecording({ apiKey: e, backendApi: a = "https://api-service.
|
|
|
7332
7336
|
}
|
|
7333
7337
|
const O3 = Date.now();
|
|
7334
7338
|
let E3 = false;
|
|
7335
|
-
const D3 = a3[0], F3 = { ...this._capturedRequestHeaders }
|
|
7339
|
+
const D3 = a3[0], F3 = { ...this._capturedRequestHeaders };
|
|
7340
|
+
delete F3[b], _3 && delete F3[_3.name];
|
|
7341
|
+
const emitFinished = (e3, a4, u3, b2, C4) => {
|
|
7336
7342
|
if (E3) return;
|
|
7337
7343
|
E3 = true;
|
|
7338
7344
|
const I4 = Date.now();
|
package/dist/recorder.js.br
CHANGED
|
Binary file
|
package/dist/recorder.js.gz
CHANGED
|
Binary file
|
package/dist/recorder.umd.cjs
CHANGED
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
const a3 = document.createElement("a");
|
|
431
431
|
return a3.href = e3, `${a3.hostname}${a3.port ? `:${a3.port}` : ""}`;
|
|
432
432
|
})(e2), w2 = new URL(e2).protocol;
|
|
433
|
-
return ne = new z(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a2}&sessionId=${u2}&sender=JS%2FTS&version=1.8.
|
|
433
|
+
return ne = new z(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a2}&sessionId=${u2}&sender=JS%2FTS&version=1.8.8`, [], { connectionTimeout: 3e4 }), ne.addEventListener("open", () => {
|
|
434
434
|
ee && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (ie ? "ENABLED" : "DISABLED"))), (async () => {
|
|
435
435
|
try {
|
|
436
436
|
re = true, await flushNotifyQueue(), await flushBufferedEvents();
|
|
@@ -7180,9 +7180,10 @@
|
|
|
7180
7180
|
b2 = x2.href;
|
|
7181
7181
|
}
|
|
7182
7182
|
return shouldSkipHeadersPropagation(b2, e2) ? a3.apply(m2, w2) : (async function injectHeaderWrapper(e3, a4, u3, m3, w3, b3, x3) {
|
|
7183
|
-
var _a2, _b;
|
|
7183
|
+
var _a2, _b, _c2;
|
|
7184
7184
|
if (!b3) return e3.apply(a4, u3);
|
|
7185
|
-
|
|
7185
|
+
let I3 = v4();
|
|
7186
|
+
const _2 = getUrlAndStoredUuids(), O2 = w3.method || "GET", E2 = Date.now();
|
|
7186
7187
|
let D2, F2 = {};
|
|
7187
7188
|
try {
|
|
7188
7189
|
if (m3 instanceof Request) {
|
|
@@ -7203,8 +7204,11 @@
|
|
|
7203
7204
|
} catch (e4) {
|
|
7204
7205
|
pp && console.warn("[Sailfish] Failed to capture request data:", e4);
|
|
7205
7206
|
}
|
|
7207
|
+
delete F2[C];
|
|
7208
|
+
const U2 = (_a2 = getFuncSpanHeader()) == null ? void 0 : _a2.name;
|
|
7209
|
+
U2 && delete F2[U2];
|
|
7206
7210
|
try {
|
|
7207
|
-
let
|
|
7211
|
+
let U3 = await (async function injectHeader(e4, a5, u4, m4, w4, b4, x4) {
|
|
7208
7212
|
const I4 = getFuncSpanHeader();
|
|
7209
7213
|
if (u4 instanceof Request) {
|
|
7210
7214
|
const _3 = u4.clone(), O3 = new Headers(_3.headers);
|
|
@@ -7217,7 +7221,7 @@
|
|
|
7217
7221
|
return O3.set(C, `${w4}/${b4}/${x4}`), I4 && (O3.set(I4.name, I4.value), pp && console.log("[Sailfish] Added funcspan header to HTTP fetch:", { url: "string" == typeof u4 ? u4 : u4.href, header: I4.name })), _3.headers = O3, await e4.call(a5, u4, _3);
|
|
7218
7222
|
}
|
|
7219
7223
|
})(e3, a4, m3, w3, b3, _2.page_visit_uuid, I3), B2 = false;
|
|
7220
|
-
hp.includes(
|
|
7224
|
+
hp.includes(U3.status) && (pp && console.log("Perform retry as status was fail:", U3), I3 = v4(), U3 = await (async function retryWithoutPropagateHeaders(e4, a5, u4, m4) {
|
|
7221
7225
|
try {
|
|
7222
7226
|
let m5 = u4[0], w4 = u4[1] || {};
|
|
7223
7227
|
if ("string" == typeof m5 || m5 instanceof URL) {
|
|
@@ -7236,27 +7240,27 @@
|
|
|
7236
7240
|
throw pp && console.log(`Retry without ${C} for ${m4} also failed:`, e5), e5;
|
|
7237
7241
|
}
|
|
7238
7242
|
})(e3, a4, u3, x3), B2 = true);
|
|
7239
|
-
const $2 = Date.now(), z2 =
|
|
7243
|
+
const $2 = Date.now(), z2 = U3.status, j2 = U3.ok, V2 = j2 ? "" : `Request Error: ${U3.statusText}`;
|
|
7240
7244
|
let q2;
|
|
7241
7245
|
try {
|
|
7242
|
-
const e4 =
|
|
7246
|
+
const e4 = U3.clone();
|
|
7243
7247
|
q2 = await e4.text();
|
|
7244
7248
|
} catch (e4) {
|
|
7245
7249
|
pp && console.warn("[Sailfish] Failed to capture response data:", e4), q2 = null;
|
|
7246
7250
|
}
|
|
7247
7251
|
let H2 = null;
|
|
7248
7252
|
try {
|
|
7249
|
-
H2 = {},
|
|
7253
|
+
H2 = {}, U3.headers.forEach((e4, a5) => {
|
|
7250
7254
|
H2[a5] = e4;
|
|
7251
7255
|
});
|
|
7252
7256
|
} catch (e4) {
|
|
7253
7257
|
pp && console.warn("[Sailfish] Failed to capture response headers:", e4), H2 = null;
|
|
7254
7258
|
}
|
|
7255
|
-
return sendEvent({ type: 27, timestamp: $2, sessionId: b3, data: { request_id: I3, session_id: b3, timestamp_start: E2, timestamp_end: $2, response_code: z2, success: j2, error: V2, method: O2, url: x3, retry_without_trace_id: B2, request_headers: F2, request_body: D2, response_headers: H2, response_body: q2 }, ..._2 }),
|
|
7259
|
+
return sendEvent({ type: 27, timestamp: $2, sessionId: b3, data: { request_id: I3, session_id: b3, timestamp_start: E2, timestamp_end: $2, response_code: z2, success: j2, error: V2, method: O2, url: x3, retry_without_trace_id: B2, request_headers: F2, request_body: D2, response_headers: H2, response_body: q2 }, ..._2 }), U3;
|
|
7256
7260
|
} catch (m4) {
|
|
7257
|
-
const w4 = Date.now(), C2 = false,
|
|
7258
|
-
if (m4 instanceof TypeError && ((
|
|
7259
|
-
throw sendEvent({ type: 27, timestamp: w4, sessionId: b3, data: { request_id: I3, session_id: b3, timestamp_start: E2, timestamp_end: w4, response_code:
|
|
7261
|
+
const w4 = Date.now(), C2 = false, U3 = ((_b = m4.response) == null ? void 0 : _b.status) || 500, B2 = m4.message || "Fetch request failed";
|
|
7262
|
+
if (m4 instanceof TypeError && ((_c2 = m4 == null ? void 0 : m4.message) == null ? void 0 : _c2.toLowerCase().includes(fp.toLowerCase()))) return e3.apply(a4, u3);
|
|
7263
|
+
throw sendEvent({ type: 27, timestamp: w4, sessionId: b3, data: { request_id: I3, session_id: b3, timestamp_start: E2, timestamp_end: w4, response_code: U3, success: C2, error: B2, method: O2, url: x3, request_headers: F2, request_body: D2, response_body: null }, ..._2 }), m4;
|
|
7260
7264
|
}
|
|
7261
7265
|
})(a3, m2, w2, x2, I2, u2, b2);
|
|
7262
7266
|
} });
|
|
@@ -7321,7 +7325,9 @@
|
|
|
7321
7325
|
}
|
|
7322
7326
|
const O3 = Date.now();
|
|
7323
7327
|
let E3 = false;
|
|
7324
|
-
const D3 = a4[0], F3 = { ...this._capturedRequestHeaders }
|
|
7328
|
+
const D3 = a4[0], F3 = { ...this._capturedRequestHeaders };
|
|
7329
|
+
delete F3[C], _3 && delete F3[_3.name];
|
|
7330
|
+
const emitFinished = (e4, a5, u4, b4, C2) => {
|
|
7325
7331
|
if (E3) return;
|
|
7326
7332
|
E3 = true;
|
|
7327
7333
|
const I4 = Date.now();
|