@edraj/sauron-browser 1.6.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/README.md CHANGED
@@ -199,12 +199,17 @@ offline queue. Returns the live `SauronClient`.
199
199
 
200
200
  Idempotent: a second `init()` tears the previous client down first (restoring
201
201
  every patched global, clearing the current screen) before installing a fresh
202
- one. Throws `Error` when `dsn` is missing or not a string, and `DsnError` when
203
- the DSN itself is malformed.
202
+ one. Throws `Error` when `dsn` is missing or not a string, when `release` is
203
+ missing or blank, and `DsnError` when the DSN itself is malformed.
204
+
205
+ `release` is required as of v1.7.0 — `init()` throws without one.
204
206
 
205
207
  ```ts
206
- const client = Sauron.init({ dsn: 'https://pk_test@localhost:8081/1' });
207
- client.options.release; // null
208
+ const client = Sauron.init({
209
+ dsn: 'https://pk_test@localhost:8081/1',
210
+ release: 'web@1.4.2',
211
+ });
212
+ client.options.release; // 'web@1.4.2'
208
213
  client.dsn.projectId; // '1'
209
214
  ```
210
215
 
@@ -985,7 +990,7 @@ const appFrames = frames.filter((f) => isInAppFrame(f.filename));
985
990
 
986
991
  ```ts
987
992
  const SDK_NAME: string // 'sauron.javascript'
988
- const SDK_VERSION: string // '1.6.0'
993
+ const SDK_VERSION: string // '1.7.0'
989
994
  ```
990
995
 
991
996
  The SDK identity embedded in `header.sdk` of every envelope.
@@ -1106,7 +1111,7 @@ Other scope data:
1106
1111
  is unavailable.
1107
1112
 
1108
1113
  ```ts
1109
- Sauron.init({ dsn, tags: { tier: 'free' }, extra: { build: 'ci-42' } });
1114
+ Sauron.init({ dsn, release: 'web@1.4.2', tags: { tier: 'free' }, extra: { build: 'ci-42' } });
1110
1115
  Sauron.setTag('tier', 'pro'); // scope beats init default
1111
1116
  Sauron.track('upgraded', {}, { tags: { tier: 'trial' } });
1112
1117
  // -> event tags: { tier: 'trial' }, extra: { build: 'ci-42' }
@@ -1126,8 +1131,8 @@ Sauron.track('upgraded', {}, { tags: { tier: 'trial' } });
1126
1131
 
1127
1132
  ```html
1128
1133
  <script type="module">
1129
- import { Sauron } from 'https://esm.sh/@edraj/sauron-browser@1.6.0';
1130
- Sauron.init({ dsn: 'https://pk_test@ingest.example.com/42' });
1134
+ import { Sauron } from 'https://esm.sh/@edraj/sauron-browser@1.7.0';
1135
+ Sauron.init({ dsn: 'https://pk_test@ingest.example.com/42', release: 'web@1.4.2' });
1131
1136
  </script>
1132
1137
  ```
1133
1138
 
@@ -1238,7 +1243,8 @@ npm run dev # tsup --watch
1238
1243
 
1239
1244
  ## License
1240
1245
 
1241
- AGPL-3.0-only — GNU Affero General Public License v3.0.
1246
+ LGPL-3.0-only — GNU Lesser General Public License v3.0. LGPLv3 applies on top of
1247
+ the GNU GPL v3, whose text ships alongside it in `COPYING`.
1242
1248
 
1243
1249
  Repo: <https://github.com/edraj/sauron> — wiki:
1244
1250
  <https://github.com/edraj/sauron/wiki>
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
8
8
 
9
9
  // src/utils.ts
10
10
  var SDK_NAME = "sauron.javascript";
11
- var SDK_VERSION = "1.6.0";
11
+ var SDK_VERSION = "1.7.0";
12
12
  function getGlobal() {
13
13
  return globalThis;
14
14
  }
@@ -2175,10 +2175,13 @@ function resolveOptions(options) {
2175
2175
  if (!options || typeof options.dsn !== "string" || options.dsn.length === 0) {
2176
2176
  throw new Error("[sauron] init() requires a `dsn`");
2177
2177
  }
2178
+ if (typeof options.release !== "string" || options.release.trim().length === 0) {
2179
+ throw new Error("[sauron] init() requires a `release` (the app version this build reports as)");
2180
+ }
2178
2181
  const t = options.transport ?? {};
2179
2182
  return {
2180
2183
  dsn: options.dsn,
2181
- release: options.release ?? null,
2184
+ release: options.release.trim(),
2182
2185
  sampleRate: clamp(options.sampleRate ?? 1, 0, 1),
2183
2186
  maxBreadcrumbs: options.maxBreadcrumbs ?? 50,
2184
2187
  tags: options.tags ?? {},