@sentry/junior-sentry 0.256.0 → 0.258.0
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/dist/index.js +27 -0
- package/dist/oauth-account.d.ts +15 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -67,6 +67,32 @@ function issueSentryCredential(ctx) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
// src/oauth-account.ts
|
|
71
|
+
function nonBlankString(value) {
|
|
72
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
73
|
+
return String(value);
|
|
74
|
+
}
|
|
75
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
76
|
+
}
|
|
77
|
+
function resolveSentryOAuthAccount(ctx) {
|
|
78
|
+
const user = ctx.tokenResponse.user;
|
|
79
|
+
if (!user || typeof user !== "object" || Array.isArray(user)) {
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
const fields = user;
|
|
83
|
+
const id = nonBlankString(fields.id);
|
|
84
|
+
if (!id) {
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
const name = nonBlankString(fields.name);
|
|
88
|
+
const label = nonBlankString(fields.email) ?? name;
|
|
89
|
+
return {
|
|
90
|
+
id,
|
|
91
|
+
...name ? { displayName: name } : void 0,
|
|
92
|
+
...label ? { label } : void 0
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
70
96
|
// src/index.ts
|
|
71
97
|
function sentryPlugin() {
|
|
72
98
|
return defineJuniorPlugin({
|
|
@@ -132,6 +158,7 @@ function sentryPlugin() {
|
|
|
132
158
|
hooks: {
|
|
133
159
|
grantForEgress: sentryGrantForEgress,
|
|
134
160
|
issueCredential: issueSentryCredential,
|
|
161
|
+
resolveOAuthAccount: resolveSentryOAuthAccount,
|
|
135
162
|
routes(ctx) {
|
|
136
163
|
return [
|
|
137
164
|
createSentryWebhookRoute({
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentry OAuth account.
|
|
3
|
+
*
|
|
4
|
+
* Sentry returns the authorized user in the OAuth token response. The Sentry
|
|
5
|
+
* users API rejects OAuth app tokens, so Junior reads the account from that
|
|
6
|
+
* response.
|
|
7
|
+
*/
|
|
8
|
+
import type { PluginProviderAccount, ResolveOAuthAccountHookContext } from "@sentry/junior-plugin-api";
|
|
9
|
+
/**
|
|
10
|
+
* Read the Sentry user from the OAuth token response.
|
|
11
|
+
*
|
|
12
|
+
* Sentry does not report whether the user email is verified, so the email is
|
|
13
|
+
* only a label and never links the account.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveSentryOAuthAccount(ctx: ResolveOAuthAccountHookContext): PluginProviderAccount | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-sentry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.258.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"zod": "^4.5.4",
|
|
30
|
-
"@sentry/junior-plugin-api": "0.
|
|
30
|
+
"@sentry/junior-plugin-api": "0.258.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@oxlint/plugins": "1.79.0",
|
|
34
34
|
"@types/node": "^25.9.1",
|
|
35
35
|
"oxlint": "^1.79.0",
|
|
36
36
|
"tsup": "^8.5.1",
|
|
37
|
-
"typescript": "^
|
|
37
|
+
"typescript": "^7.0.2",
|
|
38
38
|
"vitest": "^4.1.7"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|