1
1
import { DsnLike } from './dsn' ;
2
+ import { Envelope } from './envelope' ;
2
3
import { Event } from './event' ;
4
+ import { EventStatus } from './eventstatus' ;
3
5
import { SentryRequestType } from './request' ;
4
6
import { Response } from './response' ;
5
7
import { SdkMetadata } from './sdkmetadata' ;
@@ -13,6 +15,46 @@ export type Outcome =
13
15
| 'ratelimit_backoff'
14
16
| 'sample_rate' ;
15
17
18
+ export type TransportCategory = 'error' | 'transaction' | 'attachment' | 'session' ;
19
+
20
+ export type TransportRequest = {
21
+ body : string ;
22
+ category : TransportCategory ;
23
+ } ;
24
+
25
+ export type TransportMakeRequestResponse = {
26
+ body ?: string ;
27
+ headers ?: {
28
+ [ key : string ] : string | null ;
29
+ 'x-sentry-rate-limits' : string | null ;
30
+ 'retry-after' : string | null ;
31
+ } ;
32
+ reason ?: string ;
33
+ statusCode : number ;
34
+ } ;
35
+
36
+ export type TransportResponse = {
37
+ status : EventStatus ;
38
+ reason ?: string ;
39
+ } ;
40
+
41
+ export interface InternalBaseTransportOptions {
42
+ bufferSize ?: number ;
43
+ }
44
+ export interface BaseTransportOptions extends InternalBaseTransportOptions {
45
+ // url to send the event
46
+ // transport does not care about dsn specific - client should take care of
47
+ // parsing and figuring that out
48
+ url : string ;
49
+ }
50
+
51
+ export interface NewTransport {
52
+ send ( request : Envelope ) : PromiseLike < TransportResponse > ;
53
+ flush ( timeout ?: number ) : PromiseLike < boolean > ;
54
+ }
55
+
56
+ export type TransportRequestExecutor = ( request : TransportRequest ) => PromiseLike < TransportMakeRequestResponse > ;
57
+
16
58
/** Transport used sending data to Sentry */
17
59
export interface Transport {
18
60
/**
0 commit comments