tracebck-sdk 0.2.0 → 0.3.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 +44 -4
- package/dist/index.cjs +22 -22
- package/dist/index.iife.js +22 -22
- package/dist/index.js +22 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,8 @@ init({
|
|
|
65
65
|
| `apiKey` | `string` | **required** | Your project API key |
|
|
66
66
|
| `maskAllInputs` | `boolean` | `false` | Replace all input values with `*` for privacy |
|
|
67
67
|
| `captureNetwork` | `boolean` | `true` | Capture fetch and XHR requests |
|
|
68
|
+
| `networkDenyUrls` | `array` | `[]` | URL patterns to exclude from network capture (strings or RegExp) |
|
|
69
|
+
| `sanitizeRequest` | `function` | `null` | Callback to modify or drop captured network events |
|
|
68
70
|
| `flushInterval` | `number` | `5000` | Interval in ms between event flushes |
|
|
69
71
|
| `options` | `object` | `{}` | Additional [rrweb options](#rrweb-options) |
|
|
70
72
|
|
|
@@ -95,11 +97,11 @@ Browser metadata (URL, referrer, userAgent, language, resolution) is captured au
|
|
|
95
97
|
|
|
96
98
|
### `stopSession()`
|
|
97
99
|
|
|
98
|
-
Stops recording, flushes remaining events, and closes the session.
|
|
100
|
+
Stops recording, flushes remaining events, and closes the session. Sessions are also automatically stopped and flushed when the page is closed via `pagehide`.
|
|
99
101
|
|
|
100
102
|
## rrweb Options
|
|
101
103
|
|
|
102
|
-
Pass
|
|
104
|
+
Pass additional recording options via the `options` field in `init()` to customize recording behavior.
|
|
103
105
|
|
|
104
106
|
### Privacy
|
|
105
107
|
|
|
@@ -107,7 +109,7 @@ Block elements entirely (rendered as grey placeholders in replay):
|
|
|
107
109
|
|
|
108
110
|
```javascript
|
|
109
111
|
options: {
|
|
110
|
-
blockClass: '
|
|
112
|
+
blockClass: 'tracebck-block', // default: 'tracebck-block'
|
|
111
113
|
blockSelector: '.secret-panel'
|
|
112
114
|
}
|
|
113
115
|
```
|
|
@@ -116,11 +118,19 @@ Mask text content (replaced with `*`):
|
|
|
116
118
|
|
|
117
119
|
```javascript
|
|
118
120
|
options: {
|
|
119
|
-
maskTextClass: '
|
|
121
|
+
maskTextClass: 'tracebck-mask',
|
|
120
122
|
maskTextSelector: '.sensitive'
|
|
121
123
|
}
|
|
122
124
|
```
|
|
123
125
|
|
|
126
|
+
Ignore DOM mutations:
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
options: {
|
|
130
|
+
ignoreClass: 'tracebck-ignore'
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
124
134
|
Granular input masking:
|
|
125
135
|
|
|
126
136
|
```javascript
|
|
@@ -152,6 +162,36 @@ When `captureNetwork` is enabled (default), the SDK intercepts `fetch` and `XMLH
|
|
|
152
162
|
|
|
153
163
|
Captured per request: method, URL, status code, headers, body (text content types only, max 100KB), and duration.
|
|
154
164
|
|
|
165
|
+
**Sensitive headers** (`Authorization`, `Cookie`, `Set-Cookie`, `Proxy-Authorization`, `X-Api-Key`, `X-CSRF-Token`, `X-XSRF-Token`) are automatically stripped from captured requests for security.
|
|
166
|
+
|
|
167
|
+
Exclude URLs from capture:
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
init({
|
|
171
|
+
captureNetwork: true,
|
|
172
|
+
networkDenyUrls: [
|
|
173
|
+
/analytics\.example\.com/, // RegExp pattern
|
|
174
|
+
'https://tracking.service' // String pattern
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Customize network events before capture:
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
init({
|
|
183
|
+
captureNetwork: true,
|
|
184
|
+
sanitizeRequest: (event) => {
|
|
185
|
+
// Modify event if needed
|
|
186
|
+
if (event.request?.url.includes('sensitive')) {
|
|
187
|
+
event.request.body = '[REDACTED]';
|
|
188
|
+
}
|
|
189
|
+
// Return modified event, or null to drop it entirely
|
|
190
|
+
return event.request?.url.includes('drop-me') ? null : event;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
155
195
|
## Distribution
|
|
156
196
|
|
|
157
197
|
| Format | File | Usage |
|