0
# Sentry Types
1
2
**DEPRECATED**: The `@sentry/types` package is deprecated. All exports have been moved to `@sentry/core`. This package serves as a backward compatibility layer for existing consumers and should not be used in new projects.
3
4
This package provides TypeScript type definitions for all Sentry JavaScript SDKs, containing common interfaces, types, and contracts used across the Sentry ecosystem for error monitoring and performance tracking.
5
6
## Package Information
7
8
- **Package Name**: @sentry/types
9
- **Package Type**: npm
10
- **Language**: TypeScript
11
- **Installation**: `npm install @sentry/types` (deprecated - use `@sentry/core` instead)
12
- **Version**: 10.10.0
13
14
## Core Imports
15
16
**Deprecated approach:**
17
```typescript
18
import type { Event, Breadcrumb, Span, User } from "@sentry/types";
19
```
20
21
**Recommended approach:**
22
```typescript
23
import type { Event, Breadcrumb, Span, User } from "@sentry/core";
24
```
25
26
For CommonJS:
27
```javascript
28
// Deprecated
29
const { Event, Breadcrumb } = require("@sentry/types");
30
31
// Recommended
32
const { Event, Breadcrumb } = require("@sentry/core");
33
```
34
35
## Basic Usage
36
37
```typescript
38
// Import types from @sentry/core (recommended)
39
import type { Event, User, Breadcrumb, Span } from "@sentry/core";
40
41
// Define user data with type safety
42
const user: User = {
43
id: "123",
44
email: "user@example.com",
45
username: "john_doe"
46
};
47
48
// Define breadcrumb with type safety
49
const breadcrumb: Breadcrumb = {
50
message: "User clicked button",
51
category: "ui",
52
level: "info",
53
timestamp: Date.now() / 1000
54
};
55
56
// Define event with type safety
57
const event: Event = {
58
message: "Something went wrong",
59
level: "error",
60
user,
61
breadcrumbs: [breadcrumb]
62
};
63
```
64
65
## Migration Guide
66
67
All types in this package have been moved to `@sentry/core`. Update your imports:
68
69
```typescript
70
// Before (deprecated)
71
import type {
72
Event,
73
Breadcrumb,
74
User,
75
Span,
76
Client,
77
Scope
78
} from "@sentry/types";
79
80
// After (recommended)
81
import type {
82
Event,
83
Breadcrumb,
84
User,
85
Span,
86
Client,
87
Scope
88
} from "@sentry/core";
89
```
90
91
## Capabilities
92
93
### Core Event Types
94
95
Type definitions for Sentry events, errors, and transactions.
96
97
```typescript { .api }
98
/** Core event interface for all Sentry events */
99
interface Event {
100
event_id?: string;
101
message?: string;
102
timestamp?: number;
103
level?: SeverityLevel;
104
logger?: string;
105
transaction?: string;
106
server_name?: string;
107
release?: string;
108
dist?: string;
109
environment?: string;
110
sdk?: SdkInfo;
111
request?: Request;
112
exception?: {
113
values?: Exception[];
114
};
115
stacktrace?: Stacktrace;
116
breadcrumbs?: Breadcrumb[];
117
contexts?: Contexts;
118
tags?: { [key: string]: string };
119
extra?: Extras;
120
user?: User;
121
fingerprint?: string[];
122
modules?: { [key: string]: string };
123
platform?: string;
124
start_timestamp?: number;
125
spans?: Span[];
126
transaction_info?: {
127
source: TransactionSource;
128
};
129
}
130
131
/** Error-specific event interface */
132
interface ErrorEvent extends Event {
133
exception: {
134
values: Exception[];
135
};
136
}
137
138
/** Transaction event interface for performance monitoring */
139
interface TransactionEvent extends Event {
140
type: "transaction";
141
transaction: string;
142
start_timestamp: number;
143
spans?: Span[];
144
contexts?: Contexts & {
145
trace?: TraceContext;
146
};
147
}
148
149
/** Severity levels for events */
150
type SeverityLevel = "fatal" | "error" | "warning" | "log" | "info" | "debug";
151
152
/** Event processing hints */
153
interface EventHint {
154
event_id?: string;
155
captureContext?: CaptureContext;
156
mechanism?: Partial<Mechanism>;
157
syntheticException?: Error;
158
originalException?: Error | string;
159
data?: any;
160
}
161
162
/** Event processor function interface */
163
interface EventProcessor {
164
(event: Event, hint?: EventHint): PromiseLike<Event | null> | Event | null;
165
}
166
```
167
168
### User and Context Types
169
170
Type definitions for user identification and contextual data.
171
172
```typescript { .api }
173
/** User identification and metadata */
174
interface User {
175
id?: string;
176
ip_address?: string;
177
email?: string;
178
username?: string;
179
name?: string;
180
segment?: string;
181
data?: { [key: string]: any };
182
}
183
184
/** Generic context interface */
185
interface Context {
186
[key: string]: any;
187
}
188
189
/** Collection of context data */
190
interface Contexts {
191
app?: AppContext;
192
device?: DeviceContext;
193
os?: OsContext;
194
culture?: CultureContext;
195
trace?: TraceContext;
196
cloud_resource?: CloudResourceContext;
197
[key: string]: Context | undefined;
198
}
199
200
/** Application context */
201
interface AppContext extends Context {
202
app_name?: string;
203
app_start_time?: string;
204
app_version?: string;
205
app_identifier?: string;
206
build_type?: string;
207
app_memory?: number;
208
}
209
210
/** Device context */
211
interface DeviceContext extends Context {
212
name?: string;
213
family?: string;
214
model?: string;
215
model_id?: string;
216
arch?: string;
217
battery_level?: number;
218
battery_temperature?: number;
219
orientation?: "portrait" | "landscape";
220
manufacturer?: string;
221
brand?: string;
222
screen_resolution?: string;
223
screen_height_pixels?: number;
224
screen_width_pixels?: number;
225
screen_density?: number;
226
screen_dpi?: number;
227
online?: boolean;
228
charging?: boolean;
229
low_memory?: boolean;
230
simulator?: boolean;
231
memory_size?: number;
232
free_memory?: number;
233
usable_memory?: number;
234
storage_size?: number;
235
free_storage?: number;
236
external_storage_size?: number;
237
external_free_storage?: number;
238
boot_time?: string;
239
timezone?: string;
240
}
241
242
/** Operating system context */
243
interface OsContext extends Context {
244
name?: string;
245
version?: string;
246
build?: string;
247
kernel_version?: string;
248
rooted?: boolean;
249
raw_description?: string;
250
}
251
252
/** Localization context */
253
interface CultureContext extends Context {
254
calendar?: string;
255
display_name?: string;
256
locale?: string;
257
is_24_hour_format?: boolean;
258
timezone?: string;
259
}
260
261
/** Distributed tracing context */
262
interface TraceContext extends Context {
263
trace_id?: string;
264
span_id?: string;
265
parent_span_id?: string;
266
op?: string;
267
description?: string;
268
status?: SpanStatus;
269
tags?: { [key: string]: string };
270
data?: { [key: string]: any };
271
}
272
```
273
274
### Breadcrumb Types
275
276
Type definitions for user action tracking through breadcrumbs.
277
278
```typescript { .api }
279
/** Breadcrumb interface for tracking user actions */
280
interface Breadcrumb {
281
timestamp?: number;
282
message?: string;
283
category?: string;
284
level?: SeverityLevel;
285
type?: string;
286
data?: { [key: string]: any };
287
}
288
289
/** Additional breadcrumb metadata */
290
interface BreadcrumbHint {
291
[key: string]: any;
292
}
293
294
/** Fetch request breadcrumb data */
295
interface FetchBreadcrumbData {
296
method: string;
297
url: string;
298
status_code?: number;
299
reason?: string;
300
request_body_size?: number;
301
response_body_size?: number;
302
}
303
304
/** XHR request breadcrumb data */
305
interface XhrBreadcrumbData {
306
method?: string;
307
url?: string;
308
status_code?: number;
309
request_body_size?: number;
310
response_body_size?: number;
311
}
312
313
/** Fetch breadcrumb hint */
314
interface FetchBreadcrumbHint extends BreadcrumbHint {
315
input: RequestInfo;
316
data?: any;
317
response?: Response;
318
}
319
320
/** XHR breadcrumb hint */
321
interface XhrBreadcrumbHint extends BreadcrumbHint {
322
xhr?: XMLHttpRequest;
323
}
324
```
325
326
### Span and Tracing Types
327
328
Type definitions for distributed tracing and performance monitoring.
329
330
```typescript { .api }
331
/** Distributed tracing span interface */
332
interface Span {
333
spanId: string;
334
traceId: string;
335
parentSpanId?: string;
336
status?: SpanStatus;
337
description?: string;
338
op?: string;
339
origin?: SpanOrigin;
340
data?: { [key: string]: any };
341
tags?: { [key: string]: string };
342
attributes?: SpanAttributes;
343
startTimestamp: number;
344
endTimestamp?: number;
345
isRecording(): boolean;
346
setStatus(status: SpanStatus): this;
347
setData(key: string, value: any): this;
348
setTag(key: string, value: string): this;
349
setAttribute(key: string, value: SpanAttributeValue): this;
350
setAttributes(attributes: SpanAttributes): this;
351
updateName(name: string): this;
352
end(endTimestamp?: number): void;
353
}
354
355
/** Span attributes collection */
356
interface SpanAttributes {
357
[key: string]: SpanAttributeValue;
358
}
359
360
/** Span attribute value types */
361
type SpanAttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
362
363
/** Span status enumeration */
364
type SpanStatus = "ok" | "deadline_exceeded" | "unauthenticated" | "permission_denied" | "not_found" | "resource_exhausted" | "invalid_argument" | "unimplemented" | "unavailable" | "internal_error" | "unknown_error" | "cancelled" | "already_exists" | "failed_precondition" | "aborted" | "out_of_range" | "data_loss";
365
366
/** Span origin information */
367
type SpanOrigin = "manual" | "auto" | string;
368
369
/** Time input for spans */
370
type SpanTimeInput = number | Date;
371
372
/** Options for starting spans */
373
interface StartSpanOptions {
374
name: string;
375
op?: string;
376
description?: string;
377
parentSpan?: Span;
378
attributes?: SpanAttributes;
379
startTime?: SpanTimeInput;
380
scope?: Scope;
381
onlyIfParent?: boolean;
382
forceTransaction?: boolean;
383
}
384
385
/** Arguments for Sentry span creation */
386
interface SentrySpanArguments {
387
spanId?: string;
388
traceId?: string;
389
parentSpanId?: string;
390
startTimestamp?: number;
391
endTimestamp?: number;
392
description?: string;
393
op?: string;
394
origin?: SpanOrigin;
395
status?: SpanStatus;
396
data?: { [key: string]: any };
397
tags?: { [key: string]: string };
398
attributes?: SpanAttributes;
399
}
400
401
/** Span JSON serialization format */
402
interface SpanJSON {
403
span_id: string;
404
trace_id: string;
405
parent_span_id?: string;
406
op?: string;
407
description?: string;
408
start_timestamp: number;
409
timestamp?: number;
410
status?: SpanStatus;
411
tags?: { [key: string]: string };
412
data?: { [key: string]: any };
413
origin?: SpanOrigin;
414
}
415
416
/** Span context data */
417
interface SpanContextData {
418
spanId: string;
419
traceId: string;
420
parentSpanId?: string;
421
}
422
```
423
424
### Client and Scope Types
425
426
Type definitions for Sentry client and scope management.
427
428
```typescript { .api }
429
/** Main Sentry client interface */
430
interface Client<O extends ClientOptions = ClientOptions> {
431
getOptions(): O;
432
captureException(exception: any, hint?: EventHint, scope?: Scope): string;
433
captureMessage(message: string, level?: SeverityLevel, hint?: EventHint, scope?: Scope): string;
434
captureEvent(event: Event, hint?: EventHint, scope?: Scope): string;
435
captureSession?(session: Session): void;
436
getDsn(): DsnComponents | undefined;
437
getTransport(): Transport;
438
flush(timeout?: number): PromiseLike<boolean>;
439
close(timeout?: number): PromiseLike<boolean>;
440
setupIntegrations(): void;
441
getIntegrationById(integrationId: string): Integration | null;
442
recordDroppedEvent(reason: EventDropReason, category: DataCategory, eventType?: EventType): void;
443
}
444
445
/** Client configuration options */
446
interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOptions> {
447
dsn?: DsnLike;
448
debug?: boolean;
449
release?: string;
450
environment?: string;
451
dist?: string;
452
maxBreadcrumbs?: number;
453
attachStacktrace?: boolean;
454
sendDefaultPii?: boolean;
455
maxValueLength?: number;
456
normalizeDepth?: number;
457
normalizeMaxBreadth?: number;
458
maxEventBytes?: number;
459
beforeSend?: (event: Event, hint: EventHint) => PromiseLike<Event | null> | Event | null;
460
beforeSendTransaction?: (event: TransactionEvent, hint: EventHint) => PromiseLike<TransactionEvent | null> | TransactionEvent | null;
461
beforeBreadcrumb?: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null;
462
integrations?: Integration[];
463
defaultIntegrations?: Integration[] | false;
464
transport?: TransportClass<TO>;
465
transportOptions?: TO;
466
stackParser?: StackParser;
467
sampleRate?: number;
468
tracesSampleRate?: number;
469
tracesSampler?: (samplingContext: SamplingContext) => number | boolean;
470
profilesSampleRate?: number;
471
profilesSampler?: (samplingContext: SamplingContext) => number | boolean;
472
replaysSessionSampleRate?: number;
473
replaysOnErrorSampleRate?: number;
474
sendClientReports?: boolean;
475
tunnel?: string;
476
_experiments?: { [key: string]: any };
477
_metadata?: SdkMetadata;
478
ignoreErrors?: Array<string | RegExp>;
479
denyUrls?: Array<string | RegExp>;
480
allowUrls?: Array<string | RegExp>;
481
autoSessionTracking?: boolean;
482
initialScope?: CaptureContext;
483
enabled?: boolean;
484
}
485
486
/** Transport class interface */
487
interface TransportClass<T extends BaseTransportOptions = BaseTransportOptions> {
488
new (options: T): Transport;
489
}
490
491
/** Request session interface */
492
interface RequestSession {
493
status?: SessionStatus;
494
requestSession?: Session;
495
}
496
497
/** Hub interface for integration setup */
498
interface Hub {
499
captureException(exception: any, hint?: EventHint): string;
500
captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string;
501
captureEvent(event: Event, hint?: EventHint): string;
502
getClient<C extends Client>(): C | undefined;
503
getScope(): Scope;
504
getStackTop(): Layer;
505
withScope(callback: (scope: Scope) => void): void;
506
pushScope(): Scope;
507
popScope(): boolean;
508
}
509
510
/** Hub layer interface */
511
interface Layer {
512
client?: Client;
513
scope: Scope;
514
}
515
516
/** Current scope interface */
517
interface Scope {
518
addScopeListener(callback: (scope: Scope) => void): void;
519
addEventProcessor(callback: EventProcessor): this;
520
setUser(user: User | null): this;
521
getUser(): User | undefined;
522
getRequestSession(): RequestSession | undefined;
523
setRequestSession(requestSession?: RequestSession): this;
524
setTags(tags: { [key: string]: string }): this;
525
setTag(key: string, value: string): this;
526
setExtras(extras: Extras): this;
527
setExtra(key: string, extra: Extra): this;
528
setFingerprint(fingerprint: string[]): this;
529
setLevel(level: SeverityLevel): this;
530
getLevel(): SeverityLevel | undefined;
531
setTransactionName(name?: string): this;
532
setTransaction(name?: string): this;
533
getTransaction(): string | undefined;
534
setContext(key: string, context: Context | null): this;
535
setSpan(span?: Span): this;
536
getSpan(): Span | undefined;
537
getTraceContext(): TraceContext;
538
getSession(): Session | undefined;
539
setSession(session?: Session): this;
540
update(captureContext?: CaptureContext): this;
541
clear(): this;
542
addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
543
getBreadcrumbs(): Breadcrumb[];
544
clearBreadcrumbs(): this;
545
applyToEvent(event: Event, hint?: EventHint, additionalEventProcessors?: EventProcessor[]): PromiseLike<Event | null>;
546
captureException(exception: any, hint?: EventHint): string;
547
captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string;
548
captureEvent(event: Event, hint?: EventHint): string;
549
clone(): Scope;
550
setSDKProcessingMetadata(newData: { [key: string]: unknown }): this;
551
}
552
553
/** Scope context data */
554
interface ScopeContext {
555
user?: User;
556
level?: SeverityLevel;
557
extra?: Extras;
558
contexts?: Contexts;
559
tags?: { [key: string]: string };
560
fingerprint?: string[];
561
requestSession?: RequestSession;
562
propagationContext?: PropagationContext;
563
}
564
565
/** Scope data structure */
566
interface ScopeData {
567
eventProcessors: EventProcessor[];
568
breadcrumbs: Breadcrumb[];
569
user: User;
570
tags: { [key: string]: string };
571
extra: Extras;
572
contexts: Contexts;
573
attachments: Attachment[];
574
propagationContext: PropagationContext;
575
sdkProcessingMetadata: { [key: string]: unknown };
576
fingerprint: string[];
577
level?: SeverityLevel;
578
transactionName?: string;
579
span?: Span;
580
}
581
582
/** Context for capturing events */
583
type CaptureContext = Scope | ScopeContext | ((scope: Scope) => Scope) | undefined;
584
```
585
586
### Transport and Envelope Types
587
588
Type definitions for data transport and envelope system.
589
590
```typescript { .api }
591
/** Transport layer interface */
592
interface Transport {
593
send(request: TransportRequest): PromiseLike<TransportMakeRequestResponse>;
594
flush(timeout?: number): PromiseLike<boolean>;
595
}
596
597
/** Transport request structure */
598
interface TransportRequest {
599
body: string | Uint8Array;
600
type: TransportRequestType;
601
url?: string;
602
}
603
604
/** Transport request type */
605
type TransportRequestType = "event" | "transaction" | "session" | "attachment";
606
607
/** Transport response */
608
interface TransportMakeRequestResponse {
609
statusCode?: number;
610
headers?: {
611
[key: string]: string | null;
612
'retry-after'?: string | null;
613
'x-sentry-rate-limits'?: string | null;
614
};
615
}
616
617
/** Base transport configuration */
618
interface BaseTransportOptions {
619
url?: string;
620
headers?: { [key: string]: string };
621
caCerts?: string | Buffer | Array<string | Buffer>;
622
proxy?: string;
623
httpsProxy?: string;
624
httpProxy?: string;
625
}
626
627
/** Envelope container for multiple items */
628
interface Envelope {
629
0: EnvelopeHeaders;
630
1: EnvelopeItem[];
631
}
632
633
/** Individual envelope item */
634
interface EnvelopeItem {
635
0: EnvelopeItemHeaders;
636
1: any;
637
}
638
639
/** Envelope item type enumeration */
640
type EnvelopeItemType = "session" | "sessions" | "transaction" | "event" | "client_report" | "user_report" | "profile" | "profile_chunk" | "replay_event" | "replay_recording" | "check_in" | "feedback" | "span" | "statsd" | "attachment";
641
642
/** Envelope headers */
643
type EnvelopeHeaders = BaseEnvelopeHeaders;
644
645
/** Envelope item headers */
646
type EnvelopeItemHeaders = BaseEnvelopeItemHeaders;
647
648
/** Base envelope headers */
649
interface BaseEnvelopeHeaders {
650
dsn?: string;
651
sdk?: SdkInfo;
652
sent_at?: string;
653
trace?: TraceparentData & { transaction?: string; public_key?: DsnComponents['publicKey']; sample_rate?: string; sampled?: string };
654
}
655
656
/** Base envelope item headers */
657
interface BaseEnvelopeItemHeaders {
658
type: EnvelopeItemType;
659
length?: number;
660
filename?: string;
661
content_type?: string;
662
attachment_type?: string;
663
}
664
```
665
666
### Integration Types
667
668
Type definitions for Sentry integrations.
669
670
```typescript { .api }
671
/** Base integration interface */
672
interface Integration {
673
name: string;
674
setupOnce?(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
675
setup?(client: Client): void;
676
afterAllSetup?(client: Client): void;
677
processEvent?(event: Event, hint: EventHint, client: Client): Event;
678
}
679
680
/** Integration factory function */
681
interface IntegrationFn<T = Integration> {
682
(...args: any[]): T;
683
id?: string;
684
}
685
```
686
687
### Exception and Stack Trace Types
688
689
Type definitions for error handling and stack traces.
690
691
```typescript { .api }
692
/** Exception data structure */
693
interface Exception {
694
type?: string;
695
value?: string;
696
module?: string;
697
thread_id?: number;
698
stacktrace?: Stacktrace;
699
mechanism?: Mechanism;
700
}
701
702
/** Enhanced error interface with Sentry metadata */
703
interface ExtendedError extends Error {
704
name: string;
705
message: string;
706
stack?: string;
707
cause?: unknown;
708
[key: string]: unknown;
709
}
710
711
/** Error mechanism information */
712
interface Mechanism {
713
type: string;
714
description?: string;
715
help_link?: string;
716
handled?: boolean;
717
synthetic?: boolean;
718
data?: { [key: string]: string | boolean };
719
meta?: { [key: string]: any };
720
}
721
722
/** Complete stack trace */
723
interface Stacktrace {
724
frames?: StackFrame[];
725
frames_omitted?: [number, number];
726
}
727
728
/** Stack frame information */
729
interface StackFrame {
730
filename?: string;
731
function?: string;
732
module?: string;
733
platform?: string;
734
lineno?: number;
735
colno?: number;
736
abs_path?: string;
737
context_line?: string;
738
pre_context?: string[];
739
post_context?: string[];
740
in_app?: boolean;
741
instruction_addr?: string;
742
addr_mode?: string;
743
package?: string;
744
symbol?: string;
745
symbol_addr?: string;
746
image_addr?: string;
747
vars?: { [key: string]: any };
748
}
749
750
/** Stack trace parser interface */
751
interface StackParser {
752
(stack: string, skipFirst?: number): StackFrame[];
753
}
754
755
/** Single line parser interface */
756
interface StackLineParser {
757
(line: string): StackFrame | undefined;
758
}
759
760
/** Parser function type */
761
type StackLineParserFn = (line: string) => StackFrame | undefined;
762
```
763
764
### Session and Feedback Types
765
766
Type definitions for session tracking and user feedback.
767
768
```typescript { .api }
769
/** User session interface */
770
interface Session {
771
sid: string;
772
did?: string | number;
773
init: boolean;
774
timestamp: number;
775
started: number;
776
duration?: number;
777
status: SessionStatus;
778
release?: string;
779
environment?: string;
780
userAgent?: string;
781
ipAddress?: string;
782
errors: number;
783
user?: User | null;
784
ignoreDuration: boolean;
785
abnormal_mechanism?: string;
786
toJSON(): {
787
sid: string;
788
init: boolean;
789
started: string;
790
timestamp: string;
791
status: SessionStatus;
792
errors: number;
793
did?: string | number;
794
duration?: number;
795
abnormal_mechanism?: string;
796
attrs?: {
797
release?: string;
798
environment?: string;
799
user_agent?: string;
800
ip_address?: string;
801
};
802
};
803
}
804
805
/** Session status enumeration */
806
type SessionStatus = "ok" | "exited" | "crashed" | "abnormal";
807
808
/** Session context data */
809
interface SessionContext {
810
sid?: string;
811
did?: string | number;
812
init?: boolean;
813
timestamp?: number;
814
started?: number;
815
duration?: number;
816
status?: SessionStatus;
817
release?: string;
818
environment?: string;
819
userAgent?: string;
820
ipAddress?: string;
821
errors?: number;
822
user?: User | null;
823
ignoreDuration?: boolean;
824
abnormal_mechanism?: string;
825
}
826
827
/** Serialized session format */
828
interface SerializedSession {
829
sid: string;
830
init: boolean;
831
started: string;
832
timestamp: string;
833
status: SessionStatus;
834
errors: number;
835
did?: string | number;
836
duration?: number;
837
abnormal_mechanism?: string;
838
attrs?: {
839
release?: string;
840
environment?: string;
841
user_agent?: string;
842
ip_address?: string;
843
};
844
}
845
846
/** User feedback interface */
847
interface UserFeedback {
848
event_id: string;
849
name: string;
850
email: string;
851
comments: string;
852
}
853
854
/** Feedback event structure */
855
interface FeedbackEvent {
856
type: "feedback";
857
event_id: string;
858
timestamp: number;
859
dist?: string;
860
platform: string;
861
environment?: string;
862
release?: string;
863
request?: RequestEventData;
864
contexts?: {
865
feedback?: {
866
message: string;
867
contact_email?: string;
868
name?: string;
869
replay_id?: string;
870
url?: string;
871
source?: string;
872
associated_event_id?: string;
873
};
874
trace?: TraceContext;
875
};
876
tags?: { [key: string]: string };
877
user?: User;
878
breadcrumbs?: Breadcrumb[];
879
}
880
881
/** Feedback form data */
882
interface FeedbackFormData {
883
name?: string;
884
email?: string;
885
message: string;
886
source?: string;
887
url?: string;
888
associated_event_id?: string;
889
}
890
```
891
892
### SDK and DSN Types
893
894
Type definitions for SDK metadata and DSN components.
895
896
```typescript { .api }
897
/** SDK information */
898
interface SdkInfo {
899
name: string;
900
version: string;
901
integrations?: string[];
902
packages?: Array<{
903
name: string;
904
version: string;
905
}>;
906
}
907
908
/** SDK metadata */
909
interface SdkMetadata {
910
sdk?: SdkInfo;
911
[key: string]: any;
912
}
913
914
/** DSN component breakdown */
915
interface DsnComponents {
916
protocol: DsnProtocol;
917
publicKey: string;
918
pass: string;
919
host: string;
920
port: string;
921
path: string;
922
projectId: string;
923
}
924
925
/** DSN protocol enumeration */
926
type DsnProtocol = "http" | "https";
927
928
/** DSN-like identifier */
929
type DsnLike = string | DsnComponents;
930
931
/** W3C traceparent data */
932
interface TraceparentData {
933
traceId: string;
934
parentSpanId: string;
935
traceFlags: number;
936
}
937
938
/** Context for sampling decisions */
939
interface SamplingContext {
940
transactionContext: {
941
name: string;
942
op?: string;
943
};
944
location?: Location;
945
request?: any;
946
[key: string]: any;
947
}
948
949
/** File attachment interface */
950
interface Attachment {
951
filename: string;
952
data: string | Uint8Array;
953
contentType?: string;
954
attachmentType?: string;
955
}
956
957
/** Trace propagation context */
958
interface PropagationContext {
959
traceId: string;
960
spanId: string;
961
parentSpanId?: string;
962
sampled?: boolean;
963
baggage?: string;
964
dsc?: DynamicSamplingContext;
965
}
966
967
/** Dynamic sampling context */
968
interface DynamicSamplingContext {
969
trace_id: string;
970
public_key: string;
971
sample_rate?: string;
972
release?: string;
973
environment?: string;
974
transaction?: string;
975
replay_id?: string;
976
sampled?: string;
977
}
978
979
/** Transaction source enumeration */
980
type TransactionSource = "custom" | "url" | "route" | "view" | "component" | "task";
981
```
982
983
### Utility Types
984
985
Commonly used utility types and primitives.
986
987
```typescript { .api }
988
/** Primitive value types */
989
type Primitive = number | string | boolean | bigint | symbol | null | undefined;
990
991
/** Additional data interface */
992
type Extra = unknown;
993
994
/** Collection of extra data */
995
type Extras = Record<string, Extra>;
996
997
/** Generic event interface */
998
interface PolymorphicEvent {
999
[key: string]: any;
1000
type?: string;
1001
}
1002
1003
/** Function wrapper interface */
1004
interface WrappedFunction<T extends Function = Function> extends Function {
1005
__sentry_original__?: T;
1006
__sentry_wrapped__?: WrappedFunction<T>;
1007
}
1008
1009
/** Web Worker location interface */
1010
interface WorkerLocation {
1011
protocol: string;
1012
hostname: string;
1013
port: string;
1014
pathname: string;
1015
search: string;
1016
hash: string;
1017
href: string;
1018
origin: string;
1019
host: string;
1020
}
1021
1022
/** Parameterized string type */
1023
type ParameterizedString = string;
1024
1025
/** Data category enumeration */
1026
type DataCategory = "default" | "error" | "transaction" | "replay" | "security" | "attachment" | "session" | "internal" | "profile" | "monitor" | "feedback" | "span" | "statsd" | "metric_bucket";
1027
1028
/** Event processing outcome */
1029
type Outcome = "before_send" | "event_processor" | "network_error" | "queue_overflow" | "ratelimit_backoff" | "sample_rate" | "send_error" | "internal_sdk_error";
1030
1031
/** Reason for dropping events */
1032
type EventDropReason = "before_send" | "event_processor" | "network_error" | "queue_overflow" | "ratelimit_backoff" | "sample_rate" | "send_error" | "internal_sdk_error";
1033
1034
/** Console log level enumeration */
1035
type ConsoleLevel = "debug" | "info" | "warn" | "error" | "log" | "assert" | "trace";
1036
```
1037
1038
## Types
1039
1040
All types are **deprecated** and re-exported from `@sentry/core`. Use the migration guide above to update your imports.
1041
1042
The package contains 353 type definitions covering:
1043
1044
- **Event System**: Core event interfaces and processing
1045
- **Error Handling**: Exception types and stack traces
1046
- **Performance Monitoring**: Spans, tracing, and transactions
1047
- **User Context**: User identification and metadata
1048
- **Breadcrumbs**: User action tracking
1049
- **Client Management**: Client configuration and scope
1050
- **Transport Layer**: Data transmission and envelopes
1051
- **Integrations**: Plugin system interfaces
1052
- **Sessions**: User session tracking
1053
- **Feedback**: User feedback collection
1054
- **Utilities**: Helper types and primitives
1055
1056
## Notes
1057
1058
- This package is **deprecated** as of version 10.10.0
1059
- All functionality has been moved to `@sentry/core`
1060
- This package serves only as a backward compatibility layer
1061
- New projects should import directly from `@sentry/core`
1062
- Migration requires only updating import statements