@absolutejs/beacon 0.4.16 → 0.4.18

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 CHANGED
@@ -123,15 +123,24 @@ beacon.captureMessage("checkout started", "info");
123
123
  storms (one endpoint hammered in seconds), reload loops, stale releases (a
124
124
  service worker serving a build older than one this browser already ran),
125
125
  font-face load failures, focus dropped to `<body>` when a dialog unmounts,
126
- and form frustration (identical resubmits / repeated native-validation
127
- failures). Each is individually toggleable on `signals`, deduped, capped,
128
- and exempts `data-beacon-scan="allow"` subtrees where a DOM scan is
129
- involved.
126
+ focus escaping or never entering an explicit modal, browser interventions,
127
+ enforced CSP violations, repeated visible-page main-thread stalls, and form
128
+ frustration (identical resubmits / repeated native-validation failures).
129
+ Each is individually toggleable on `signals`, deduped, capped, and exempts
130
+ `data-beacon-scan="allow"` subtrees where a DOM scan is involved.
130
131
  - **Actionable network signals** — expected aborts remain breadcrumbs instead of
131
132
  issues; offline, timeout, isolated-endpoint, and multi-endpoint connectivity
132
- failures are classified separately. Concurrent failures become one event with
133
- every attempt, method, endpoint, duration, original error/stack, online state,
134
- transport, and page visibility preserved in `extra.networkFailures`.
133
+ failures are classified separately. HTTP 429 responses and repeated 401/403
134
+ responses surface rate-limit and authorization storms without treating one
135
+ ordinary authorization rejection as an issue. Concurrent failures become one
136
+ event with every attempt, method, endpoint, duration, original error/stack,
137
+ online state, transport, and page visibility preserved in
138
+ `extra.networkFailures`.
139
+ - **Runtime boundary signals** — abnormal WebSocket closes, WebSocket and SSE
140
+ reconnect flapping, handled service-worker registration/install failures, and
141
+ dedicated/shared worker construction, runtime, and message-decoding failures
142
+ become replay-linked warnings. Normal socket closes, page teardown, hidden-tab
143
+ SSE errors, and successfully replaced service workers are exempt.
135
144
 
136
145
  ## API
137
146
 
@@ -148,7 +157,7 @@ setTags(tags) · setUser(user | null)
148
157
  flush() => Promise<void> // buffered events out now
149
158
  close() => Promise<void> // remove listeners + final flush
150
159
 
151
- // Typed names for event.tags.signal in beforeSend policies:
160
+ // Typed names for event.tags.signal in beforeSend policies (all built-ins):
152
161
  BEACON_SIGNAL.FETCH_FAILED
153
162
  BEACON_SIGNAL.SLOW_RESPONSE
154
163
  BEACON_SIGNAL.HTTP_5XX
package/dist/index.d.ts CHANGED
@@ -21,7 +21,10 @@
21
21
  export type BeaconLevel = "fatal" | "error" | "warning" | "info";
22
22
  /** Stable names for Beacon's built-in UX and health signals. */
