UNPKG

2.82 kBTypeScriptView Raw
1/// <reference types="node" />
2import { API } from '@sentry/core';
3import { DsnProtocol, Event, Response, SentryRequest, SentryRequestType, Session, SessionAggregates, Transport, TransportOptions } from '@sentry/types';
4import { PromiseBuffer } from '@sentry/utils';
5import * as http from 'http';
6import * as https from 'https';
7import { URL } from 'url';
8import { HTTPModule } from './http-module';
9export declare type URLParts = Pick<URL, 'hostname' | 'pathname' | 'port' | 'protocol'>;
10export declare type UrlParser = (url: string) => URLParts;
11/** Base Transport class implementation */
12export declare abstract class BaseTransport implements Transport {
13 options: TransportOptions;
14 /** The Agent used for corresponding transport */
15 module?: HTTPModule;
16 /** The Agent used for corresponding transport */
17 client?: http.Agent | https.Agent;
18 /** API object */
19 protected _api: API;
20 /** A simple buffer holding all requests. */
21 protected readonly _buffer: PromiseBuffer<Response>;
22 /** Locks transport after receiving rate limits in a response */
23 protected readonly _rateLimits: Record<string, Date>;
24 /** Create instance and set this.dsn */
25 constructor(options: TransportOptions);
26 /** Default function used to parse URLs */
27 urlParser: UrlParser;
28 /**
29 * @inheritDoc
30 */
31 sendEvent(_: Event): PromiseLike<Response>;
32 /**
33 * @inheritDoc
34 */
35 close(timeout?: number): PromiseLike<boolean>;
36 /**
37 * Extracts proxy settings from client options and env variables.
38 *
39 * Honors `no_proxy` env variable with the highest priority to allow for hosts exclusion.
40 *
41 * An order of priority for available protocols is:
42 * `http` => `options.httpProxy` | `process.env.http_proxy`
43 * `https` => `options.httpsProxy` | `options.httpProxy` | `process.env.https_proxy` | `process.env.http_proxy`
44 */
45 protected _getProxy(protocol: DsnProtocol): string | undefined;
46 /** Returns a build request option object used by request */
47 protected _getRequestOptions(urlParts: URLParts): http.RequestOptions | https.RequestOptions;
48 /**
49 * Gets the time that given category is disabled until for rate limiting
50 */
51 protected _disabledUntil(requestType: SentryRequestType): Date;
52 /**
53 * Checks if a category is rate limited
54 */
55 protected _isRateLimited(requestType: SentryRequestType): boolean;
56 /**
57 * Sets internal _rateLimits from incoming headers. Returns true if headers contains a non-empty rate limiting header.
58 */
59 protected _handleRateLimit(headers: Record<string, string | null>): boolean;
60 /** JSDoc */
61 protected _send(sentryRequest: SentryRequest, originalPayload?: Event | Session | SessionAggregates): Promise<Response>;
62}
63//# sourceMappingURL=index.d.ts.map
\No newline at end of file