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