@allstak/react 0.1.3 → 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 CHANGED
@@ -3,7 +3,7 @@
3
3
  **Drop-in error tracking for React. One `<AllStakErrorBoundary>`, zero config beyond your API key.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@allstak/react.svg)](https://www.npmjs.com/package/@allstak/react)
6
- [![CI](https://github.com/allstak-io/allstak-react/actions/workflows/ci.yml/badge.svg)](https://github.com/allstak-io/allstak-react/actions)
6
+ [![CI](https://github.com/AllStak/allstak-react/actions/workflows/ci.yml/badge.svg)](https://github.com/AllStak/allstak-react/actions)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
8
 
9
9
  Official AllStak SDK for React — error boundary component, hooks, and a profiler HOC on top of the browser SDK.
@@ -114,6 +114,49 @@ import { AllStak } from '@allstak/react';
114
114
  AllStak.setUser({ id: user.id, email: user.email });
115
115
  ```
116
116
 
117
+ ## HTTP tracking
118
+
119
+ Setting `enableHttpTracking: true` (off by default) auto-wraps `fetch`,
120
+ `XMLHttpRequest`, and `axios` (when installed) so every outbound HTTP
121
+ call is recorded as an `http_request` event.
122
+
123
+ **Privacy defaults are aggressive:**
124
+
125
+ - request/response bodies are **not** captured
126
+ - headers are **not** captured
127
+ - `Authorization`, `Cookie`, `Set-Cookie`, `X-API-Key`, `X-Auth-Token`,
128
+ `Proxy-Authorization` are **always** redacted
129
+ - query params named `token`, `password`, `api_key`, `apikey`,
130
+ `authorization`, `auth`, `secret`, `access_token`, `refresh_token`,
131
+ `session`, `sessionid`, `jwt` are **always** redacted in the URL
132
+
133
+ To enable richer capture (only on routes you control):
134
+
135
+ ```ts
136
+ AllStak.init({
137
+ apiKey: '...',
138
+ enableHttpTracking: true,
139
+ httpTracking: {
140
+ captureRequestBody: true,
141
+ captureResponseBody: true,
142
+ captureHeaders: true, // auth headers still hard-redacted
143
+ redactHeaders: ['x-tenant'],
144
+ redactQueryParams: ['custom_id'],
145
+ ignoredUrls: [/health/i, '/metrics'],
146
+ allowedUrls: [],
147
+ maxBodyBytes: 4096,
148
+ },
149
+ });
150
+
151
+ // axios with custom adapter (rare):
152
+ import axios from 'axios';
153
+ const api = AllStak.instrumentAxios(axios.create({ baseURL: 'https://api.example.com' }));
154
+ ```
155
+
156
+ When an exception fires after a failed request, the most recent failed
157
+ HTTP requests (last 10) are automatically attached to the error
158
+ metadata under `http.recentFailed` for easy triage.
159
+
117
160
  ## Production Endpoint
118
161
 
119
162
  Production endpoint: `https://api.allstak.sa`. Override via `host` for self-hosted installs:
@@ -122,11 +165,61 @@ Production endpoint: `https://api.allstak.sa`. Override via `host` for self-host
122
165
  AllStak.init({ apiKey: '...', host: 'https://allstak.mycorp.com' });
123
166
  ```
124
167
 
168
+ ## Source maps
169
+
170
+ Production stack traces are minified — to see real function names and
171
+ line numbers in the AllStak dashboard you need to upload the source maps
172
+ that your bundler emits. The CLI lives in `@allstak/js/sourcemaps`; you
173
+ do **not** need to install `@allstak/js` as a runtime dependency, only
174
+ as a `devDependency` for the build step.
175
+
176
+ ### Vite
177
+
178
+ ```bash
179
+ npm install -D @allstak/js
180
+ ```
181
+
182
+ ```ts
183
+ // vite.config.ts
184
+ import { defineConfig } from 'vite';
185
+ import { allstakSourcemaps } from '@allstak/js/vite';
186
+
187
+ export default defineConfig({
188
+ build: { sourcemap: 'hidden' },
189
+ plugins: [
190
+ allstakSourcemaps({
191
+ release: process.env.RELEASE!,
192
+ token: process.env.ALLSTAK_UPLOAD_TOKEN!,
193
+ }),
194
+ ],
195
+ });
196
+ ```
197
+
198
+ ### Webpack / Next / generic
199
+
200
+ The plugin exists for `@allstak/js/webpack` and `@allstak/js/next`; for
201
+ any other bundler call the underlying API after your build:
202
+
203
+ ```ts
204
+ import { processBuildOutput } from '@allstak/js/sourcemaps';
205
+
206
+ await processBuildOutput({
207
+ dir: 'dist',
208
+ release: process.env.RELEASE!,
209
+ token: process.env.ALLSTAK_UPLOAD_TOKEN!,
210
+ });
211
+ ```
212
+
213
+ This injects a stable `debugId` into every chunk and uploads the matching
214
+ `.map`. The runtime resolver in `@allstak/react` reads `globalThis._allstakDebugIds`
215
+ to attach the right debug-id to each captured frame, so the symbolicator
216
+ picks the correct map even after long-tail caching of bundles.
217
+
125
218
  ## Links
126
219
 
127
220
  - Documentation: https://docs.allstak.sa
128
221
  - Dashboard: https://app.allstak.sa
129
- - Source: https://github.com/allstak-io/allstak-react
222
+ - Source: https://github.com/AllStak/allstak-react
130
223
 
131
224
  ## License
132
225