@newtalaria/browser 0.1.1 → 0.1.4
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 +58 -11
- package/dist/client.d.ts +42 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +527 -79
- package/dist/index.js.map +3 -3
- package/dist/replay/fit_segment.d.ts +35 -0
- package/dist/replay/fit_segment.d.ts.map +1 -0
- package/dist/replay/privacy.d.ts.map +1 -1
- package/dist/replay/recorder.d.ts +2 -0
- package/dist/replay/recorder.d.ts.map +1 -1
- package/dist/replay/segment_buffer.d.ts +56 -6
- package/dist/replay/segment_buffer.d.ts.map +1 -1
- package/dist/transport/replays.d.ts +3 -0
- package/dist/transport/replays.d.ts.map +1 -1
- package/dist/transport/serverpod.d.ts.map +1 -1
- package/dist/types.d.ts +9 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type RrwebEvent } from './segment_buffer.js';
|
|
2
|
+
export type CompressEvents = (events: RrwebEvent[]) => Promise<Uint8Array>;
|
|
3
|
+
/**
|
|
4
|
+
* Absolute error-clip wall: upload start + afterMs + flush slack.
|
|
5
|
+
* Callers must set this once; later errors must not recompute a later wall.
|
|
6
|
+
*/
|
|
7
|
+
export declare function computeErrorClipDeadlineMs(uploadStartedAtMs: number, afterMs: number, slackMs?: number): number;
|
|
8
|
+
/** True when error-clip segment or compressed-byte budget is exhausted. */
|
|
9
|
+
export declare function isErrorClipBudgetExhausted(opts: {
|
|
10
|
+
segmentIndex: number;
|
|
11
|
+
uploadedCompressedBytes: number;
|
|
12
|
+
maxSegments?: number;
|
|
13
|
+
maxBytes?: number;
|
|
14
|
+
}): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* How to handle a segment rejected as oversized.
|
|
17
|
+
* Never re-queue an identical single-event payload (that loops forever).
|
|
18
|
+
*/
|
|
19
|
+
export declare function planOversizedRetry(events: RrwebEvent[]): {
|
|
20
|
+
action: 'drop';
|
|
21
|
+
} | {
|
|
22
|
+
action: 'bisect';
|
|
23
|
+
left: RrwebEvent[];
|
|
24
|
+
right: RrwebEvent[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Binary-search the largest prefix that gzips under the pack target.
|
|
28
|
+
* Remainder is returned for re-queue; null means every event was dropped.
|
|
29
|
+
*/
|
|
30
|
+
export declare function fitCompressedPrefix(events: RrwebEvent[], compress: CompressEvents, targetBytes?: number, hardCap?: number): Promise<{
|
|
31
|
+
events: RrwebEvent[];
|
|
32
|
+
gzip: Uint8Array;
|
|
33
|
+
remainder: RrwebEvent[];
|
|
34
|
+
} | null>;
|
|
35
|
+
//# sourceMappingURL=fit_segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit_segment.d.ts","sourceRoot":"","sources":["../../src/replay/fit_segment.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA4B,GAClC,MAAM,CAER;AAED,2EAA2E;AAC3E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAOV;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAAE,GACnB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,UAAU,EAAE,CAAC;IAAC,KAAK,EAAE,UAAU,EAAE,CAAA;CAAE,CAUpF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,UAAU,EAAE,EACpB,QAAQ,EAAE,cAAc,EACxB,WAAW,SAAkC,EAC7C,OAAO,SAA+B,GACrC,OAAO,CAAC;IACT,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,UAAU,EAAE,CAAC;CACzB,GAAG,IAAI,CAAC,CAkCR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../src/replay/privacy.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY7C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../src/replay/privacy.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY7C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAU3D"}
|
|
@@ -6,6 +6,8 @@ export interface RecorderOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export interface RecorderHandle {
|
|
8
8
|
stop: () => void;
|
|
9
|
+
/** Force Meta + FullSnapshot so the next replay has a paint base. */
|
|
10
|
+
takeFullSnapshot: () => void;
|
|
9
11
|
}
|
|
10
12
|
export declare function startRecorder(options: RecorderOptions): RecorderHandle;
|
|
11
13
|
//# sourceMappingURL=recorder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../src/replay/recorder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../src/replay/recorder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,qEAAqE;IACrE,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CA0CtE"}
|
|
@@ -4,26 +4,76 @@ export interface RrwebEvent {
|
|
|
4
4
|
data: unknown;
|
|
5
5
|
timestamp: number;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Soft uncompressed take size before gzip fitting.
|
|
9
|
+
* Keep in sync with ReplayLimits.maxUncompressedSegmentBytes intent.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SEGMENT_SIZE_BYTES = 400000;
|
|
12
|
+
/**
|
|
13
|
+
* Server hard cap — keep in sync with ReplayLimits.maxCompressedSegmentBytes.
|
|
14
|
+
* Restart Serverpod after changing this constant pair.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MAX_COMPRESSED_SEGMENT_BYTES: number;
|
|
17
|
+
/** Pack under hard cap minus margin (never disagree with a live 512KiB server). */
|
|
18
|
+
export declare const TARGET_COMPRESSED_SEGMENT_BYTES: number;
|
|
19
|
+
/**
|
|
20
|
+
* Absolute max segments per replay (session / long error mode).
|
|
21
|
+
* Keep in sync with ReplayLimits.maxSegmentsPerReplay.
|
|
22
|
+
*/
|
|
23
|
+
export declare const MAX_SEGMENTS_PER_REPLAY = 200;
|
|
24
|
+
/**
|
|
25
|
+
* Error-clip mode: hard segment budget so one heavy page cannot spam ingest.
|
|
26
|
+
*/
|
|
27
|
+
export declare const MAX_SEGMENTS_ERROR_CLIP = 12;
|
|
28
|
+
/** Error-clip mode: hard compressed-byte budget for the whole clip. */
|
|
29
|
+
export declare const MAX_ERROR_CLIP_COMPRESSED_BYTES: number;
|
|
30
|
+
/** Slack added to the error-clip wall for in-flight flush. */
|
|
31
|
+
export declare const ERROR_CLIP_FLUSH_SLACK_MS = 5000;
|
|
9
32
|
/** Periodic flush interval. */
|
|
10
33
|
export declare const SEGMENT_FLUSH_MS = 5000;
|
|
11
34
|
/** Keep ~60s of events while buffering (error-only sample path). */
|
|
12
35
|
export declare const RING_BUFFER_MS = 60000;
|
|
13
|
-
/**
|
|
36
|
+
/** Cap ring buffer size so one error flush stays bounded. */
|
|
37
|
+
export declare const RING_BUFFER_MAX_BYTES = 1500000;
|
|
38
|
+
/** Default post-error upload window (cheap error clip). */
|
|
14
39
|
export declare const ERROR_REPLAY_AFTER_MS = 15000;
|
|
40
|
+
/**
|
|
41
|
+
* Hard cap for continuous upload (session sample or error-continue mode).
|
|
42
|
+
* Keep in sync with ReplayLimits.defaultMaxDurationMs on the server.
|
|
43
|
+
*/
|
|
44
|
+
export declare const MAX_REPLAY_DURATION_MS: number;
|
|
45
|
+
/** rrweb EventType.FullSnapshot */
|
|
46
|
+
export declare const RRWEB_FULL_SNAPSHOT = 2;
|
|
47
|
+
/** rrweb EventType.Meta */
|
|
48
|
+
export declare const RRWEB_META = 4;
|
|
15
49
|
export declare class SegmentBuffer {
|
|
16
50
|
private events;
|
|
17
51
|
private pendingBytes;
|
|
18
52
|
get length(): number;
|
|
19
53
|
get estimatedBytes(): number;
|
|
20
54
|
push(event: RrwebEvent): void;
|
|
21
|
-
|
|
22
|
-
|
|
55
|
+
hasFullSnapshot(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Drop leading events until Meta+FullSnapshot (or FullSnapshot alone).
|
|
58
|
+
* Returns false if no FullSnapshot is present (replay would paint blank).
|
|
59
|
+
*/
|
|
60
|
+
trimToFullSnapshot(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Drop events older than the ring window and/or over the byte cap
|
|
63
|
+
* (buffer-only mode). Prefer keeping the newest events.
|
|
64
|
+
*/
|
|
65
|
+
trimRing(now?: number, maxBytes?: number): void;
|
|
23
66
|
shouldFlushBySize(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Take a prefix of events whose estimated JSON size is ~maxBytes.
|
|
69
|
+
* Always returns at least one event when the buffer is non-empty (caller
|
|
70
|
+
* must handle a single oversized event).
|
|
71
|
+
*/
|
|
72
|
+
takeByEstimatedBytes(maxBytes: number): RrwebEvent[];
|
|
24
73
|
takeAll(): RrwebEvent[];
|
|
25
|
-
/** Re-queue events at the front (failed upload retry). */
|
|
74
|
+
/** Re-queue events at the front (failed upload retry / bisect remainder). */
|
|
26
75
|
prepend(events: RrwebEvent[]): void;
|
|
76
|
+
clear(): void;
|
|
27
77
|
peekTimes(): {
|
|
28
78
|
startedAt: Date;
|
|
29
79
|
endedAt: Date;
|
|
@@ -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
|
|
1
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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"}
|
|
@@ -14,12 +14,15 @@ export interface IngestSegmentParams {
|
|
|
14
14
|
startedAt: Date;
|
|
15
15
|
endedAt: Date;
|
|
16
16
|
keepalive?: boolean;
|
|
17
|
+
/** Precomputed gzip payload; when set, `events` is only used for eventCount. */
|
|
18
|
+
gzip?: Uint8Array;
|
|
17
19
|
}
|
|
18
20
|
export interface FinishReplayParams {
|
|
19
21
|
replayId: string;
|
|
20
22
|
reason?: string;
|
|
21
23
|
keepalive?: boolean;
|
|
22
24
|
}
|
|
25
|
+
export declare function compressReplayEvents(events: unknown[]): Promise<Uint8Array>;
|
|
23
26
|
export declare function startReplay(transport: ServerpodTransport, params: StartReplayParams): Promise<unknown>;
|
|
24
27
|
export declare function ingestReplaySegment(transport: ServerpodTransport, params: IngestSegmentParams): Promise<unknown>;
|
|
25
28
|
export declare function finishReplay(transport: ServerpodTransport, params: FinishReplayParams): Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replays.d.ts","sourceRoot":"","sources":["../../src/transport/replays.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"replays.d.ts","sourceRoot":"","sources":["../../src/transport/replays.ts"],"names":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.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,EAAE,yBAAyB;IAKxC,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAC7B,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"serverpod.d.ts","sourceRoot":"","sources":["../../src/transport/serverpod.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,EAAE,yBAAyB;IAKxC,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAC7B,OAAO,CAAC,OAAO,CAAC;CA8CpB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -17,12 +17,16 @@ export interface TalariaInitOptions {
|
|
|
17
17
|
/** Fraction of sessions that upload continuously (0–1). Default `0`. */
|
|
18
18
|
replaysSessionSampleRate?: number;
|
|
19
19
|
/**
|
|
20
|
-
* Fraction of errors that
|
|
21
|
-
*
|
|
22
|
-
* Ignored for the rest of a session once `replaysSessionSampleRate` already
|
|
23
|
-
* enabled continuous upload.
|
|
20
|
+
* Fraction of errors that promote the ring buffer to an uploaded replay (0–1).
|
|
21
|
+
* Default `1`. Ignored once `replaysSessionSampleRate` already enabled upload.
|
|
24
22
|
*/
|
|
25
23
|
replaysOnErrorSampleRate?: number;
|
|
24
|
+
/**
|
|
25
|
+
* How long to keep uploading after an error-sample hit (ms).
|
|
26
|
+
* - Default `15000` (~15s): cheap error clip, then finish and return to buffer mode.
|
|
27
|
+
* - `0`: Sentry-like — continue until the 5-minute max duration or page unload.
|
|
28
|
+
*/
|
|
29
|
+
replaysErrorAfterMs?: number;
|
|
26
30
|
/** Passed to rrweb. Default `true`. */
|
|
27
31
|
maskAllInputs?: boolean;
|
|
28
32
|
/** CSS selectors blocked from the DOM snapshot (plus `[data-talaria-mask]`). */
|
|
@@ -45,6 +49,7 @@ export interface ResolvedOptions {
|
|
|
45
49
|
release?: string;
|
|
46
50
|
replaysSessionSampleRate: number;
|
|
47
51
|
replaysOnErrorSampleRate: number;
|
|
52
|
+
replaysErrorAfterMs: number;
|
|
48
53
|
maskAllInputs: boolean;
|
|
49
54
|
blockSelector: string;
|
|
50
55
|
userId?: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE7E,mDAAmD;AACnD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,MAAM,EAAE,MAAM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,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,MAAM,CAAC;IACjC,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0BAA0B,EAAE,OAAO,CAAC;CACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newtalaria/browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Talaria browser SDK — error capture and session replay (rrweb)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js"
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
13
15
|
}
|
|
14
16
|
},
|
|
15
17
|
"files": [
|
|
@@ -21,6 +23,8 @@
|
|
|
21
23
|
"copy:example": "mkdir -p ../../examples/sdk-spa/vendor && cp dist/index.js ../../examples/sdk-spa/vendor/talaria.js && cp dist/index.js.map ../../examples/sdk-spa/vendor/talaria.js.map",
|
|
22
24
|
"build:types": "tsc -p tsconfig.json",
|
|
23
25
|
"clean": "rm -rf dist",
|
|
26
|
+
"prepare": "npm run build",
|
|
27
|
+
"test": "esbuild test/replay_ingest.test.ts --bundle --platform=node --format=esm --outfile=test/dist/replay_ingest.test.js && node --test test/dist/replay_ingest.test.js",
|
|
24
28
|
"prepublishOnly": "npm run build"
|
|
25
29
|
},
|
|
26
30
|
"dependencies": {
|