@glasstrace/sdk 1.3.5 → 1.3.7
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/README.md +23 -18
- package/dist/{chunk-QJVAKVQJ.js → chunk-4WUHMLMM.js} +2 -2
- package/dist/{chunk-BQKPRFLF.js → chunk-DBKG6SRI.js} +2 -2
- package/dist/{chunk-WKOQJCFN.js → chunk-FKBCEOJ5.js} +2 -2
- package/dist/{chunk-EK6MYHR2.js → chunk-LW7474ZA.js} +29 -22
- package/dist/{chunk-EK6MYHR2.js.map → chunk-LW7474ZA.js.map} +1 -1
- package/dist/{chunk-E62DL2H4.js → chunk-TUFUV43S.js} +3 -3
- package/dist/{chunk-P4OYPFQ5.js → chunk-TZMYGEMB.js} +2 -2
- package/dist/chunk-TZMYGEMB.js.map +1 -0
- package/dist/{chunk-LQKJ27LO.js → chunk-V2S7BSV4.js} +2 -2
- package/dist/{chunk-M4ZI7J3N.js → chunk-XS5W3SPL.js} +1 -1
- package/dist/{chunk-M4ZI7J3N.js.map → chunk-XS5W3SPL.js.map} +1 -1
- package/dist/{chunk-3HWBR7XM.js → chunk-YSBGMBI5.js} +3 -3
- package/dist/cli/init.cjs +3 -3
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +8 -8
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/mcp-add.cjs +1 -1
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +3 -3
- package/dist/cli/uninit.js +3 -3
- package/dist/cli/validate.cjs.map +1 -1
- package/dist/cli/validate.js +2 -2
- package/dist/{edge-entry-shCc8_Y1.d.ts → edge-entry-BSKA1l_0.d.ts} +1 -1
- package/dist/{edge-entry-DT9OhPTC.d.cts → edge-entry-DyMWa6JK.d.cts} +1 -1
- package/dist/edge-entry.cjs.map +1 -1
- package/dist/edge-entry.d.cts +2 -2
- package/dist/edge-entry.d.ts +2 -2
- package/dist/edge-entry.js +2 -2
- package/dist/index.cjs +24 -17
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-DiI6uVEW.d.cts → index.d-Bo_Rxund.d.cts} +4 -1
- package/dist/{index.d-DiI6uVEW.d.ts → index.d-Bo_Rxund.d.ts} +4 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/node-entry.cjs +26 -19
- package/dist/node-entry.cjs.map +1 -1
- package/dist/node-entry.d.cts +2 -2
- package/dist/node-entry.d.ts +2 -2
- package/dist/node-entry.js +7 -7
- package/dist/node-subpath.cjs.map +1 -1
- package/dist/node-subpath.d.cts +1 -1
- package/dist/node-subpath.d.ts +1 -1
- package/dist/node-subpath.js +3 -3
- package/dist/{source-map-uploader-JAD3XM4F.js → source-map-uploader-FSTHCYDR.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-P4OYPFQ5.js.map +0 -1
- /package/dist/{chunk-QJVAKVQJ.js.map → chunk-4WUHMLMM.js.map} +0 -0
- /package/dist/{chunk-BQKPRFLF.js.map → chunk-DBKG6SRI.js.map} +0 -0
- /package/dist/{chunk-WKOQJCFN.js.map → chunk-FKBCEOJ5.js.map} +0 -0
- /package/dist/{chunk-E62DL2H4.js.map → chunk-TUFUV43S.js.map} +0 -0
- /package/dist/{chunk-LQKJ27LO.js.map → chunk-V2S7BSV4.js.map} +0 -0
- /package/dist/{chunk-3HWBR7XM.js.map → chunk-YSBGMBI5.js.map} +0 -0
- /package/dist/{source-map-uploader-JAD3XM4F.js.map → source-map-uploader-FSTHCYDR.js.map} +0 -0
package/README.md
CHANGED
|
@@ -250,8 +250,8 @@ const provider = new BasicTracerProvider({
|
|
|
250
250
|
branded exporter the auto-attach path uses, so duplicate
|
|
251
251
|
`registerGlasstrace()` calls remain idempotent. `registerGlasstrace()`
|
|
252
252
|
is still required when wiring the processor manually — it handles the
|
|
253
|
-
init handshake, anonymous-key resolution, session management,
|
|
254
|
-
|
|
253
|
+
init handshake, anonymous-key resolution, and session management, none
|
|
254
|
+
of which are owned by the span processor.
|
|
255
255
|
|
|
256
256
|
A future SDK release may extend the auto-attach detection to recognize
|
|
257
257
|
additional Next 16 provider shapes; until that ships, the manual path
|
|
@@ -380,21 +380,22 @@ mapped frames.
|
|
|
380
380
|
|
|
381
381
|
## Browser-extension discovery
|
|
382
382
|
|
|
383
|
-
|
|
384
|
-
`public/.well-known/glasstrace.json` (or
|
|
385
|
-
on SvelteKit)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
383
|
+
The supported discovery contract is the static file
|
|
384
|
+
`public/.well-known/glasstrace.json` (or
|
|
385
|
+
`static/.well-known/glasstrace.json` on SvelteKit). The Glasstrace
|
|
386
|
+
browser extension reads this file directly. `glasstrace init` writes
|
|
387
|
+
it for you; you do not need to add any HTTP routing for discovery. The
|
|
388
|
+
file contains only a schema version and the project's anonymous key —
|
|
389
|
+
it is public metadata, not a secret, and should be committed to source
|
|
389
390
|
control alongside the rest of your project.
|
|
390
391
|
|
|
391
|
-
The SDK no longer requires `createDiscoveryHandler` to be wired into
|
|
392
|
-
your server. If you previously registered the handler (for example,
|
|
393
|
-
inside `middleware.ts` or `proxy.ts` on Next.js), you can remove the
|
|
394
|
-
handler code and the extension will read the static file instead.
|
|
395
|
-
|
|
396
392
|
### Migration: removing the runtime discovery handler
|
|
397
393
|
|
|
394
|
+
If you previously wired `createDiscoveryHandler` yourself (for example
|
|
395
|
+
on `@glasstrace/sdk@<1.0.0`), the migration below shows how to remove
|
|
396
|
+
it on upgrade. Users starting fresh on `@glasstrace/sdk@>=1.0.0` do
|
|
397
|
+
not need this section.
|
|
398
|
+
|
|
398
399
|
**Next.js 15 and earlier (`middleware.ts`):**
|
|
399
400
|
|
|
400
401
|
```ts
|
|
@@ -451,11 +452,15 @@ export function proxy(_req: Request) {
|
|
|
451
452
|
|
|
452
453
|
If `proxy.ts` no longer does anything else, you can delete it entirely.
|
|
453
454
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
455
|
+
**The supported discovery contract is `public/.well-known/glasstrace.json`.**
|
|
456
|
+
`createDiscoveryHandler` was removed from the public API in `v1.0.0` and
|
|
457
|
+
is no longer exported from `@glasstrace/sdk`. The SDK retains an
|
|
458
|
+
internal runtime handler at `/__glasstrace/config` for backwards
|
|
459
|
+
compatibility with older consumer integrations during local
|
|
460
|
+
development. The internal handler is **not part of the supported
|
|
461
|
+
discovery contract** — it is not documented for use, not covered by
|
|
462
|
+
validation expectations, and may be removed in a future release
|
|
463
|
+
without a deprecation cycle. Rely on the static file.
|
|
459
464
|
|
|
460
465
|
## Subpath exports
|
|
461
466
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createBuildHash
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XS5W3SPL.js";
|
|
4
4
|
|
|
5
5
|
// src/import-graph.ts
|
|
6
6
|
import * as fs from "node:fs/promises";
|
|
@@ -175,4 +175,4 @@ export {
|
|
|
175
175
|
extractImports,
|
|
176
176
|
buildImportGraph
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
178
|
+
//# sourceMappingURL=chunk-4WUHMLMM.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
PresignedUploadResponseSchema,
|
|
6
6
|
SourceMapManifestResponseSchema,
|
|
7
7
|
SourceMapUploadResponseSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XS5W3SPL.js";
|
|
9
9
|
|
|
10
10
|
// src/source-map-uploader.ts
|
|
11
11
|
import * as fs from "node:fs/promises";
|
|
@@ -331,4 +331,4 @@ export {
|
|
|
331
331
|
uploadSourceMapsPresigned,
|
|
332
332
|
uploadSourceMapsAuto
|
|
333
333
|
};
|
|
334
|
-
//# sourceMappingURL=chunk-
|
|
334
|
+
//# sourceMappingURL=chunk-DBKG6SRI.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-DQ25VOKK.js";
|
|
4
4
|
import {
|
|
5
5
|
GLASSTRACE_ATTRIBUTE_NAMES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XS5W3SPL.js";
|
|
7
7
|
|
|
8
8
|
// src/errors.ts
|
|
9
9
|
var SdkError = class extends Error {
|
|
@@ -102,4 +102,4 @@ export {
|
|
|
102
102
|
GlasstraceSpanProcessor,
|
|
103
103
|
captureCorrelationId
|
|
104
104
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
//# sourceMappingURL=chunk-FKBCEOJ5.js.map
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
performInit,
|
|
34
34
|
recordSpansDropped,
|
|
35
35
|
recordSpansExported
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-YSBGMBI5.js";
|
|
37
37
|
import {
|
|
38
38
|
isAnonymousMode,
|
|
39
39
|
isProductionDisabled,
|
|
@@ -44,11 +44,11 @@ import {
|
|
|
44
44
|
getOrCreateAnonKey,
|
|
45
45
|
isSyncFsAvailable,
|
|
46
46
|
readAnonKey
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-V2S7BSV4.js";
|
|
48
48
|
import {
|
|
49
49
|
GLASSTRACE_ATTRIBUTE_NAMES,
|
|
50
50
|
deriveSessionId
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-XS5W3SPL.js";
|
|
52
52
|
import {
|
|
53
53
|
__require
|
|
54
54
|
} from "./chunk-NSBPE2FW.js";
|
|
@@ -4092,19 +4092,19 @@ function stopHeartbeat() {
|
|
|
4092
4092
|
}
|
|
4093
4093
|
}
|
|
4094
4094
|
function checkShutdownMarker(projectRoot) {
|
|
4095
|
-
let
|
|
4096
|
-
let
|
|
4095
|
+
let fsSync2 = null;
|
|
4096
|
+
let pathSync2 = null;
|
|
4097
4097
|
try {
|
|
4098
|
-
|
|
4099
|
-
|
|
4098
|
+
fsSync2 = __require("node:fs");
|
|
4099
|
+
pathSync2 = __require("node:path");
|
|
4100
4100
|
} catch {
|
|
4101
4101
|
return { triggered: false };
|
|
4102
4102
|
}
|
|
4103
4103
|
const root = projectRoot ?? (typeof process !== "undefined" ? process.cwd() : ".");
|
|
4104
|
-
const markerPath =
|
|
4105
|
-
if (!
|
|
4104
|
+
const markerPath = pathSync2.join(root, SHUTDOWN_MARKER_RELPATH);
|
|
4105
|
+
if (!fsSync2.existsSync(markerPath)) return { triggered: false };
|
|
4106
4106
|
try {
|
|
4107
|
-
|
|
4107
|
+
fsSync2.unlinkSync(markerPath);
|
|
4108
4108
|
} catch {
|
|
4109
4109
|
}
|
|
4110
4110
|
const shutdown = executeShutdown().catch(() => {
|
|
@@ -4184,8 +4184,15 @@ function registerHeartbeatShutdownHook(config, anonKey, sdkVersion) {
|
|
|
4184
4184
|
}
|
|
4185
4185
|
|
|
4186
4186
|
// src/runtime-state.ts
|
|
4187
|
-
|
|
4188
|
-
|
|
4187
|
+
var fsSync = null;
|
|
4188
|
+
var pathSync = null;
|
|
4189
|
+
try {
|
|
4190
|
+
fsSync = __require("node:fs");
|
|
4191
|
+
pathSync = __require("node:path");
|
|
4192
|
+
} catch {
|
|
4193
|
+
fsSync = null;
|
|
4194
|
+
pathSync = null;
|
|
4195
|
+
}
|
|
4189
4196
|
var _projectRoot = null;
|
|
4190
4197
|
var _sdkVersion = "unknown";
|
|
4191
4198
|
var _lastScenario;
|
|
@@ -4194,7 +4201,7 @@ var _debounceTimer = null;
|
|
|
4194
4201
|
var _started = false;
|
|
4195
4202
|
function startRuntimeStateWriter(options) {
|
|
4196
4203
|
if (_started) return;
|
|
4197
|
-
if (!isSyncFsAvailable()) {
|
|
4204
|
+
if (!isSyncFsAvailable() || fsSync === null || pathSync === null) {
|
|
4198
4205
|
_started = true;
|
|
4199
4206
|
return;
|
|
4200
4207
|
}
|
|
@@ -4246,9 +4253,9 @@ function writeStateNow() {
|
|
|
4246
4253
|
if (_lastError) {
|
|
4247
4254
|
runtimeState.lastError = _lastError;
|
|
4248
4255
|
}
|
|
4249
|
-
const dir = join(_projectRoot, ".glasstrace");
|
|
4250
|
-
const filePath = join(dir, "runtime-state.json");
|
|
4251
|
-
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
4256
|
+
const dir = pathSync.join(_projectRoot, ".glasstrace");
|
|
4257
|
+
const filePath = pathSync.join(dir, "runtime-state.json");
|
|
4258
|
+
fsSync.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
4252
4259
|
atomicWriteFileSync(filePath, JSON.stringify(runtimeState, null, 2) + "\n", {
|
|
4253
4260
|
mode: 384
|
|
4254
4261
|
});
|
|
@@ -4290,7 +4297,7 @@ function registerGlasstrace(options) {
|
|
|
4290
4297
|
setCoreState(CoreState.REGISTERING);
|
|
4291
4298
|
startRuntimeStateWriter({
|
|
4292
4299
|
projectRoot: process.cwd(),
|
|
4293
|
-
sdkVersion: "1.3.
|
|
4300
|
+
sdkVersion: "1.3.7"
|
|
4294
4301
|
});
|
|
4295
4302
|
const config = resolveConfig(options);
|
|
4296
4303
|
if (config.verbose) {
|
|
@@ -4457,8 +4464,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
|
|
|
4457
4464
|
if (config.verbose) {
|
|
4458
4465
|
console.info("[glasstrace] Background init firing.");
|
|
4459
4466
|
}
|
|
4460
|
-
const healthReport = collectHealthReport("1.3.
|
|
4461
|
-
const initResult = await performInit(config, anonKeyForInit, "1.3.
|
|
4467
|
+
const healthReport = collectHealthReport("1.3.7");
|
|
4468
|
+
const initResult = await performInit(config, anonKeyForInit, "1.3.7", healthReport);
|
|
4462
4469
|
if (generation !== registrationGeneration) return;
|
|
4463
4470
|
const currentState = getCoreState();
|
|
4464
4471
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -4481,7 +4488,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
|
|
|
4481
4488
|
}
|
|
4482
4489
|
maybeInstallConsoleCapture();
|
|
4483
4490
|
if (didLastInitSucceed()) {
|
|
4484
|
-
startHeartbeat(config, anonKeyForInit, "1.3.
|
|
4491
|
+
startHeartbeat(config, anonKeyForInit, "1.3.7", generation, (newApiKey, accountId) => {
|
|
4485
4492
|
setAuthState(AuthState.CLAIMING);
|
|
4486
4493
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
4487
4494
|
setResolvedApiKey(newApiKey);
|
|
@@ -4778,7 +4785,7 @@ async function handleSourceMapUpload(distDir) {
|
|
|
4778
4785
|
);
|
|
4779
4786
|
return;
|
|
4780
4787
|
}
|
|
4781
|
-
const { discoverSourceMapFiles, computeBuildHash, uploadSourceMaps } = await import("./source-map-uploader-
|
|
4788
|
+
const { discoverSourceMapFiles, computeBuildHash, uploadSourceMaps } = await import("./source-map-uploader-FSTHCYDR.js");
|
|
4782
4789
|
const files = await discoverSourceMapFiles(distDir);
|
|
4783
4790
|
if (files.length === 0) {
|
|
4784
4791
|
console.info("[glasstrace] No source map files found. Skipping upload.");
|
|
@@ -4881,4 +4888,4 @@ export {
|
|
|
4881
4888
|
withGlasstraceConfig,
|
|
4882
4889
|
captureError
|
|
4883
4890
|
};
|
|
4884
|
-
//# sourceMappingURL=chunk-
|
|
4891
|
+
//# sourceMappingURL=chunk-LW7474ZA.js.map
|