23
23
  export declare const BEACON_SIGNAL: {
24
+ readonly AUTH_FAILURE_STORM: "auth_failure_storm";
25
+ readonly BROWSER_INTERVENTION: "browser_intervention";
24
26
  readonly CONSOLE_ERROR: "console_error";
27
+ readonly CSP_VIOLATION: "csp_violation";
25
28
  readonly DEAD_CLICK: "dead_click";
26
29
  readonly FETCH_FAILED: "fetch_failed";
27
30
  readonly FOCUS_LOST: "focus_lost";
@@ -30,16 +33,23 @@ export declare const BEACON_SIGNAL: {
30
33
  readonly HTTP_5XX: "http_5xx";
31
34
  readonly INVISIBLE_TEXT: "invisible_text";
32
35
  readonly LAYOUT_OVERFLOW: "layout_overflow";
36
+ readonly MAIN_THREAD_STALL: "main_thread_stall";
37
+ readonly MODAL_FOCUS_ESCAPE: "modal_focus_escape";
33
38
  readonly OCCLUDED_CONTROL: "occluded_control";
34
39
  readonly RAGE_CLICK: "rage_click";
40
+ readonly RATE_LIMITED: "rate_limited";
35
41
  readonly RELOAD_LOOP: "reload_loop";
36
42
  readonly REQUEST_STORM: "request_storm";
37
43
  readonly SCROLL_JAIL: "scroll_jail";
38
44
  readonly SLOW_RESPONSE: "slow_response";
45
+ readonly SOCKET_ABNORMAL_CLOSE: "socket_abnormal_close";
39
46
  readonly SOCKET_FLAPPING: "socket_flapping";
47
+ readonly SSE_FLAPPING: "sse_flapping";
40
48
  readonly STALE_RELEASE: "stale_release";
41
49
  readonly STALLED_STREAM: "stalled_stream";
42
50
  readonly STUCK_LOADING: "stuck_loading";
51
+ readonly SERVICE_WORKER_FAILURE: "service_worker_failure";
52
+ readonly WORKER_FAILURE: "worker_failure";
43
53
  };
44
54
  export type BeaconSignal = (typeof BEACON_SIGNAL)[keyof typeof BEACON_SIGNAL];
45
55
  /** Stable DOM attributes understood by Beacon's instrumentation. */
@@ -141,10 +151,21 @@ export type BeaconResourceFailure = {
141
151
  * full session streaming. Each enabled signal becomes a warning-level issue
142
152
  * (via `captureException`, so it carries breadcrumbs + the replayId), surfacing
143
153
  * silent problems no thrown error or user report would: rage/dead clicks,
144
- * server 5xx, slow/failed requests, and `console.error`. Reuses the existing
145
- * click / fetch / console instrumentation — no extra global patching.
154
+ * server failures, policy violations, worker/realtime faults, and
155
+ * `console.error`. Each detector is feature-gated and independently tunable.
146
156
  */
147
157
  export type BeaconSignals = {
158
+ /** Repeated 401/403 responses from one endpoint inside a short window.
159
+ * Default true. */
160
+ authFailureStorms?: boolean;
161
+ /** Authorization failures from one endpoint that trip a storm. Default 4. */
162
+ authFailureStormCount?: number;
163
+ /** Window for the authorization-failure storm counter. Default 30000ms. */
164
+ authFailureStormWindowMs?: number;
165
+ /** Browser intervention reports surfaced by ReportingObserver. Default true. */
166
+ browserInterventions?: boolean;
167
+ /** Enforced Content Security Policy violations. Default true. */
168
+ cspViolations?: boolean;
148
169
  /** N rapid clicks in roughly the same spot. Default true. */
149
170
  rageClicks?: boolean;
150
171
  /** An interactive control clicked with no DOM/nav/scroll/focus/request response. Default true. */
@@ -183,12 +204,25 @@ export type BeaconSignals = {
183
204
  /** Quiet period after load/resize/navigation before the settled visual
184
205
  * scan runs, letting transitions and lazy content settle. Default 600ms. */
185
206
  layoutOverflowSettleMs?: number;
207
+ /** Repeated long animation frames/tasks on a visible page. Default true. */
208
+ mainThreadStalls?: boolean;
209
+ /** Long-frame duration that counts as a main-thread stall. Default 200ms. */
210
+ mainThreadStallMs?: number;
211
+ /** Stalls inside the window that trip a report. Default 3. */
212
+ mainThreadStallCount?: number;
213
+ /** Window for repeated main-thread stalls. Default 10000ms. */
214
+ mainThreadStallWindowMs?: number;
215
+ /** Focus outside an open modal, including a modal that never receives
216
+ * initial focus. Default true. */
217
+ modalFocusEscape?: boolean;
186
218
  /** Sampled `elementFromPoint` check for interactive controls covered by an
187
219
  * unrelated element (leaked scrims, z-index bugs). Skipped entirely while
188
220
  * a dialog is open. Default true. */
189
221
  occludedControls?: boolean;
190
222
  /** Rapid-click count that trips a rage click. Default 3. */
191
223
  rageClickCount?: number;
224
+ /** HTTP 429 responses. Default true. */
225
+ rateLimits?: boolean;
192
226
  /** Several full page loads within a minute — a crash or reload loop.
193
227
  * Default true. */
194
228
  reloadLoops?: boolean;
@@ -204,9 +238,20 @@ export type BeaconSignals = {
204
238
  * scroll lock leaked by a closed modal. Boundary scrolling (already at the
205
239
  * top/bottom) is exempt. Default true. */
206
240
  scrollJail?: boolean;
241
+ /** Service-worker registration and installation failures. Default true. */
242
+ serviceWorkerFailures?: boolean;
243
+ /** Abnormal WebSocket closes (`wasClean: false` or non-normal codes).
244
+ * Default true. */
245
+ socketAbnormalCloses?: boolean;
207
246
  /** WebSocket connect/close cycles to one URL tripping a flap report.
208
247
  * Default true. */
209
248
  socketFlapping?: boolean;
249
+ /** Repeated EventSource error/reconnect cycles. Default true. */
250
+ sseFlapping?: boolean;
251
+ /** EventSource failures that trip a flap report. Default 4. */
252
+ sseFlapCount?: number;
253
+ /** Window for EventSource flap detection. Default 60000ms. */
254
+ sseFlapWindowMs?: number;
210
255
  /** This page's `release` is older than one this browser has already run —
211
256
  * a service worker or cache serving a stale build. Default true. */
212
257
  staleReleases?: boolean;
@@ -223,6 +268,9 @@ export type BeaconSignals = {
223
268
  /** Age at which a visible loading indicator counts as stuck.
224
269
  * Default 20000ms. */
225
270
  stuckLoadingMs?: number;
271
+ /** Dedicated/shared worker construction, runtime, and message decoding
272
+ * failures. Default true. */
273
+ workerFailures?: boolean;
226
274
  /**
227
275
  * Maximum wait for a same-origin link accepted by an SPA router to finish
228
276
  * navigating before it is considered dead. Default 8000ms; never shorter