1 | import type { CaptureContext, CheckIn, Event, EventHint, EventProcessor, Extra, Extras, MonitorConfig, Primitive, Session, SessionContext, SeverityLevel, User } from '@sentry/types';
|
2 | import type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';
|
3 | /**
|
4 | * Captures an exception event and sends it to Sentry.
|
5 | *
|
6 | * @param exception The exception to capture.
|
7 | * @param hint Optional additional data to attach to the Sentry event.
|
8 | * @returns the id of the captured Sentry event.
|
9 | */
|
10 | export declare function captureException(exception: any, hint?: ExclusiveEventHintOrCaptureContext): string;
|
11 | /**
|
12 | * Captures a message event and sends it to Sentry.
|
13 | *
|
14 | * @param exception The exception to capture.
|
15 | * @param captureContext Define the level of the message or pass in additional data to attach to the message.
|
16 | * @returns the id of the captured message.
|
17 | */
|
18 | export declare function captureMessage(message: string, captureContext?: CaptureContext | SeverityLevel): string;
|
19 | /**
|
20 | * Captures a manually created event and sends it to Sentry.
|
21 | *
|
22 | * @param exception The event to send to Sentry.
|
23 | * @param hint Optional additional data to attach to the Sentry event.
|
24 | * @returns the id of the captured event.
|
25 | */
|
26 | export declare function captureEvent(event: Event, hint?: EventHint): string;
|
27 | /**
|
28 | * Sets context data with the given name.
|
29 | * @param name of the context
|
30 | * @param context Any kind of data. This data will be normalized.
|
31 | */
|
32 | export declare function setContext(name: string, context: {
|
33 | [key: string]: any;
|
34 | } | null): void;
|
35 | /**
|
36 | * Set an object that will be merged sent as extra data with the event.
|
37 | * @param extras Extras object to merge into current context.
|
38 | */
|
39 | export declare function setExtras(extras: Extras): void;
|
40 | /**
|
41 | * Set key:value that will be sent as extra data with the event.
|
42 | * @param key String of extra
|
43 | * @param extra Any kind of data. This data will be normalized.
|
44 | */
|
45 | export declare function setExtra(key: string, extra: Extra): void;
|
46 | /**
|
47 | * Set an object that will be merged sent as tags data with the event.
|
48 | * @param tags Tags context object to merge into current context.
|
49 | */
|
50 | export declare function setTags(tags: {
|
51 | [key: string]: Primitive;
|
52 | }): void;
|
53 | /**
|
54 | * Set key:value that will be sent as tags data with the event.
|
55 | *
|
56 | * Can also be used to unset a tag, by passing `undefined`.
|
57 | *
|
58 | * @param key String key of tag
|
59 | * @param value Value of tag
|
60 | */
|
61 | export declare function setTag(key: string, value: Primitive): void;
|
62 | /**
|
63 | * Updates user context information for future events.
|
64 | *
|
65 | * @param user User context object to be set in the current context. Pass `null` to unset the user.
|
66 | */
|
67 | export declare function setUser(user: User | null): void;
|
68 | /**
|
69 | * The last error event id of the isolation scope.
|
70 | *
|
71 | * Warning: This function really returns the last recorded error event id on the current
|
72 | * isolation scope. If you call this function after handling a certain error and another error
|
73 | * is captured in between, the last one is returned instead of the one you might expect.
|
74 | * Also, ids of events that were never sent to Sentry (for example because
|
75 | * they were dropped in `beforeSend`) could be returned.
|
76 | *
|
77 | * @returns The last event id of the isolation scope.
|
78 | */
|
79 | export declare function lastEventId(): string | undefined;
|
80 | /**
|
81 | * Create a cron monitor check in and send it to Sentry.
|
82 | *
|
83 | * @param checkIn An object that describes a check in.
|
84 | * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
85 | * to create a monitor automatically when sending a check in.
|
86 | */
|
87 | export declare function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorConfig): string;
|
88 | /**
|
89 | * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.
|
90 | *
|
91 | * @param monitorSlug The distinct slug of the monitor.
|
92 | * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
93 | * to create a monitor automatically when sending a check in.
|
94 | */
|
95 | export declare function withMonitor<T>(monitorSlug: CheckIn['monitorSlug'], callback: () => T, upsertMonitorConfig?: MonitorConfig): T;
|
96 | /**
|
97 | * Call `flush()` on the current client, if there is one. See {@link Client.flush}.
|
98 | *
|
99 | * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause
|
100 | * the client to wait until all events are sent before resolving the promise.
|
101 | * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
|
102 | * doesn't (or if there's no client defined).
|
103 | */
|
104 | export declare function flush(timeout?: number): Promise<boolean>;
|
105 | /**
|
106 | * Call `close()` on the current client, if there is one. See {@link Client.close}.
|
107 | *
|
108 | * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this
|
109 | * parameter will cause the client to wait until all events are sent before disabling itself.
|
110 | * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
|
111 | * doesn't (or if there's no client defined).
|
112 | */
|
113 | export declare function close(timeout?: number): Promise<boolean>;
|
114 | /**
|
115 | * Returns true if Sentry has been properly initialized.
|
116 | */
|
117 | export declare function isInitialized(): boolean;
|
118 | /** If the SDK is initialized & enabled. */
|
119 | export declare function isEnabled(): boolean;
|
120 | /**
|
121 | * Add an event processor.
|
122 | * This will be added to the current isolation scope, ensuring any event that is processed in the current execution
|
123 | * context will have the processor applied.
|
124 | */
|
125 | export declare function addEventProcessor(callback: EventProcessor): void;
|
126 | /**
|
127 | * Start a session on the current isolation scope.
|
128 | *
|
129 | * @param context (optional) additional properties to be applied to the returned session object
|
130 | *
|
131 | * @returns the new active session
|
132 | */
|
133 | export declare function startSession(context?: SessionContext): Session;
|
134 | /**
|
135 | * End the session on the current isolation scope.
|
136 | */
|
137 | export declare function endSession(): void;
|
138 | /**
|
139 | * Sends the current session on the scope to Sentry
|
140 | *
|
141 | * @param end If set the session will be marked as exited and removed from the scope.
|
142 | * Defaults to `false`.
|
143 | */
|
144 | export declare function captureSession(end?: boolean): void;
|
145 | //# sourceMappingURL=exports.d.ts.map |
\ | No newline at end of file |