UNPKG

3.48 kBTypeScriptView Raw
1import { Integrations as CoreIntegrations } from '@sentry/core';
2import type { StackParser } from '@sentry/types';
3import { NodeClient } from './client';
4import { Console, Context, ContextLines, Http, LinkedErrors, LocalVariables, Modules, OnUncaughtException, OnUnhandledRejection, RequestData } from './integrations';
5import type { NodeOptions } from './types';
6export declare const defaultIntegrations: (Console | Http | OnUncaughtException | OnUnhandledRejection | ContextLines | LinkedErrors | Modules | Context | RequestData | LocalVariables | CoreIntegrations.InboundFilters | CoreIntegrations.FunctionToString)[];
7/**
8 * The Sentry Node SDK Client.
9 *
10 * To use this SDK, call the {@link init} function as early as possible in the
11 * main entry module. To set context information or send manual events, use the
12 * provided methods.
13 *
14 * @example
15 * ```
16 *
17 * const { init } = require('@sentry/node');
18 *
19 * init({
20 * dsn: '__DSN__',
21 * // ...
22 * });
23 * ```
24 *
25 * @example
26 * ```
27 *
28 * const { configureScope } = require('@sentry/node');
29 * configureScope((scope: Scope) => {
30 * scope.setExtra({ battery: 0.7 });
31 * scope.setTag({ user_mode: 'admin' });
32 * scope.setUser({ id: '4711' });
33 * });
34 * ```
35 *
36 * @example
37 * ```
38 *
39 * const { addBreadcrumb } = require('@sentry/node');
40 * addBreadcrumb({
41 * message: 'My Breadcrumb',
42 * // ...
43 * });
44 * ```
45 *
46 * @example
47 * ```
48 *
49 * const Sentry = require('@sentry/node');
50 * Sentry.captureMessage('Hello, world!');
51 * Sentry.captureException(new Error('Good bye'));
52 * Sentry.captureEvent({
53 * message: 'Manual',
54 * stacktrace: [
55 * // ...
56 * ],
57 * });
58 * ```
59 *
60 * @see {@link NodeOptions} for documentation on configuration options.
61 */
62export declare function init(options?: NodeOptions): void;
63/**
64 * This is the getter for lastEventId.
65 *
66 * @returns The last event id of a captured event.
67 */
68export declare function lastEventId(): string | undefined;
69/**
70 * Call `flush()` on the current client, if there is one. See {@link Client.flush}.
71 *
72 * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause
73 * the client to wait until all events are sent before resolving the promise.
74 * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
75 * doesn't (or if there's no client defined).
76 */
77export declare function flush(timeout?: number): Promise<boolean>;
78/**
79 * Call `close()` on the current client, if there is one. See {@link Client.close}.
80 *
81 * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this
82 * parameter will cause the client to wait until all events are sent before disabling itself.
83 * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
84 * doesn't (or if there's no client defined).
85 */
86export declare function close(timeout?: number): Promise<boolean>;
87/**
88 * Function that takes an instance of NodeClient and checks if autoSessionTracking option is enabled for that client
89 */
90export declare function isAutoSessionTrackingEnabled(client?: NodeClient): boolean;
91/**
92 * Returns a release dynamically from environment variables.
93 */
94export declare function getSentryRelease(fallback?: string): string | undefined;
95/** Node.js stack parser */
96export declare const defaultStackParser: StackParser;
97//# sourceMappingURL=sdk.d.ts.map
\No newline at end of file