@hanzo/event 0.3.20 → 0.3.21
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/dist/index.cjs +17 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.mjs +17 -24
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +17 -24
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +17 -24
- package/dist/react.mjs.map +1 -1
- package/hz.js +7 -8
- package/package.json +10 -10
- package/src/core.test.ts +3 -37
- package/src/core.ts +18 -24
- package/src/dsn.test.ts +28 -18
- package/src/dsn.ts +14 -34
- package/src/hz.test.ts +4 -10
- package/src/version.ts +1 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 hanzo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -82,15 +82,11 @@ var PRODUCT_PROJECT = Object.freeze({
|
|
|
82
82
|
site: "019f9b1e-5785-7359-ad0b-f75db8e58c99"
|
|
83
83
|
// hanzo.ai (marketing; product `site`)
|
|
84
84
|
});
|
|
85
|
-
function dsnForProduct(product) {
|
|
86
|
-
if (!product) return void 0;
|
|
85
|
+
function dsnForProduct(product, key) {
|
|
86
|
+
if (!product || !key) return void 0;
|
|
87
87
|
const projectId = PRODUCT_PROJECT[product];
|
|
88
88
|
if (!projectId) return void 0;
|
|
89
|
-
return `https://${
|
|
90
|
-
}
|
|
91
|
-
var HANZO_PUBLISHABLE_KEY = "pk-live-c88649f1085fb6ad441d8a0072933a9b";
|
|
92
|
-
function defaultPublishableKey(host) {
|
|
93
|
-
return host === void 0 || host === "https://api.hanzo.ai" ? HANZO_PUBLISHABLE_KEY : void 0;
|
|
89
|
+
return `https://${key}@api.hanzo.ai/v1/sentry/${projectId}`;
|
|
94
90
|
}
|
|
95
91
|
|
|
96
92
|
// src/events.ts
|
|
@@ -374,7 +370,7 @@ function uuidv7Time(id) {
|
|
|
374
370
|
}
|
|
375
371
|
|
|
376
372
|
// src/version.ts
|
|
377
|
-
var VERSION = "0.3.
|
|
373
|
+
var VERSION = "0.3.21";
|
|
378
374
|
|
|
379
375
|
// src/sentry.ts
|
|
380
376
|
var MAX_FRAMES = 50;
|
|
@@ -825,27 +821,24 @@ var Analytics = class {
|
|
|
825
821
|
enabled: true,
|
|
826
822
|
captureErrors: true,
|
|
827
823
|
...config,
|
|
828
|
-
// The publishable key resolves
|
|
829
|
-
//
|
|
830
|
-
// enough. Most specific first:
|
|
824
|
+
// The publishable key resolves from ONE live source, never a literal baked
|
|
825
|
+
// beside the code. Most specific first:
|
|
831
826
|
// 1. an explicit `ingestKey` in config;
|
|
832
827
|
// 2. NEXT_PUBLIC_PUBLISHABLE_KEY, the inlined build-time env the fleet
|
|
833
|
-
// carries end to end
|
|
834
|
-
// build-arg -> the NEXT_PUBLIC_ prefix Next inlines
|
|
835
|
-
// 3. the hanzo org key baked in `dsn.ts`, on the hanzo cloud only.
|
|
828
|
+
// carries end to end — KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
|
|
829
|
+
// build-arg -> the NEXT_PUBLIC_ prefix Next inlines.
|
|
836
830
|
//
|
|
837
|
-
//
|
|
838
|
-
//
|
|
839
|
-
//
|
|
840
|
-
//
|
|
841
|
-
//
|
|
842
|
-
|
|
843
|
-
// its own cloud (a non-default host) gets no default, so the org this
|
|
844
|
-
// attributes to is never the wrong one.
|
|
845
|
-
ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? defaultPublishableKey(config.host ?? DEFAULT_HOST)
|
|
831
|
+
// A surface that provides neither has no key, and its anonymous traffic
|
|
832
|
+
// files under `$public` (which drops track/identify/group and answers 200);
|
|
833
|
+
// the fix is to give it the KMS-sourced env, not to hardcode the org key
|
|
834
|
+
// here. The key is a credential-class value: its home is KMS, and the ONE
|
|
835
|
+
// build reads it from there.
|
|
836
|
+
ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY")
|
|
846
837
|
};
|
|
847
838
|
this.transport = config.transport ?? new DefaultTransport();
|
|
848
|
-
this.dsn = parseDsn(
|
|
839
|
+
this.dsn = parseDsn(
|
|
840
|
+
config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product, this.cfg.ingestKey)
|
|
841
|
+
);
|
|
849
842
|
}
|
|
850
843
|
/** errorPlaneEnabled reports whether captured exceptions can actually reach the
|
|
851
844
|
* error host. False means a DSN was never configured — the documented
|