1 | import type { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, Outcome, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, 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 _integrationsInitialized: boolean;
|
45 |
|
46 | protected _numProcessing: number;
|
47 |
|
48 | private _outcomes;
|
49 | private _hooks;
|
50 | private _eventProcessors;
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 | protected constructor(options: O);
|
57 | /**
|
58 | * @inheritDoc
|
59 | */
|
60 | captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined;
|
61 | /**
|
62 | * @inheritDoc
|
63 | */
|
64 | captureMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint, scope?: Scope): string | undefined;
|
65 | /**
|
66 | * @inheritDoc
|
67 | */
|
68 | captureEvent(event: Event, hint?: EventHint, scope?: Scope): string | undefined;
|
69 | /**
|
70 | * @inheritDoc
|
71 | */
|
72 | captureSession(session: Session): void;
|
73 | /**
|
74 | * @inheritDoc
|
75 | */
|
76 | getDsn(): DsnComponents | undefined;
|
77 | /**
|
78 | * @inheritDoc
|
79 | */
|
80 | getOptions(): O;
|
81 | /**
|
82 | * @see SdkMetadata in @sentry/types
|
83 | *
|
84 | * @return The metadata of the SDK
|
85 | */
|
86 | getSdkMetadata(): SdkMetadata | undefined;
|
87 | /**
|
88 | * @inheritDoc
|
89 | */
|
90 | getTransport(): Transport | undefined;
|
91 | /**
|
92 | * @inheritDoc
|
93 | */
|
94 | flush(timeout?: number): PromiseLike<boolean>;
|
95 | /**
|
96 | * @inheritDoc
|
97 | */
|
98 | close(timeout?: number): PromiseLike<boolean>;
|
99 | /** Get all installed event processors. */
|
100 | getEventProcessors(): EventProcessor[];
|
101 | /** @inheritDoc */
|
102 | addEventProcessor(eventProcessor: EventProcessor): void;
|
103 | /**
|
104 | * Sets up the integrations
|
105 | */
|
106 | setupIntegrations(forceInitialize?: boolean): void;
|
107 | /**
|
108 | * Gets an installed integration by its `id`.
|
109 | *
|
110 | * @returns The installed integration or `undefined` if no integration with that `id` was installed.
|
111 | */
|
112 | getIntegrationById(integrationId: string): Integration | undefined;
|
113 | /**
|
114 | * @inheritDoc
|
115 | */
|
116 | getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null;
|
117 | /**
|
118 | * @inheritDoc
|
119 | */
|
120 | addIntegration(integration: Integration): void;
|
121 | /**
|
122 | * @inheritDoc
|
123 | */
|
124 | sendEvent(event: Event, hint?: EventHint): void;
|
125 | /**
|
126 | * @inheritDoc
|
127 | */
|
128 | sendSession(session: Session | SessionAggregates): void;
|
129 | /**
|
130 | * @inheritDoc
|
131 | */
|
132 | recordDroppedEvent(reason: EventDropReason, category: DataCategory, _event?: Event): void;
|
133 | /** @inheritdoc */
|
134 | on(hook: 'startTransaction', callback: (transaction: Transaction) => void): void;
|
135 | /** @inheritdoc */
|
136 | on(hook: 'finishTransaction', callback: (transaction: Transaction) => void): void;
|
137 | /** @inheritdoc */
|
138 | on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): void;
|
139 | /** @inheritdoc */
|
140 | on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint) => void): void;
|
141 | /** @inheritdoc */
|
142 | on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint) => void): void;
|
143 | /** @inheritdoc */
|
144 | on(hook: 'afterSendEvent', callback: (event: Event, sendResponse: TransportMakeRequestResponse | void) => void): void;
|
145 | /** @inheritdoc */
|
146 | on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): void;
|
147 | /** @inheritdoc */
|
148 | on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext) => void): void;
|
149 | /** @inheritdoc */
|
150 | on(hook: 'otelSpanEnd', callback: (otelSpan: unknown, mutableOptions: {
|
151 | drop: boolean;
|
152 | }) => void): void;
|
153 | /** @inheritdoc */
|
154 | on(hook: 'beforeSendFeedback', callback: (feedback: FeedbackEvent, options?: {
|
155 | includeReplay: boolean;
|
156 | }) => void): void;
|
157 | /** @inheritdoc */
|
158 | emit(hook: 'startTransaction', transaction: Transaction): void;
|
159 | /** @inheritdoc */
|
160 | emit(hook: 'finishTransaction', transaction: Transaction): void;
|
161 | /** @inheritdoc */
|
162 | emit(hook: 'beforeEnvelope', envelope: Envelope): void;
|
163 | /** @inheritdoc */
|
164 | emit(hook: 'beforeSendEvent', event: Event, hint?: EventHint): void;
|
165 | /** @inheritdoc */
|
166 | emit(hook: 'preprocessEvent', event: Event, hint?: EventHint): void;
|
167 | /** @inheritdoc */
|
168 | emit(hook: 'afterSendEvent', event: Event, sendResponse: TransportMakeRequestResponse | void): void;
|
169 | /** @inheritdoc */
|
170 | emit(hook: 'beforeAddBreadcrumb', breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;
|
171 | /** @inheritdoc */
|
172 | emit(hook: 'createDsc', dsc: DynamicSamplingContext): void;
|
173 | /** @inheritdoc */
|
174 | emit(hook: 'otelSpanEnd', otelSpan: unknown, mutableOptions: {
|
175 | drop: boolean;
|
176 | }): void;
|
177 | /** @inheritdoc */
|
178 | emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: {
|
179 | includeReplay: boolean;
|
180 | }): void;
|
181 | /** Updates existing session based on the provided event */
|
182 | protected _updateSessionFromEvent(session: Session, event: Event): void;
|
183 | /**
|
184 | * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
|
185 | * "no" (resolving to `false`) in order to give the client a chance to potentially finish first.
|
186 | *
|
187 | * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not
|
188 | * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to
|
189 | * `true`.
|
190 | * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
|
191 | * `false` otherwise
|
192 | */
|
193 | protected _isClientDoneProcessing(timeout?: number): PromiseLike<boolean>;
|
194 | /** Determines whether this SDK is enabled and a transport is present. */
|
195 | protected _isEnabled(): boolean;
|
196 | /**
|
197 | * Adds common information to events.
|
198 | *
|
199 | * The information includes release and environment from `options`,
|
200 | * breadcrumbs and context (extra, tags and user) from the scope.
|
201 | *
|
202 | * Information that is already present in the event is never overwritten. For
|
203 | * nested objects, such as the context, keys are merged.
|
204 | *
|
205 | * @param event The original event.
|
206 | * @param hint May contain additional information about the original exception.
|
207 | * @param scope A scope containing event metadata.
|
208 | * @returns A new event with more information.
|
209 | */
|
210 | protected _prepareEvent(event: Event, hint: EventHint, scope?: Scope): PromiseLike<Event | null>;
|
211 | /**
|
212 | * Processes the event and logs an error in case of rejection
|
213 | * @param event
|
214 | * @param hint
|
215 | * @param scope
|
216 | */
|
217 | protected _captureEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<string | undefined>;
|
218 | /**
|
219 | * Processes an event (either error or message) and sends it to Sentry.
|
220 | *
|
221 | * This also adds breadcrumbs and context information to the event. However,
|
222 | * platform specific meta data (such as the User's IP address) must be added
|
223 | * by the SDK implementor.
|
224 | *
|
225 | *
|
226 | * @param event The event to send to Sentry.
|
227 | * @param hint May contain additional information about the original exception.
|
228 | * @param scope A scope containing event metadata.
|
229 | * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
|
230 | */
|
231 | protected _processEvent(event: Event, hint: EventHint, scope?: Scope): PromiseLike<Event>;
|
232 | /**
|
233 | * Occupies the client with processing and event
|
234 | */
|
235 | protected _process<T>(promise: PromiseLike<T>): void;
|
236 | /**
|
237 | * @inheritdoc
|
238 | */
|
239 | protected _sendEnvelope(envelope: Envelope): PromiseLike<void | TransportMakeRequestResponse> | void;
|
240 | /**
|
241 | * Clears outcomes on this client and returns them.
|
242 | */
|
243 | protected _clearOutcomes(): Outcome[];
|
244 | /**
|
245 | * @inheritDoc
|
246 | */
|
247 | abstract eventFromException(_exception: any, _hint?: EventHint): PromiseLike<Event>;
|
248 | /**
|
249 | * @inheritDoc
|
250 | */
|
251 | abstract eventFromMessage(_message: string, _level?: Severity | SeverityLevel, _hint?: EventHint): PromiseLike<Event>;
|
252 | }
|
253 | //# sourceMappingURL=baseclient.d.ts.map |
\ | No newline at end of file |