@hanzo/event 0.3.35 → 0.3.37
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/LICENSE.md +21 -0
- package/README.md +8 -8
- package/TAXONOMY.md +1 -1
- package/dist/attribution.d.ts +14 -0
- package/dist/attribution.d.ts.map +1 -0
- package/dist/core.d.ts +102 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/dsn.d.ts +43 -0
- package/dist/dsn.d.ts.map +1 -0
- package/dist/events.d.ts +21 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/exception.d.ts +50 -0
- package/dist/exception.d.ts.map +1 -0
- package/dist/funnels.d.ts +14 -0
- package/dist/funnels.d.ts.map +1 -0
- package/dist/goals.d.ts +24 -0
- package/dist/goals.d.ts.map +1 -0
- package/dist/index.cjs +24 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -292
- package/dist/index.d.ts +22 -292
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +24 -8
- package/dist/index.mjs.map +1 -1
- package/dist/org.d.ts +74 -0
- package/dist/org.d.ts.map +1 -0
- package/dist/react.cjs +24 -8
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +13 -14
- package/dist/react.d.ts +13 -14
- package/dist/react.d.ts.map +1 -0
- package/dist/react.mjs +24 -8
- package/dist/react.mjs.map +1 -1
- package/dist/scrub.d.ts +20 -0
- package/dist/scrub.d.ts.map +1 -0
- package/dist/sentry.d.ts +62 -0
- package/dist/sentry.d.ts.map +1 -0
- package/dist/stack.d.ts +25 -0
- package/dist/stack.d.ts.map +1 -0
- package/dist/storage.d.ts +32 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/{core-CIhI2R7S.d.cts → types.d.ts} +21 -119
- package/dist/types.d.ts.map +1 -0
- package/dist/uid.d.ts +10 -0
- package/dist/uid.d.ts.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +11 -11
- package/src/anon.d.ts +1 -1
- package/src/anon.js +3 -3
- package/src/anon.test.ts +3 -3
- package/src/core.test.ts +6 -6
- package/src/core.ts +11 -11
- package/src/events.ts +1 -1
- package/src/exception.ts +1 -1
- package/src/org.test.ts +16 -0
- package/src/org.ts +17 -1
- package/src/stack.ts +1 -1
- package/src/types.ts +3 -3
- package/src/uid.ts +2 -2
- package/src/version.ts +1 -1
- package/dist/core-CIhI2R7S.d.ts +0 -380
package/dist/org.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which org owns a host's telemetry.
|
|
3
|
+
*
|
|
4
|
+
* A surface should not have to LEARN its key. It already knows the domain it is
|
|
5
|
+
* served from, and a domain belongs to exactly one brand, so the key is derivable
|
|
6
|
+
* and asking a surface to carry one is asking it to restate something already
|
|
7
|
+
* true. This module answers `orgOf(location.hostname)` and hands back that org's
|
|
8
|
+
* publishable key, which is what lets a static export report correctly while
|
|
9
|
+
* configuring nothing.
|
|
10
|
+
*
|
|
11
|
+
* This is the SAME question `hanzo.id` answers at runtime for the identity hosts
|
|
12
|
+
* (`pkgs/shared/src/ingest.ts`): one image serves every brand, so the key cannot
|
|
13
|
+
* be a property of the build. It was, and the bill is on record — Lux's, Zoo's,
|
|
14
|
+
* Osage's and Pars' visitors were all filed in HANZO's project, because one
|
|
15
|
+
* build-time key was inlined for every brand. That is the white-label boundary
|
|
16
|
+
* crossed in the direction that shows up latest. The marketing sites carry the
|
|
17
|
+
* identical defect in its other form: each commits its OWN key literal, so the
|
|
18
|
+
* fleet holds N copies of a value with one source, and a site added tomorrow
|
|
19
|
+
* reports nothing until somebody remembers to paste one in.
|
|
20
|
+
*
|
|
21
|
+
* A `pk-` is PUBLISHABLE: it authorizes a write into one org and mints no reading
|
|
22
|
+
* principal. It is readable in devtools on every deployed page that sends an
|
|
23
|
+
* event, so stating it here exposes nothing that serving the page did not. What
|
|
24
|
+
* it does buy is that correct attribution becomes the DEFAULT rather than
|
|
25
|
+
* something each surface opts into.
|
|
26
|
+
*
|
|
27
|
+
* Keyed by ORG, never by host: a brand's facts repeat on every alias it owns
|
|
28
|
+
* (`lux.id`, `id.lux.network`), and a key stated per host would have to be
|
|
29
|
+
* repeated too — so the day someone adds an alias and forgets the key, that host
|
|
30
|
+
* silently stops reporting. Stated once per org, a new alias inherits its brand's
|
|
31
|
+
* key by naming its brand's domain, which is all an alias ever says.
|
|
32
|
+
*/
|
|
33
|
+
/** One publishable key per org. */
|
|
34
|
+
export type Keyring = Readonly<Record<string, string>>;
|
|
35
|
+
/**
|
|
36
|
+
* Each org's registrable domains. A host matches a domain when it IS that domain
|
|
37
|
+
* or a subdomain of it, so `explore.lux.network` needs no entry of its own.
|
|
38
|
+
*
|
|
39
|
+
* An org absent from this table resolves to undefined, and that is deliberate:
|
|
40
|
+
* `osage`, `pars` and `bootnode` have no project of their own yet, and reporting
|
|
41
|
+
* NOTHING is the honest answer. Filing them under a brand that is not theirs is
|
|
42
|
+
* the defect this module exists to prevent — it is silent, it reads as working,
|
|
43
|
+
* and it is only visible later in someone else's warehouse.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ORG_DOMAIN: Readonly<Record<string, readonly string[]>>;
|
|
46
|
+
/**
|
|
47
|
+
* Each org's publishable key — the same values `universe`'s `SPA_INGEST_KEYRING`
|
|
48
|
+
* serves to the identity hosts, which are each brand's own insights team token.
|
|
49
|
+
* Add an org here the day its project exists, never before.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ORG_KEY: Keyring;
|
|
52
|
+
/**
|
|
53
|
+
* The org that owns a host, or undefined when no brand claims it.
|
|
54
|
+
*
|
|
55
|
+
* Longest match wins, so a brand owning both a domain and a subdomain of another
|
|
56
|
+
* brand's cannot be decided by table order. Pure and total.
|
|
57
|
+
*/
|
|
58
|
+
export declare function orgOf(host: string): string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* The publishable key for a host, or undefined when there is not exactly one to
|
|
61
|
+
* give.
|
|
62
|
+
*
|
|
63
|
+
* Deliberately WITHOUT a fallback: returning Hanzo's key for an unrecognised host
|
|
64
|
+
* is precisely the defect described above. Undefined is the honest answer and the
|
|
65
|
+
* caller reports nothing.
|
|
66
|
+
*
|
|
67
|
+
* `keyring` is a parameter so the identity runtime — which receives its keyring
|
|
68
|
+
* from `/config.json` because one image serves every brand — resolves through
|
|
69
|
+
* this SAME function rather than a second copy of it.
|
|
70
|
+
*/
|
|
71
|
+
export declare function keyFor(host: string, keyring?: Keyring): string | undefined;
|
|
72
|
+
/** The key for the page this code is running on; undefined off a browser. */
|
|
73
|
+
export declare function keyForPage(keyring?: Keyring): string | undefined;
|
|
74
|
+
//# sourceMappingURL=org.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../src/org.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,mCAAmC;AACnC,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAEtD;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CA6BjE,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,OAIpB,CAAA;AAWF;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CActD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAiB,GAAG,MAAM,GAAG,SAAS,CAOnF;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,OAAO,GAAE,OAAiB,GAAG,MAAM,GAAG,SAAS,CAGzE"}
|
package/dist/react.cjs
CHANGED
|
@@ -88,7 +88,23 @@ function dsnForProduct(product, key) {
|
|
|
88
88
|
|
|
89
89
|
// src/org.ts
|
|
90
90
|
var ORG_DOMAIN = Object.freeze({
|
|
91
|
-
|
|
91
|
+
// A brand's domains are not a pattern — `hanzoskills.com` is Hanzo's and does
|
|
92
|
+
// not end in `hanzo.ai`, while `hanzo.works` is a registrable domain of its own
|
|
93
|
+
// rather than a subdomain of anything here. Each is stated because each is a
|
|
94
|
+
// separate fact, which is the whole reason this is a table.
|
|
95
|
+
hanzo: Object.freeze([
|
|
96
|
+
"hanzo.ai",
|
|
97
|
+
"hanzo.app",
|
|
98
|
+
"hanzo.bot",
|
|
99
|
+
"hanzo.chat",
|
|
100
|
+
"hanzo.codes",
|
|
101
|
+
"hanzo.id",
|
|
102
|
+
"hanzo.sh",
|
|
103
|
+
"hanzo.team",
|
|
104
|
+
"hanzo.ventures",
|
|
105
|
+
"hanzo.works",
|
|
106
|
+
"hanzoskills.com"
|
|
107
|
+
]),
|
|
92
108
|
lux: Object.freeze([
|
|
93
109
|
"lux.network",
|
|
94
110
|
"lux.exchange",
|
|
@@ -366,7 +382,7 @@ function hzAnonId() {
|
|
|
366
382
|
}
|
|
367
383
|
|
|
368
384
|
// src/version.ts
|
|
369
|
-
var VERSION = "0.3.
|
|
385
|
+
var VERSION = "0.3.37";
|
|
370
386
|
|
|
371
387
|
// src/sentry.ts
|
|
372
388
|
var MAX_FRAMES = 50;
|
|
@@ -836,10 +852,10 @@ var Analytics = class {
|
|
|
836
852
|
// so before this the only way to report was to commit a key literal, and the
|
|
837
853
|
// fleet grew one copy per site of a value with a single source.
|
|
838
854
|
//
|
|
839
|
-
// A surface no brand claims still has no key, and the
|
|
855
|
+
// A surface no brand claims still has no key, and the edge REFUSES an
|
|
840
856
|
// unattributed event (401 `ingest_key_required`) — the reserved `$public`
|
|
841
857
|
// tenant that once caught keyless beacons is retired, and anonymous ingest is
|
|
842
|
-
// refused at every
|
|
858
|
+
// refused at every edge on every brand host. So there is no quiet fallback to
|
|
843
859
|
// rely on: an event lands in the org a credential names, or it does not land.
|
|
844
860
|
ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? keyForPage()
|
|
845
861
|
};
|
|
@@ -977,7 +993,7 @@ var Analytics = class {
|
|
|
977
993
|
this.cohort = mergeCohort(patch);
|
|
978
994
|
}
|
|
979
995
|
/** flush drains the buffer to the server as ONE batch through the ONE ingest
|
|
980
|
-
*
|
|
996
|
+
* endpoint POST /v1/event, body { batch: [Event…] }. beacon=true selects the
|
|
981
997
|
* unload-safe transport. Auth is orthogonal to the wire:
|
|
982
998
|
*
|
|
983
999
|
* • publishable key set → rides ?ingest_key=pk-… on both sends, keeping each
|
|
@@ -1190,15 +1206,15 @@ ErrorBoundary.contextType = Ctx;
|
|
|
1190
1206
|
*
|
|
1191
1207
|
* The two call sites:
|
|
1192
1208
|
* 1. src/storage.ts — the bundled npm client; IMPORTS this file.
|
|
1193
|
-
* 2. hanzoai/cloud apps/analytics/tag.js — the tag
|
|
1209
|
+
* 2. hanzoai/cloud apps/analytics/tag.js — the tag served at
|
|
1194
1210
|
* /v1/event.js; vendors this file and its tag.go serves the marked region
|
|
1195
|
-
* with the tag as one asset, so
|
|
1211
|
+
* with the tag as one asset, so cloud holds no second copy either.
|
|
1196
1212
|
*
|
|
1197
1213
|
* (2) has no bundler and cannot import anything, which is why the chain lives in a
|
|
1198
1214
|
* file that is plain ES5 rather than in a .ts: the region between the BEGIN and END
|
|
1199
1215
|
* markers is COPIED VERBATIM. Keep it ES5, dependency-free, `hz`-prefixed (it is
|
|
1200
1216
|
* spliced into other people's scopes) and unformatted — a reformat here is a diff
|
|
1201
|
-
* against the vendored copy. After editing, resync
|
|
1217
|
+
* against the vendored copy. After editing, resync that copy:
|
|
1202
1218
|
*
|
|
1203
1219
|
* curl -fsSL https://unpkg.com/@hanzo/event/src/anon.js -o apps/analytics/anon.js
|
|
1204
1220
|
*/
|