@starko-one/sdk 0.0.0-stage → 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +248 -0
- package/LICENSE +17 -0
- package/NOTICE +58 -0
- package/README.md +81 -2
- package/dist/api-BAFm4Lxj.d.ts +558 -0
- package/dist/api-DNrctwJu.d.cts +558 -0
- package/dist/browser/index.cjs +168 -0
- package/dist/browser/index.d.cts +131 -0
- package/dist/browser/index.d.ts +131 -0
- package/dist/browser/index.js +7 -0
- package/dist/build/rollup.cjs +22 -0
- package/dist/build/rollup.d.cts +34 -0
- package/dist/build/rollup.d.ts +34 -0
- package/dist/build/rollup.js +3 -0
- package/dist/build/vite.cjs +51 -0
- package/dist/build/vite.d.cts +23 -0
- package/dist/build/vite.d.ts +23 -0
- package/dist/build/vite.js +46 -0
- package/dist/build/webpack.cjs +18 -0
- package/dist/build/webpack.d.cts +39 -0
- package/dist/build/webpack.d.ts +39 -0
- package/dist/build/webpack.js +3 -0
- package/dist/chunk-2PM4FRM5.cjs +431 -0
- package/dist/chunk-335HNCOJ.js +249 -0
- package/dist/chunk-3AW5B2WW.js +115 -0
- package/dist/chunk-3R5TQAWD.js +216 -0
- package/dist/chunk-6H5MOPTQ.cjs +1230 -0
- package/dist/chunk-7TKNT3QJ.cjs +2487 -0
- package/dist/chunk-A4WLNFMU.cjs +220 -0
- package/dist/chunk-ALYFFOPR.cjs +134 -0
- package/dist/chunk-BVVFVRMO.js +1113 -0
- package/dist/chunk-CIHNKN62.cjs +15 -0
- package/dist/chunk-CMGCH6HD.js +1212 -0
- package/dist/chunk-D6QAPQ7L.cjs +56 -0
- package/dist/chunk-DUO5V6WZ.js +213 -0
- package/dist/chunk-EC2WZ6PG.js +90 -0
- package/dist/chunk-EFURLFJT.cjs +187 -0
- package/dist/chunk-EROUORMY.js +53 -0
- package/dist/chunk-LXBXFOAP.cjs +96 -0
- package/dist/chunk-MF6SA6DB.js +563 -0
- package/dist/chunk-N5R6ORIB.js +413 -0
- package/dist/chunk-N6R6BWHK.cjs +142 -0
- package/dist/chunk-QAGGN2T7.cjs +225 -0
- package/dist/chunk-QV4HRIDD.cjs +659 -0
- package/dist/chunk-TKNDYQB3.cjs +583 -0
- package/dist/chunk-UI5YC4TH.js +131 -0
- package/dist/chunk-VEHZYLK6.cjs +1151 -0
- package/dist/chunk-VNCWOGTI.js +12 -0
- package/dist/chunk-VWNIOGE6.js +180 -0
- package/dist/chunk-WDKRKGYF.js +608 -0
- package/dist/chunk-XOZIXBUK.js +2462 -0
- package/dist/chunk-ZS3K3SDR.cjs +258 -0
- package/dist/cli/index.cjs +2780 -0
- package/dist/common-DLFAqL2d.d.cts +36 -0
- package/dist/common-DbSXkaw6.d.ts +36 -0
- package/dist/dedupe-Bh5riD8Z.d.cts +13 -0
- package/dist/dedupe-DoYiSx-9.d.ts +13 -0
- package/dist/handler-BcnsnvhF.d.cts +82 -0
- package/dist/handler-qHzilC9T.d.ts +82 -0
- package/dist/index.cjs +309 -0
- package/dist/index.d.cts +187 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +4 -0
- package/dist/next/client.cjs +113 -0
- package/dist/next/client.d.cts +26 -0
- package/dist/next/client.d.ts +26 -0
- package/dist/next/client.js +41 -0
- package/dist/next/config.cjs +277 -0
- package/dist/next/config.d.cts +193 -0
- package/dist/next/config.d.ts +193 -0
- package/dist/next/config.js +263 -0
- package/dist/next/index.cjs +148 -0
- package/dist/next/index.d.cts +32 -0
- package/dist/next/index.d.ts +32 -0
- package/dist/next/index.js +59 -0
- package/dist/node/index.cjs +257 -0
- package/dist/node/index.d.cts +145 -0
- package/dist/node/index.d.ts +145 -0
- package/dist/node/index.js +83 -0
- package/dist/options-BUhWuWJX.d.cts +79 -0
- package/dist/options-BUhWuWJX.d.ts +79 -0
- package/dist/react/index.cjs +107 -0
- package/dist/react/index.d.cts +84 -0
- package/dist/react/index.d.ts +84 -0
- package/dist/react/index.js +103 -0
- package/dist/scope-D1ouJm2h.d.cts +628 -0
- package/dist/scope-D1ouJm2h.d.ts +628 -0
- package/dist/server-edge-7624N3WF.cjs +51 -0
- package/dist/server-edge-BEEXWL7T.js +48 -0
- package/dist/server-node-ET4LIPEC.cjs +27 -0
- package/dist/server-node-TQUVMZUC.js +24 -0
- package/dist/session-C_WzbEN2.d.cts +4 -0
- package/dist/session-C_WzbEN2.d.ts +4 -0
- package/dist/session-propagation-Pr0Zb9Zn.d.cts +30 -0
- package/dist/session-propagation-RM5py1bp.d.ts +30 -0
- package/dist/starko.min.js +6 -0
- package/docs/browser.md +386 -0
- package/docs/configuration.md +310 -0
- package/docs/nextjs.md +488 -0
- package/docs/node.md +427 -0
- package/docs/other-backends.md +232 -0
- package/docs/privacy.md +112 -0
- package/docs/react.md +187 -0
- package/docs/source-maps.md +482 -0
- package/docs/troubleshooting.md +263 -0
- package/docs/widget.md +84 -0
- package/docs/wire-format.md +547 -0
- package/package.json +191 -4
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkVEHZYLK6_cjs = require('../chunk-VEHZYLK6.cjs');
|
|
4
|
+
var chunkA4WLNFMU_cjs = require('../chunk-A4WLNFMU.cjs');
|
|
5
|
+
var chunk2PM4FRM5_cjs = require('../chunk-2PM4FRM5.cjs');
|
|
6
|
+
require('../chunk-ALYFFOPR.cjs');
|
|
7
|
+
var chunk6H5MOPTQ_cjs = require('../chunk-6H5MOPTQ.cjs');
|
|
8
|
+
var chunkCIHNKN62_cjs = require('../chunk-CIHNKN62.cjs');
|
|
9
|
+
require('../chunk-ZS3K3SDR.cjs');
|
|
10
|
+
var chunkQV4HRIDD_cjs = require('../chunk-QV4HRIDD.cjs');
|
|
11
|
+
require('../chunk-N6R6BWHK.cjs');
|
|
12
|
+
|
|
13
|
+
// src/node/express.ts
|
|
14
|
+
function getErrorStatus(error) {
|
|
15
|
+
try {
|
|
16
|
+
if (!error || typeof error !== "object") return void 0;
|
|
17
|
+
const e = error;
|
|
18
|
+
const output = e.output;
|
|
19
|
+
for (const v of [e.status, e.statusCode, e.status_code, output && output.statusCode]) {
|
|
20
|
+
const n = typeof v === "string" ? Number(v) : v;
|
|
21
|
+
if (typeof n === "number" && Number.isInteger(n) && n >= 100 && n <= 599) return n;
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
var defaultShouldHandle = (error) => {
|
|
28
|
+
const status = getErrorStatus(error);
|
|
29
|
+
return status === void 0 || status >= 500;
|
|
30
|
+
};
|
|
31
|
+
function expressRequestHandler() {
|
|
32
|
+
return function starkoRequestHandler(req, _res, next) {
|
|
33
|
+
let entered = false;
|
|
34
|
+
chunk2PM4FRM5_cjs.trackRoute(req);
|
|
35
|
+
try {
|
|
36
|
+
const existing = chunk2PM4FRM5_cjs.storeOf(req);
|
|
37
|
+
if (existing && chunk2PM4FRM5_cjs.getCurrentStore() === existing) {
|
|
38
|
+
entered = true;
|
|
39
|
+
return next();
|
|
40
|
+
}
|
|
41
|
+
chunk2PM4FRM5_cjs.openRequestScope(
|
|
42
|
+
() => {
|
|
43
|
+
entered = true;
|
|
44
|
+
next();
|
|
45
|
+
},
|
|
46
|
+
() => chunk2PM4FRM5_cjs.requestDataFrom(req),
|
|
47
|
+
req
|
|
48
|
+
);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
if (entered) throw err;
|
|
51
|
+
next();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function expressErrorHandler(options = {}) {
|
|
56
|
+
return function starkoErrorHandler(err, req, _res, next) {
|
|
57
|
+
try {
|
|
58
|
+
const should = options.shouldHandleError || defaultShouldHandle;
|
|
59
|
+
let capture = false;
|
|
60
|
+
try {
|
|
61
|
+
capture = should(err);
|
|
62
|
+
} catch {
|
|
63
|
+
capture = defaultShouldHandle(err);
|
|
64
|
+
}
|
|
65
|
+
if (capture) {
|
|
66
|
+
const status = getErrorStatus(err);
|
|
67
|
+
const handled = status !== void 0 && status < 500;
|
|
68
|
+
const data = chunk2PM4FRM5_cjs.requestDataFrom(req);
|
|
69
|
+
const own = chunk2PM4FRM5_cjs.storeOf(req);
|
|
70
|
+
const current = chunk2PM4FRM5_cjs.getCurrentStore();
|
|
71
|
+
const foreign = !!current && (current.source ? current.source !== req : !!current.request);
|
|
72
|
+
const base = own ? own.scope : foreign ? void 0 : chunk2PM4FRM5_cjs.readScope();
|
|
73
|
+
const capture2 = () => chunk2PM4FRM5_cjs.openRequestScope(() => chunkQV4HRIDD_cjs.captureException(err, { mechanism: { type: "middleware", handled } }), data, void 0, base, own ? own.key : req);
|
|
74
|
+
if (own) chunk2PM4FRM5_cjs.runInStore(own, capture2);
|
|
75
|
+
else capture2();
|
|
76
|
+
}
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
next(err);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Object.defineProperty(exports, "CONNECT_TIMEOUT_MS", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return chunkVEHZYLK6_cjs.CONNECT_TIMEOUT_MS; }
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "consoleBreadcrumbsIntegration", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () { return chunkVEHZYLK6_cjs.consoleBreadcrumbsIntegration; }
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "contextLinesIntegration", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () { return chunkVEHZYLK6_cjs.contextLinesIntegration; }
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, "flushOnExitIntegration", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () { return chunkVEHZYLK6_cjs.flushOnExitIntegration; }
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(exports, "getDefaultIntegrations", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () { return chunkVEHZYLK6_cjs.getDefaultIntegrations; }
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "getUnhandledRejectionMode", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () { return chunkVEHZYLK6_cjs.getUnhandledRejectionMode; }
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(exports, "httpServerIntegration", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
get: function () { return chunkVEHZYLK6_cjs.httpServerIntegration; }
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(exports, "init", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () { return chunkVEHZYLK6_cjs.init; }
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(exports, "instrumentServer", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function () { return chunkVEHZYLK6_cjs.instrumentServer; }
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(exports, "makeNodeTransport", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
get: function () { return chunkVEHZYLK6_cjs.makeNodeTransport; }
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(exports, "nodeContextIntegration", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function () { return chunkVEHZYLK6_cjs.nodeContextIntegration; }
|
|
126
|
+
});
|
|
127
|
+
Object.defineProperty(exports, "onUncaughtExceptionIntegration", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function () { return chunkVEHZYLK6_cjs.onUncaughtExceptionIntegration; }
|
|
130
|
+
});
|
|
131
|
+
Object.defineProperty(exports, "onUnhandledRejectionIntegration", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () { return chunkVEHZYLK6_cjs.onUnhandledRejectionIntegration; }
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(exports, "GZIP_THRESHOLD", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () { return chunkA4WLNFMU_cjs.GZIP_THRESHOLD; }
|
|
138
|
+
});
|
|
139
|
+
Object.defineProperty(exports, "makeServerFetchTransport", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function () { return chunkA4WLNFMU_cjs.makeServerFetchTransport; }
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(exports, "nodeIsInApp", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get: function () { return chunkA4WLNFMU_cjs.nodeIsInApp; }
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(exports, "requestDataIntegration", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () { return chunkA4WLNFMU_cjs.requestDataIntegration; }
|
|
150
|
+
});
|
|
151
|
+
Object.defineProperty(exports, "currentRequestKey", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function () { return chunk2PM4FRM5_cjs.currentRequestKey; }
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(exports, "getRequestData", {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
get: function () { return chunk2PM4FRM5_cjs.getRequestData; }
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(exports, "markServing", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function () { return chunk2PM4FRM5_cjs.markServing; }
|
|
162
|
+
});
|
|
163
|
+
Object.defineProperty(exports, "platformWaitUntil", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
get: function () { return chunk2PM4FRM5_cjs.platformWaitUntil; }
|
|
166
|
+
});
|
|
167
|
+
Object.defineProperty(exports, "requestDataFrom", {
|
|
168
|
+
enumerable: true,
|
|
169
|
+
get: function () { return chunk2PM4FRM5_cjs.requestDataFrom; }
|
|
170
|
+
});
|
|
171
|
+
Object.defineProperty(exports, "runWithRequestScope", {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
get: function () { return chunk2PM4FRM5_cjs.runWithRequestScope; }
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(exports, "wrapHandler", {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function () { return chunk2PM4FRM5_cjs.wrapHandler; }
|
|
178
|
+
});
|
|
179
|
+
Object.defineProperty(exports, "dedupeIntegration", {
|
|
180
|
+
enumerable: true,
|
|
181
|
+
get: function () { return chunk6H5MOPTQ_cjs.dedupeIntegration; }
|
|
182
|
+
});
|
|
183
|
+
Object.defineProperty(exports, "SESSION_HEADER", {
|
|
184
|
+
enumerable: true,
|
|
185
|
+
get: function () { return chunkCIHNKN62_cjs.SESSION_HEADER; }
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(exports, "SDK_VERSION", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function () { return chunkQV4HRIDD_cjs.SDK_VERSION; }
|
|
190
|
+
});
|
|
191
|
+
Object.defineProperty(exports, "addBreadcrumb", {
|
|
192
|
+
enumerable: true,
|
|
193
|
+
get: function () { return chunkQV4HRIDD_cjs.addBreadcrumb; }
|
|
194
|
+
});
|
|
195
|
+
Object.defineProperty(exports, "captureException", {
|
|
196
|
+
enumerable: true,
|
|
197
|
+
get: function () { return chunkQV4HRIDD_cjs.captureException; }
|
|
198
|
+
});
|
|
199
|
+
Object.defineProperty(exports, "captureMessage", {
|
|
200
|
+
enumerable: true,
|
|
201
|
+
get: function () { return chunkQV4HRIDD_cjs.captureMessage; }
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(exports, "close", {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
get: function () { return chunkQV4HRIDD_cjs.close; }
|
|
206
|
+
});
|
|
207
|
+
Object.defineProperty(exports, "flush", {
|
|
208
|
+
enumerable: true,
|
|
209
|
+
get: function () { return chunkQV4HRIDD_cjs.flush; }
|
|
210
|
+
});
|
|
211
|
+
Object.defineProperty(exports, "getClient", {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
get: function () { return chunkQV4HRIDD_cjs.getClient; }
|
|
214
|
+
});
|
|
215
|
+
Object.defineProperty(exports, "getCurrentScope", {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
get: function () { return chunkQV4HRIDD_cjs.getCurrentScope; }
|
|
218
|
+
});
|
|
219
|
+
Object.defineProperty(exports, "getGlobalScope", {
|
|
220
|
+
enumerable: true,
|
|
221
|
+
get: function () { return chunkQV4HRIDD_cjs.getGlobalScope; }
|
|
222
|
+
});
|
|
223
|
+
Object.defineProperty(exports, "identify", {
|
|
224
|
+
enumerable: true,
|
|
225
|
+
get: function () { return chunkQV4HRIDD_cjs.identify; }
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(exports, "setContext", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function () { return chunkQV4HRIDD_cjs.setContext; }
|
|
230
|
+
});
|
|
231
|
+
Object.defineProperty(exports, "setExtra", {
|
|
232
|
+
enumerable: true,
|
|
233
|
+
get: function () { return chunkQV4HRIDD_cjs.setExtra; }
|
|
234
|
+
});
|
|
235
|
+
Object.defineProperty(exports, "setExtras", {
|
|
236
|
+
enumerable: true,
|
|
237
|
+
get: function () { return chunkQV4HRIDD_cjs.setExtras; }
|
|
238
|
+
});
|
|
239
|
+
Object.defineProperty(exports, "setTag", {
|
|
240
|
+
enumerable: true,
|
|
241
|
+
get: function () { return chunkQV4HRIDD_cjs.setTag; }
|
|
242
|
+
});
|
|
243
|
+
Object.defineProperty(exports, "setTags", {
|
|
244
|
+
enumerable: true,
|
|
245
|
+
get: function () { return chunkQV4HRIDD_cjs.setTags; }
|
|
246
|
+
});
|
|
247
|
+
Object.defineProperty(exports, "setUser", {
|
|
248
|
+
enumerable: true,
|
|
249
|
+
get: function () { return chunkQV4HRIDD_cjs.setUser; }
|
|
250
|
+
});
|
|
251
|
+
Object.defineProperty(exports, "withScope", {
|
|
252
|
+
enumerable: true,
|
|
253
|
+
get: function () { return chunkQV4HRIDD_cjs.withScope; }
|
|
254
|
+
});
|
|
255
|
+
exports.expressErrorHandler = expressErrorHandler;
|
|
256
|
+
exports.expressRequestHandler = expressRequestHandler;
|
|
257
|
+
exports.getErrorStatus = getErrorStatus;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { R as RequestData } from '../handler-BcnsnvhF.cjs';
|
|
2
|
+
export { N as NodeOptions, W as WrapHandlerOptions, c as currentRequestKey, a as getDefaultIntegrations, g as getRequestData, i as init, m as markServing, p as platformWaitUntil, r as runWithRequestScope, w as wrapHandler } from '../handler-BcnsnvhF.cjs';
|
|
3
|
+
import { I as Integration, T as TransportOptions, a as Transport } from '../api-DNrctwJu.cjs';
|
|
4
|
+
export { C as Client, E as EventHint, O as Options, S as SDK_VERSION, b as TransportResult, c as addBreadcrumb, d as captureException, e as captureMessage, f as close, g as flush, h as getClient, i as getCurrentScope, j as getGlobalScope, k as identify, s as setContext, l as setExtra, m as setExtras, n as setTag, o as setTags, p as setUser, w as withScope } from '../api-DNrctwJu.cjs';
|
|
5
|
+
import { W as WireEvent } from '../scope-D1ouJm2h.cjs';
|
|
6
|
+
export { B as Breadcrumb, L as Level, S as Scope, a as WireUser } from '../scope-D1ouJm2h.cjs';
|
|
7
|
+
export { S as SESSION_HEADER } from '../session-C_WzbEN2.cjs';
|
|
8
|
+
export { D as DedupeOptions, d as dedupeIntegration } from '../dedupe-Bh5riD8Z.cjs';
|
|
9
|
+
|
|
10
|
+
/** Wraps `server.emit` so entry events run in their own scope. */
|
|
11
|
+
declare function instrumentServer(server: unknown): void;
|
|
12
|
+
declare function httpServerIntegration(): Integration;
|
|
13
|
+
|
|
14
|
+
/** The parts of a Node / Express request this SDK reads. */
|
|
15
|
+
interface NodeRequestLike {
|
|
16
|
+
method?: string;
|
|
17
|
+
url?: string;
|
|
18
|
+
originalUrl?: string;
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
headers?: Record<string, string | string[] | undefined> | {
|
|
21
|
+
get(name: string): string | null;
|
|
22
|
+
};
|
|
23
|
+
route?: {
|
|
24
|
+
path?: unknown;
|
|
25
|
+
};
|
|
26
|
+
protocol?: string;
|
|
27
|
+
socket?: unknown;
|
|
28
|
+
}
|
|
29
|
+
/** Method, URL, route and session id of a request object. Never throws. */
|
|
30
|
+
declare function requestDataFrom(req: unknown): RequestData;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Express middlewares (4 and 5, typed structurally: the SDK does not import
|
|
34
|
+
* `express`).
|
|
35
|
+
*
|
|
36
|
+
* app.use(expressRequestHandler()); // first
|
|
37
|
+
* // … routes …
|
|
38
|
+
* app.use(expressErrorHandler()); // after the routes, before the app's own error handlers
|
|
39
|
+
*
|
|
40
|
+
* Every request already has its own scope from the HTTP server
|
|
41
|
+
* instrumentation (integrations/http-server.ts), so neither middleware is
|
|
42
|
+
* needed for isolation. `expressRequestHandler` reuses that scope (one
|
|
43
|
+
* scope per request, never two) and records the route as Express matches
|
|
44
|
+
* it; where the instrumentation is not active (a server Node does not
|
|
45
|
+
* report, the integration removed) it opens the request scope itself. What
|
|
46
|
+
* the request sets (`setUser`, `setTag`, breadcrumbs) stays with it, and its
|
|
47
|
+
* events carry the method, the sanitised URL, the route and the browser's
|
|
48
|
+
* session id (`x-starko-session-id`).
|
|
49
|
+
*
|
|
50
|
+
* `expressErrorHandler` captures errors passed to `next(err)` (and thrown /
|
|
51
|
+
* rejected by Express 5 handlers) with `mechanism.type: "middleware"`, then
|
|
52
|
+
* calls `next(err)` so the app's own error handling runs exactly as before.
|
|
53
|
+
* The event's request data comes from `req` alone, and its scope is the
|
|
54
|
+
* scope opened for `req` (never the scope of whatever async context the
|
|
55
|
+
* error handler happens to run in, which can be another request's). By
|
|
56
|
+
* default only errors that become a 5xx (status ≥ 500, or none) are
|
|
57
|
+
* captured; they are reported as unhandled.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
type ExpressRequestLike = NodeRequestLike;
|
|
61
|
+
type ExpressNext = (err?: unknown) => void;
|
|
62
|
+
type ExpressMiddleware = (req: ExpressRequestLike, res: unknown, next: ExpressNext) => void;
|
|
63
|
+
type ExpressErrorMiddleware = (err: unknown, req: ExpressRequestLike, res: unknown, next: ExpressNext) => void;
|
|
64
|
+
interface ExpressErrorHandlerOptions {
|
|
65
|
+
/** Capture this error? Default: when its status is ≥ 500 or it has none. */
|
|
66
|
+
shouldHandleError?(error: unknown): boolean;
|
|
67
|
+
}
|
|
68
|
+
/** `status`, `statusCode`, `status_code` or `output.statusCode` (Boom) of an error, when it is a number. */
|
|
69
|
+
declare function getErrorStatus(error: unknown): number | undefined;
|
|
70
|
+
declare function expressRequestHandler(): ExpressMiddleware;
|
|
71
|
+
declare function expressErrorHandler(options?: ExpressErrorHandlerOptions): ExpressErrorMiddleware;
|
|
72
|
+
|
|
73
|
+
declare function onUncaughtExceptionIntegration(): Integration;
|
|
74
|
+
|
|
75
|
+
type UnhandledRejectionMode = "throw" | "strict" | "warn" | "warn-with-error-code" | "none";
|
|
76
|
+
/** The process's `--unhandled-rejections` mode: the command line wins over NODE_OPTIONS, the last flag wins, default `throw`. */
|
|
77
|
+
declare function getUnhandledRejectionMode(execArgv?: string[], nodeOptions?: string | undefined): UnhandledRejectionMode;
|
|
78
|
+
|
|
79
|
+
interface OnUnhandledRejectionOptions {
|
|
80
|
+
/** Override the mode read from `process.execArgv` / `NODE_OPTIONS` (tests). */
|
|
81
|
+
mode?: UnhandledRejectionMode;
|
|
82
|
+
}
|
|
83
|
+
declare function onUnhandledRejectionIntegration(opts?: OnUnhandledRejectionOptions): Integration;
|
|
84
|
+
|
|
85
|
+
interface ContextLinesOptions {
|
|
86
|
+
/** Lines before and after the frame's line. Default 7 (the most the wire format keeps). */
|
|
87
|
+
lines?: number;
|
|
88
|
+
/** Also read files under node_modules (for frames marked in-app by a custom rule). Default false. */
|
|
89
|
+
includeNodeModules?: boolean;
|
|
90
|
+
/** Directories besides `process.cwd()` whose files may be read (a monorepo's packages, say). */
|
|
91
|
+
roots?: string[];
|
|
92
|
+
maxFileBytes?: number;
|
|
93
|
+
maxFiles?: number;
|
|
94
|
+
/** Files kept in the cache. Default 100. */
|
|
95
|
+
cacheSize?: number;
|
|
96
|
+
/** Bytes of source text kept in the cache. Default 8 MiB. */
|
|
97
|
+
cacheBytes?: number;
|
|
98
|
+
}
|
|
99
|
+
interface ContextLinesIntegration extends Integration {
|
|
100
|
+
/** Adds source lines to the event's frames in place. Never rejects. */
|
|
101
|
+
addContextLines(event: WireEvent): Promise<void>;
|
|
102
|
+
/** Test seam: forget cached files. */
|
|
103
|
+
clearCache(): void;
|
|
104
|
+
}
|
|
105
|
+
declare function contextLinesIntegration(opts?: ContextLinesOptions): ContextLinesIntegration;
|
|
106
|
+
|
|
107
|
+
declare function nodeContextIntegration(): Integration;
|
|
108
|
+
|
|
109
|
+
declare function consoleBreadcrumbsIntegration(): Integration;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* `request` (method, URL, route) of the request the event was captured in,
|
|
113
|
+
* from the request scope (`runWithRequestScope`, which the Express
|
|
114
|
+
* middleware, `wrapHandler` and Next's `onRequestError` open). The event's
|
|
115
|
+
* own fields win. The URL gets the privacy defaults when the event is built
|
|
116
|
+
* (fragment dropped, sensitive query values redacted). The session id is
|
|
117
|
+
* stamped by the client (`getSessionId`), not here.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
declare function requestDataIntegration(): Integration;
|
|
121
|
+
|
|
122
|
+
interface FlushOnExitOptions {
|
|
123
|
+
/** Flush on SIGTERM / SIGINT when the app does not listen for them. Default true. */
|
|
124
|
+
signals?: boolean;
|
|
125
|
+
}
|
|
126
|
+
declare function flushOnExitIntegration(opts?: FlushOnExitOptions): Integration;
|
|
127
|
+
|
|
128
|
+
/** Bodies larger than this are gzipped. */
|
|
129
|
+
declare const GZIP_THRESHOLD: number;
|
|
130
|
+
interface NodeTransportOptions extends TransportOptions {
|
|
131
|
+
/** Secret key with the `errors:write` scope (server only). */
|
|
132
|
+
apiKey?: string;
|
|
133
|
+
/** Defaults to the global `fetch` at call time. */
|
|
134
|
+
fetchImpl?: typeof fetch;
|
|
135
|
+
/** Extra request headers (proxies). `Authorization` is set from `apiKey` only. */
|
|
136
|
+
headers?: Record<string, string>;
|
|
137
|
+
}
|
|
138
|
+
declare function makeServerFetchTransport(options: NodeTransportOptions): Transport;
|
|
139
|
+
|
|
140
|
+
declare const CONNECT_TIMEOUT_MS = 3000;
|
|
141
|
+
declare function makeNodeTransport(options: NodeTransportOptions): Transport;
|
|
142
|
+
|
|
143
|
+
declare function nodeIsInApp(filename: string | undefined): boolean;
|
|
144
|
+
|
|
145
|
+
export { CONNECT_TIMEOUT_MS, type ContextLinesIntegration, type ContextLinesOptions, type ExpressErrorHandlerOptions, type ExpressErrorMiddleware, type ExpressMiddleware, type ExpressNext, type ExpressRequestLike, type FlushOnExitOptions, GZIP_THRESHOLD, Integration, type NodeRequestLike, type NodeTransportOptions, type OnUnhandledRejectionOptions, RequestData, Transport, TransportOptions, type UnhandledRejectionMode, WireEvent, consoleBreadcrumbsIntegration, contextLinesIntegration, expressErrorHandler, expressRequestHandler, flushOnExitIntegration, getErrorStatus, getUnhandledRejectionMode, httpServerIntegration, instrumentServer, makeNodeTransport, makeServerFetchTransport, nodeContextIntegration, nodeIsInApp, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, requestDataFrom, requestDataIntegration };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { R as RequestData } from '../handler-qHzilC9T.js';
|
|
2
|
+
export { N as NodeOptions, W as WrapHandlerOptions, c as currentRequestKey, a as getDefaultIntegrations, g as getRequestData, i as init, m as markServing, p as platformWaitUntil, r as runWithRequestScope, w as wrapHandler } from '../handler-qHzilC9T.js';
|
|
3
|
+
import { I as Integration, T as TransportOptions, a as Transport } from '../api-BAFm4Lxj.js';
|
|
4
|
+
export { C as Client, E as EventHint, O as Options, S as SDK_VERSION, b as TransportResult, c as addBreadcrumb, d as captureException, e as captureMessage, f as close, g as flush, h as getClient, i as getCurrentScope, j as getGlobalScope, k as identify, s as setContext, l as setExtra, m as setExtras, n as setTag, o as setTags, p as setUser, w as withScope } from '../api-BAFm4Lxj.js';
|
|
5
|
+
import { W as WireEvent } from '../scope-D1ouJm2h.js';
|
|
6
|
+
export { B as Breadcrumb, L as Level, S as Scope, a as WireUser } from '../scope-D1ouJm2h.js';
|
|
7
|
+
export { S as SESSION_HEADER } from '../session-C_WzbEN2.js';
|
|
8
|
+
export { D as DedupeOptions, d as dedupeIntegration } from '../dedupe-DoYiSx-9.js';
|
|
9
|
+
|
|
10
|
+
/** Wraps `server.emit` so entry events run in their own scope. */
|
|
11
|
+
declare function instrumentServer(server: unknown): void;
|
|
12
|
+
declare function httpServerIntegration(): Integration;
|
|
13
|
+
|
|
14
|
+
/** The parts of a Node / Express request this SDK reads. */
|
|
15
|
+
interface NodeRequestLike {
|
|
16
|
+
method?: string;
|
|
17
|
+
url?: string;
|
|
18
|
+
originalUrl?: string;
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
headers?: Record<string, string | string[] | undefined> | {
|
|
21
|
+
get(name: string): string | null;
|
|
22
|
+
};
|
|
23
|
+
route?: {
|
|
24
|
+
path?: unknown;
|
|
25
|
+
};
|
|
26
|
+
protocol?: string;
|
|
27
|
+
socket?: unknown;
|
|
28
|
+
}
|
|
29
|
+
/** Method, URL, route and session id of a request object. Never throws. */
|
|
30
|
+
declare function requestDataFrom(req: unknown): RequestData;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Express middlewares (4 and 5, typed structurally: the SDK does not import
|
|
34
|
+
* `express`).
|
|
35
|
+
*
|
|
36
|
+
* app.use(expressRequestHandler()); // first
|
|
37
|
+
* // … routes …
|
|
38
|
+
* app.use(expressErrorHandler()); // after the routes, before the app's own error handlers
|
|
39
|
+
*
|
|
40
|
+
* Every request already has its own scope from the HTTP server
|
|
41
|
+
* instrumentation (integrations/http-server.ts), so neither middleware is
|
|
42
|
+
* needed for isolation. `expressRequestHandler` reuses that scope (one
|
|
43
|
+
* scope per request, never two) and records the route as Express matches
|
|
44
|
+
* it; where the instrumentation is not active (a server Node does not
|
|
45
|
+
* report, the integration removed) it opens the request scope itself. What
|
|
46
|
+
* the request sets (`setUser`, `setTag`, breadcrumbs) stays with it, and its
|
|
47
|
+
* events carry the method, the sanitised URL, the route and the browser's
|
|
48
|
+
* session id (`x-starko-session-id`).
|
|
49
|
+
*
|
|
50
|
+
* `expressErrorHandler` captures errors passed to `next(err)` (and thrown /
|
|
51
|
+
* rejected by Express 5 handlers) with `mechanism.type: "middleware"`, then
|
|
52
|
+
* calls `next(err)` so the app's own error handling runs exactly as before.
|
|
53
|
+
* The event's request data comes from `req` alone, and its scope is the
|
|
54
|
+
* scope opened for `req` (never the scope of whatever async context the
|
|
55
|
+
* error handler happens to run in, which can be another request's). By
|
|
56
|
+
* default only errors that become a 5xx (status ≥ 500, or none) are
|
|
57
|
+
* captured; they are reported as unhandled.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
type ExpressRequestLike = NodeRequestLike;
|
|
61
|
+
type ExpressNext = (err?: unknown) => void;
|
|
62
|
+
type ExpressMiddleware = (req: ExpressRequestLike, res: unknown, next: ExpressNext) => void;
|
|
63
|
+
type ExpressErrorMiddleware = (err: unknown, req: ExpressRequestLike, res: unknown, next: ExpressNext) => void;
|
|
64
|
+
interface ExpressErrorHandlerOptions {
|
|
65
|
+
/** Capture this error? Default: when its status is ≥ 500 or it has none. */
|
|
66
|
+
shouldHandleError?(error: unknown): boolean;
|
|
67
|
+
}
|
|
68
|
+
/** `status`, `statusCode`, `status_code` or `output.statusCode` (Boom) of an error, when it is a number. */
|
|
69
|
+
declare function getErrorStatus(error: unknown): number | undefined;
|
|
70
|
+
declare function expressRequestHandler(): ExpressMiddleware;
|
|
71
|
+
declare function expressErrorHandler(options?: ExpressErrorHandlerOptions): ExpressErrorMiddleware;
|
|
72
|
+
|
|
73
|
+
declare function onUncaughtExceptionIntegration(): Integration;
|
|
74
|
+
|
|
75
|
+
type UnhandledRejectionMode = "throw" | "strict" | "warn" | "warn-with-error-code" | "none";
|
|
76
|
+
/** The process's `--unhandled-rejections` mode: the command line wins over NODE_OPTIONS, the last flag wins, default `throw`. */
|
|
77
|
+
declare function getUnhandledRejectionMode(execArgv?: string[], nodeOptions?: string | undefined): UnhandledRejectionMode;
|
|
78
|
+
|
|
79
|
+
interface OnUnhandledRejectionOptions {
|
|
80
|
+
/** Override the mode read from `process.execArgv` / `NODE_OPTIONS` (tests). */
|
|
81
|
+
mode?: UnhandledRejectionMode;
|
|
82
|
+
}
|
|
83
|
+
declare function onUnhandledRejectionIntegration(opts?: OnUnhandledRejectionOptions): Integration;
|
|
84
|
+
|
|
85
|
+
interface ContextLinesOptions {
|
|
86
|
+
/** Lines before and after the frame's line. Default 7 (the most the wire format keeps). */
|
|
87
|
+
lines?: number;
|
|
88
|
+
/** Also read files under node_modules (for frames marked in-app by a custom rule). Default false. */
|
|
89
|
+
includeNodeModules?: boolean;
|
|
90
|
+
/** Directories besides `process.cwd()` whose files may be read (a monorepo's packages, say). */
|
|
91
|
+
roots?: string[];
|
|
92
|
+
maxFileBytes?: number;
|
|
93
|
+
maxFiles?: number;
|
|
94
|
+
/** Files kept in the cache. Default 100. */
|
|
95
|
+
cacheSize?: number;
|
|
96
|
+
/** Bytes of source text kept in the cache. Default 8 MiB. */
|
|
97
|
+
cacheBytes?: number;
|
|
98
|
+
}
|
|
99
|
+
interface ContextLinesIntegration extends Integration {
|
|
100
|
+
/** Adds source lines to the event's frames in place. Never rejects. */
|
|
101
|
+
addContextLines(event: WireEvent): Promise<void>;
|
|
102
|
+
/** Test seam: forget cached files. */
|
|
103
|
+
clearCache(): void;
|
|
104
|
+
}
|
|
105
|
+
declare function contextLinesIntegration(opts?: ContextLinesOptions): ContextLinesIntegration;
|
|
106
|
+
|
|
107
|
+
declare function nodeContextIntegration(): Integration;
|
|
108
|
+
|
|
109
|
+
declare function consoleBreadcrumbsIntegration(): Integration;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* `request` (method, URL, route) of the request the event was captured in,
|
|
113
|
+
* from the request scope (`runWithRequestScope`, which the Express
|
|
114
|
+
* middleware, `wrapHandler` and Next's `onRequestError` open). The event's
|
|
115
|
+
* own fields win. The URL gets the privacy defaults when the event is built
|
|
116
|
+
* (fragment dropped, sensitive query values redacted). The session id is
|
|
117
|
+
* stamped by the client (`getSessionId`), not here.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
declare function requestDataIntegration(): Integration;
|
|
121
|
+
|
|
122
|
+
interface FlushOnExitOptions {
|
|
123
|
+
/** Flush on SIGTERM / SIGINT when the app does not listen for them. Default true. */
|
|
124
|
+
signals?: boolean;
|
|
125
|
+
}
|
|
126
|
+
declare function flushOnExitIntegration(opts?: FlushOnExitOptions): Integration;
|
|
127
|
+
|
|
128
|
+
/** Bodies larger than this are gzipped. */
|
|
129
|
+
declare const GZIP_THRESHOLD: number;
|
|
130
|
+
interface NodeTransportOptions extends TransportOptions {
|
|
131
|
+
/** Secret key with the `errors:write` scope (server only). */
|
|
132
|
+
apiKey?: string;
|
|
133
|
+
/** Defaults to the global `fetch` at call time. */
|
|
134
|
+
fetchImpl?: typeof fetch;
|
|
135
|
+
/** Extra request headers (proxies). `Authorization` is set from `apiKey` only. */
|
|
136
|
+
headers?: Record<string, string>;
|
|
137
|
+
}
|
|
138
|
+
declare function makeServerFetchTransport(options: NodeTransportOptions): Transport;
|
|
139
|
+
|
|
140
|
+
declare const CONNECT_TIMEOUT_MS = 3000;
|
|
141
|
+
declare function makeNodeTransport(options: NodeTransportOptions): Transport;
|
|
142
|
+
|
|
143
|
+
declare function nodeIsInApp(filename: string | undefined): boolean;
|
|
144
|
+
|
|
145
|
+
export { CONNECT_TIMEOUT_MS, type ContextLinesIntegration, type ContextLinesOptions, type ExpressErrorHandlerOptions, type ExpressErrorMiddleware, type ExpressMiddleware, type ExpressNext, type ExpressRequestLike, type FlushOnExitOptions, GZIP_THRESHOLD, Integration, type NodeRequestLike, type NodeTransportOptions, type OnUnhandledRejectionOptions, RequestData, Transport, TransportOptions, type UnhandledRejectionMode, WireEvent, consoleBreadcrumbsIntegration, contextLinesIntegration, expressErrorHandler, expressRequestHandler, flushOnExitIntegration, getErrorStatus, getUnhandledRejectionMode, httpServerIntegration, instrumentServer, makeNodeTransport, makeServerFetchTransport, nodeContextIntegration, nodeIsInApp, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, requestDataFrom, requestDataIntegration };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export { CONNECT_TIMEOUT_MS, consoleBreadcrumbsIntegration, contextLinesIntegration, flushOnExitIntegration, getDefaultIntegrations, getUnhandledRejectionMode, httpServerIntegration, init, instrumentServer, makeNodeTransport, nodeContextIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration } from '../chunk-BVVFVRMO.js';
|
|
2
|
+
export { GZIP_THRESHOLD, makeServerFetchTransport, nodeIsInApp, requestDataIntegration } from '../chunk-DUO5V6WZ.js';
|
|
3
|
+
import { trackRoute, storeOf, getCurrentStore, openRequestScope, requestDataFrom, readScope, runInStore } from '../chunk-N5R6ORIB.js';
|
|
4
|
+
export { currentRequestKey, getRequestData, markServing, platformWaitUntil, requestDataFrom, runWithRequestScope, wrapHandler } from '../chunk-N5R6ORIB.js';
|
|
5
|
+
import '../chunk-UI5YC4TH.js';
|
|
6
|
+
export { dedupeIntegration } from '../chunk-CMGCH6HD.js';
|
|
7
|
+
export { SESSION_HEADER } from '../chunk-VNCWOGTI.js';
|
|
8
|
+
import '../chunk-335HNCOJ.js';
|
|
9
|
+
import { captureException } from '../chunk-WDKRKGYF.js';
|
|
10
|
+
export { SDK_VERSION, addBreadcrumb, captureException, captureMessage, close, flush, getClient, getCurrentScope, getGlobalScope, identify, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope } from '../chunk-WDKRKGYF.js';
|
|
11
|
+
import '../chunk-3AW5B2WW.js';
|
|
12
|
+
|
|
13
|
+
// src/node/express.ts
|
|
14
|
+
function getErrorStatus(error) {
|
|
15
|
+
try {
|
|
16
|
+
if (!error || typeof error !== "object") return void 0;
|
|
17
|
+
const e = error;
|
|
18
|
+
const output = e.output;
|
|
19
|
+
for (const v of [e.status, e.statusCode, e.status_code, output && output.statusCode]) {
|
|
20
|
+
const n = typeof v === "string" ? Number(v) : v;
|
|
21
|
+
if (typeof n === "number" && Number.isInteger(n) && n >= 100 && n <= 599) return n;
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
var defaultShouldHandle = (error) => {
|
|
28
|
+
const status = getErrorStatus(error);
|
|
29
|
+
return status === void 0 || status >= 500;
|
|
30
|
+
};
|
|
31
|
+
function expressRequestHandler() {
|
|
32
|
+
return function starkoRequestHandler(req, _res, next) {
|
|
33
|
+
let entered = false;
|
|
34
|
+
trackRoute(req);
|
|
35
|
+
try {
|
|
36
|
+
const existing = storeOf(req);
|
|
37
|
+
if (existing && getCurrentStore() === existing) {
|
|
38
|
+
entered = true;
|
|
39
|
+
return next();
|
|
40
|
+
}
|
|
41
|
+
openRequestScope(
|
|
42
|
+
() => {
|
|
43
|
+
entered = true;
|
|
44
|
+
next();
|
|
45
|
+
},
|
|
46
|
+
() => requestDataFrom(req),
|
|
47
|
+
req
|
|
48
|
+
);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
if (entered) throw err;
|
|
51
|
+
next();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function expressErrorHandler(options = {}) {
|
|
56
|
+
return function starkoErrorHandler(err, req, _res, next) {
|
|
57
|
+
try {
|
|
58
|
+
const should = options.shouldHandleError || defaultShouldHandle;
|
|
59
|
+
let capture = false;
|
|
60
|
+
try {
|
|
61
|
+
capture = should(err);
|
|
62
|
+
} catch {
|
|
63
|
+
capture = defaultShouldHandle(err);
|
|
64
|
+
}
|
|
65
|
+
if (capture) {
|
|
66
|
+
const status = getErrorStatus(err);
|
|
67
|
+
const handled = status !== void 0 && status < 500;
|
|
68
|
+
const data = requestDataFrom(req);
|
|
69
|
+
const own = storeOf(req);
|
|
70
|
+
const current = getCurrentStore();
|
|
71
|
+
const foreign = !!current && (current.source ? current.source !== req : !!current.request);
|
|
72
|
+
const base = own ? own.scope : foreign ? void 0 : readScope();
|
|
73
|
+
const capture2 = () => openRequestScope(() => captureException(err, { mechanism: { type: "middleware", handled } }), data, void 0, base, own ? own.key : req);
|
|
74
|
+
if (own) runInStore(own, capture2);
|
|
75
|
+
else capture2();
|
|
76
|
+
}
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
next(err);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { expressErrorHandler, expressRequestHandler, getErrorStatus };
|