UNPKG

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