1 | Object.defineProperty(exports, "__esModule", { value: true });
|
2 | var tslib_1 = require("tslib");
|
3 | var core_1 = require("@sentry/core");
|
4 | var hub_1 = require("@sentry/hub");
|
5 | var utils_1 = require("@sentry/utils");
|
6 | var domain = require("domain");
|
7 | var client_1 = require("./client");
|
8 | var integrations_1 = require("./integrations");
|
9 | exports.defaultIntegrations = [
|
10 |
|
11 | new core_1.Integrations.InboundFilters(),
|
12 | new core_1.Integrations.FunctionToString(),
|
13 |
|
14 | new integrations_1.Console(),
|
15 | new integrations_1.Http(),
|
16 |
|
17 | new integrations_1.OnUncaughtException(),
|
18 | new integrations_1.OnUnhandledRejection(),
|
19 |
|
20 | new integrations_1.LinkedErrors(),
|
21 | ];
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | function init(options) {
|
78 | if (options === void 0) { options = {}; }
|
79 | if (options.defaultIntegrations === undefined) {
|
80 | options.defaultIntegrations = exports.defaultIntegrations;
|
81 | }
|
82 | if (options.dsn === undefined && process.env.SENTRY_DSN) {
|
83 | options.dsn = process.env.SENTRY_DSN;
|
84 | }
|
85 | if (options.release === undefined) {
|
86 | var global_1 = utils_1.getGlobalObject();
|
87 |
|
88 | if (process.env.SENTRY_RELEASE) {
|
89 | options.release = process.env.SENTRY_RELEASE;
|
90 | }
|
91 |
|
92 | else if (global_1.SENTRY_RELEASE && global_1.SENTRY_RELEASE.id) {
|
93 | options.release = global_1.SENTRY_RELEASE.id;
|
94 | }
|
95 | }
|
96 | if (options.environment === undefined && process.env.SENTRY_ENVIRONMENT) {
|
97 | options.environment = process.env.SENTRY_ENVIRONMENT;
|
98 | }
|
99 | if (domain.active) {
|
100 | hub_1.setHubOnCarrier(hub_1.getMainCarrier(), core_1.getCurrentHub());
|
101 | }
|
102 | core_1.initAndBind(client_1.NodeClient, options);
|
103 | }
|
104 | exports.init = init;
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 | function lastEventId() {
|
111 | return core_1.getCurrentHub().lastEventId();
|
112 | }
|
113 | exports.lastEventId = lastEventId;
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 | function flush(timeout) {
|
121 | return tslib_1.__awaiter(this, void 0, void 0, function () {
|
122 | var client;
|
123 | return tslib_1.__generator(this, function (_a) {
|
124 | client = core_1.getCurrentHub().getClient();
|
125 | if (client) {
|
126 | return [2 , client.flush(timeout)];
|
127 | }
|
128 | return [2 , Promise.reject(false)];
|
129 | });
|
130 | });
|
131 | }
|
132 | exports.flush = flush;
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 | function close(timeout) {
|
140 | return tslib_1.__awaiter(this, void 0, void 0, function () {
|
141 | var client;
|
142 | return tslib_1.__generator(this, function (_a) {
|
143 | client = core_1.getCurrentHub().getClient();
|
144 | if (client) {
|
145 | return [2 , client.close(timeout)];
|
146 | }
|
147 | return [2 , Promise.reject(false)];
|
148 | });
|
149 | });
|
150 | }
|
151 | exports.close = close;
|
152 |
|
\ | No newline at end of file |