Skip to content

Commit 8a51110

Browse files
committed
change EventBufferProxy types back
1 parent 2ab35cf commit 8a51110

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

packages/replay-internal/src/eventBuffer/EventBufferArray.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ export class EventBufferArray implements EventBuffer {
1414
/** @inheritdoc */
1515
public hasCheckout: boolean;
1616

17+
/** @inheritdoc */
18+
public waitForCheckout: boolean;
19+
1720
private _totalSize: number;
1821

1922
public constructor() {
2023
this.events = [];
2124
this._totalSize = 0;
2225
this.hasCheckout = false;
26+
this.waitForCheckout = false;
2327
}
2428

2529
/** @inheritdoc */

packages/replay-internal/src/eventBuffer/EventBufferCompressionWorker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export class EventBufferCompressionWorker implements EventBuffer {
1616
/** @inheritdoc */
1717
public hasCheckout: boolean;
1818

19+
/** @inheritdoc */
20+
public waitForCheckout: boolean;
21+
1922
private _worker: WorkerHandler;
2023
private _earliestTimestamp: number | null;
2124
private _totalSize;
@@ -25,6 +28,7 @@ export class EventBufferCompressionWorker implements EventBuffer {
2528
this._earliestTimestamp = null;
2629
this._totalSize = 0;
2730
this.hasCheckout = false;
31+
this.waitForCheckout = false;
2832
}
2933

3034
/** @inheritdoc */

packages/replay-internal/src/eventBuffer/EventBufferProxy.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ import { EventBufferCompressionWorker } from './EventBufferCompressionWorker';
1212
* Exported only for testing.
1313
*/
1414
export class EventBufferProxy implements EventBuffer {
15-
/**
16-
* If the event buffer needs to wait for a checkout event before it
17-
* starts buffering events.
18-
*/
19-
public waitForCheckout: boolean;
20-
2115
private _fallback: EventBufferArray;
2216
private _compression: EventBufferCompressionWorker;
2317
private _used: EventBuffer;
@@ -29,7 +23,11 @@ export class EventBufferProxy implements EventBuffer {
2923
this._used = this._fallback;
3024

3125
this._ensureWorkerIsLoadedPromise = this._ensureWorkerIsLoaded();
32-
this.waitForCheckout = false;
26+
}
27+
28+
/** @inheritdoc */
29+
public get waitForCheckout(): boolean {
30+
return this._used.waitForCheckout;
3331
}
3432

3533
/** @inheritdoc */

packages/replay-internal/src/eventBuffer/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getWorkerURL } from '@sentry-internal/replay-worker';
22

3+
import type { EventBuffer } from '../types';
34
import { DEBUG_BUILD } from '../debug-build';
45
import { logger } from '../util/logger';
56
import { EventBufferArray } from './EventBufferArray';
@@ -19,7 +20,7 @@ declare const __SENTRY_EXCLUDE_REPLAY_WORKER__: boolean;
1920
export function createEventBuffer({
2021
useCompression,
2122
workerUrl: customWorkerUrl,
22-
}: CreateEventBufferParams): EventBufferProxy {
23+
}: CreateEventBufferParams): EventBuffer {
2324
if (
2425
useCompression &&
2526
// eslint-disable-next-line no-restricted-globals

packages/replay-internal/src/replay.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import type {
2727
AddUpdateCallback,
2828
AllPerformanceEntry,
2929
AllPerformanceEntryData,
30+
EventBuffer,
3031
InternalEventContext,
3132
PopEventContext,
3233
RecordingEvent,
@@ -57,13 +58,12 @@ import { sendReplay } from './util/sendReplay';
5758
import { RateLimitError } from './util/sendReplayRequest';
5859
import type { SKIPPED } from './util/throttle';
5960
import { THROTTLED, throttle } from './util/throttle';
60-
import type { EventBufferProxy } from './eventBuffer/EventBufferProxy';
6161

6262
/**
6363
* The main replay container class, which holds all the state and methods for recording and sending replays.
6464
*/
6565
export class ReplayContainer implements ReplayContainerInterface {
66-
public eventBuffer: EventBufferProxy | null;
66+
public eventBuffer: EventBuffer | null;
6767

6868
public performanceEntries: AllPerformanceEntry[];
6969

packages/replay-internal/src/types/replay.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type {
99
Span,
1010
XhrBreadcrumbHint,
1111
} from '@sentry/types';
12-
import type { EventBufferProxy } from '../eventBuffer/EventBufferProxy';
1312

1413
import type { SKIPPED, THROTTLED } from '../util/throttle';
1514
import type { AllPerformanceEntry, AllPerformanceEntryData, ReplayPerformanceEntry } from './performance';
@@ -401,6 +400,12 @@ export interface EventBuffer {
401400
*/
402401
hasCheckout: boolean;
403402

403+
/**
404+
* If the event buffer needs to wait for a checkout event before it
405+
* starts buffering events.
406+
*/
407+
waitForCheckout: boolean;
408+
404409
/**
405410
* Destroy the event buffer.
406411
*/
@@ -450,7 +455,7 @@ export interface ReplayClickDetector {
450455
}
451456

452457
export interface ReplayContainer {
453-
eventBuffer: EventBufferProxy | null;
458+
eventBuffer: EventBuffer | null;
454459
clickDetector: ReplayClickDetector | undefined;
455460
/**
456461
* List of PerformanceEntry from PerformanceObservers.

0 commit comments

Comments
 (0)