Skip to content

Commit feea637

Browse files
committed
ref: PR fixes
1 parent 063e339 commit feea637

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/core/src/envelope.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ export function createEventEnvelope(
6363
tunnel?: string,
6464
): EventEnvelope {
6565
const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
66-
const eventType = event.type || 'event';
66+
67+
/*
68+
Note: Due to TS, event.type may be `replay_event`, theoretically.
69+
In practice, we never call `createEventEnvelope` with `replay_event` type,
70+
and we'd have to adjut a looot of types to make this work properly.
71+
We want to avoid casting this around, as that could lead to bugs (e.g. when we add another type)
72+
So the safe choice is to really guard against the replay_event type here.
73+
*/
74+
const eventType = event.type && event.type !== 'replay_event' ? event.type : 'event';
6775

6876
enhanceEventWithSdkInfo(event, metadata && metadata.sdk);
6977

packages/types/src/datacategory.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export type DataCategory =
1010
| 'error'
1111
// Transaction type event
1212
| 'transaction'
13+
// Replay type event
14+
| 'replay_event'
1315
// Events with `event_type` csp, hpkp, expectct, expectstaple
1416
| 'security'
1517
// Attachment bytes stored (unused for rate limiting

0 commit comments

Comments
 (0)