@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 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://${HANZO_PUBLISHABLE_KEY}@api.hanzo.ai/v1/sentry/${projectId}`;
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.20";
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 the SAME way the DSN below does, and now
829
- // ends the SAME way too — in a baked default, so declaring nothing is
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 (KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
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
- // (3) is why this is `publishable_key for all`: a hanzo surface that passes
838
- // no key in code and inlines no env still emits attributed, exactly as
839
- // declaring `product` is enough for the DSN. Without it that surface sent
840
- // its beacons to `$public` which drops every track/identify/group and
841
- // still answers 200 silent in the page and invisible until you read the
842
- // warehouse and find the host missing entirely. A white-label surface on
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(config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product));
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