UNPKG

2.79 kBTypeScriptView Raw
1import { DsnLike } from './dsn';
2import { Event } from './event';
3import { SentryRequestType } from './request';
4import { Response } from './response';
5import { SdkMetadata } from './sdkmetadata';
6import { Session, SessionAggregates } from './session';
7export declare enum Outcome {
8 BeforeSend = "before_send",
9 EventProcessor = "event_processor",
10 NetworkError = "network_error",
11 QueueOverflow = "queue_overflow",
12 RateLimitBackoff = "ratelimit_backoff",
13 SampleRate = "sample_rate"
14}
15/** Transport used sending data to Sentry */
16export interface Transport {
17 /**
18 * Sends the event to the Store endpoint in Sentry.
19 *
20 * @param event Event that should be sent to Sentry.
21 */
22 sendEvent(event: Event): PromiseLike<Response>;
23 /**
24 * Sends the session to the Envelope endpoint in Sentry.
25 *
26 * @param session Session that should be sent to Sentry | Session Aggregates that should be sent to Sentry.
27 */
28 sendSession?(session: Session | SessionAggregates): PromiseLike<Response>;
29 /**
30 * Wait for all events to be sent or the timeout to expire, whichever comes first.
31 *
32 * @param timeout Maximum time in ms the transport should wait for events to be flushed. Omitting this parameter will
33 * cause the transport to wait until all events are sent before resolving the promise.
34 * @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are
35 * still events in the queue when the timeout is reached.
36 */
37 close(timeout?: number): PromiseLike<boolean>;
38 /**
39 * Increment the counter for the specific client outcome
40 */
41 recordLostEvent?(type: Outcome, category: SentryRequestType): void;
42}
43/** JSDoc */
44export declare type TransportClass<T extends Transport> = new (options: TransportOptions) => T;
45/** JSDoc */
46export interface TransportOptions {
47 /** Sentry DSN */
48 dsn: DsnLike;
49 /** Define custom headers */
50 headers?: {
51 [key: string]: string;
52 };
53 /** Set a HTTP proxy that should be used for outbound requests. */
54 httpProxy?: string;
55 /** Set a HTTPS proxy that should be used for outbound requests. */
56 httpsProxy?: string;
57 /** HTTPS proxy certificates path */
58 caCerts?: string;
59 /** Fetch API init parameters */
60 fetchParameters?: {
61 [key: string]: string;
62 };
63 /** The envelope tunnel to use. */
64 tunnel?: string;
65 /** Send SDK Client Reports. Enabled by default. */
66 sendClientReports?: boolean;
67 /**
68 * Set of metadata about the SDK that can be internally used to enhance envelopes and events,
69 * and provide additional data about every request.
70 * */
71 _metadata?: SdkMetadata;
72}
73//# sourceMappingURL=transport.d.ts.map
\No newline at end of file