1 | import { Scope, Session } from '@sentry/hub';
|
2 | import { Client, Event, EventHint, Integration, IntegrationClass, Options, Severity } from '@sentry/types';
|
3 | import { Dsn } from '@sentry/utils';
|
4 | import { Backend, BackendClass } from './basebackend';
|
5 | import { IntegrationIndex } from './integration';
|
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 |
|
36 |
|
37 |
|
38 | export declare abstract class BaseClient<B extends Backend, O extends Options> implements Client<O> {
|
39 | |
40 |
|
41 |
|
42 |
|
43 |
|
44 | protected readonly _backend: B;
|
45 |
|
46 | protected readonly _options: O;
|
47 |
|
48 | protected readonly _dsn?: Dsn;
|
49 |
|
50 | protected _integrations: IntegrationIndex;
|
51 |
|
52 | protected _numProcessing: number;
|
53 | |
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | protected constructor(backendClass: BackendClass<B, O>, options: O);
|
60 | /**
|
61 | * @inheritDoc
|
62 | */
|
63 | captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined;
|
64 | /**
|
65 | * @inheritDoc
|
66 | */
|
67 | captureMessage(message: string, level?: Severity, hint?: EventHint, scope?: Scope): string | undefined;
|
68 | /**
|
69 | * @inheritDoc
|
70 | */
|
71 | captureEvent(event: Event, hint?: EventHint, scope?: Scope): string | undefined;
|
72 | /**
|
73 | * @inheritDoc
|
74 | */
|
75 | captureSession(session: Session): void;
|
76 | /**
|
77 | * @inheritDoc
|
78 | */
|
79 | getDsn(): Dsn | undefined;
|
80 | /**
|
81 | * @inheritDoc
|
82 | */
|
83 | getOptions(): O;
|
84 | /**
|
85 | * @inheritDoc
|
86 | */
|
87 | flush(timeout?: number): PromiseLike<boolean>;
|
88 | /**
|
89 | * @inheritDoc
|
90 | */
|
91 | close(timeout?: number): PromiseLike<boolean>;
|
92 | /**
|
93 | * Sets up the integrations
|
94 | */
|
95 | setupIntegrations(): void;
|
96 | /**
|
97 | * @inheritDoc
|
98 | */
|
99 | getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null;
|
100 | /** Updates existing session based on the provided event */
|
101 | protected _updateSessionFromEvent(session: Session, event: Event): void;
|
102 | /** Deliver captured session to Sentry */
|
103 | protected _sendSession(session: Session): void;
|
104 | /**
|
105 | * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
|
106 | * "no" (resolving to `false`) in order to give the client a chance to potentially finish first.
|
107 | *
|
108 | * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not
|
109 | * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to
|
110 | * `true`.
|
111 | * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
|
112 | * `false` otherwise
|
113 | */
|
114 | protected _isClientDoneProcessing(timeout?: number): PromiseLike<boolean>;
|
115 | /** Returns the current backend. */
|
116 | protected _getBackend(): B;
|
117 | /** Determines whether this SDK is enabled and a valid Dsn is present. */
|
118 | protected _isEnabled(): boolean;
|
119 | /**
|
120 | * Adds common information to events.
|
121 | *
|
122 | * The information includes release and environment from `options`,
|
123 | * breadcrumbs and context (extra, tags and user) from the scope.
|
124 | *
|
125 | * Information that is already present in the event is never overwritten. For
|
126 | * nested objects, such as the context, keys are merged.
|
127 | *
|
128 | * @param event The original event.
|
129 | * @param hint May contain additional information about the original exception.
|
130 | * @param scope A scope containing event metadata.
|
131 | * @returns A new event with more information.
|
132 | */
|
133 | protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null>;
|
134 | /**
|
135 | * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.
|
136 | * Normalized keys:
|
137 | * - `breadcrumbs.data`
|
138 | * - `user`
|
139 | * - `contexts`
|
140 | * - `extra`
|
141 | * @param event Event
|
142 | * @returns Normalized event
|
143 | */
|
144 | protected _normalizeEvent(event: Event | null, depth: number): Event | null;
|
145 | /**
|
146 | * Enhances event using the client configuration.
|
147 | * It takes care of all "static" values like environment, release and `dist`,
|
148 | * as well as truncating overly long values.
|
149 | * @param event event instance to be enhanced
|
150 | */
|
151 | protected _applyClientOptions(event: Event): void;
|
152 | /**
|
153 | * This function adds all used integrations to the SDK info in the event.
|
154 | * @param event The event that will be filled with all integrations.
|
155 | */
|
156 | protected _applyIntegrationsMetadata(event: Event): void;
|
157 | /**
|
158 | * Tells the backend to send this event
|
159 | * @param event The Sentry event to send
|
160 | */
|
161 | protected _sendEvent(event: Event): void;
|
162 | /**
|
163 | * Processes the event and logs an error in case of rejection
|
164 | * @param event
|
165 | * @param hint
|
166 | * @param scope
|
167 | */
|
168 | protected _captureEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<string | undefined>;
|
169 | /**
|
170 | * Processes an event (either error or message) and sends it to Sentry.
|
171 | *
|
172 | * This also adds breadcrumbs and context information to the event. However,
|
173 | * platform specific meta data (such as the User's IP address) must be added
|
174 | * by the SDK implementor.
|
175 | *
|
176 | *
|
177 | * @param event The event to send to Sentry.
|
178 | * @param hint May contain additional information about the original exception.
|
179 | * @param scope A scope containing event metadata.
|
180 | * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
|
181 | */
|
182 | protected _processEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<Event>;
|
183 | /**
|
184 | * Occupies the client with processing and event
|
185 | */
|
186 | protected _process<T>(promise: PromiseLike<T>): void;
|
187 | /**
|
188 | * Verifies that return value of configured `beforeSend` is of expected type.
|
189 | */
|
190 | protected _ensureBeforeSendRv(rv: PromiseLike<Event | null> | Event | null): PromiseLike<Event | null> | Event | null;
|
191 | }
|
192 | //# sourceMappingURL=baseclient.d.ts.map |
\ | No newline at end of file |