@absolutejs/beacon 0.7.0-beta.22 → 0.7.0-beta.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/CHANGELOG.md +12 -0
- package/changelog.json +26 -0
- package/dist/index.d.ts +1 -21
- package/dist/index.js +68 -14
- package/dist/index.js.map +5 -4
- package/dist/outbox.js.map +1 -1
- package/dist/rejection.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ This file is generated by `absolute-changelog` from the entries in
|
|
|
6
6
|
`changelog/`. Edit an entry, not this file — and add new ones under
|
|
7
7
|
`changelog/unreleased/`.
|
|
8
8
|
|
|
9
|
+
## 0.7.0-beta.24 — 2026-11-17
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Preserve safe browser rejection diagnostics instead of empty JSON, handle throwing getters and proxies, and avoid serializing arbitrary rejection payloads or fabricating stacks.** (`BEACON_SDK_VERSION`)
|
|
14
|
+
|
|
15
|
+
## 0.7.0-beta.23 — 2026-10-28
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Require meaningful accumulated pixel scroll intent before reporting scroll jail, avoiding fractional trackpad inertia false positives while retaining blocked-scroll detection.** (`BEACON_SDK_VERSION`)
|
|
20
|
+
|
|
9
21
|
## 0.7.0-beta.22 — 2026-10-27
|
|
10
22
|
|
|
11
23
|
### Fixed
|
package/changelog.json
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
"contract": 1,
|
|
3
3
|
"name": "@absolutejs/beacon",
|
|
4
4
|
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "fixed",
|
|
9
|
+
"summary": "Preserve safe browser rejection diagnostics instead of empty JSON, handle throwing getters and proxies, and avoid serializing arbitrary rejection payloads or fabricating stacks.",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"BEACON_SDK_VERSION"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"date": "2026-11-17",
|
|
16
|
+
"version": "0.7.0-beta.24"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"changes": [
|
|
20
|
+
{
|
|
21
|
+
"kind": "fixed",
|
|
22
|
+
"summary": "Require meaningful accumulated pixel scroll intent before reporting scroll jail, avoiding fractional trackpad inertia false positives while retaining blocked-scroll detection.",
|
|
23
|
+
"symbols": [
|
|
24
|
+
"BEACON_SDK_VERSION"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"date": "2026-10-28",
|
|
29
|
+
"version": "0.7.0-beta.23"
|
|
30
|
+
},
|
|
5
31
|
{
|
|
6
32
|
"changes": [
|
|
7
33
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @absolutejs/beacon — tiny, zero-dependency browser SDK for the AbsoluteJS
|
|
3
|
-
* observability stack.
|
|
4
|
-
*
|
|
5
|
-
* It is deliberately NOT Effect-native: a browser SDK loads on every page for
|
|
6
|
-
* every user, so bytes are the dominant cost (measured: an Effect client is
|
|
7
|
-
* ~108 KB gz; this is ~2-5 KB gz). The client has no trust boundary — it's a
|
|
8
|
-
* dumb producer of telemetry — so the Effect/Schema rigor lives server-side in
|
|
9
|
-
* `@absolutejs/errors/ingest`, which validates the untrusted POST body.
|
|
10
|
-
*
|
|
11
|
-
* Type safety is preserved end-to-end WITHOUT shipping Effect: the envelope
|
|
12
|
-
* type below is contract-locked to the ingest endpoint's accepted shape by a
|
|
13
|
-
* compile-time assertion in tests (`tests/contract.test.ts`). The type spans
|
|
14
|
-
* the wire; the runtime machinery does not.
|
|
15
|
-
*
|
|
16
|
-
* captureException / global handlers
|
|
17
|
-
* → enrich (breadcrumbs, tags, context, replayId)
|
|
18
|
-
* → batch
|
|
19
|
-
* → flush: POST envelope to /ingest via sendBeacon / fetch keepalive
|
|
20
|
-
*/
|
|
21
1
|
export { BEACON_ATTRIBUTE, BEACON_SIGNAL } from "./contracts";
|
|
22
2
|
export type { BeaconSignal } from "./contracts";
|
|
23
3
|
import type { BeaconSignal } from "./contracts";
|
|
@@ -25,7 +5,7 @@ export type BeaconLevel = "fatal" | "error" | "warning" | "info";
|
|
|
25
5
|
/** Response header used to correlate a browser signal with its server request. */
|
|
26
6
|
export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
27
7
|
/** Beacon package version retained with every captured event. */
|
|
28
|
-
export declare const BEACON_SDK_VERSION = "0.7.0-beta.
|
|
8
|
+
export declare const BEACON_SDK_VERSION = "0.7.0-beta.24";
|
|
29
9
|
/** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
|
|
30
10
|
export type BeaconTags = Record<string, string> & {
|
|
31
11
|
signal?: BeaconSignal;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
+
// src/rejection.ts
|
|
2
|
+
var read = (value, key) => {
|
|
3
|
+
try {
|
|
4
|
+
return value !== null && (typeof value === "object" || typeof value === "function") ? Reflect.get(value, key) : undefined;
|
|
5
|
+
} catch {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
var isArray = (value) => {
|
|
10
|
+
try {
|
|
11
|
+
return Array.isArray(value);
|
|
12
|
+
} catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var text = (value) => typeof value === "string" && value.length > 0 ? value.slice(0, 2048) : undefined;
|
|
17
|
+
var describeRejection = (reason) => {
|
|
18
|
+
const extra = {
|
|
19
|
+
rejectionType: reason === null ? "null" : isArray(reason) ? "array" : typeof reason
|
|
20
|
+
};
|
|
21
|
+
const name = text(read(reason, "name"));
|
|
22
|
+
const message = text(read(reason, "message"));
|
|
23
|
+
const originalStack = read(reason, "stack");
|
|
24
|
+
const stack = typeof originalStack === "string" ? originalStack : undefined;
|
|
25
|
+
const className = text(read(read(reason, "constructor"), "name"));
|
|
26
|
+
if (className)
|
|
27
|
+
extra.rejectionClass = className;
|
|
28
|
+
for (const key of ["code", "type", "status", "statusText", "url"]) {
|
|
29
|
+
const value = read(reason, key);
|
|
30
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
31
|
+
extra[key] = value;
|
|
32
|
+
else if (text(value))
|
|
33
|
+
extra[key] = text(value);
|
|
34
|
+
}
|
|
35
|
+
const target = read(reason, "target");
|
|
36
|
+
const tag = text(read(target, "tagName"));
|
|
37
|
+
if (tag)
|
|
38
|
+
extra.resourceTag = tag;
|
|
39
|
+
if (tag && ["SCRIPT", "LINK", "IMG", "SOURCE", "VIDEO", "AUDIO"].includes(tag.toUpperCase())) {
|
|
40
|
+
const url = text(read(target, "currentSrc")) ?? text(read(target, "src")) ?? text(read(target, "href"));
|
|
41
|
+
if (url)
|
|
42
|
+
extra.resourceUrl = url;
|
|
43
|
+
}
|
|
44
|
+
const description = message ?? (typeof reason === "string" ? reason : reason === null || typeof reason !== "object" && typeof reason !== "function" ? String(reason) : `Unhandled promise rejection (${name ?? className ?? "object"}${extra.type ? `: ${extra.type}` : ""}${extra.status !== undefined ? `; status ${extra.status}` : ""})`);
|
|
45
|
+
const error = new Error(description);
|
|
46
|
+
error.name = name ?? "UnhandledRejection";
|
|
47
|
+
error.stack = stack;
|
|
48
|
+
const cause = read(reason, "cause");
|
|
49
|
+
if (stack !== undefined && cause !== undefined)
|
|
50
|
+
error.cause = cause;
|
|
51
|
+
return { error, extra };
|
|
52
|
+
};
|
|
53
|
+
|
|
1
54
|
// src/contracts.ts
|
|
2
55
|
var BEACON_SIGNAL = {
|
|
3
56
|
AUTH_FAILURE_STORM: "auth_failure_storm",
|
|
@@ -192,7 +245,7 @@ var consumeEarlyLayoutShiftBuffer = () => {
|
|
|
192
245
|
|
|
193
246
|
// src/index.ts
|
|
194
247
|
var BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
195
|
-
var BEACON_SDK_VERSION = "0.7.0-beta.
|
|
248
|
+
var BEACON_SDK_VERSION = "0.7.0-beta.24";
|
|
196
249
|
var inBrowser = () => typeof window !== "undefined";
|
|
197
250
|
var newId = () => {
|
|
198
251
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -971,6 +1024,7 @@ var createBeacon = (options) => {
|
|
|
971
1024
|
const FONT_FAILURE_CONFIRM_DEFAULT_MS = 5000;
|
|
972
1025
|
const KEYBOARD_VIEWPORT_HEIGHT_RATIO_MAX = 0.8;
|
|
973
1026
|
const SCROLL_JAIL_EVENT_COUNT = 8;
|
|
1027
|
+
const SCROLL_JAIL_MIN_PIXEL_INTENT = 16;
|
|
974
1028
|
const SCROLL_JAIL_WINDOW_MS = 2000;
|
|
975
1029
|
const SCROLL_JAIL_SETTLE_MS = 500;
|
|
976
1030
|
const SCROLL_JAIL_BOUNDARY_TOLERANCE_PX = 2;
|
|
@@ -2025,22 +2079,17 @@ var createBeacon = (options) => {
|
|
|
2025
2079
|
if (instrument.unhandledRejections !== false) {
|
|
2026
2080
|
const onRejection = (event) => {
|
|
2027
2081
|
const reason = event.reason;
|
|
2028
|
-
|
|
2082
|
+
let nativeError = false;
|
|
2083
|
+
try {
|
|
2084
|
+
nativeError = reason instanceof Error;
|
|
2085
|
+
} catch {}
|
|
2086
|
+
if (nativeError) {
|
|
2029
2087
|
captureException(reason, { level: "error" });
|
|
2030
2088
|
reportCapturedErrorClick(reason);
|
|
2031
2089
|
return;
|
|
2032
2090
|
}
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
return;
|
|
2036
|
-
}
|
|
2037
|
-
const message = typeof reason === "string" ? reason : safeStringify(reason);
|
|
2038
|
-
captureException(errorWithoutStack("UnhandledRejection", message), {
|
|
2039
|
-
extra: {
|
|
2040
|
-
rejectionType: reason === null ? "null" : Array.isArray(reason) ? "array" : typeof reason
|
|
2041
|
-
},
|
|
2042
|
-
level: "error"
|
|
2043
|
-
});
|
|
2091
|
+
const { error, extra } = describeRejection(reason);
|
|
2092
|
+
captureException(error, { extra, level: "error" });
|
|
2044
2093
|
reportErrorClick?.("UnhandledRejection");
|
|
2045
2094
|
};
|
|
2046
2095
|
window.addEventListener("unhandledrejection", onRejection);
|
|
@@ -3736,6 +3785,10 @@ var createBeacon = (options) => {
|
|
|
3736
3785
|
jailBurst = [];
|
|
3737
3786
|
if (confirmedBurst.length < SCROLL_JAIL_EVENT_COUNT)
|
|
3738
3787
|
return;
|
|
3788
|
+
const pixelBurst = confirmedBurst.every(({ event }) => event.deltaMode === undefined || event.deltaMode === 0);
|
|
3789
|
+
const requestedPixels = confirmedBurst.reduce((sum, { event }) => sum + event.deltaY, 0);
|
|
3790
|
+
if (pixelBurst && Math.abs(requestedPixels) < SCROLL_JAIL_MIN_PIXEL_INTENT)
|
|
3791
|
+
return;
|
|
3739
3792
|
if (scrollActivityGeneration !== jailStartingScrollGeneration)
|
|
3740
3793
|
return;
|
|
3741
3794
|
if (!scroller.isConnected || scroller.scrollTop !== startingPosition)
|
|
@@ -3755,6 +3808,7 @@ var createBeacon = (options) => {
|
|
|
3755
3808
|
scroller: descriptor,
|
|
3756
3809
|
direction: scrollingDown ? "down" : "up",
|
|
3757
3810
|
wheelCount: confirmedBurst.length,
|
|
3811
|
+
requestedPixels: pixelBurst ? requestedPixels : undefined,
|
|
3758
3812
|
deltaX: event.deltaX,
|
|
3759
3813
|
deltaY: event.deltaY,
|
|
3760
3814
|
deltaMode: event.deltaMode,
|
|
@@ -5066,5 +5120,5 @@ export {
|
|
|
5066
5120
|
redactBeaconEvent
|
|
5067
5121
|
};
|
|
5068
5122
|
|
|
5069
|
-
//# debugId=
|
|
5123
|
+
//# debugId=0615D4EF9F91436164756E2164756E21
|
|
5070
5124
|
//# sourceMappingURL=index.js.map
|