UNPKG

5.14 kBTypeScriptView Raw
1import type { AttachmentType } from './attachment';
2import type { SerializedCheckIn } from './checkin';
3import type { ClientReport } from './clientreport';
4import type { DsnComponents } from './dsn';
5import type { Event } from './event';
6import type { FeedbackEvent, UserFeedback } from './feedback';
7import type { Profile, ProfileChunk } from './profiling';
8import type { ReplayEvent, ReplayRecordingData } from './replay';
9import type { SdkInfo } from './sdkinfo';
10import type { SerializedSession, SessionAggregates } from './session';
11import type { SpanJSON } from './span';
12export type DynamicSamplingContext = {
13 trace_id: string;
14 public_key: DsnComponents['publicKey'];
15 sample_rate?: string;
16 release?: string;
17 environment?: string;
18 transaction?: string;
19 replay_id?: string;
20 sampled?: string;
21};
22export type EnvelopeItemType = 'client_report' | 'user_report' | 'feedback' | 'session' | 'sessions' | 'transaction' | 'attachment' | 'event' | 'profile' | 'profile_chunk' | 'replay_event' | 'replay_recording' | 'check_in' | 'statsd' | 'span';
23export type BaseEnvelopeHeaders = {
24 [key: string]: unknown;
25 dsn?: string;
26 sdk?: SdkInfo;
27};
28export type BaseEnvelopeItemHeaders = {
29 [key: string]: unknown;
30 type: EnvelopeItemType;
31 length?: number;
32};
33type BaseEnvelopeItem<ItemHeader, P> = [ItemHeader & BaseEnvelopeItemHeaders, P];
34type BaseEnvelope<EnvelopeHeader, Item> = [
35 EnvelopeHeader & BaseEnvelopeHeaders,
36 Array<Item & BaseEnvelopeItem<BaseEnvelopeItemHeaders, unknown>>
37];
38type EventItemHeaders = {
39 type: 'event' | 'transaction' | 'profile' | 'feedback';
40};
41type AttachmentItemHeaders = {
42 type: 'attachment';
43 length: number;
44 filename: string;
45 content_type?: string;
46 attachment_type?: AttachmentType;
47};
48type UserFeedbackItemHeaders = {
49 type: 'user_report';
50};
51type FeedbackItemHeaders = {
52 type: 'feedback';
53};
54type SessionItemHeaders = {
55 type: 'session';
56};
57type SessionAggregatesItemHeaders = {
58 type: 'sessions';
59};
60type ClientReportItemHeaders = {
61 type: 'client_report';
62};
63type ReplayEventItemHeaders = {
64 type: 'replay_event';
65};
66type ReplayRecordingItemHeaders = {
67 type: 'replay_recording';
68 length: number;
69};
70type CheckInItemHeaders = {
71 type: 'check_in';
72};
73type ProfileItemHeaders = {
74 type: 'profile';
75};
76type ProfileChunkItemHeaders = {
77 type: 'profile_chunk';
78};
79type StatsdItemHeaders = {
80 type: 'statsd';
81 length: number;
82};
83type SpanItemHeaders = {
84 type: 'span';
85};
86export type EventItem = BaseEnvelopeItem<EventItemHeaders, Event>;
87export type AttachmentItem = BaseEnvelopeItem<AttachmentItemHeaders, string | Uint8Array>;
88export type UserFeedbackItem = BaseEnvelopeItem<UserFeedbackItemHeaders, UserFeedback>;
89export type SessionItem = BaseEnvelopeItem<SessionItemHeaders, SerializedSession> | BaseEnvelopeItem<SessionAggregatesItemHeaders, SessionAggregates>;
90export type ClientReportItem = BaseEnvelopeItem<ClientReportItemHeaders, ClientReport>;
91export type CheckInItem = BaseEnvelopeItem<CheckInItemHeaders, SerializedCheckIn>;
92type ReplayEventItem = BaseEnvelopeItem<ReplayEventItemHeaders, ReplayEvent>;
93type ReplayRecordingItem = BaseEnvelopeItem<ReplayRecordingItemHeaders, ReplayRecordingData>;
94export type StatsdItem = BaseEnvelopeItem<StatsdItemHeaders, string>;
95export type FeedbackItem = BaseEnvelopeItem<FeedbackItemHeaders, FeedbackEvent>;
96export type ProfileItem = BaseEnvelopeItem<ProfileItemHeaders, Profile>;
97export type ProfileChunkItem = BaseEnvelopeItem<ProfileChunkItemHeaders, ProfileChunk>;
98export type SpanItem = BaseEnvelopeItem<SpanItemHeaders, Partial<SpanJSON>>;
99export type EventEnvelopeHeaders = {
100 event_id: string;
101 sent_at: string;
102 trace?: DynamicSamplingContext;
103};
104type SessionEnvelopeHeaders = {
105 sent_at: string;
106};
107type CheckInEnvelopeHeaders = {
108 trace?: DynamicSamplingContext;
109};
110type ClientReportEnvelopeHeaders = BaseEnvelopeHeaders;
111type ReplayEnvelopeHeaders = BaseEnvelopeHeaders;
112type StatsdEnvelopeHeaders = BaseEnvelopeHeaders;
113type SpanEnvelopeHeaders = BaseEnvelopeHeaders & {
114 trace?: DynamicSamplingContext;
115};
116export type EventEnvelope = BaseEnvelope<EventEnvelopeHeaders, EventItem | AttachmentItem | UserFeedbackItem | FeedbackItem | ProfileItem>;
117export type SessionEnvelope = BaseEnvelope<SessionEnvelopeHeaders, SessionItem>;
118export type ClientReportEnvelope = BaseEnvelope<ClientReportEnvelopeHeaders, ClientReportItem>;
119export type ReplayEnvelope = [ReplayEnvelopeHeaders, [ReplayEventItem, ReplayRecordingItem]];
120export type CheckInEnvelope = BaseEnvelope<CheckInEnvelopeHeaders, CheckInItem>;
121export type StatsdEnvelope = BaseEnvelope<StatsdEnvelopeHeaders, StatsdItem>;
122export type SpanEnvelope = BaseEnvelope<SpanEnvelopeHeaders, SpanItem>;
123export type ProfileChunkEnvelope = BaseEnvelope<BaseEnvelopeHeaders, ProfileChunkItem>;
124export type Envelope = EventEnvelope | SessionEnvelope | ClientReportEnvelope | ProfileChunkEnvelope | ReplayEnvelope | CheckInEnvelope | StatsdEnvelope | SpanEnvelope;
125export type EnvelopeItem = Envelope[1][number];
126export {};
127//# sourceMappingURL=envelope.d.ts.map
\No newline at end of file