@edraj/sauron-browser 1.5.0 → 1.7.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/CHANGELOG.md +33 -0
- package/COPYING +674 -0
- package/LICENSE +160 -656
- package/README.md +26 -10
- package/dist/index.cjs +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -277,7 +277,8 @@ interface TransportOptions {
|
|
|
277
277
|
interface InitOptions {
|
|
278
278
|
/** `https://<public_key>@<host>/<project_id>` */
|
|
279
279
|
dsn: string;
|
|
280
|
-
|
|
280
|
+
/** Required. The app version every event is attributed to. */
|
|
281
|
+
release: string;
|
|
281
282
|
/** Error sample rate in [0, 1]. Default 1 (send everything). */
|
|
282
283
|
sampleRate?: number;
|
|
283
284
|
/** Ring-buffer size for breadcrumbs. Default 50. */
|
|
@@ -309,7 +310,7 @@ interface InitOptions {
|
|
|
309
310
|
/** Fully-resolved options with all defaults applied. */
|
|
310
311
|
interface ResolvedOptions {
|
|
311
312
|
dsn: string;
|
|
312
|
-
release: string
|
|
313
|
+
release: string;
|
|
313
314
|
sampleRate: number;
|
|
314
315
|
maxBreadcrumbs: number;
|
|
315
316
|
beforeSend?: BeforeSend;
|
|
@@ -597,7 +598,7 @@ declare function parseError(err: unknown): Frame[];
|
|
|
597
598
|
/** Small dependency-free helpers shared across the SDK. */
|
|
598
599
|
/** SDK identity, embedded in every envelope header. */
|
|
599
600
|
declare const SDK_NAME = "sauron.javascript";
|
|
600
|
-
declare const SDK_VERSION = "1.
|
|
601
|
+
declare const SDK_VERSION = "1.7.0";
|
|
601
602
|
/**
|
|
602
603
|
* Largest serialized `extra` a single transaction may carry, in bytes.
|
|
603
604
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -277,7 +277,8 @@ interface TransportOptions {
|
|
|
277
277
|
interface InitOptions {
|
|
278
278
|
/** `https://<public_key>@<host>/<project_id>` */
|
|
279
279
|
dsn: string;
|
|
280
|
-
|
|
280
|
+
/** Required. The app version every event is attributed to. */
|
|
281
|
+
release: string;
|
|
281
282
|
/** Error sample rate in [0, 1]. Default 1 (send everything). */
|
|
282
283
|
sampleRate?: number;
|
|
283
284
|
/** Ring-buffer size for breadcrumbs. Default 50. */
|
|
@@ -309,7 +310,7 @@ interface InitOptions {
|
|
|
309
310
|
/** Fully-resolved options with all defaults applied. */
|
|
310
311
|
interface ResolvedOptions {
|
|
311
312
|
dsn: string;
|
|
312
|
-
release: string
|
|
313
|
+
release: string;
|
|
313
314
|
sampleRate: number;
|
|
314
315
|
maxBreadcrumbs: number;
|
|
315
316
|
beforeSend?: BeforeSend;
|
|
@@ -597,7 +598,7 @@ declare function parseError(err: unknown): Frame[];
|
|
|
597
598
|
/** Small dependency-free helpers shared across the SDK. */
|
|
598
599
|
/** SDK identity, embedded in every envelope header. */
|
|
599
600
|
declare const SDK_NAME = "sauron.javascript";
|
|
600
|
-
declare const SDK_VERSION = "1.
|
|
601
|
+
declare const SDK_VERSION = "1.7.0";
|
|
601
602
|
/**
|
|
602
603
|
* Largest serialized `extra` a single transaction may carry, in bytes.
|
|
603
604
|
*
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
|
|
5
5
|
// src/utils.ts
|
|
6
6
|
var SDK_NAME = "sauron.javascript";
|
|
7
|
-
var SDK_VERSION = "1.
|
|
7
|
+
var SDK_VERSION = "1.7.0";
|
|
8
8
|
function getGlobal() {
|
|
9
9
|
return globalThis;
|
|
10
10
|
}
|
|
@@ -839,12 +839,12 @@ function installHistory() {
|
|
|
839
839
|
const loc = g2.location;
|
|
840
840
|
if (!hist) return;
|
|
841
841
|
let lastPath = toPath(loc?.href ?? null, loc?.href);
|
|
842
|
-
const emit = (toHref) => {
|
|
842
|
+
const emit = (toHref, operation) => {
|
|
843
843
|
const to = toPath(toHref, loc?.href);
|
|
844
844
|
const from = lastPath;
|
|
845
845
|
lastPath = to;
|
|
846
846
|
if (from === to) return;
|
|
847
|
-
withInternal(() => addNavigationBreadcrumb(from, to));
|
|
847
|
+
withInternal(() => addNavigationBreadcrumb(from, to, operation));
|
|
848
848
|
if (to && navHandler) {
|
|
849
849
|
try {
|
|
850
850
|
navHandler(to);
|
|
@@ -855,11 +855,12 @@ function installHistory() {
|
|
|
855
855
|
const wrap = (name) => {
|
|
856
856
|
const original = hist[name];
|
|
857
857
|
if (typeof original !== "function" || isWrapped(original)) return;
|
|
858
|
+
const operation = name === "pushState" ? "push" : "replace";
|
|
858
859
|
hist[name] = markWrapped(function sauronHistory(...args) {
|
|
859
860
|
const result = original.apply(this, args);
|
|
860
861
|
if (!isInternal()) {
|
|
861
862
|
const urlArg = args[2];
|
|
862
|
-
emit(urlArg != null ? String(urlArg) : loc?.href ?? null);
|
|
863
|
+
emit(urlArg != null ? String(urlArg) : loc?.href ?? null, operation);
|
|
863
864
|
}
|
|
864
865
|
return result;
|
|
865
866
|
});
|
|
@@ -871,7 +872,7 @@ function installHistory() {
|
|
|
871
872
|
wrap("replaceState");
|
|
872
873
|
if (typeof g2.addEventListener === "function") {
|
|
873
874
|
const onPopState = () => {
|
|
874
|
-
if (!isInternal()) emit(loc?.href ?? null);
|
|
875
|
+
if (!isInternal()) emit(loc?.href ?? null, "pop");
|
|
875
876
|
};
|
|
876
877
|
g2.addEventListener("popstate", onPopState);
|
|
877
878
|
registerPatch("popstate", () => {
|
|
@@ -2170,10 +2171,13 @@ function resolveOptions(options) {
|
|
|
2170
2171
|
if (!options || typeof options.dsn !== "string" || options.dsn.length === 0) {
|
|
2171
2172
|
throw new Error("[sauron] init() requires a `dsn`");
|
|
2172
2173
|
}
|
|
2174
|
+
if (typeof options.release !== "string" || options.release.trim().length === 0) {
|
|
2175
|
+
throw new Error("[sauron] init() requires a `release` (the app version this build reports as)");
|
|
2176
|
+
}
|
|
2173
2177
|
const t = options.transport ?? {};
|
|
2174
2178
|
return {
|
|
2175
2179
|
dsn: options.dsn,
|
|
2176
|
-
release: options.release
|
|
2180
|
+
release: options.release.trim(),
|
|
2177
2181
|
sampleRate: clamp(options.sampleRate ?? 1, 0, 1),
|
|
2178
2182
|
maxBreadcrumbs: options.maxBreadcrumbs ?? 50,
|
|
2179
2183
|
tags: options.tags ?? {},
|
|
@@ -2222,13 +2226,13 @@ function addBreadcrumb(input, hint) {
|
|
|
2222
2226
|
if (!client) return;
|
|
2223
2227
|
client.addBreadcrumb(normalizeBreadcrumb(input), hint);
|
|
2224
2228
|
}
|
|
2225
|
-
function addNavigationBreadcrumb(from, to) {
|
|
2229
|
+
function addNavigationBreadcrumb(from, to, operation = "push") {
|
|
2226
2230
|
addBreadcrumb({
|
|
2227
2231
|
type: "navigation",
|
|
2228
2232
|
category: "history",
|
|
2229
2233
|
level: "info",
|
|
2230
2234
|
message: null,
|
|
2231
|
-
data: { from, to }
|
|
2235
|
+
data: { from, to, operation }
|
|
2232
2236
|
});
|
|
2233
2237
|
}
|
|
2234
2238
|
|