@mushi-mushi/core 1.32.0 → 1.32.2
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/README.md +2 -2
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/reporter-channels.d.cts +1 -1
- package/dist/reporter-channels.d.ts +1 -1
- package/dist/{types-0j5BJ3aC.d.cts → types-CWa7T4bx.d.cts} +8 -5
- package/dist/{types-0j5BJ3aC.d.ts → types-CWa7T4bx.d.ts} +8 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,13 +48,13 @@ const resolved = expandPreset(config); // preset → nested options, explicit va
|
|
|
48
48
|
|
|
49
49
|
## Sampling and filters
|
|
50
50
|
|
|
51
|
-
Sampling
|
|
51
|
+
Sampling applies to **automatic** error reports, and the error filters to automatic reports and `captureException()`. A report a user sends from the widget is never sampled or filtered out. Only your own `beforeSend` can change or drop it.
|
|
52
52
|
|
|
53
53
|
| Field | Default | What it does |
|
|
54
54
|
| --- | --- | --- |
|
|
55
55
|
| `sampleRate` | `1` | Share of automatic error reports to send (`0`–`1`) |
|
|
56
56
|
| `replaySampleRate` | `1` | Share of sessions that record replay |
|
|
57
|
-
| `ignoreErrors` / `denyUrls` / `allowUrls` | — | Drop matching automatic
|
|
57
|
+
| `ignoreErrors` / `denyUrls` / `allowUrls` | — | Drop matching errors from automatic capture and `captureException()`. URLs match the frame that threw |
|
|
58
58
|
| `beforeSend` | — | `(report) => report \| null` for every report, after the PII scrubber. Return `null` to drop |
|
|
59
59
|
| `tunnel` | — | Same-origin ingest path (e.g. `/api/mushi-tunnel`) so ad blockers don't drop reports |
|
|
60
60
|
|
package/dist/index.cjs
CHANGED
|
@@ -169,8 +169,9 @@ function isPageUnloading() {
|
|
|
169
169
|
// src/api-client.ts
|
|
170
170
|
var lastOutbound = null;
|
|
171
171
|
function flushLastOutboundOnUnload() {
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
const outbound = lastOutbound;
|
|
173
|
+
lastOutbound = null;
|
|
174
|
+
return !!outbound && sendOnUnload(outbound);
|
|
174
175
|
}
|
|
175
176
|
var _credWarningEmitted = false;
|
|
176
177
|
var MUSHI_USER_TOKEN_HEADER = "X-Mushi-User-Token";
|
|
@@ -252,8 +253,10 @@ function createApiClient(options) {
|
|
|
252
253
|
...extraHeaders
|
|
253
254
|
};
|
|
254
255
|
const serialized = body ? JSON.stringify(body) : void 0;
|
|
256
|
+
let outbound = null;
|
|
255
257
|
if (serialized && method !== "GET" && internalKind !== "reporter-poll") {
|
|
256
|
-
|
|
258
|
+
outbound = { url, headers, body: serialized, path };
|
|
259
|
+
lastOutbound = outbound;
|
|
257
260
|
}
|
|
258
261
|
try {
|
|
259
262
|
const response = await fetch(url, {
|
|
@@ -323,6 +326,8 @@ function createApiClient(options) {
|
|
|
323
326
|
message: error instanceof Error ? error.message : "Unknown network error"
|
|
324
327
|
}
|
|
325
328
|
};
|
|
329
|
+
} finally {
|
|
330
|
+
if (lastOutbound === outbound) lastOutbound = null;
|
|
326
331
|
}
|
|
327
332
|
}
|
|
328
333
|
async function requestForReporter(method, path, reporterToken, body) {
|
|
@@ -620,6 +625,7 @@ function matchesErrorFilter(value, filters) {
|
|
|
620
625
|
continue;
|
|
621
626
|
}
|
|
622
627
|
try {
|
|
628
|
+
filter.lastIndex = 0;
|
|
623
629
|
if (filter.test(value)) return true;
|
|
624
630
|
} catch {
|
|
625
631
|
}
|