@absolutejs/beacon 0.6.62 → 0.7.0-beta.0

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
@@ -254,6 +254,73 @@ SSR-safe: imported in a non-DOM environment, `createBeacon` returns a no-op.
254
254
  Semantic grouping keys require `@absolutejs/errors` 0.7.3 or newer at the
255
255
  ingest boundary.
256
256
 
257
+ ## Noise policy (`@absolutejs/beacon/policy`)
258
+
259
+ An issue board is only worth opening if everything on it is real. Every
260
+ application that ships Beacon ends up writing the same `beforeSend` filter — and
261
+ most of what goes in it is not application-specific at all: a stale chunk import
262
+ after a deploy, a theme extension rewriting inline styles before hydration, a
263
+ read that failed while the tab was hidden, a 5xx the server already captured
264
+ with a stack. What differs is a handful of endpoints and hostnames.
265
+
266
+ ```ts
267
+ import {
268
+ createNoisePolicy,
269
+ createResourceFailurePolicy,
270
+ reliabilitySignalPreset,
271
+ BEACON_SIGNAL,
272
+ } from "@absolutejs/beacon/policy";
273
+
274
+ const isNoise = createNoisePolicy({
275
+ // Signals these endpoints raise in normal operation: a stream that stays
276
+ // open for a whole shift, an upload that is megabytes by design.
277
+ exemptions: [
278
+ {
279
+ signals: [BEACON_SIGNAL.SLOW_RESPONSE, BEACON_SIGNAL.FETCH_FAILED],
280
+ endpoints: ["/sync", "/stream"],
281
+ },
282
+ {
283
+ signals: [BEACON_SIGNAL.SLOW_RESPONSE],
284
+ endpoints: ["/api/uploads"],
285
+ methods: ["POST"],
286
+ },
287
+ ],
288
+ // A 5xx from here still reports even when the server captured it: a server
289
+ // that stopped answering cannot file its own issue.
290
+ probeEndpoints: ["/api/health"],
291
+ });
292
+
293
+ initBeacon({
294
+ // ...
295
+ signals: reliabilitySignalPreset({
296
+ behavioural,
297
+ recoverableSockets: ["/sync"],
298
+ }),
299
+ instrument: {
300
+ resourceErrors: createResourceFailurePolicy({
301
+ thirdPartyHosts: ["googletagmanager.com", "js.stripe.com"],
302
+ optionalPathPrefixes: ["/uploads/"],
303
+ }),
304
+ },
305
+ beforeSend: (event) => (isNoise(event) ? null : event),
306
+ });
307
+ ```
308
+
309
+ Built in, each switchable and individually exported: hidden-tab read failures,
310
+ 5xx the server already captured, stale releases the app prompts for itself,
311
+ stale chunk imports, theme-extension hydration mismatches, and third-party
312
+ deprecation reports. `rules` takes application-specific predicates.
313
+
314
+ `reliabilitySignalPreset` turns off the four detectors another system usually
315
+ already owns — browser policy reports (a `report-to` endpoint is canonical),
316
+ document discards, latency (a performance console), stale releases (a service
317
+ worker prompt) — and puts the behavioural detectors behind a consent flag.
318
+ Everything it does not name keeps its Beacon default.
319
+
320
+ This entry point imports nothing from the SDK at runtime: boot-time policy is
321
+ read by the synchronous page graph, and pulling Beacon's runtime in there makes
322
+ the bundler merge the whole SDK back into it, defeating lazy startup.
323
+
257
324
  ## License
258
325
 
259
326
  BSL-1.1 with a named carveout against hosted error-tracking / session-replay
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export type BeaconLevel = "fatal" | "error" | "warning" | "info";
25
25
  /** Response header used to correlate a browser signal with its server request. */
26
26
  export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
27
27
  /** Beacon package version retained with every captured event. */
28
- export declare const BEACON_SDK_VERSION = "0.6.62";
28
+ export declare const BEACON_SDK_VERSION = "0.7.0-beta.0";
29
29
  /** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
30
30
  export type BeaconTags = Record<string, string> & {
31
31
  signal?: BeaconSignal;
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ var BEACON_ATTRIBUTE = {
79
79
 
80
80
  // src/index.ts
81
81
  var BEACON_TRACE_HEADER = "x-absolute-trace-id";
82
- var BEACON_SDK_VERSION = "0.6.62";
82
+ var BEACON_SDK_VERSION = "0.7.0-beta.0";
83
83
  var inBrowser = () => typeof window !== "undefined";
84
84
  var newId = () => {
85
85
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -4568,5 +4568,5 @@ export {
4568
4568
  redactBeaconEvent
4569
4569
  };
4570
4570
 
4571
- //# debugId=265E265F233DD52C64756E2164756E21
4571
+ //# debugId=2893EF726AC7EB0764756E2164756E21
4572
4572
  //# sourceMappingURL=index.js.map