@hanzo/event 0.3.28 → 0.3.29

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.
@@ -196,7 +196,7 @@ interface AnalyticsConfig {
196
196
  transport?: Transport;
197
197
  /** Debug logging. */
198
198
  debug?: boolean;
199
- /** Hanzo-minted Sentry DSN: "https://<version>:<hmac>@<host>/v1/sentry/<projectId>".
199
+ /** Hanzo-minted Sentry DSN: "https://<version>:<hmac>@<host>/v1/event/<projectId>".
200
200
  * Publishable — the key authorizes writes to ONE project and can read nothing,
201
201
  * so it is safe in a browser bundle (same trust class as `ingestKey`). When
202
202
  * absent the client reads NEXT_PUBLIC_HANZO_EVENT_DSN; when neither is set the
@@ -263,6 +263,10 @@ interface Dsn {
263
263
  origin: string;
264
264
  /** Project id segment. */
265
265
  projectId: string;
266
+ /** The DSN's own origin + path, e.g. "https://api.hanzo.ai/v1/event/<projectId>".
267
+ * Every URL below is derived from this, so the ingest address is named once —
268
+ * in dsnForProduct — and nowhere else. */
269
+ base: string;
266
270
  /** Fully-derived envelope ingest URL incl. ?sentry_key=. */
267
271
  ingestUrl: string;
268
272
  }
@@ -196,7 +196,7 @@ interface AnalyticsConfig {
196
196
  transport?: Transport;
197
197
  /** Debug logging. */
198
198
  debug?: boolean;
199
- /** Hanzo-minted Sentry DSN: "https://<version>:<hmac>@<host>/v1/sentry/<projectId>".
199
+ /** Hanzo-minted Sentry DSN: "https://<version>:<hmac>@<host>/v1/event/<projectId>".
200
200
  * Publishable — the key authorizes writes to ONE project and can read nothing,
201
201
  * so it is safe in a browser bundle (same trust class as `ingestKey`). When
202
202
  * absent the client reads NEXT_PUBLIC_HANZO_EVENT_DSN; when neither is set the
@@ -263,6 +263,10 @@ interface Dsn {
263
263
  origin: string;
264
264
  /** Project id segment. */
265
265
  projectId: string;
266
+ /** The DSN's own origin + path, e.g. "https://api.hanzo.ai/v1/event/<projectId>".
267
+ * Every URL below is derived from this, so the ingest address is named once —
268
+ * in dsnForProduct — and nowhere else. */
269
+ base: string;
266
270
  /** Fully-derived envelope ingest URL incl. ?sentry_key=. */
267
271
  ingestUrl: string;
268
272
  }
package/dist/index.cjs CHANGED
@@ -88,7 +88,7 @@ function dsnForProduct(product, key) {
88
88
  if (!product || !key) return void 0;
89
89
  const projectId = PRODUCT_PROJECT[product];
90
90
  if (!projectId) return void 0;
91
- return `https://${key}@api.hanzo.ai/v1/sentry/${projectId}`;
91
+ return `https://${key}@api.hanzo.ai/v1/event/${projectId}`;
92
92
  }
93
93
 
94
94
  // src/scrub.ts
@@ -319,7 +319,7 @@ function uuidv7Time(id) {
319
319
  }
320
320
 
321
321
  // src/version.ts
322
- var VERSION = "0.3.28";
322
+ var VERSION = "0.3.29";
323
323
 
324
324
  // src/sentry.ts
325
325
  var MAX_FRAMES = 50;
@@ -348,8 +348,9 @@ function parseDsn(dsn) {
348
348
  const projectId = segs.length > 0 ? segs[segs.length - 1] : "";
349
349
  if (!projectId) return null;
350
350
  const origin = `${scheme}://${host}`;
351
- const ingestUrl = `${origin}/v1/sentry/${encodeURIComponent(projectId)}/envelope/?sentry_key=${encodeURIComponent(publicKey)}`;
352
- return { publicKey, origin, projectId, ingestUrl };
351
+ const base = `${origin}/${segs.map(encodeURIComponent).join("/")}`;
352
+ const ingestUrl = `${base}/envelope/?sentry_key=${encodeURIComponent(publicKey)}`;
353
+ return { publicKey, origin, projectId, base, ingestUrl };
353
354
  }
354
355
  var V8_FRAME = /^\s*at\s+(?:(.+?)\s+\()?(?:(.+?):(\d+):(\d+)|([^)]+))\)?\s*$/;
355
356
  var MOZ_FRAME = /^\s*(?:(.*?)@)?(.+?):(\d+):(\d+)\s*$/;
@@ -498,7 +499,7 @@ function buildEnvelope(event, dsn, sentAt) {
498
499
  const payload = JSON.stringify(event);
499
500
  const header = JSON.stringify({
500
501
  event_id: event.event_id,
501
- dsn: `${dsn.origin}/v1/sentry/${dsn.projectId}`,
502
+ dsn: dsn.base,
502
503
  sent_at: sentAt ?? (/* @__PURE__ */ new Date()).toISOString()
503
504
  });
504
505
  const itemHeader = JSON.stringify({