1 | import { Event, EventHint, Options, Session, Severity, Transport } from '@sentry/types';
|
2 | /**
|
3 | * Internal platform-dependent Sentry SDK Backend.
|
4 | *
|
5 | * While {@link Client} contains business logic specific to an SDK, the
|
6 | * Backend offers platform specific implementations for low-level operations.
|
7 | * These are persisting and loading information, sending events, and hooking
|
8 | * into the environment.
|
9 | *
|
10 | * Backends receive a handle to the Client in their constructor. When a
|
11 | * Backend automatically generates events, it must pass them to
|
12 | * the Client for validation and processing first.
|
13 | *
|
14 | * Usually, the Client will be of corresponding type, e.g. NodeBackend
|
15 | * receives NodeClient. However, higher-level SDKs can choose to instantiate
|
16 | * multiple Backends and delegate tasks between them. In this case, an event
|
17 | * generated by one backend might very well be sent by another one.
|
18 | *
|
19 | * The client also provides access to options via {@link Client.getOptions}.
|
20 | * @hidden
|
21 | */
|
22 | export interface Backend {
|
23 | /** Creates a {@link Event} from an exception. */
|
24 | eventFromException(exception: any, hint?: EventHint): PromiseLike<Event>;
|
25 | /** Creates a {@link Event} from a plain message. */
|
26 | eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;
|
27 | /** Submits the event to Sentry */
|
28 | sendEvent(event: Event): void;
|
29 | /** Submits the session to Sentry */
|
30 | sendSession(session: Session): void;
|
31 | /**
|
32 | * Returns the transport that is used by the backend.
|
33 | * Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.
|
34 | *
|
35 | * @returns The transport.
|
36 | */
|
37 | getTransport(): Transport;
|
38 | }
|
39 | /**
|
40 | * A class object that can instantiate Backend objects.
|
41 | * @hidden
|
42 | */
|
43 | export declare type BackendClass<B extends Backend, O extends Options> = new (options: O) => B;
|
44 | /**
|
45 | * This is the base implemention of a Backend.
|
46 | * @hidden
|
47 | */
|
48 | export declare abstract class BaseBackend<O extends Options> implements Backend {
|
49 | /** Options passed to the SDK. */
|
50 | protected readonly _options: O;
|
51 | /** Cached transport used internally. */
|
52 | protected _transport: Transport;
|
53 | /** Creates a new backend instance. */
|
54 | constructor(options: O);
|
55 | /**
|
56 | * @inheritDoc
|
57 | */
|
58 | eventFromException(_exception: any, _hint?: EventHint): PromiseLike<Event>;
|
59 | /**
|
60 | * @inheritDoc
|
61 | */
|
62 | eventFromMessage(_message: string, _level?: Severity, _hint?: EventHint): PromiseLike<Event>;
|
63 | /**
|
64 | * @inheritDoc
|
65 | */
|
66 | sendEvent(event: Event): void;
|
67 | /**
|
68 | * @inheritDoc
|
69 | */
|
70 | sendSession(session: Session): void;
|
71 | /**
|
72 | * @inheritDoc
|
73 | */
|
74 | getTransport(): Transport;
|
75 | /**
|
76 | * Sets up the transport so it can be used later to send requests.
|
77 | */
|
78 | protected _setupTransport(): Transport;
|
79 | }
|
80 | //# sourceMappingURL=basebackend.d.ts.map |
\ | No newline at end of file |