UNPKG

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