@replayd/core 0.1.1 → 0.1.2

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.
@@ -54,6 +54,18 @@ export interface RedactOptions {
54
54
  bodyKeys?: string[];
55
55
  queryParams?: string[];
56
56
  }
57
+ /**
58
+ * Backend log correlation (T-109): read an EXISTING request/correlation ID from these response headers, for these
59
+ * URLs only. Nothing is ever added to requests. Cross-origin APIs must list the header in
60
+ * `Access-Control-Expose-Headers`. Values longer than 128 characters or with characters other than letters, digits
61
+ * and `._:@/+=-` are dropped; headers in `redact.headers` are never read.
62
+ */
63
+ export interface CorrelationOptions {
64
+ /** Response header names, at most 3 are used, e.g. `['x-request-id']`. */
65
+ headers: string[];
66
+ /** URLs to read them from; default `replay.networkDetailAllowUrls`. `'self'` = `location.origin`. */
67
+ urls?: Matcher[];
68
+ }
57
69
  export interface ReplaydOptions {
58
70
  /** `https://<publicKey>@<host>/<projectId|slug>` */
59
71
  dsn: string;
@@ -66,6 +78,7 @@ export interface ReplaydOptions {
66
78
  websocket?: WebSocketOptions;
67
79
  errors?: ErrorOptions;
68
80
  redact?: RedactOptions;
81
+ correlation?: CorrelationOptions;
69
82
  beforeSend?: (event: ReplaydEvent) => ReplaydEvent | null | undefined | void;
70
83
  /** IndexedDB offline queue on web (always on under Capacitor; T-26). */
71
84
  offlineQueue?: boolean;
@@ -76,6 +89,17 @@ export interface Breadcrumb {
76
89
  msg: string;
77
90
  data?: Record<string, unknown>;
78
91
  }
92
+ /**
93
+ * `addBreadcrumb` input (T-107). `msg` is a short label (≤ 256 chars kept); put values in `data`, whose keys are
94
+ * redacted with `redact.bodyKeys` (password, token, …). `data` over 1 KB of JSON is replaced by `{ truncated: <size> }`.
95
+ * `cat` defaults to `'custom'` (≤ 32 chars kept); `ts` to now. Type `D` to describe your own breadcrumbs.
96
+ */
97
+ export interface BreadcrumbInput<D extends Record<string, unknown> = Record<string, unknown>> {
98
+ msg: string;
99
+ cat?: Breadcrumb['cat'];
100
+ data?: D;
101
+ ts?: number;
102
+ }
79
103
  export interface User {
80
104
  id?: string;
81
105
  email?: string;
@@ -88,7 +112,7 @@ export interface ReplaydEvent {
88
112
  ts: number;
89
113
  sid: string;
90
114
  level: 'error' | 'warning';
91
- source: 'onerror' | 'unhandledrejection' | 'console' | 'http' | 'ws' | 'vue' | 'react' | 'manual';
115
+ source: 'onerror' | 'unhandledrejection' | 'console' | 'http' | 'ws' | 'vue' | 'react' | 'manual' | 'report';
92
116
  type: string;
93
117
  message: string;
94
118
  stack?: string;
@@ -106,9 +130,17 @@ export interface ReplaydEvent {
106
130
  breadcrumbs: Breadcrumb[];
107
131
  count: number;
108
132
  }
133
+ /** `reportProblem` result (T-110): the report's id, the session it belongs to, its time, and whether this page was
134
+ * recording a replay of that session when it was made. */
135
+ export interface ProblemReport {
136
+ id: string;
137
+ sid: string;
138
+ ts: number;
139
+ replay: boolean;
140
+ }
109
141
  /** Ring-buffer / replay custom event (rrweb custom event tag + payload + original timestamp). */
110
142
  export interface RingEvent {
111
- type: 'console' | 'network' | 'ws' | 'nav' | 'breadcrumb' | 'error' | 'app' | 'gap' | 'fields';
143
+ type: 'console' | 'network' | 'ws' | 'nav' | 'breadcrumb' | 'error' | 'app' | 'gap' | 'fields' | 'report';
112
144
  ts: number;
113
145
  data: Record<string, unknown>;
114
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replayd/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "replayd browser SDK: errors, breadcrumbs, console, network and WebSocket capture, session replay",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@rrweb/record": "2.2.0"
36
36
  },
37
- "gitHead": "cdd3ef1bef13e31db0d36ec969d4d1868c25de2e",
37
+ "gitHead": "2018015a55c1fe58d03c7d755b1dfffb415d6a1a",
38
38
  "scripts": {
39
39
  "build": "node ../../scripts/build.mjs build.json && tsc -p tsconfig.build.json"
40
40
  }