@prairielearn/sentry 2.0.4 → 2.0.6
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 +13 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +23 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @prairielearn/sentry
|
|
2
2
|
|
|
3
|
+
## 2.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 852c2e2: Upgrade all JavaScript dependencies
|
|
8
|
+
|
|
9
|
+
## 2.0.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a8438ff: Upgrade all JavaScript dependencies
|
|
14
|
+
- f33f309: Update Sentry dependencies
|
|
15
|
+
|
|
3
16
|
## 2.0.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export declare function init(options: Sentry.NodeOptions): Promise<void>;
|
|
|
18
18
|
* isolate requests and set request data for Sentry.
|
|
19
19
|
*/
|
|
20
20
|
export declare function requestHandler(): (req: any, _res: any, next: any) => void;
|
|
21
|
-
export { Breadcrumb, BreadcrumbHint,
|
|
22
|
-
export {
|
|
21
|
+
export { Breadcrumb, BreadcrumbHint, Event, EventHint, Exception, NodeOptions, PolymorphicRequest, Request, SdkInfo, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, } from '@sentry/node';
|
|
22
|
+
export { addBreadcrumb, addEventProcessor, addRequestDataToEvent, captureEvent, captureException, captureMessage, close, createTransport, defaultStackParser, expressErrorHandler, expressIntegration, extractRequestData, flush, getCurrentHub, getCurrentScope, getSentryRelease, makeNodeTransport, NodeClient, Scope, SDK_VERSION, SentryContextManager, setContext, setExtra, setExtras, setTag, setTags, setupExpressErrorHandler, setUser, startInactiveSpan, startSpan, startSpanManual, withIsolationScope, withScope, } from '@sentry/node';
|
package/dist/index.js
CHANGED
|
@@ -73,5 +73,5 @@ export function requestHandler() {
|
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
export {
|
|
76
|
+
export { addBreadcrumb, addEventProcessor, addRequestDataToEvent, captureEvent, captureException, captureMessage, close, createTransport, defaultStackParser, expressErrorHandler, expressIntegration, extractRequestData, flush, getCurrentHub, getCurrentScope, getSentryRelease, makeNodeTransport, NodeClient, Scope, SDK_VERSION, SentryContextManager, setContext, setExtra, setExtras, setTag, setTags, setupExpressErrorHandler, setUser, startInactiveSpan, startSpan, startSpanManual, withIsolationScope, withScope, } from '@sentry/node';
|
|
77
77
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAA2B;IACpD,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAE9B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,CAAC;YACH,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACtE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,mEAAmE;YACnE,oCAAoC;QACtC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,IAAI,CAAC;QACV,OAAO;QACP,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAED;;;GAG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C,MAAM,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,EAAE;YAClC,KAAK,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,EAAE;gBAChC,kEAAkE;gBAClE,kEAAkE;gBAClE,oEAAoE;gBACpE,sBAAsB;gBACtB,IAAI,CAAC;oBACH,KAAK,CAAC,WAAW,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;oBAC5C,OAAO,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;gBAClD,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAwBD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,KAAK,EACL,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,wBAAwB,EACxB,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,SAAS,GACV,MAAM,cAAc,CAAC","sourcesContent":["import * as Sentry from '@sentry/node';\nimport { stripUrlQueryAndFragment } from '@sentry/utils';\nimport { execa } from 'execa';\n\n/**\n * A thin wrapper around {@link Sentry.init} that automatically sets `release`\n * based on the current Git revision.\n */\nexport async function init(options: Sentry.NodeOptions) {\n let release = options.release;\n\n if (!release) {\n try {\n release = (await execa('git', ['rev-parse', 'HEAD'])).stdout.trim();\n } catch (e) {\n // This most likely isn't running in an initialized git repository.\n // Default to not setting a release.\n }\n }\n\n Sentry.init({\n release,\n ...options,\n });\n}\n\n/**\n * Based on Sentry code that is not exported:\n * https://github.com/getsentry/sentry-javascript/blob/602703652959b581304a7849cb97117f296493bc/packages/utils/src/requestdata.ts#L102\n */\nfunction extractTransaction(req: any) {\n const method = req.method?.toUpperCase() || '';\n const path = stripUrlQueryAndFragment(req.originalUrl || req.url || '');\n\n let name = '';\n if (method) {\n name += method;\n }\n if (method && path) {\n name += ' ';\n }\n if (path) {\n name += path;\n }\n\n return name;\n}\n\n/**\n * Sentry v8 switched from simple, manual instrumentation to \"automatic\"\n * instrumentation based on OpenTelemetry. However, this interferes with\n * the way that our applications asynchronously load their configuration,\n * specifically the Sentry DSN. Sentry's automatic request isolation and\n * request data extraction requires that `Sentry.init` be called before\n * any other code is loaded, but our application startup structure is such\n * that we import most of our own code before we can load the Sentry DSN.\n *\n * Rather than jumping through hoops to restructure our application to\n * support this, this small function can be added as Express middleware to\n * isolate requests and set request data for Sentry.\n */\nexport function requestHandler() {\n return (req: any, _res: any, next: any) => {\n Sentry.withIsolationScope((scope) => {\n scope.addEventProcessor((event) => {\n // If an event processor throws an error, Sentry will catch it and\n // retrigger the event processor, which infinitely recurses. We'll\n // treat our event processor as a best-effort operation and silently\n // swallow any errors.\n try {\n event.transaction = extractTransaction(req);\n return Sentry.addRequestDataToEvent(event, req);\n } catch {\n return event;\n }\n });\n\n next();\n });\n };\n}\n\n// We export every type and function from `@sentry/node` *except* for init,\n// which we replace with our own version up above.\n\nexport {\n Breadcrumb,\n BreadcrumbHint,\n Event,\n EventHint,\n Exception,\n NodeOptions,\n PolymorphicRequest,\n Request,\n SdkInfo,\n Session,\n SeverityLevel,\n Span,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n} from '@sentry/node';\n\nexport {\n addBreadcrumb,\n addEventProcessor,\n addRequestDataToEvent,\n captureEvent,\n captureException,\n captureMessage,\n close,\n createTransport,\n defaultStackParser,\n expressErrorHandler,\n expressIntegration,\n extractRequestData,\n flush,\n getCurrentHub,\n getCurrentScope,\n getSentryRelease,\n makeNodeTransport,\n NodeClient,\n Scope,\n SDK_VERSION,\n SentryContextManager,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setupExpressErrorHandler,\n setUser,\n startInactiveSpan,\n startSpan,\n startSpanManual,\n withIsolationScope,\n withScope,\n} from '@sentry/node';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prairielearn/sentry",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@prairielearn/tsconfig": "^0.0.0",
|
|
17
|
-
"@types/node": "^20.14.
|
|
18
|
-
"tsx": "^4.
|
|
19
|
-
"typescript": "^5.5.
|
|
17
|
+
"@types/node": "^20.14.15",
|
|
18
|
+
"tsx": "^4.17.0",
|
|
19
|
+
"typescript": "^5.5.4"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sentry/node": "^8.
|
|
23
|
-
"@sentry/utils": "^8.
|
|
24
|
-
"execa": "^9.3.
|
|
22
|
+
"@sentry/node": "^8.26.0",
|
|
23
|
+
"@sentry/utils": "^8.26.0",
|
|
24
|
+
"execa": "^9.3.1"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/src/index.ts
CHANGED
|
@@ -86,52 +86,54 @@ export function requestHandler() {
|
|
|
86
86
|
export {
|
|
87
87
|
Breadcrumb,
|
|
88
88
|
BreadcrumbHint,
|
|
89
|
-
Request,
|
|
90
|
-
PolymorphicRequest,
|
|
91
|
-
SdkInfo,
|
|
92
89
|
Event,
|
|
93
90
|
EventHint,
|
|
94
91
|
Exception,
|
|
92
|
+
NodeOptions,
|
|
93
|
+
PolymorphicRequest,
|
|
94
|
+
Request,
|
|
95
|
+
SdkInfo,
|
|
95
96
|
Session,
|
|
96
97
|
SeverityLevel,
|
|
98
|
+
Span,
|
|
97
99
|
StackFrame,
|
|
98
100
|
Stacktrace,
|
|
99
101
|
Thread,
|
|
100
102
|
User,
|
|
101
|
-
Span,
|
|
102
|
-
NodeOptions,
|
|
103
103
|
} from '@sentry/node';
|
|
104
104
|
|
|
105
105
|
export {
|
|
106
|
-
addEventProcessor,
|
|
107
106
|
addBreadcrumb,
|
|
108
|
-
|
|
107
|
+
addEventProcessor,
|
|
108
|
+
addRequestDataToEvent,
|
|
109
109
|
captureEvent,
|
|
110
|
+
captureException,
|
|
110
111
|
captureMessage,
|
|
112
|
+
close,
|
|
111
113
|
createTransport,
|
|
114
|
+
defaultStackParser,
|
|
115
|
+
expressErrorHandler,
|
|
116
|
+
expressIntegration,
|
|
117
|
+
extractRequestData,
|
|
118
|
+
flush,
|
|
112
119
|
getCurrentHub,
|
|
120
|
+
getCurrentScope,
|
|
121
|
+
getSentryRelease,
|
|
122
|
+
makeNodeTransport,
|
|
123
|
+
NodeClient,
|
|
113
124
|
Scope,
|
|
114
125
|
SDK_VERSION,
|
|
126
|
+
SentryContextManager,
|
|
115
127
|
setContext,
|
|
116
128
|
setExtra,
|
|
117
129
|
setExtras,
|
|
118
130
|
setTag,
|
|
119
131
|
setTags,
|
|
132
|
+
setupExpressErrorHandler,
|
|
120
133
|
setUser,
|
|
121
|
-
|
|
122
|
-
NodeClient,
|
|
123
|
-
makeNodeTransport,
|
|
124
|
-
addRequestDataToEvent,
|
|
125
|
-
extractRequestData,
|
|
126
|
-
defaultStackParser,
|
|
127
|
-
flush,
|
|
128
|
-
close,
|
|
129
|
-
getSentryRelease,
|
|
130
|
-
getCurrentScope,
|
|
134
|
+
startInactiveSpan,
|
|
131
135
|
startSpan,
|
|
132
136
|
startSpanManual,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
expressErrorHandler,
|
|
136
|
-
setupExpressErrorHandler,
|
|
137
|
+
withIsolationScope,
|
|
138
|
+
withScope,
|
|
137
139
|
} from '@sentry/node';
|