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