@newtalaria/browser 0.1.8 → 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 +11 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/index.js +79 -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 +79 -9
- package/dist/talaria.browser.iife.js.map +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type RrwebEvent } from './segment_buffer.js';
|
|
2
|
+
/** Size diagnostics when segment 0 cannot ship a paint base. */
|
|
3
|
+
export type PaintBaseSizeDetails = {
|
|
4
|
+
segmentEventTypes: number[];
|
|
5
|
+
/** Estimated JSON bytes of the Meta event, if present. */
|
|
6
|
+
metaEstimatedBytes?: number;
|
|
7
|
+
/** Estimated JSON bytes of the FullSnapshot, if present. */
|
|
8
|
+
fullSnapshotEstimatedBytes?: number;
|
|
9
|
+
/** Actual gzip size of FullSnapshot alone, when measured. */
|
|
10
|
+
fullSnapshotCompressedBytes?: number;
|
|
11
|
+
maxUncompressedSegmentBytes: number;
|
|
12
|
+
targetCompressedSegmentBytes: number;
|
|
13
|
+
maxCompressedSegmentBytes: number;
|
|
14
|
+
} & Record<string, unknown>;
|
|
15
|
+
export declare function paintBaseSizeDetails(events: RrwebEvent[], opts?: {
|
|
16
|
+
fullSnapshotCompressedBytes?: number;
|
|
17
|
+
}): PaintBaseSizeDetails;
|
|
18
|
+
//# sourceMappingURL=paint_base_size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paint_base_size.d.ts","sourceRoot":"","sources":["../../src/replay/paint_base_size.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAE7B,gEAAgE;AAChE,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,4DAA4D;IAC5D,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,6DAA6D;IAC7D,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,2BAA2B,EAAE,MAAM,CAAC;IACpC,4BAA4B,EAAE,MAAM,CAAC;IACrC,yBAAyB,EAAE,MAAM,CAAC;CACnC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5B,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,UAAU,EAAE,EACpB,IAAI,CAAC,EAAE;IAAE,2BAA2B,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,oBAAoB,CAsBtB"}
|
|
@@ -53,6 +53,8 @@ export declare class SegmentBuffer {
|
|
|
53
53
|
get estimatedBytes(): number;
|
|
54
54
|
push(event: RrwebEvent): void;
|
|
55
55
|
hasFullSnapshot(): boolean;
|
|
56
|
+
/** First FullSnapshot still queued (does not remove it). */
|
|
57
|
+
peekFullSnapshot(): RrwebEvent | undefined;
|
|
56
58
|
/**
|
|
57
59
|
* Drop leading events until Meta+FullSnapshot (or FullSnapshot alone).
|
|
58
60
|
* Returns false if no FullSnapshot is present (replay would paint blank).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segment_buffer.d.ts","sourceRoot":"","sources":["../../src/replay/segment_buffer.ts"],"names":[],"mappings":"AAEA,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,SAAU,CAAC;AAC1C;;;GAGG;AACH,eAAO,MAAM,4BAA4B,QAAc,CAAC;A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I,MAAM,CAE3B;IAED,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAK7B,eAAe,IAAI,OAAO;IAI1B,4DAA4D;IAC5D,gBAAgB,IAAI,UAAU,GAAG,SAAS;IAI1C;;;OAGG;IACH,kBAAkB,IAAI,OAAO;IAc7B;;;OAGG;IACH,QAAQ,CAAC,GAAG,SAAa,EAAE,QAAQ,SAAwB,GAAG,IAAI;IAiBlE,iBAAiB,IAAI,OAAO;IAI5B;;;;OAIG;IACH,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE;IAyBpD,OAAO,IAAI,UAAU,EAAE;IAOvB,6EAA6E;IAC7E,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI;IAMnC,KAAK,IAAI,IAAI;IAKb,SAAS,IAAI;QAAE,SAAS,EAAE,IAAI,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE,GAAG,IAAI;IAUtD,OAAO,CAAC,cAAc;CAGvB"}
|
|
@@ -163,6 +163,10 @@
|
|
|
163
163
|
hasFullSnapshot() {
|
|
164
164
|
return this.events.some((e) => e.type === RRWEB_FULL_SNAPSHOT);
|
|
165
165
|
}
|
|
166
|
+
/** First FullSnapshot still queued (does not remove it). */
|
|
167
|
+
peekFullSnapshot() {
|
|
168
|
+
return this.events.find((e) => e.type === RRWEB_FULL_SNAPSHOT);
|
|
169
|
+
}
|
|
166
170
|
/**
|
|
167
171
|
* Drop leading events until Meta+FullSnapshot (or FullSnapshot alone).
|
|
168
172
|
* Returns false if no FullSnapshot is present (replay would paint blank).
|
|
@@ -392,6 +396,28 @@
|
|
|
392
396
|
};
|
|
393
397
|
}
|
|
394
398
|
|
|
399
|
+
// src/replay/paint_base_size.ts
|
|
400
|
+
function paintBaseSizeDetails(events, opts) {
|
|
401
|
+
const meta = events.find((e) => e.type === RRWEB_META);
|
|
402
|
+
const full = events.find((e) => e.type === RRWEB_FULL_SNAPSHOT);
|
|
403
|
+
const details = {
|
|
404
|
+
segmentEventTypes: events.map((e) => e.type),
|
|
405
|
+
maxUncompressedSegmentBytes: SEGMENT_SIZE_BYTES,
|
|
406
|
+
targetCompressedSegmentBytes: TARGET_COMPRESSED_SEGMENT_BYTES,
|
|
407
|
+
maxCompressedSegmentBytes: MAX_COMPRESSED_SEGMENT_BYTES
|
|
408
|
+
};
|
|
409
|
+
if (meta) {
|
|
410
|
+
details.metaEstimatedBytes = estimateJsonBytes(meta);
|
|
411
|
+
}
|
|
412
|
+
if (full) {
|
|
413
|
+
details.fullSnapshotEstimatedBytes = estimateJsonBytes(full);
|
|
414
|
+
}
|
|
415
|
+
if (opts?.fullSnapshotCompressedBytes !== void 0) {
|
|
416
|
+
details.fullSnapshotCompressedBytes = opts.fullSnapshotCompressedBytes;
|
|
417
|
+
}
|
|
418
|
+
return details;
|
|
419
|
+
}
|
|
420
|
+
|
|
395
421
|
// ../../node_modules/rrweb/dist/rrweb.js
|
|
396
422
|
var __defProp = Object.defineProperty;
|
|
397
423
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -13977,7 +14003,11 @@
|
|
|
13977
14003
|
if (!this.options || !this.transport || !this.replayId) return;
|
|
13978
14004
|
if (!this.startedOnServer || this.finishedOnServer) return;
|
|
13979
14005
|
if (!this.prepareBufferForNewReplay()) {
|
|
13980
|
-
|
|
14006
|
+
const leftover = this.buffer.peekFullSnapshot();
|
|
14007
|
+
await this.abortUnusableClip(
|
|
14008
|
+
"no_full_snapshot",
|
|
14009
|
+
paintBaseSizeDetails(leftover ? [leftover] : [])
|
|
14010
|
+
);
|
|
13981
14011
|
return;
|
|
13982
14012
|
}
|
|
13983
14013
|
while (this.buffer.length > 0) {
|
|
@@ -14025,9 +14055,21 @@
|
|
|
14025
14055
|
}
|
|
14026
14056
|
const { events, gzip } = fitted;
|
|
14027
14057
|
if (this.segmentIndex === 0 && !events.some((e) => e.type === RRWEB_FULL_SNAPSHOT)) {
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14058
|
+
const leftoverFs = this.buffer.peekFullSnapshot();
|
|
14059
|
+
let compressedBytes;
|
|
14060
|
+
if (leftoverFs) {
|
|
14061
|
+
try {
|
|
14062
|
+
compressedBytes = (await compressReplayEvents([leftoverFs])).length;
|
|
14063
|
+
} catch {
|
|
14064
|
+
}
|
|
14065
|
+
}
|
|
14066
|
+
await this.abortUnusableClip(
|
|
14067
|
+
"no_full_snapshot",
|
|
14068
|
+
paintBaseSizeDetails(
|
|
14069
|
+
leftoverFs ? [...events, leftoverFs] : events,
|
|
14070
|
+
{ fullSnapshotCompressedBytes: compressedBytes }
|
|
14071
|
+
)
|
|
14072
|
+
);
|
|
14031
14073
|
return;
|
|
14032
14074
|
}
|
|
14033
14075
|
if (this.isErrorClipMode() && this.uploadedCompressedBytes + gzip.length > MAX_ERROR_CLIP_COMPRESSED_BYTES && this.segmentIndex > 0) {
|
|
@@ -14079,9 +14121,14 @@
|
|
|
14079
14121
|
{ type: droppedType }
|
|
14080
14122
|
);
|
|
14081
14123
|
if (this.segmentIndex === 0 && droppedType === RRWEB_FULL_SNAPSHOT) {
|
|
14082
|
-
await this.abortUnusableClip(
|
|
14083
|
-
|
|
14084
|
-
|
|
14124
|
+
await this.abortUnusableClip(
|
|
14125
|
+
"oversized_full_snapshot",
|
|
14126
|
+
{
|
|
14127
|
+
source: "server_reject",
|
|
14128
|
+
...paintBaseSizeDetails(events),
|
|
14129
|
+
rejectedCompressedBytes: gzip.length
|
|
14130
|
+
}
|
|
14131
|
+
);
|
|
14085
14132
|
return;
|
|
14086
14133
|
}
|
|
14087
14134
|
continue;
|
|
@@ -14130,11 +14177,21 @@
|
|
|
14130
14177
|
{ type: dropped?.type }
|
|
14131
14178
|
);
|
|
14132
14179
|
if (this.segmentIndex === 0 && dropped?.type === RRWEB_FULL_SNAPSHOT) {
|
|
14180
|
+
let compressedBytes;
|
|
14181
|
+
try {
|
|
14182
|
+
compressedBytes = (await compressReplayEvents([dropped])).length;
|
|
14183
|
+
} catch {
|
|
14184
|
+
}
|
|
14133
14185
|
return {
|
|
14134
14186
|
events: [],
|
|
14135
14187
|
gzip: new Uint8Array(),
|
|
14136
14188
|
abortReason: "oversized_full_snapshot",
|
|
14137
|
-
abortDetails: {
|
|
14189
|
+
abortDetails: {
|
|
14190
|
+
source: "fit_compressed_prefix",
|
|
14191
|
+
...paintBaseSizeDetails(chunk, {
|
|
14192
|
+
fullSnapshotCompressedBytes: compressedBytes
|
|
14193
|
+
})
|
|
14194
|
+
}
|
|
14138
14195
|
};
|
|
14139
14196
|
}
|
|
14140
14197
|
if (chunk.length > 1) {
|
|
@@ -14143,11 +14200,24 @@
|
|
|
14143
14200
|
return this.takeFittedSegment();
|
|
14144
14201
|
}
|
|
14145
14202
|
if (this.segmentIndex === 0 && chunk.some((e) => e.type === RRWEB_FULL_SNAPSHOT) && !fitted.events.some((e) => e.type === RRWEB_FULL_SNAPSHOT)) {
|
|
14203
|
+
const full = chunk.find((e) => e.type === RRWEB_FULL_SNAPSHOT);
|
|
14204
|
+
let compressedBytes;
|
|
14205
|
+
if (full) {
|
|
14206
|
+
try {
|
|
14207
|
+
compressedBytes = (await compressReplayEvents([full])).length;
|
|
14208
|
+
} catch {
|
|
14209
|
+
}
|
|
14210
|
+
}
|
|
14146
14211
|
return {
|
|
14147
14212
|
events: [],
|
|
14148
14213
|
gzip: new Uint8Array(),
|
|
14149
14214
|
abortReason: "oversized_full_snapshot",
|
|
14150
|
-
abortDetails: {
|
|
14215
|
+
abortDetails: {
|
|
14216
|
+
source: "fit_dropped_full_snapshot",
|
|
14217
|
+
...paintBaseSizeDetails(chunk, {
|
|
14218
|
+
fullSnapshotCompressedBytes: compressedBytes
|
|
14219
|
+
})
|
|
14220
|
+
}
|
|
14151
14221
|
};
|
|
14152
14222
|
}
|
|
14153
14223
|
if (fitted.remainder.length > 0) {
|