@jeffjassky/telemetry 0.7.0 → 0.8.1

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Telemetry</title>
7
7
  <!--telemetry-config-->
8
- <script type="module" crossorigin src="./_assets/index-BksXA5iG.js"></script>
8
+ <script type="module" crossorigin src="./_assets/index-GvGDQ08Z.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./_assets/index-COswHpSX.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffjassky/telemetry",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "Unified telemetry — product events, errors, traces, state transitions, and billable usage in one Mongo envelope, with typed SDKs and a mountable dashboard.",
5
5
  "license": "MIT",
6
6
  "author": "Jeff Jassky <jeff@jeffjassky.com>",
@@ -104,12 +104,21 @@
104
104
  "vue": "^3.0.0"
105
105
  },
106
106
  "peerDependenciesMeta": {
107
- "express": { "optional": true },
108
- "mongoose": { "optional": true },
109
- "react": { "optional": true },
110
- "vue": { "optional": true }
107
+ "express": {
108
+ "optional": true
109
+ },
110
+ "mongoose": {
111
+ "optional": true
112
+ },
113
+ "react": {
114
+ "optional": true
115
+ },
116
+ "vue": {
117
+ "optional": true
118
+ }
111
119
  },
112
120
  "devDependencies": {
121
+ "@jridgewell/gen-mapping": "^0.3.13",
113
122
  "@types/express": "^5.0.6",
114
123
  "@types/node": "^22.7.0",
115
124
  "@types/react": "^18.3.0",
@@ -130,6 +139,7 @@
130
139
  "access": "public"
131
140
  },
132
141
  "dependencies": {
142
+ "@jridgewell/trace-mapping": "^0.3.31",
133
143
  "uuidv7": "^1.2.1",
134
144
  "zod": "^4.4.3"
135
145
  }
package/types/index.d.ts CHANGED
@@ -902,6 +902,12 @@ export interface Telemetry<R extends Registry = Registry> {
902
902
  */
903
903
  linkSubjects: LinkSubjects | null;
904
904
  logger: Logger;
905
+ /**
906
+ * Sourcemaps for minified clients. Server-side only — there is no HTTP
907
+ * route. The dashboard translates error frames at read time against the
908
+ * map registered for the record's (tenantId, service, release, file).
909
+ */
910
+ sourcemaps: Sourcemaps;
905
911
  /** mint an ingest key against this instance's key collection */
906
912
  createKey(input: CreateKeyInput): Promise<{ key: string; id: string }>;
907
913
  models: {
@@ -917,6 +923,45 @@ export interface Telemetry<R extends Registry = Registry> {
917
923
  };
918
924
  }
919
925
 
926
+ // ── sourcemaps ──────────────────────────────────────────────────────────────
927
+
928
+ export interface SourcemapFile {
929
+ /** the bundle's file name as a frame's `filename` ends with it: `chunk-vendors.f18c196e.js` */
930
+ file: string;
931
+ /** the map, as JSON text or a parsed object */
932
+ map: string | Record<string, unknown>;
933
+ }
934
+
935
+ export interface RegisterSourcemapsInput {
936
+ tenantId: string;
937
+ service: string;
938
+ /** must equal the client's `release`; `'unknown'` is refused */
939
+ release: string;
940
+ files: SourcemapFile[];
941
+ }
942
+
943
+ export interface OriginalPosition {
944
+ source: string;
945
+ line: number;
946
+ column: number;
947
+ name?: string;
948
+ /** the original source line, trimmed and capped */
949
+ context?: string;
950
+ }
951
+
952
+ export interface Sourcemaps {
953
+ ensureIndexes(): Promise<void>;
954
+ /** idempotent per release — call it on every boot; refreshes retention */
955
+ register(input: RegisterSourcemapsInput): Promise<{ stored: number; skipped: string[] }>;
956
+ resolve(
957
+ where: { tenantId: string; service: string; release: string; filename: string },
958
+ lineno: number,
959
+ colno: number,
960
+ ): Promise<OriginalPosition | null>;
961
+ /** a copy of an error record with `original` on each translatable frame; never throws */
962
+ symbolicate<T extends Record<string, any>>(record: T): Promise<T>;
963
+ }
964
+
920
965
  export declare function createTelemetry<const R extends Registry>(
921
966
  config: CreateTelemetryConfig<R>,
922
967
  ): Telemetry<R>;