@hanzo/event 0.3.28 → 0.3.30
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/dist/{core-usULsfUB.d.cts → core-ZXDaPEyY.d.cts} +5 -1
- package/dist/{core-usULsfUB.d.ts → core-ZXDaPEyY.d.ts} +5 -1
- package/dist/index.cjs +6 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +6 -5
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs +6 -5
- package/dist/react.mjs.map +1 -1
- package/hz.js +1 -1
- package/package.json +1 -1
- package/src/core.test.ts +3 -3
- package/src/core.ts +1 -1
- package/src/dsn.test.ts +4 -4
- package/src/dsn.ts +6 -6
- package/src/sentry.test.ts +3 -3
- package/src/sentry.ts +11 -7
- package/src/types.ts +5 -1
- package/src/version.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Cohort, A as Attribution, S as SentryEvent, D as Dsn, a as CaptureErrorOptions, b as SentryFrame, E as ExceptionEntry, c as SentryLevel, d as ExceptionProperties } from './core-
|
|
2
|
-
export { e as Analytics, f as AnalyticsConfig, g as EventKind, h as Exception, i as ExceptionFrame, T as Transport, W as WireEvent, j as createAnalytics } from './core-
|
|
1
|
+
import { C as Cohort, A as Attribution, S as SentryEvent, D as Dsn, a as CaptureErrorOptions, b as SentryFrame, E as ExceptionEntry, c as SentryLevel, d as ExceptionProperties } from './core-ZXDaPEyY.cjs';
|
|
2
|
+
export { e as Analytics, f as AnalyticsConfig, g as EventKind, h as Exception, i as ExceptionFrame, T as Transport, W as WireEvent, j as createAnalytics } from './core-ZXDaPEyY.cjs';
|
|
3
3
|
import { FunnelId } from '@hanzo/events';
|
|
4
4
|
export { EVENTS, EXCEPTION, EventName, FUNNELS, FunnelDef, FunnelId, FunnelStep, PAGEVIEW, PRODUCTS, ProductId, eventsOf } from '@hanzo/events';
|
|
5
5
|
|
|
@@ -8,10 +8,10 @@ declare function getFirstTouch(): Attribution | undefined;
|
|
|
8
8
|
/** Read persisted cohort dimensions. */
|
|
9
9
|
declare function getCohort(): Cohort | undefined;
|
|
10
10
|
|
|
11
|
-
declare const VERSION = "0.3.
|
|
11
|
+
declare const VERSION = "0.3.30";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* parseDsn parses "https://<version>:<hmac>@<host>/v1/
|
|
14
|
+
* parseDsn parses "https://<version>:<hmac>@<host>/v1/event/<projectId>" into its
|
|
15
15
|
* public key + the derived envelope ingest URL. The key (which itself contains a
|
|
16
16
|
* ':') is taken verbatim as the userinfo — we do NOT split it as user:pass. The
|
|
17
17
|
* key rides ?sentry_key= (not the DSN in the body) because that is the credential
|
|
@@ -80,14 +80,14 @@ declare function hzUuidv7(now?: number): string
|
|
|
80
80
|
declare function uuidv7Time(id: string): number;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* The product →
|
|
83
|
+
* The product → Sentinel DSN registry.
|
|
84
84
|
*
|
|
85
85
|
* An app declares WHAT it is (`product: 'console'`); this module knows WHERE its
|
|
86
86
|
* errors go. That split is the whole point: no surface has to learn a DSN, carry
|
|
87
87
|
* a build argument, or grow a config file to report errors — declaring the
|
|
88
88
|
* product it already declares is enough.
|
|
89
89
|
*
|
|
90
|
-
* A
|
|
90
|
+
* A Sentinel DSN is PUBLIC by construction. It ships inside the client bundle and
|
|
91
91
|
* is readable in devtools on any deployed page, and it grants exactly one
|
|
92
92
|
* capability: submitting new events. It cannot read issues, projects, or any
|
|
93
93
|
* other data. So committing it is not leaking a secret — it is recording a public
|
|
@@ -101,10 +101,10 @@ declare function uuidv7Time(id: string): number;
|
|
|
101
101
|
* exception table is the same data with a trap in it.
|
|
102
102
|
*
|
|
103
103
|
* Projects are org-scoped and named `<org>-<app>`. To add one: create the project
|
|
104
|
-
* (POST /v1/
|
|
104
|
+
* (POST /v1/sentinel/projects with X-Org-Id), then add its `dsn` here keyed by the
|
|
105
105
|
* product name the app passes to `createAnalytics`.
|
|
106
106
|
*/
|
|
107
|
-
/** PRODUCT_PROJECT maps a `product` to its
|
|
107
|
+
/** PRODUCT_PROJECT maps a `product` to its Sentinel project id. The DSN's KEY is no
|
|
108
108
|
* longer a per-project secret — it is the ONE org publishable key (below), so a
|
|
109
109
|
* surface's errors ride the SAME key its events do. The id only names WHICH
|
|
110
110
|
* project the errors group under, and cloud auto-provisions that project on first
|
|
@@ -112,7 +112,7 @@ declare function uuidv7Time(id: string): number;
|
|
|
112
112
|
* project — an explicit map, because the projects predate this and do not derive
|
|
113
113
|
* cleanly from the product name. */
|
|
114
114
|
declare const PRODUCT_PROJECT: Readonly<Record<string, string>>;
|
|
115
|
-
/** dsnForProduct builds the product's
|
|
115
|
+
/** dsnForProduct builds the product's Sentinel DSN from the caller's resolved
|
|
116
116
|
* publishable `key` and the product's project — the SAME key the event stream
|
|
117
117
|
* carries, at the product's envelope endpoint. Returns undefined when there is no
|
|
118
118
|
* key or no project for the product, leaving the error plane inert rather than
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Cohort, A as Attribution, S as SentryEvent, D as Dsn, a as CaptureErrorOptions, b as SentryFrame, E as ExceptionEntry, c as SentryLevel, d as ExceptionProperties } from './core-
|
|
2
|
-
export { e as Analytics, f as AnalyticsConfig, g as EventKind, h as Exception, i as ExceptionFrame, T as Transport, W as WireEvent, j as createAnalytics } from './core-
|
|
1
|
+
import { C as Cohort, A as Attribution, S as SentryEvent, D as Dsn, a as CaptureErrorOptions, b as SentryFrame, E as ExceptionEntry, c as SentryLevel, d as ExceptionProperties } from './core-ZXDaPEyY.js';
|
|
2
|
+
export { e as Analytics, f as AnalyticsConfig, g as EventKind, h as Exception, i as ExceptionFrame, T as Transport, W as WireEvent, j as createAnalytics } from './core-ZXDaPEyY.js';
|
|
3
3
|
import { FunnelId } from '@hanzo/events';
|
|
4
4
|
export { EVENTS, EXCEPTION, EventName, FUNNELS, FunnelDef, FunnelId, FunnelStep, PAGEVIEW, PRODUCTS, ProductId, eventsOf } from '@hanzo/events';
|
|
5
5
|
|
|
@@ -8,10 +8,10 @@ declare function getFirstTouch(): Attribution | undefined;
|
|
|
8
8
|
/** Read persisted cohort dimensions. */
|
|
9
9
|
declare function getCohort(): Cohort | undefined;
|
|
10
10
|
|
|
11
|
-
declare const VERSION = "0.3.
|
|
11
|
+
declare const VERSION = "0.3.30";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* parseDsn parses "https://<version>:<hmac>@<host>/v1/
|
|
14
|
+
* parseDsn parses "https://<version>:<hmac>@<host>/v1/event/<projectId>" into its
|
|
15
15
|
* public key + the derived envelope ingest URL. The key (which itself contains a
|
|
16
16
|
* ':') is taken verbatim as the userinfo — we do NOT split it as user:pass. The
|
|
17
17
|
* key rides ?sentry_key= (not the DSN in the body) because that is the credential
|
|
@@ -80,14 +80,14 @@ declare function hzUuidv7(now?: number): string
|
|
|
80
80
|
declare function uuidv7Time(id: string): number;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* The product →
|
|
83
|
+
* The product → Sentinel DSN registry.
|
|
84
84
|
*
|
|
85
85
|
* An app declares WHAT it is (`product: 'console'`); this module knows WHERE its
|
|
86
86
|
* errors go. That split is the whole point: no surface has to learn a DSN, carry
|
|
87
87
|
* a build argument, or grow a config file to report errors — declaring the
|
|
88
88
|
* product it already declares is enough.
|
|
89
89
|
*
|
|
90
|
-
* A
|
|
90
|
+
* A Sentinel DSN is PUBLIC by construction. It ships inside the client bundle and
|
|
91
91
|
* is readable in devtools on any deployed page, and it grants exactly one
|
|
92
92
|
* capability: submitting new events. It cannot read issues, projects, or any
|
|
93
93
|
* other data. So committing it is not leaking a secret — it is recording a public
|
|
@@ -101,10 +101,10 @@ declare function uuidv7Time(id: string): number;
|
|
|
101
101
|
* exception table is the same data with a trap in it.
|
|
102
102
|
*
|
|
103
103
|
* Projects are org-scoped and named `<org>-<app>`. To add one: create the project
|
|
104
|
-
* (POST /v1/
|
|
104
|
+
* (POST /v1/sentinel/projects with X-Org-Id), then add its `dsn` here keyed by the
|
|
105
105
|
* product name the app passes to `createAnalytics`.
|
|
106
106
|
*/
|
|
107
|
-
/** PRODUCT_PROJECT maps a `product` to its
|
|
107
|
+
/** PRODUCT_PROJECT maps a `product` to its Sentinel project id. The DSN's KEY is no
|
|
108
108
|
* longer a per-project secret — it is the ONE org publishable key (below), so a
|
|
109
109
|
* surface's errors ride the SAME key its events do. The id only names WHICH
|
|
110
110
|
* project the errors group under, and cloud auto-provisions that project on first
|
|
@@ -112,7 +112,7 @@ declare function uuidv7Time(id: string): number;
|
|
|
112
112
|
* project — an explicit map, because the projects predate this and do not derive
|
|
113
113
|
* cleanly from the product name. */
|
|
114
114
|
declare const PRODUCT_PROJECT: Readonly<Record<string, string>>;
|
|
115
|
-
/** dsnForProduct builds the product's
|
|
115
|
+
/** dsnForProduct builds the product's Sentinel DSN from the caller's resolved
|
|
116
116
|
* publishable `key` and the product's project — the SAME key the event stream
|
|
117
117
|
* carries, at the product's envelope endpoint. Returns undefined when there is no
|
|
118
118
|
* key or no project for the product, leaving the error plane inert rather than
|
package/dist/index.mjs
CHANGED
|
@@ -87,7 +87,7 @@ function dsnForProduct(product, key) {
|
|
|
87
87
|
if (!product || !key) return void 0;
|
|
88
88
|
const projectId = PRODUCT_PROJECT[product];
|
|
89
89
|
if (!projectId) return void 0;
|
|
90
|
-
return `https://${key}@api.hanzo.ai/v1/
|
|
90
|
+
return `https://${key}@api.hanzo.ai/v1/event/${projectId}`;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// src/scrub.ts
|
|
@@ -318,7 +318,7 @@ function uuidv7Time(id) {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
// src/version.ts
|
|
321
|
-
var VERSION = "0.3.
|
|
321
|
+
var VERSION = "0.3.30";
|
|
322
322
|
|
|
323
323
|
// src/sentry.ts
|
|
324
324
|
var MAX_FRAMES = 50;
|
|
@@ -347,8 +347,9 @@ function parseDsn(dsn) {
|
|
|
347
347
|
const projectId = segs.length > 0 ? segs[segs.length - 1] : "";
|
|
348
348
|
if (!projectId) return null;
|
|
349
349
|
const origin = `${scheme}://${host}`;
|
|
350
|
-
const
|
|
351
|
-
|
|
350
|
+
const base = `${origin}/${segs.map(encodeURIComponent).join("/")}`;
|
|
351
|
+
const ingestUrl = `${base}/envelope/?sentry_key=${encodeURIComponent(publicKey)}`;
|
|
352
|
+
return { publicKey, origin, projectId, base, ingestUrl };
|
|
352
353
|
}
|
|
353
354
|
var V8_FRAME = /^\s*at\s+(?:(.+?)\s+\()?(?:(.+?):(\d+):(\d+)|([^)]+))\)?\s*$/;
|
|
354
355
|
var MOZ_FRAME = /^\s*(?:(.*?)@)?(.+?):(\d+):(\d+)\s*$/;
|
|
@@ -497,7 +498,7 @@ function buildEnvelope(event, dsn, sentAt) {
|
|
|
497
498
|
const payload = JSON.stringify(event);
|
|
498
499
|
const header = JSON.stringify({
|
|
499
500
|
event_id: event.event_id,
|
|
500
|
-
dsn:
|
|
501
|
+
dsn: dsn.base,
|
|
501
502
|
sent_at: sentAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
502
503
|
});
|
|
503
504
|
const itemHeader = JSON.stringify({
|