@npaw/forge-web 10.0.2 → 10.0.4
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/forge_kernel_wasm_bg.wasm +0 -0
- package/dist/index.cjs +52 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.global.js +52 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +52 -4
- package/dist/index.js.map +1 -1
- package/dist/npaw-forge-web.iife.js +53 -5
- package/dist/npaw-forge-web.iife.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1531,6 +1531,14 @@ var defaultPrivacy = {
|
|
|
1531
1531
|
hashElementIdentity: false,
|
|
1532
1532
|
captureElementText: true
|
|
1533
1533
|
};
|
|
1534
|
+
var CACHE_STATS_RESPONSE_HEADERS = [
|
|
1535
|
+
"cache-status",
|
|
1536
|
+
"cf-cache-status",
|
|
1537
|
+
"x-cache-status",
|
|
1538
|
+
"x-cache",
|
|
1539
|
+
"x-cache-remote"
|
|
1540
|
+
];
|
|
1541
|
+
var CACHE_STATS_JOIN_KEYS = new Set(CACHE_STATS_RESPONSE_HEADERS);
|
|
1534
1542
|
var networkCaptureSuppressionDepth = 0;
|
|
1535
1543
|
var nextNetworkEventId = 1;
|
|
1536
1544
|
var REMOTE_FOCUS_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -2773,7 +2781,11 @@ var BrowserCapture = class {
|
|
|
2773
2781
|
if (Object.keys(requestHeaders).length > 0) {
|
|
2774
2782
|
observation.requestHeaders = requestHeaders;
|
|
2775
2783
|
}
|
|
2776
|
-
const
|
|
2784
|
+
const responseHeaderNames = [
|
|
2785
|
+
...this.options.privacy.allowedResponseHeaders,
|
|
2786
|
+
...CACHE_STATS_RESPONSE_HEADERS
|
|
2787
|
+
];
|
|
2788
|
+
const responseHeaders = result.response ? sanitizeHeaders(result.response.headers, responseHeaderNames) : sanitizeRawHeaders((_n = (_m = (_l = result.xhr) == null ? void 0 : _l.getAllResponseHeaders) == null ? void 0 : _m.call(_l)) != null ? _n : "", responseHeaderNames);
|
|
2777
2789
|
if (Object.keys(responseHeaders).length > 0) {
|
|
2778
2790
|
observation.responseHeaders = responseHeaders;
|
|
2779
2791
|
}
|
|
@@ -3198,8 +3210,14 @@ function sanitizeRawHeaders(rawHeaders, allowlist) {
|
|
|
3198
3210
|
continue;
|
|
3199
3211
|
}
|
|
3200
3212
|
const key = line.slice(0, separator).trim().toLowerCase();
|
|
3201
|
-
if (allowed.has(key)) {
|
|
3202
|
-
|
|
3213
|
+
if (!allowed.has(key)) {
|
|
3214
|
+
continue;
|
|
3215
|
+
}
|
|
3216
|
+
const value = sanitizeCaptureString(line.slice(separator + 1).trim());
|
|
3217
|
+
if (output[key] !== void 0 && CACHE_STATS_JOIN_KEYS.has(key)) {
|
|
3218
|
+
output[key] = `${output[key]}, ${value}`;
|
|
3219
|
+
} else {
|
|
3220
|
+
output[key] = value;
|
|
3203
3221
|
}
|
|
3204
3222
|
}
|
|
3205
3223
|
return output;
|
|
@@ -3309,7 +3327,11 @@ var METRIC_FIELDS = [
|
|
|
3309
3327
|
"batteryLevelPct",
|
|
3310
3328
|
"batteryCharging",
|
|
3311
3329
|
"thermal",
|
|
3312
|
-
"diskFreeBytes"
|
|
3330
|
+
"diskFreeBytes",
|
|
3331
|
+
"netSignalDbm",
|
|
3332
|
+
"netLinkMbps",
|
|
3333
|
+
"netDownlinkKbps",
|
|
3334
|
+
"netFreqMhz"
|
|
3313
3335
|
];
|
|
3314
3336
|
async function collectBrowserDeviceSample(families, environment = readBrowserDeviceInsightsEnvironment()) {
|
|
3315
3337
|
const sample = {};
|
|
@@ -3328,6 +3350,12 @@ async function collectBrowserDeviceSample(families, environment = readBrowserDev
|
|
|
3328
3350
|
sample.batteryCharging = battery.charging;
|
|
3329
3351
|
}
|
|
3330
3352
|
}
|
|
3353
|
+
if (families.includes("net")) {
|
|
3354
|
+
const downlinkKbps = readDownlinkKbps(environment);
|
|
3355
|
+
if (downlinkKbps !== void 0) {
|
|
3356
|
+
sample.netDownlinkKbps = downlinkKbps;
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3331
3359
|
return hasDeviceMetric(sample) ? sample : void 0;
|
|
3332
3360
|
}
|
|
3333
3361
|
function hasDeviceMetric(sample) {
|
|
@@ -3385,6 +3413,22 @@ async function readBattery(environment) {
|
|
|
3385
3413
|
}
|
|
3386
3414
|
return result;
|
|
3387
3415
|
}
|
|
3416
|
+
function readDownlinkKbps(environment) {
|
|
3417
|
+
var _a;
|
|
3418
|
+
if (!environment.connection) {
|
|
3419
|
+
return void 0;
|
|
3420
|
+
}
|
|
3421
|
+
let downlink;
|
|
3422
|
+
try {
|
|
3423
|
+
downlink = (_a = environment.connection()) == null ? void 0 : _a.downlink;
|
|
3424
|
+
} catch (e) {
|
|
3425
|
+
return void 0;
|
|
3426
|
+
}
|
|
3427
|
+
if (typeof downlink !== "number" || !Number.isFinite(downlink) || downlink <= 0) {
|
|
3428
|
+
return void 0;
|
|
3429
|
+
}
|
|
3430
|
+
return Math.round(downlink * 1e3);
|
|
3431
|
+
}
|
|
3388
3432
|
function readBrowserDeviceInsightsEnvironment() {
|
|
3389
3433
|
const environment = {};
|
|
3390
3434
|
const performanceRef = globalThis.performance;
|
|
@@ -3395,6 +3439,10 @@ function readBrowserDeviceInsightsEnvironment() {
|
|
|
3395
3439
|
if (navigatorRef && typeof navigatorRef.getBattery === "function") {
|
|
3396
3440
|
environment.getBattery = () => navigatorRef.getBattery();
|
|
3397
3441
|
}
|
|
3442
|
+
const connectionRef = navigatorRef == null ? void 0 : navigatorRef.connection;
|
|
3443
|
+
if (connectionRef && typeof connectionRef === "object") {
|
|
3444
|
+
environment.connection = () => connectionRef;
|
|
3445
|
+
}
|
|
3398
3446
|
return environment;
|
|
3399
3447
|
}
|
|
3400
3448
|
|