@absolutejs/beacon 0.7.0-beta.27 → 0.7.0-beta.28
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 +6 -0
- package/changelog.json +14 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +36 -13
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ 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.28 — 2026-11-30
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Retain page and script origins plus installation state transitions for service-worker failures. Keep same-path failures from different origins distinct within the observer without retaining URL query values or changing existing issue messages.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
14
|
+
|
|
9
15
|
## 0.7.0-beta.27 — 2026-11-30
|
|
10
16
|
|
|
11
17
|
### Fixed
|
package/changelog.json
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
"contract": 1,
|
|
3
3
|
"name": "@absolutejs/beacon",
|
|
4
4
|
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "fixed",
|
|
9
|
+
"summary": "Retain page and script origins plus installation state transitions for service-worker failures. Keep same-path failures from different origins distinct within the observer without retaining URL query values or changing existing issue messages.",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"createBeacon",
|
|
12
|
+
"BEACON_SDK_VERSION"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"date": "2026-11-30",
|
|
17
|
+
"version": "0.7.0-beta.28"
|
|
18
|
+
},
|
|
5
19
|
{
|
|
6
20
|
"changes": [
|
|
7
21
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type BeaconLevel = "fatal" | "error" | "warning" | "info";
|
|
|
5
5
|
/** Response header used to correlate a browser signal with its server request. */
|
|
6
6
|
export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
7
7
|
/** Beacon package version retained with every captured event. */
|
|
8
|
-
export declare const BEACON_SDK_VERSION = "0.7.0-beta.
|
|
8
|
+
export declare const BEACON_SDK_VERSION = "0.7.0-beta.28";
|
|
9
9
|
/** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
|
|
10
10
|
export type BeaconTags = Record<string, string> & {
|
|
11
11
|
signal?: BeaconSignal;
|
package/dist/index.js
CHANGED
|
@@ -311,7 +311,7 @@ var consumeEarlyLayoutShiftBuffer = () => {
|
|
|
311
311
|
|
|
312
312
|
// src/index.ts
|
|
313
313
|
var BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
314
|
-
var BEACON_SDK_VERSION = "0.7.0-beta.
|
|
314
|
+
var BEACON_SDK_VERSION = "0.7.0-beta.28";
|
|
315
315
|
var inBrowser = () => typeof window !== "undefined";
|
|
316
316
|
var newId = () => {
|
|
317
317
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -4638,26 +4638,40 @@ var createBeacon = (options) => {
|
|
|
4638
4638
|
"TimeoutError",
|
|
4639
4639
|
"TypeError"
|
|
4640
4640
|
]);
|
|
4641
|
-
const reportServiceWorkerFailure = (
|
|
4642
|
-
const
|
|
4641
|
+
const reportServiceWorkerFailure = (scriptUrl, failureKind, error, workerState) => {
|
|
4642
|
+
const endpointLabel = shortUrl(scriptUrl);
|
|
4643
|
+
let endpointOrigin;
|
|
4644
|
+
try {
|
|
4645
|
+
if (scriptUrl !== "service-worker")
|
|
4646
|
+
endpointOrigin = new URL(scriptUrl, location.href).origin;
|
|
4647
|
+
} catch {}
|
|
4648
|
+
const key = `${endpointOrigin ?? "unknown"}|${endpointLabel}|${failureKind}`;
|
|
4643
4649
|
if (reportedServiceWorkerFailures.has(key))
|
|
4644
4650
|
return;
|
|
4645
4651
|
reportedServiceWorkerFailures.add(key);
|
|
4646
4652
|
emitSignal(`Service worker failure — ${endpointLabel} failed during ${failureKind} — ${shortUrl(location.href)}`, {
|
|
4647
4653
|
endpoint: endpointLabel,
|
|
4654
|
+
...endpointOrigin === undefined ? {} : { endpointOrigin },
|
|
4655
|
+
pageOrigin: location.origin,
|
|
4648
4656
|
failureKind,
|
|
4649
4657
|
signal: BEACON_SIGNAL.SERVICE_WORKER_FAILURE
|
|
4650
|
-
}, undefined,
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4658
|
+
}, undefined, {
|
|
4659
|
+
...workerState === undefined ? {} : { serviceWorkerState: workerState },
|
|
4660
|
+
...error === undefined ? {} : {
|
|
4661
|
+
serviceWorkerError: {
|
|
4662
|
+
message: error.message,
|
|
4663
|
+
name: error.name,
|
|
4664
|
+
...error.stack === undefined ? {} : { stack: error.stack }
|
|
4665
|
+
}
|
|
4655
4666
|
}
|
|
4656
4667
|
});
|
|
4657
4668
|
};
|
|
4658
4669
|
const watchInstallingWorker = (worker, registration) => {
|
|
4659
4670
|
let settled = worker.state === "installed" || worker.state === "activated";
|
|
4671
|
+
let previousState = worker.state;
|
|
4660
4672
|
const onStateChange = () => {
|
|
4673
|
+
const fromState = previousState;
|
|
4674
|
+
previousState = worker.state;
|
|
4661
4675
|
if (worker.state === "installed" || worker.state === "activated")
|
|
4662
4676
|
settled = true;
|
|
4663
4677
|
if (worker.state !== "redundant" || settled)
|
|
@@ -4665,7 +4679,12 @@ var createBeacon = (options) => {
|
|
|
4665
4679
|
const successor = registration?.installing ?? registration?.waiting;
|
|
4666
4680
|
if (successor !== null && successor !== undefined && successor !== worker)
|
|
4667
4681
|
return;
|
|
4668
|
-
reportServiceWorkerFailure(
|
|
4682
|
+
reportServiceWorkerFailure(worker.scriptURL, "installation", undefined, {
|
|
4683
|
+
previousState: fromState,
|
|
4684
|
+
state: worker.state,
|
|
4685
|
+
hasActiveWorker: Boolean(registration?.active),
|
|
4686
|
+
hasWaitingWorker: Boolean(registration?.waiting)
|
|
4687
|
+
});
|
|
4669
4688
|
};
|
|
4670
4689
|
worker.addEventListener("statechange", onStateChange);
|
|
4671
4690
|
serviceWorkerListenerCleanups.push(() => worker.removeEventListener("statechange", onStateChange));
|
|
@@ -4685,7 +4704,11 @@ var createBeacon = (options) => {
|
|
|
4685
4704
|
const isServiceWorkerRegistration = (registration) => typeof registration === "object" && registration !== null && ("installing" in registration) && typeof registration.addEventListener === "function";
|
|
4686
4705
|
const originalRegister = container.register;
|
|
4687
4706
|
const wrappedRegister = async function(scriptURL, registrationOptions) {
|
|
4688
|
-
const
|
|
4707
|
+
const rawScriptUrl = String(scriptURL);
|
|
4708
|
+
let endpointLabel = shortUrl(rawScriptUrl);
|
|
4709
|
+
try {
|
|
4710
|
+
endpointLabel = new URL(rawScriptUrl, location.href).origin + endpointLabel;
|
|
4711
|
+
} catch {}
|
|
4689
4712
|
try {
|
|
4690
4713
|
const registration = await originalRegister.call(this, scriptURL, registrationOptions);
|
|
4691
4714
|
if (isServiceWorkerRegistration(registration)) {
|
|
@@ -4712,13 +4735,13 @@ var createBeacon = (options) => {
|
|
|
4712
4735
|
error: registrationError,
|
|
4713
4736
|
timeout: setTimeout(() => {
|
|
4714
4737
|
pendingRegistrationFailures.delete(endpointLabel);
|
|
4715
|
-
reportServiceWorkerFailure(
|
|
4738
|
+
reportServiceWorkerFailure(rawScriptUrl, "registration", pending.error);
|
|
4716
4739
|
}, recoveryMs)
|
|
4717
4740
|
};
|
|
4718
4741
|
pendingRegistrationFailures.set(endpointLabel, pending);
|
|
4719
4742
|
}
|
|
4720
4743
|
} else {
|
|
4721
|
-
reportServiceWorkerFailure(
|
|
4744
|
+
reportServiceWorkerFailure(rawScriptUrl, "registration", registrationError);
|
|
4722
4745
|
}
|
|
4723
4746
|
throw error;
|
|
4724
4747
|
}
|
|
@@ -5230,5 +5253,5 @@ export {
|
|
|
5230
5253
|
redactBeaconEvent
|
|
5231
5254
|
};
|
|
5232
5255
|
|
|
5233
|
-
//# debugId=
|
|
5256
|
+
//# debugId=C87616922B09895C64756E2164756E21
|
|
5234
5257
|
//# sourceMappingURL=index.js.map
|