@newtalaria/browser 0.1.13 → 0.1.15
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 +15 -5
- package/dist/client.d.ts +21 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/index.js +397 -40
- package/dist/index.js.map +3 -3
- package/dist/replay/hooks.d.ts +28 -2
- package/dist/replay/hooks.d.ts.map +1 -1
- package/dist/sdk_meta.d.ts +1 -1
- package/dist/talaria.browser.iife.js +397 -40
- package/dist/talaria.browser.iife.js.map +3 -3
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/environment.d.ts +7 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/network_error.d.ts +13 -0
- package/dist/utils/network_error.d.ts.map +1 -0
- package/dist/utils/sdk_internal_noise.d.ts +6 -0
- package/dist/utils/sdk_internal_noise.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,6 +59,8 @@ Every ingested event includes browser runtime tags (`browser.name`, `browser.ver
|
|
|
59
59
|
|
|
60
60
|
Optional init `tags` are merged into every captured event (per-call tags win on key conflict).
|
|
61
61
|
|
|
62
|
+
`environment` must resolve to a wire value: `production` | `staging` | `development`. Common aliases are accepted (`test`/`uat` → `staging`, `prod`/`live` → `production`, `dev`/`local` → `development`), matching the PHP SDK. Invalid values throw at `init`. Permanent `events/ingest` 4xx responses disable further capture for that page session so misconfig cannot spin forever.
|
|
63
|
+
|
|
62
64
|
## Script tag (IIFE)
|
|
63
65
|
|
|
64
66
|
For hosts without a bundler (e.g. Silverstripe `Requirements`):
|
|
@@ -172,7 +174,7 @@ Segment payloads are a **gzip-compressed JSON array** of rrweb events.
|
|
|
172
174
|
|
|
173
175
|
Custom rrweb events:
|
|
174
176
|
|
|
175
|
-
- `talaria-console` — console level + args (truncated)
|
|
177
|
+
- `talaria-console` — console level + message/args (truncated)
|
|
176
178
|
- `talaria-network` — method, redacted URL, status, duration (no bodies / no auth headers)
|
|
177
179
|
|
|
178
180
|
Privacy defaults: `maskAllInputs: true`, password fields masked, `[data-talaria-mask]` blocked.
|
|
@@ -183,17 +185,25 @@ By default `inlineStylesheet` is `false`: linked stylesheets stay as `href`s and
|
|
|
183
185
|
|
|
184
186
|
Set `inlineStylesheet: true` so same-origin stylesheet rules are embedded while the user is logged in. Cross-origin sheets without CORS still cannot be inlined (browser `cssRules` restriction).
|
|
185
187
|
|
|
186
|
-
### Failed HTTP requests → events
|
|
188
|
+
### Failed HTTP / network requests → events
|
|
189
|
+
|
|
190
|
+
By default, completed `fetch` / XHR responses with status **500–599** are sent as Talaria events (message like `HTTP 500: GET /api/...`).
|
|
191
|
+
|
|
192
|
+
Transport failures (CORS, offline, DNS — browser `TypeError: Failed to fetch`) are also promoted by default as:
|
|
193
|
+
|
|
194
|
+
`Network error: GET https://… — TypeError: Failed to fetch`
|
|
187
195
|
|
|
188
|
-
|
|
196
|
+
Replay `talaria-network` breadcrumbs include method, redacted URL, status (when present), duration, and on failures `errorName` / `errorMessage` / `aborted`. Request/response bodies and auth headers are never captured.
|
|
189
197
|
|
|
190
198
|
```ts
|
|
191
199
|
Talaria.init({
|
|
192
200
|
dsn: 'https://api.example.com',
|
|
193
201
|
apiKey: 'tal_live_…',
|
|
194
202
|
environment: 'production',
|
|
195
|
-
// Default true
|
|
203
|
+
// Default true — HTTP status promotion
|
|
196
204
|
captureFailedRequests: true,
|
|
205
|
+
// Default true — CORS/offline/DNS fetch failures
|
|
206
|
+
captureNetworkErrors: true,
|
|
197
207
|
// Default [[500, 599]]. CMS admin often wants 4xx too:
|
|
198
208
|
failedRequestStatusCodes: [[400, 599]],
|
|
199
209
|
// Extra URL substrings to skip (Talaria /events and /replays are always skipped)
|
|
@@ -201,7 +211,7 @@ Talaria.init({
|
|
|
201
211
|
});
|
|
202
212
|
```
|
|
203
213
|
|
|
204
|
-
|
|
214
|
+
`AbortError` is never promoted and is ignored by the global `unhandledrejection` handler. If a fetch failure is left unhandled after network-error promotion, the duplicate bare `TypeError` event is suppressed; if promotion is off, the exception is kept and correlated with the recent request URL/method/duration.
|
|
205
215
|
|
|
206
216
|
## Public API
|
|
207
217
|
|
package/dist/client.d.ts
CHANGED
|
@@ -36,6 +36,15 @@ export declare class TalariaClient {
|
|
|
36
36
|
private lastReplayCaptureFailure;
|
|
37
37
|
/** Cached once per init for event tags/extra. */
|
|
38
38
|
private browserContext;
|
|
39
|
+
/** Prevent ingest/replay failures from being re-captured via unhandledrejection. */
|
|
40
|
+
private capturing;
|
|
41
|
+
/**
|
|
42
|
+
* Set after a permanent events/ingest 4xx (bad env/auth/wire). Further
|
|
43
|
+
* captures no-op so we don't spin on retries or burn error-clip replay quota.
|
|
44
|
+
*/
|
|
45
|
+
private ingestDisabled;
|
|
46
|
+
/** Recent fetch/XHR transport failures for correlation + dedupe. */
|
|
47
|
+
private recentNetworkFailures;
|
|
39
48
|
init(options: TalariaInitOptions): void;
|
|
40
49
|
getReplayId(): string | null;
|
|
41
50
|
captureException(error: unknown, context?: CaptureContext): Promise<void>;
|
|
@@ -52,6 +61,11 @@ export declare class TalariaClient {
|
|
|
52
61
|
close(): Promise<void>;
|
|
53
62
|
private onRrwebEvent;
|
|
54
63
|
private capture;
|
|
64
|
+
/**
|
|
65
|
+
* Stop further event capture (and error-clip uploads) after a permanent
|
|
66
|
+
* events/ingest 4xx so misconfig cannot spin forever.
|
|
67
|
+
*/
|
|
68
|
+
private disableIngestAfterPermanentError;
|
|
55
69
|
private markUploadStarted;
|
|
56
70
|
private isPastMaxDuration;
|
|
57
71
|
private isPastErrorClipDeadline;
|
|
@@ -90,6 +104,13 @@ export declare class TalariaClient {
|
|
|
90
104
|
*/
|
|
91
105
|
private abortUnusableClip;
|
|
92
106
|
private stopUploadingAfterLimit;
|
|
107
|
+
private pruneRecentNetworkFailures;
|
|
108
|
+
private rememberNetworkFailure;
|
|
109
|
+
/**
|
|
110
|
+
* Find a recent transport failure for a bare fetch TypeError.
|
|
111
|
+
* Consumes the entry so a later duplicate path cannot reuse it.
|
|
112
|
+
*/
|
|
113
|
+
private consumeCorrelatedNetworkFailure;
|
|
93
114
|
private installGlobalHandlers;
|
|
94
115
|
private enqueueUpload;
|
|
95
116
|
private ensureStarted;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,aAAa,EACb,kBAAkB,EACnB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,aAAa,EACb,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAiEpB,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAkIrC,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,MAAM,CAAuB;IACrC,yEAAyE;IACzE,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAS;IAChC,OA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