1 | import type { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, Outcome, ParameterizedString, SdkMetadata, Session, SessionAggregates, SeverityLevel, Span, SpanAttributes, SpanContextData, StartSpanOptions, Transport, TransportMakeRequestResponse } from '@sentry/types';
|
2 | import type { IntegrationIndex } from './integration';
|
3 | import type { Scope } from './scope';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export declare abstract class BaseClient<O extends ClientOptions> implements Client<O> {
|
36 |
|
37 | protected readonly _options: O;
|
38 |
|
39 | protected readonly _dsn?: DsnComponents;
|
40 | protected readonly _transport?: Transport;
|
41 |
|
42 | protected _integrations: IntegrationIndex;
|
43 |
|
44 | protected _numProcessing: number;
|
45 | protected _eventProcessors: EventProcessor[];
|
46 |
|
47 | private _outcomes;
|
48 | private _hooks;
|
49 | |
50 |
|
51 |
|
52 |
|
53 |
|
54 | protected constructor(options: O);
|
55 | /**
|
56 | * @inheritDoc
|
57 | */
|
58 | captureException(exception: any, hint?: EventHint, scope?: Scope): string;
|
59 | /**
|
60 | * @inheritDoc
|
61 | */
|
62 | captureMessage(message: ParameterizedString, level?: SeverityLevel, hint?: EventHint, currentScope?: Scope): string;
|
63 | /**
|
64 | * @inheritDoc
|
65 | */
|
66 | captureEvent(event: Event, hint?: EventHint, currentScope?: Scope): string;
|
67 | /**
|
68 | * @inheritDoc
|
69 | */
|
70 | captureSession(session: Session): void;
|
71 | /**
|
72 | * @inheritDoc
|
73 | */
|
74 | getDsn(): DsnComponents | undefined;
|
75 | /**
|
76 | * @inheritDoc
|
77 | */
|
78 | getOptions(): O;
|
79 | /**
|
80 | * @see SdkMetadata in @sentry/types
|
81 | *
|
82 | * @return The metadata of the SDK
|
83 | */
|
84 | getSdkMetadata(): SdkMetadata | undefined;
|
85 | /**
|
86 | * @inheritDoc
|
87 | */
|
88 | getTransport(): Transport | undefined;
|
89 | /**
|
90 | * @inheritDoc
|
91 | */
|
92 | flush(timeout?: number): PromiseLike<boolean>;
|
93 | /**
|
94 | * @inheritDoc
|
95 | */
|
96 | close(timeout?: number): PromiseLike<boolean>;
|
97 | /** Get all installed event processors. */
|
98 | getEventProcessors(): EventProcessor[];
|
99 | /** @inheritDoc */
|
100 | addEventProcessor(eventProcessor: EventProcessor): void;
|
101 | /** @inheritdoc */
|
102 | init(): void;
|
103 | /**
|
104 | * Gets an installed integration by its name.
|
105 | *
|
106 | * @returns The installed integration or `undefined` if no integration with that `name` was installed.
|
107 | */
|
108 | getIntegrationByName<T extends Integration = Integration>(integrationName: string): T | undefined;
|
109 | /**
|
110 | * @inheritDoc
|
111 | */
|
112 | addIntegration(integration: Integration): void;
|
113 | /**
|
114 | * @inheritDoc
|
115 | */
|
116 | sendEvent(event: Event, hint?: EventHint): void;
|
117 | /**
|
118 | * @inheritDoc
|
119 | */
|
120 | sendSession(session: Session | SessionAggregates): void;
|
121 | /**
|
122 | * @inheritDoc
|
123 | */
|
124 | recordDroppedEvent(reason: EventDropReason, category: DataCategory, _event?: Event): void;
|
125 | /** @inheritdoc */
|
126 | on(hook: 'spanStart', callback: (span: Span) => void): void;
|
127 | /** @inheritdoc */
|
128 | on(hook: 'spanEnd', callback: (span: Span) => void): void;
|
129 | /** @inheritdoc */
|
130 | on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): void;
|
131 | /** @inheritdoc */
|
132 | on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): void;
|
133 | /** @inheritdoc */
|
134 | on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint) => void): void;
|
135 | /** @inheritdoc */
|
136 | on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint) => void): void;
|
137 | /** @inheritdoc */
|
138 | on(hook: 'afterSendEvent', callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void): void;
|
139 | /** @inheritdoc */
|
140 | on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): void;
|
141 | /** @inheritdoc */
|
142 | on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext) => void): void;
|
143 | /** @inheritdoc */
|
144 | on(hook: 'beforeSendFeedback', callback: (feedback: FeedbackEvent, options?: {
|
145 | includeReplay: boolean;
|
146 | }) => void): void;
|
147 | /** @inheritdoc */
|
148 | on(hook: 'beforeSampling', callback: (samplingData: {
|
149 | spanAttributes: SpanAttributes;
|
150 | spanName: string;
|
151 | parentSampled?: boolean;
|
152 | parentContext?: SpanContextData;
|
153 | }, samplingDecision: {
|
154 | decision: boolean;
|
155 | }) => void): void;
|
156 | /** @inheritdoc */
|
157 | on(hook: 'startPageLoadSpan', callback: (options: StartSpanOptions, traceOptions?: {
|
158 | sentryTrace?: string | undefined;
|
159 | baggage?: string | undefined;
|
160 | }) => void): void;
|
161 | /** @inheritdoc */
|
162 | on(hook: 'startNavigationSpan', callback: (options: StartSpanOptions) => void): void;
|
163 | on(hook: 'flush', callback: () => void): void;
|
164 | on(hook: 'close', callback: () => void): void;
|
165 | /** @inheritdoc */
|
166 | emit(hook: 'beforeSampling', samplingData: {
|
167 | spanAttributes: SpanAttributes;
|
168 | spanName: string;
|
169 | parentSampled?: boolean;
|
170 | parentContext?: SpanContextData;
|
171 | }, samplingDecision: {
|
172 | decision: boolean;
|
173 | }): void;
|
174 | /** @inheritdoc */
|
175 | emit(hook: 'spanStart', span: Span): void;
|
176 | /** @inheritdoc */
|
177 | emit(hook: 'spanEnd', span: Span): void;
|
178 | /** @inheritdoc */
|
179 | emit(hook: 'idleSpanEnableAutoFinish', span: Span): void;
|
180 | /** @inheritdoc */
|
181 | emit(hook: 'beforeEnvelope', envelope: Envelope): void;
|
182 | /** @inheritdoc */
|
183 | emit(hook: 'beforeSendEvent', event: Event, hint?: EventHint): void;
|
184 | /** @inheritdoc */
|
185 | emit(hook: 'preprocessEvent', event: Event, hint?: EventHint): void;
|
186 | /** @inheritdoc */
|
187 | emit(hook: 'afterSendEvent', event: Event, sendResponse: TransportMakeRequestResponse): void;
|
188 | /** @inheritdoc */
|
189 | emit(hook: 'beforeAddBreadcrumb', breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;
|
190 | /** @inheritdoc */
|
191 | emit(hook: 'createDsc', dsc: DynamicSamplingContext): void;
|
192 | /** @inheritdoc */
|
193 | emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: {
|
194 | includeReplay: boolean;
|
195 | }): void;
|
196 | /** @inheritdoc */
|
197 | emit(hook: 'startPageLoadSpan', options: StartSpanOptions, traceOptions?: {
|
198 | sentryTrace?: string | undefined;
|
199 | baggage?: string | undefined;
|
200 | }): void;
|
201 | /** @inheritdoc */
|
202 | emit(hook: 'startNavigationSpan', options: StartSpanOptions): void;
|
203 | /** @inheritdoc */
|
204 | emit(hook: 'flush'): void;
|
205 | /** @inheritdoc */
|
206 | emit(hook: 'close'): void;
|
207 | /**
|
208 | * @inheritdoc
|
209 | */
|
210 | sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse>;
|
211 | /** Setup integrations for this client. */
|
212 | protected _setupIntegrations(): void;
|
213 | /** Updates existing session based on the provided event */
|
214 | protected _updateSessionFromEvent(session: Session, event: Event): void;
|
215 | /**
|
216 | * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
|
217 | * "no" (resolving to `false`) in order to give the client a chance to potentially finish first.
|
218 | *
|
219 | * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not
|
220 | * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to
|
221 | * `true`.
|
222 | * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
|
223 | * `false` otherwise
|
224 | */
|
225 | protected _isClientDoneProcessing(timeout?: number): PromiseLike<boolean>;
|
226 | /** Determines whether this SDK is enabled and a transport is present. */
|
227 | protected _isEnabled(): boolean;
|
228 | /**
|
229 | * Adds common information to events.
|
230 | *
|
231 | * The information includes release and environment from `options`,
|
232 | * breadcrumbs and context (extra, tags and user) from the scope.
|
233 | *
|
234 | * Information that is already present in the event is never overwritten. For
|
235 | * nested objects, such as the context, keys are merged.
|
236 | *
|
237 | * @param event The original event.
|
238 | * @param hint May contain additional information about the original exception.
|
239 | * @param currentScope A scope containing event metadata.
|
240 | * @returns A new event with more information.
|
241 | */
|
242 | protected _prepareEvent(event: Event, hint: EventHint, currentScope?: Scope, isolationScope?: import("@sentry/types").Scope): PromiseLike<Event | null>;
|
243 | /**
|
244 | * Processes the event and logs an error in case of rejection
|
245 | * @param event
|
246 | * @param hint
|
247 | * @param scope
|
248 | */
|
249 | protected _captureEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<string | undefined>;
|
250 | /**
|
251 | * Processes an event (either error or message) and sends it to Sentry.
|
252 | *
|
253 | * This also adds breadcrumbs and context information to the event. However,
|
254 | * platform specific meta data (such as the User's IP address) must be added
|
255 | * by the SDK implementor.
|
256 | *
|
257 | *
|
258 | * @param event The event to send to Sentry.
|
259 | * @param hint May contain additional information about the original exception.
|
260 | * @param currentScope A scope containing event metadata.
|
261 | * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
|
262 | */
|
263 | protected _processEvent(event: Event, hint: EventHint, currentScope?: Scope): PromiseLike<Event>;
|
264 | /**
|
265 | * Occupies the client with processing and event
|
266 | */
|
267 | protected _process<T>(promise: PromiseLike<T>): void;
|
268 | /**
|
269 | * Clears outcomes on this client and returns them.
|
270 | */
|
271 | protected _clearOutcomes(): Outcome[];
|
272 | /**
|
273 | * @inheritDoc
|
274 | */
|
275 | abstract eventFromException(_exception: any, _hint?: EventHint): PromiseLike<Event>;
|
276 | /**
|
277 | * @inheritDoc
|
278 | */
|
279 | abstract eventFromMessage(_message: ParameterizedString, _level?: SeverityLevel, _hint?: EventHint): PromiseLike<Event>;
|
280 | }
|
281 | //# sourceMappingURL=baseclient.d.ts.map |
\ | No newline at end of file |