@tracewayapp/core 0.2.0 → 1.0.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/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Shared types and utilities for all Traceway JavaScript SDKs. Zero runtime dependencies.
4
4
 
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @tracewayapp/core
9
+ ```
10
+
5
11
  ## Types
6
12
 
7
13
  | Type | Description |
package/dist/index.d.mts CHANGED
@@ -5,6 +5,7 @@ interface ExceptionStackTrace {
5
5
  recordedAt: string;
6
6
  attributes?: Record<string, string>;
7
7
  isMessage: boolean;
8
+ sessionRecordingId?: string | null;
8
9
  }
9
10
  interface MetricRecord {
10
11
  name: string;
@@ -33,6 +34,11 @@ interface CollectionFrame {
33
34
  stackTraces: ExceptionStackTrace[];
34
35
  metrics: MetricRecord[];
35
36
  traces: Trace[];
37
+ sessionRecordings?: SessionRecordingPayload[];
38
+ }
39
+ interface SessionRecordingPayload {
40
+ exceptionId: string;
41
+ events: unknown[];
36
42
  }
37
43
  interface ReportRequest {
38
44
  collectionFrames: CollectionFrame[];
@@ -64,4 +70,4 @@ declare const METRIC_MEM_USED = "mem.used";
64
70
  declare const METRIC_MEM_TOTAL = "mem.total";
65
71
  declare const METRIC_CPU_USED_PCNT = "cpu.used_pcnt";
66
72
 
67
- export { type CollectionFrame, type ExceptionStackTrace, METRIC_CPU_USED_PCNT, METRIC_MEM_TOTAL, METRIC_MEM_USED, type MetricRecord, type ParsedConnectionString, type ReportRequest, type Span, type Trace, type TracewayOptions, generateUUID, msToNanoseconds, nowISO, parseConnectionString };
73
+ export { type CollectionFrame, type ExceptionStackTrace, METRIC_CPU_USED_PCNT, METRIC_MEM_TOTAL, METRIC_MEM_USED, type MetricRecord, type ParsedConnectionString, type ReportRequest, type SessionRecordingPayload, type Span, type Trace, type TracewayOptions, generateUUID, msToNanoseconds, nowISO, parseConnectionString };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ interface ExceptionStackTrace {
5
5
  recordedAt: string;
6
6
  attributes?: Record<string, string>;
7
7
  isMessage: boolean;
8
+ sessionRecordingId?: string | null;
8
9
  }
9
10
  interface MetricRecord {
10
11
  name: string;
@@ -33,6 +34,11 @@ interface CollectionFrame {
33
34
  stackTraces: ExceptionStackTrace[];
34
35
  metrics: MetricRecord[];
35
36
  traces: Trace[];
37
+ sessionRecordings?: SessionRecordingPayload[];
38
+ }
39
+ interface SessionRecordingPayload {
40
+ exceptionId: string;
41
+ events: unknown[];
36
42
  }
37
43
  interface ReportRequest {
38
44
  collectionFrames: CollectionFrame[];
@@ -64,4 +70,4 @@ declare const METRIC_MEM_USED = "mem.used";
64
70
  declare const METRIC_MEM_TOTAL = "mem.total";
65
71
  declare const METRIC_CPU_USED_PCNT = "cpu.used_pcnt";
66
72
 
67
- export { type CollectionFrame, type ExceptionStackTrace, METRIC_CPU_USED_PCNT, METRIC_MEM_TOTAL, METRIC_MEM_USED, type MetricRecord, type ParsedConnectionString, type ReportRequest, type Span, type Trace, type TracewayOptions, generateUUID, msToNanoseconds, nowISO, parseConnectionString };
73
+ export { type CollectionFrame, type ExceptionStackTrace, METRIC_CPU_USED_PCNT, METRIC_MEM_TOTAL, METRIC_MEM_USED, type MetricRecord, type ParsedConnectionString, type ReportRequest, type SessionRecordingPayload, type Span, type Trace, type TracewayOptions, generateUUID, msToNanoseconds, nowISO, parseConnectionString };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/constants.ts"],"sourcesContent":["export type {\n ExceptionStackTrace,\n MetricRecord,\n Span,\n Trace,\n CollectionFrame,\n ReportRequest,\n TracewayOptions,\n} from \"./types.js\";\n\nexport {\n generateUUID,\n parseConnectionString,\n nowISO,\n msToNanoseconds,\n} from \"./utils.js\";\nexport type { ParsedConnectionString } from \"./utils.js\";\n\nexport {\n METRIC_MEM_USED,\n METRIC_MEM_TOTAL,\n METRIC_CPU_USED_PCNT,\n} from \"./constants.js\";\n","export function generateUUID(): string {\n if (\n typeof crypto !== \"undefined\" &&\n typeof crypto.randomUUID === \"function\"\n ) {\n return crypto.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nexport interface ParsedConnectionString {\n token: string;\n apiUrl: string;\n}\n\nexport function parseConnectionString(\n connectionString: string,\n): ParsedConnectionString {\n const atIndex = connectionString.indexOf(\"@\");\n if (atIndex === -1) {\n throw new Error(\n \"Invalid connection string: must be in format {token}@{apiUrl}\",\n );\n }\n const token = connectionString.slice(0, atIndex);\n const apiUrl = connectionString.slice(atIndex + 1);\n if (!token || !apiUrl) {\n throw new Error(\n \"Invalid connection string: token and apiUrl must not be empty\",\n );\n }\n return { token, apiUrl };\n}\n\nexport function nowISO(): string {\n return new Date().toISOString();\n}\n\nexport function msToNanoseconds(ms: number): number {\n return Math.round(ms * 1_000_000);\n}\n","export const METRIC_MEM_USED = \"mem.used\";\nexport const METRIC_MEM_TOTAL = \"mem.total\";\nexport const METRIC_CPU_USED_PCNT = \"cpu.used_pcnt\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,eAAuB;AACrC,MACE,OAAO,WAAW,eAClB,OAAO,OAAO,eAAe,YAC7B;AACA,WAAO,OAAO,WAAW;AAAA,EAC3B;AACA,SAAO,uCAAuC,QAAQ,SAAS,CAAC,MAAM;AACpE,UAAM,IAAK,KAAK,OAAO,IAAI,KAAM;AACjC,UAAM,IAAI,MAAM,MAAM,IAAK,IAAI,IAAO;AACtC,WAAO,EAAE,SAAS,EAAE;AAAA,EACtB,CAAC;AACH;AAOO,SAAS,sBACd,kBACwB;AACxB,QAAM,UAAU,iBAAiB,QAAQ,GAAG;AAC5C,MAAI,YAAY,IAAI;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,QAAQ,iBAAiB,MAAM,GAAG,OAAO;AAC/C,QAAM,SAAS,iBAAiB,MAAM,UAAU,CAAC;AACjD,MAAI,CAAC,SAAS,CAAC,QAAQ;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,EAAE,OAAO,OAAO;AACzB;AAEO,SAAS,SAAiB;AAC/B,UAAO,oBAAI,KAAK,GAAE,YAAY;AAChC;AAEO,SAAS,gBAAgB,IAAoB;AAClD,SAAO,KAAK,MAAM,KAAK,GAAS;AAClC;;;AC5CO,IAAM,kBAAkB;AACxB,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/constants.ts"],"sourcesContent":["export type {\n ExceptionStackTrace,\n MetricRecord,\n Span,\n Trace,\n CollectionFrame,\n SessionRecordingPayload,\n ReportRequest,\n TracewayOptions,\n} from \"./types.js\";\n\nexport {\n generateUUID,\n parseConnectionString,\n nowISO,\n msToNanoseconds,\n} from \"./utils.js\";\nexport type { ParsedConnectionString } from \"./utils.js\";\n\nexport {\n METRIC_MEM_USED,\n METRIC_MEM_TOTAL,\n METRIC_CPU_USED_PCNT,\n} from \"./constants.js\";\n","export function generateUUID(): string {\n if (\n typeof crypto !== \"undefined\" &&\n typeof crypto.randomUUID === \"function\"\n ) {\n return crypto.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nexport interface ParsedConnectionString {\n token: string;\n apiUrl: string;\n}\n\nexport function parseConnectionString(\n connectionString: string,\n): ParsedConnectionString {\n const atIndex = connectionString.indexOf(\"@\");\n if (atIndex === -1) {\n throw new Error(\n \"Invalid connection string: must be in format {token}@{apiUrl}\",\n );\n }\n const token = connectionString.slice(0, atIndex);\n const apiUrl = connectionString.slice(atIndex + 1);\n if (!token || !apiUrl) {\n throw new Error(\n \"Invalid connection string: token and apiUrl must not be empty\",\n );\n }\n return { token, apiUrl };\n}\n\nexport function nowISO(): string {\n return new Date().toISOString();\n}\n\nexport function msToNanoseconds(ms: number): number {\n return Math.round(ms * 1_000_000);\n}\n","export const METRIC_MEM_USED = \"mem.used\";\nexport const METRIC_MEM_TOTAL = \"mem.total\";\nexport const METRIC_CPU_USED_PCNT = \"cpu.used_pcnt\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,eAAuB;AACrC,MACE,OAAO,WAAW,eAClB,OAAO,OAAO,eAAe,YAC7B;AACA,WAAO,OAAO,WAAW;AAAA,EAC3B;AACA,SAAO,uCAAuC,QAAQ,SAAS,CAAC,MAAM;AACpE,UAAM,IAAK,KAAK,OAAO,IAAI,KAAM;AACjC,UAAM,IAAI,MAAM,MAAM,IAAK,IAAI,IAAO;AACtC,WAAO,EAAE,SAAS,EAAE;AAAA,EACtB,CAAC;AACH;AAOO,SAAS,sBACd,kBACwB;AACxB,QAAM,UAAU,iBAAiB,QAAQ,GAAG;AAC5C,MAAI,YAAY,IAAI;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,QAAQ,iBAAiB,MAAM,GAAG,OAAO;AAC/C,QAAM,SAAS,iBAAiB,MAAM,UAAU,CAAC;AACjD,MAAI,CAAC,SAAS,CAAC,QAAQ;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,EAAE,OAAO,OAAO;AACzB;AAEO,SAAS,SAAiB;AAC/B,UAAO,oBAAI,KAAK,GAAE,YAAY;AAChC;AAEO,SAAS,gBAAgB,IAAoB;AAClD,SAAO,KAAK,MAAM,KAAK,GAAS;AAClC;;;AC5CO,IAAM,kBAAkB;AACxB,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tracewayapp/core",
3
- "version": "0.2.0",
3
+ "version": "1.0.0",
4
4
  "description": "Shared types and utilities for Traceway SDKs",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",