@newtalaria/browser 0.1.7 → 0.1.9
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 +12 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/index.js +88 -9
- package/dist/index.js.map +3 -3
- package/dist/replay/paint_base_size.d.ts +18 -0
- package/dist/replay/paint_base_size.d.ts.map +1 -0
- package/dist/replay/segment_buffer.d.ts +2 -0
- package/dist/replay/segment_buffer.d.ts.map +1 -1
- package/dist/talaria.browser.iife.js +88 -9
- package/dist/talaria.browser.iife.js.map +3 -3
- package/dist/utils/opaque_script_error.d.ts +12 -0
- package/dist/utils/opaque_script_error.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ await Talaria.flush();
|
|
|
53
53
|
await Talaria.close();
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
`Talaria.init` also installs `window.onerror` / `unhandledrejection` handlers unless you pass `disableDefaultIntegrations: true`.
|
|
56
|
+
`Talaria.init` also installs `window.onerror` / `unhandledrejection` handlers unless you pass `disableDefaultIntegrations: true`. Opaque cross-origin `"Script error."` events (no usable `Error` object) are ignored by default.
|
|
57
57
|
|
|
58
58
|
Optional init `tags` are merged into every captured event (per-call tags win on key conflict).
|
|
59
59
|
|
|
@@ -114,6 +114,17 @@ When an **error/fatal** event attempts an on-error clip (`replaysSessionSampleRa
|
|
|
114
114
|
|
|
115
115
|
Failed captures do **not** set `replayId` (avoids linking a blank player). Details are also under `extra.replayCapture`.
|
|
116
116
|
|
|
117
|
+
When the paint base cannot ship, `extra.replayCapture` also includes size diagnostics where available:
|
|
118
|
+
|
|
119
|
+
| Field | Meaning |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| `fullSnapshotEstimatedBytes` | JSON size estimate of the FullSnapshot |
|
|
122
|
+
| `fullSnapshotCompressedBytes` | Gzip size of the FullSnapshot alone (when measured) |
|
|
123
|
+
| `metaEstimatedBytes` | JSON size estimate of the Meta event |
|
|
124
|
+
| `maxUncompressedSegmentBytes` / `maxCompressedSegmentBytes` | Current pack caps |
|
|
125
|
+
|
|
126
|
+
Use these to see how far over budget a CMS/admin snapshot was when a clip was aborted.
|
|
127
|
+
|
|
117
128
|
## Serverpod URL pattern
|
|
118
129
|
|
|
119
130
|
Talaria uses **Serverpod RPC**, not REST resource URLs:
|
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;AA8CpB,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,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;AA4ErC,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,OAA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vB,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,qBAAqB;YAOf,qBAAqB;IAsBnC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,mBAAmB;IAO3B,8EAA8E;YAChE,YAAY;YAgBZ,eAAe;IAW7B,oFAAoF;IACpF,OAAO,CAAC,iBAAiB;IAiBzB,+EAA+E;IAC/E,OAAO,CAAC,oBAAoB;IAI5B;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAcjC;;;OAGG;YACW,iBAAiB;IAkC/B,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,qBAAqB;IAgC7B,OAAO,CAAC,aAAa;YAKP,aAAa;YAkBb,qBAAqB;IA0LnC,OAAO,CAAC,kBAAkB;IAQ1B;;;;OAIG;YACW,iBAAiB;YAoFjB,cAAc;CAuB7B"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,14 @@ function createId() {
|
|
|
15
15
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// src/utils/opaque_script_error.ts
|
|
19
|
+
function isOpaqueCrossOriginScriptError(event) {
|
|
20
|
+
const msg = (event.message ?? "").trim();
|
|
21
|
+
if (!/^script error\.?$/i.test(msg)) return false;
|
|
22
|
+
if (event.error instanceof Error) return false;
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
// src/transport/serverpod.ts
|
|
19
27
|
var ServerpodTransport = class {
|
|
20
28
|
constructor(options) {
|
|
@@ -153,6 +161,10 @@ var SegmentBuffer = class {
|
|
|
153
161
|
hasFullSnapshot() {
|
|
154
162
|
return this.events.some((e) => e.type === RRWEB_FULL_SNAPSHOT);
|
|
155
163
|
}
|
|
164
|
+
/** First FullSnapshot still queued (does not remove it). */
|
|
165
|
+
peekFullSnapshot() {
|
|
166
|
+
return this.events.find((e) => e.type === RRWEB_FULL_SNAPSHOT);
|
|
167
|
+
}
|
|
156
168
|
/**
|
|
157
169
|
* Drop leading events until Meta+FullSnapshot (or FullSnapshot alone).
|
|
158
170
|
* Returns false if no FullSnapshot is present (replay would paint blank).
|
|
@@ -382,6 +394,28 @@ function mergeReplayCaptureExtra(extra, outcome) {
|
|
|
382
394
|
};
|
|
383
395
|
}
|
|
384
396
|
|
|
397
|
+
// src/replay/paint_base_size.ts
|
|
398
|
+
function paintBaseSizeDetails(events, opts) {
|
|
399
|
+
const meta = events.find((e) => e.type === RRWEB_META);
|
|
400
|
+
const full = events.find((e) => e.type === RRWEB_FULL_SNAPSHOT);
|
|
401
|
+
const details = {
|
|
402
|
+
segmentEventTypes: events.map((e) => e.type),
|
|
403
|
+
maxUncompressedSegmentBytes: SEGMENT_SIZE_BYTES,
|
|
404
|
+
targetCompressedSegmentBytes: TARGET_COMPRESSED_SEGMENT_BYTES,
|
|
405
|
+
maxCompressedSegmentBytes: MAX_COMPRESSED_SEGMENT_BYTES
|
|
406
|
+
};
|
|
407
|
+
if (meta) {
|
|
408
|
+
details.metaEstimatedBytes = estimateJsonBytes(meta);
|
|
409
|
+
}
|
|
410
|
+
if (full) {
|
|
411
|
+
details.fullSnapshotEstimatedBytes = estimateJsonBytes(full);
|
|
412
|
+
}
|
|
413
|
+
if (opts?.fullSnapshotCompressedBytes !== void 0) {
|
|
414
|
+
details.fullSnapshotCompressedBytes = opts.fullSnapshotCompressedBytes;
|
|
415
|
+
}
|
|
416
|
+
return details;
|
|
417
|
+
}
|
|
418
|
+
|
|
385
419
|
// ../../node_modules/rrweb/dist/rrweb.js
|
|
386
420
|
var __defProp = Object.defineProperty;
|
|
387
421
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -13923,6 +13957,7 @@ var TalariaClient = class {
|
|
|
13923
13957
|
installGlobalHandlers() {
|
|
13924
13958
|
if (typeof window === "undefined") return;
|
|
13925
13959
|
const onError = (event) => {
|
|
13960
|
+
if (isOpaqueCrossOriginScriptError(event)) return;
|
|
13926
13961
|
const error = event.error instanceof Error ? event.error : new Error(event.message || "window.onerror");
|
|
13927
13962
|
void this.captureException(error, {
|
|
13928
13963
|
extra: {
|
|
@@ -13966,7 +14001,11 @@ var TalariaClient = class {
|
|
|
13966
14001
|
if (!this.options || !this.transport || !this.replayId) return;
|
|
13967
14002
|
if (!this.startedOnServer || this.finishedOnServer) return;
|
|
13968
14003
|
if (!this.prepareBufferForNewReplay()) {
|
|
13969
|
-
|
|
14004
|
+
const leftover = this.buffer.peekFullSnapshot();
|
|
14005
|
+
await this.abortUnusableClip(
|
|
14006
|
+
"no_full_snapshot",
|
|
14007
|
+
paintBaseSizeDetails(leftover ? [leftover] : [])
|
|
14008
|
+
);
|
|
13970
14009
|
return;
|
|
13971
14010
|
}
|
|
13972
14011
|
while (this.buffer.length > 0) {
|
|
@@ -14014,9 +14053,21 @@ var TalariaClient = class {
|
|
|
14014
14053
|
}
|
|
14015
14054
|
const { events, gzip } = fitted;
|
|
14016
14055
|
if (this.segmentIndex === 0 && !events.some((e) => e.type === RRWEB_FULL_SNAPSHOT)) {
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14056
|
+
const leftoverFs = this.buffer.peekFullSnapshot();
|
|
14057
|
+
let compressedBytes;
|
|
14058
|
+
if (leftoverFs) {
|
|
14059
|
+
try {
|
|
14060
|
+
compressedBytes = (await compressReplayEvents([leftoverFs])).length;
|
|
14061
|
+
} catch {
|
|
14062
|
+
}
|
|
14063
|
+
}
|
|
14064
|
+
await this.abortUnusableClip(
|
|
14065
|
+
"no_full_snapshot",
|
|
14066
|
+
paintBaseSizeDetails(
|
|
14067
|
+
leftoverFs ? [...events, leftoverFs] : events,
|
|
14068
|
+
{ fullSnapshotCompressedBytes: compressedBytes }
|
|
14069
|
+
)
|
|
14070
|
+
);
|
|
14020
14071
|
return;
|
|
14021
14072
|
}
|
|
14022
14073
|
if (this.isErrorClipMode() && this.uploadedCompressedBytes + gzip.length > MAX_ERROR_CLIP_COMPRESSED_BYTES && this.segmentIndex > 0) {
|
|
@@ -14068,9 +14119,14 @@ var TalariaClient = class {
|
|
|
14068
14119
|
{ type: droppedType }
|
|
14069
14120
|
);
|
|
14070
14121
|
if (this.segmentIndex === 0 && droppedType === RRWEB_FULL_SNAPSHOT) {
|
|
14071
|
-
await this.abortUnusableClip(
|
|
14072
|
-
|
|
14073
|
-
|
|
14122
|
+
await this.abortUnusableClip(
|
|
14123
|
+
"oversized_full_snapshot",
|
|
14124
|
+
{
|
|
14125
|
+
source: "server_reject",
|
|
14126
|
+
...paintBaseSizeDetails(events),
|
|
14127
|
+
rejectedCompressedBytes: gzip.length
|
|
14128
|
+
}
|
|
14129
|
+
);
|
|
14074
14130
|
return;
|
|
14075
14131
|
}
|
|
14076
14132
|
continue;
|
|
@@ -14119,11 +14175,21 @@ var TalariaClient = class {
|
|
|
14119
14175
|
{ type: dropped?.type }
|
|
14120
14176
|
);
|
|
14121
14177
|
if (this.segmentIndex === 0 && dropped?.type === RRWEB_FULL_SNAPSHOT) {
|
|
14178
|
+
let compressedBytes;
|
|
14179
|
+
try {
|
|
14180
|
+
compressedBytes = (await compressReplayEvents([dropped])).length;
|
|
14181
|
+
} catch {
|
|
14182
|
+
}
|
|
14122
14183
|
return {
|
|
14123
14184
|
events: [],
|
|
14124
14185
|
gzip: new Uint8Array(),
|
|
14125
14186
|
abortReason: "oversized_full_snapshot",
|
|
14126
|
-
abortDetails: {
|
|
14187
|
+
abortDetails: {
|
|
14188
|
+
source: "fit_compressed_prefix",
|
|
14189
|
+
...paintBaseSizeDetails(chunk, {
|
|
14190
|
+
fullSnapshotCompressedBytes: compressedBytes
|
|
14191
|
+
})
|
|
14192
|
+
}
|
|
14127
14193
|
};
|
|
14128
14194
|
}
|
|
14129
14195
|
if (chunk.length > 1) {
|
|
@@ -14132,11 +14198,24 @@ var TalariaClient = class {
|
|
|
14132
14198
|
return this.takeFittedSegment();
|
|
14133
14199
|
}
|
|
14134
14200
|
if (this.segmentIndex === 0 && chunk.some((e) => e.type === RRWEB_FULL_SNAPSHOT) && !fitted.events.some((e) => e.type === RRWEB_FULL_SNAPSHOT)) {
|
|
14201
|
+
const full = chunk.find((e) => e.type === RRWEB_FULL_SNAPSHOT);
|
|
14202
|
+
let compressedBytes;
|
|
14203
|
+
if (full) {
|
|
14204
|
+
try {
|
|
14205
|
+
compressedBytes = (await compressReplayEvents([full])).length;
|
|
14206
|
+
} catch {
|
|
14207
|
+
}
|
|
14208
|
+
}
|
|
14135
14209
|
return {
|
|
14136
14210
|
events: [],
|
|
14137
14211
|
gzip: new Uint8Array(),
|
|
14138
14212
|
abortReason: "oversized_full_snapshot",
|
|
14139
|
-
abortDetails: {
|
|
14213
|
+
abortDetails: {
|
|
14214
|
+
source: "fit_dropped_full_snapshot",
|
|
14215
|
+
...paintBaseSizeDetails(chunk, {
|
|
14216
|
+
fullSnapshotCompressedBytes: compressedBytes
|
|
14217
|
+
})
|
|
14218
|
+
}
|
|
14140
14219
|
};
|
|
14141
14220
|
}
|
|
14142
14221
|
if (fitted.remainder.length > 0) {
|