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