@glasstrace/sdk 0.19.0 → 0.20.0

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/index.js CHANGED
@@ -587,6 +587,14 @@ function deriveErrorCategory(errorType) {
587
587
  }
588
588
 
589
589
  // src/discovery-endpoint.ts
590
+ var runtimeHandlerDeprecationWarned = false;
591
+ function warnRuntimeHandlerDeprecatedOnce() {
592
+ if (runtimeHandlerDeprecationWarned) return;
593
+ runtimeHandlerDeprecationWarned = true;
594
+ console.warn(
595
+ "[glasstrace] createDiscoveryHandler is deprecated. Run `npx glasstrace init` to generate a static file at public/.well-known/glasstrace.json (or static/.well-known/glasstrace.json on SvelteKit). The runtime handler will be removed in v1.0.0."
596
+ );
597
+ }
590
598
  function isAllowedOrigin(origin) {
591
599
  if (origin === null) return true;
592
600
  if (origin.startsWith("chrome-extension://")) return true;
@@ -615,6 +623,7 @@ function createDiscoveryHandler(getAnonKey, getSessionId, getClaimState) {
615
623
  if (url.pathname !== "/__glasstrace/config") {
616
624
  return null;
617
625
  }
626
+ warnRuntimeHandlerDeprecatedOnce();
618
627
  const origin = request.headers.get("Origin");
619
628
  const corsHeaders = buildCorsHeaders(origin);
620
629
  if (request.method === "OPTIONS") {
@@ -4207,7 +4216,7 @@ function registerGlasstrace(options) {
4207
4216
  setCoreState(CoreState.REGISTERING);
4208
4217
  startRuntimeStateWriter({
4209
4218
  projectRoot: process.cwd(),
4210
- sdkVersion: "0.19.0"
4219
+ sdkVersion: "0.20.0"
4211
4220
  });
4212
4221
  const config = resolveConfig(options);
4213
4222
  if (config.verbose) {
@@ -4373,8 +4382,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4373
4382
  if (config.verbose) {
4374
4383
  console.info("[glasstrace] Background init firing.");
4375
4384
  }
4376
- const healthReport = collectHealthReport("0.19.0");
4377
- const initResult = await performInit(config, anonKeyForInit, "0.19.0", healthReport);
4385
+ const healthReport = collectHealthReport("0.20.0");
4386
+ const initResult = await performInit(config, anonKeyForInit, "0.20.0", healthReport);
4378
4387
  if (generation !== registrationGeneration) return;
4379
4388
  const currentState = getCoreState();
4380
4389
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -4397,7 +4406,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4397
4406
  }
4398
4407
  maybeInstallConsoleCapture();
4399
4408
  if (didLastInitSucceed()) {
4400
- startHeartbeat(config, anonKeyForInit, "0.19.0", generation, (newApiKey, accountId) => {
4409
+ startHeartbeat(config, anonKeyForInit, "0.20.0", generation, (newApiKey, accountId) => {
4401
4410
  setAuthState(AuthState.CLAIMING);
4402
4411
  emitLifecycleEvent("auth:claim_started", { accountId });
4403
4412
  setResolvedApiKey(newApiKey);