@briefkasten/adapter-sentry 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +28 -2
- package/dist/index.d.mts +433 -0
- package/dist/index.mjs +552 -0
- package/package.json +58 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lukas Mateffy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @briefkasten/adapter-sentry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Sentry adapter for [briefkasten](https://www.npmjs.com/package/briefkasten): the webhooks of a
|
|
4
|
+
Sentry integration (issues, errors and alerts), verified with `Sentry-Hook-Signature`, as typed
|
|
5
|
+
events.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install briefkasten @briefkasten/adapter-sentry
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { briefkasten } from "briefkasten";
|
|
13
|
+
import { sentry } from "@briefkasten/adapter-sentry";
|
|
14
|
+
|
|
15
|
+
const hooks = briefkasten({
|
|
16
|
+
sources: { sentry: sentry({ secret: process.env.SENTRY_CLIENT_SECRET ?? "" }) },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
hooks.on("sentry:issue.created", async (event) => {
|
|
20
|
+
console.log(event.body.data.issue.title);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Mount it: a fetch handler, or `hooks.node` for Express and node:http.
|
|
24
|
+
app.post("/webhooks/*", (c) => hooks.fetch(c.req.raw));
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Docs: <https://briefkasten.fabrik.computer/docs/adapters/sentry>
|
|
28
|
+
|
|
29
|
+
MIT licensed.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Adapter, AdapterBinding, AdapterInstance, AdapterSample, NewEvent, NoOptions } from "briefkasten";
|
|
3
|
+
//#region src/sentry-schemas.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Sentry's integration webhooks, as its documentation describes them
|
|
6
|
+
* (https://docs.sentry.io/organization/integrations/integration-platform/webhooks/):
|
|
7
|
+
*
|
|
8
|
+
* headers: Sentry-Hook-Resource: issue, Sentry-Hook-Timestamp, Sentry-Hook-Signature, Request-ID
|
|
9
|
+
* body: { action: "created", installation: { uuid }, data: { issue: { … } }, actor: { … } }
|
|
10
|
+
*
|
|
11
|
+
* The resource names what changed and the action what happened to it. This adapter publishes
|
|
12
|
+
* the four resources an integration subscribes to for errors and alerts:
|
|
13
|
+
*
|
|
14
|
+
* | Resource | Actions | `data` holds |
|
|
15
|
+
* | -------------- | ----------------------------------------------------------- | ---------------------- |
|
|
16
|
+
* | `issue` | `created`, `resolved`, `assigned`, `archived`, `unresolved` | `issue` |
|
|
17
|
+
* | `error` | `created` | `error` |
|
|
18
|
+
* | `event_alert` | `triggered` | `event`, `triggered_rule` |
|
|
19
|
+
* | `metric_alert` | `critical`, `warning`, `resolved` | `metric_alert`, `description_title`, … |
|
|
20
|
+
*
|
|
21
|
+
* The fields this adapter addresses an event by are required; everything else passes through,
|
|
22
|
+
* so a field Sentry adds later does not drop a delivery.
|
|
23
|
+
*/
|
|
24
|
+
/** The actions of each resource this adapter publishes, as Sentry's resource pages list them. */
|
|
25
|
+
declare const RESOURCES: {
|
|
26
|
+
readonly issue: readonly ["created", "resolved", "assigned", "archived", "unresolved"];
|
|
27
|
+
readonly error: readonly ["created"];
|
|
28
|
+
readonly event_alert: readonly ["triggered"];
|
|
29
|
+
readonly metric_alert: readonly ["critical", "warning", "resolved"];
|
|
30
|
+
};
|
|
31
|
+
type SentryResource = keyof typeof RESOURCES;
|
|
32
|
+
/** What every delivery has: the action, the installation, the resource's data and the actor. */
|
|
33
|
+
declare const deliverySchema: z.ZodObject<{
|
|
34
|
+
action: z.ZodString;
|
|
35
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
36
|
+
uuid: z.ZodString;
|
|
37
|
+
}, z.core.$loose>>>;
|
|
38
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
39
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
40
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
42
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
}, z.core.$loose>>>;
|
|
44
|
+
}, z.core.$loose>;
|
|
45
|
+
type SentryDelivery = z.infer<typeof deliverySchema>;
|
|
46
|
+
/** An issue: `data.issue` of an `issue` delivery. */
|
|
47
|
+
declare const issueSchema: z.ZodObject<{
|
|
48
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
49
|
+
shortId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
title: z.ZodString;
|
|
51
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
substatus: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
+
priority: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
57
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
58
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
}, z.core.$loose>>>;
|
|
61
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
|
+
permalink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
+
assignedTo: z.ZodOptional<z.ZodUnknown>;
|
|
64
|
+
}, z.core.$loose>;
|
|
65
|
+
/** An error event: `data.error` of an `error` delivery. */
|
|
66
|
+
declare const errorSchema: z.ZodObject<{
|
|
67
|
+
event_id: z.ZodString;
|
|
68
|
+
issue_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
69
|
+
title: z.ZodString;
|
|
70
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
71
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
release: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
issue_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
}, z.core.$loose>;
|
|
79
|
+
/** The event an issue alert fired on: `data.event` of an `event_alert` delivery. */
|
|
80
|
+
declare const alertEventSchema: z.ZodObject<{
|
|
81
|
+
event_id: z.ZodString;
|
|
82
|
+
issue_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
83
|
+
title: z.ZodString;
|
|
84
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
85
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
87
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
88
|
+
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
|
+
release: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
issue_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
}, z.core.$loose>;
|
|
93
|
+
/** An incident: `data.metric_alert` of a `metric_alert` delivery. */
|
|
94
|
+
declare const metricAlertSchema: z.ZodObject<{
|
|
95
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
96
|
+
identifier: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
97
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
99
|
+
projects: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
100
|
+
alert_rule: z.ZodObject<{
|
|
101
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
}, z.core.$loose>;
|
|
104
|
+
}, z.core.$loose>;
|
|
105
|
+
/** The body of an `issue.<action>` event: the delivery as Sentry posted it. */
|
|
106
|
+
declare const issueEventSchema: z.ZodObject<{
|
|
107
|
+
action: z.ZodEnum<{
|
|
108
|
+
created: "created";
|
|
109
|
+
resolved: "resolved";
|
|
110
|
+
assigned: "assigned";
|
|
111
|
+
archived: "archived";
|
|
112
|
+
unresolved: "unresolved";
|
|
113
|
+
}>;
|
|
114
|
+
data: z.ZodObject<{
|
|
115
|
+
issue: z.ZodObject<{
|
|
116
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
117
|
+
shortId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
title: z.ZodString;
|
|
119
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
120
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
121
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
122
|
+
substatus: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
123
|
+
priority: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
125
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
126
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
127
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
128
|
+
}, z.core.$loose>>>;
|
|
129
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
130
|
+
permalink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
131
|
+
assignedTo: z.ZodOptional<z.ZodUnknown>;
|
|
132
|
+
}, z.core.$loose>;
|
|
133
|
+
}, z.core.$loose>;
|
|
134
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
135
|
+
uuid: z.ZodString;
|
|
136
|
+
}, z.core.$loose>>>;
|
|
137
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
138
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
139
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
140
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
+
}, z.core.$loose>>>;
|
|
142
|
+
}, z.core.$loose>;
|
|
143
|
+
type SentryIssueEvent = z.infer<typeof issueEventSchema>;
|
|
144
|
+
/** The body of an `error.created` event. */
|
|
145
|
+
declare const errorEventSchema: z.ZodObject<{
|
|
146
|
+
action: z.ZodEnum<{
|
|
147
|
+
created: "created";
|
|
148
|
+
}>;
|
|
149
|
+
data: z.ZodObject<{
|
|
150
|
+
error: z.ZodObject<{
|
|
151
|
+
event_id: z.ZodString;
|
|
152
|
+
issue_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
153
|
+
title: z.ZodString;
|
|
154
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
155
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
156
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
157
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
158
|
+
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
159
|
+
release: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
160
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
161
|
+
issue_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
162
|
+
}, z.core.$loose>;
|
|
163
|
+
}, z.core.$loose>;
|
|
164
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
165
|
+
uuid: z.ZodString;
|
|
166
|
+
}, z.core.$loose>>>;
|
|
167
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
168
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
169
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
170
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
171
|
+
}, z.core.$loose>>>;
|
|
172
|
+
}, z.core.$loose>;
|
|
173
|
+
type SentryErrorEvent = z.infer<typeof errorEventSchema>;
|
|
174
|
+
/** The body of an `event_alert.triggered` event: the event and the rule that fired. */
|
|
175
|
+
declare const eventAlertEventSchema: z.ZodObject<{
|
|
176
|
+
action: z.ZodEnum<{
|
|
177
|
+
triggered: "triggered";
|
|
178
|
+
}>;
|
|
179
|
+
data: z.ZodObject<{
|
|
180
|
+
event: z.ZodObject<{
|
|
181
|
+
event_id: z.ZodString;
|
|
182
|
+
issue_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
183
|
+
title: z.ZodString;
|
|
184
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
185
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
186
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
release: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
190
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
191
|
+
issue_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
192
|
+
}, z.core.$loose>;
|
|
193
|
+
triggered_rule: z.ZodString;
|
|
194
|
+
}, z.core.$loose>;
|
|
195
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
196
|
+
uuid: z.ZodString;
|
|
197
|
+
}, z.core.$loose>>>;
|
|
198
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
199
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
201
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
202
|
+
}, z.core.$loose>>>;
|
|
203
|
+
}, z.core.$loose>;
|
|
204
|
+
type SentryEventAlertEvent = z.infer<typeof eventAlertEventSchema>;
|
|
205
|
+
/** The body of a `metric_alert.<action>` event: the incident and its alert rule. */
|
|
206
|
+
declare const metricAlertEventSchema: z.ZodObject<{
|
|
207
|
+
action: z.ZodEnum<{
|
|
208
|
+
resolved: "resolved";
|
|
209
|
+
critical: "critical";
|
|
210
|
+
warning: "warning";
|
|
211
|
+
}>;
|
|
212
|
+
data: z.ZodObject<{
|
|
213
|
+
metric_alert: z.ZodObject<{
|
|
214
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
215
|
+
identifier: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
216
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
217
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
218
|
+
projects: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
219
|
+
alert_rule: z.ZodObject<{
|
|
220
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
221
|
+
name: z.ZodString;
|
|
222
|
+
}, z.core.$loose>;
|
|
223
|
+
}, z.core.$loose>;
|
|
224
|
+
description_title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
225
|
+
description_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
226
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
227
|
+
}, z.core.$loose>;
|
|
228
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
229
|
+
uuid: z.ZodString;
|
|
230
|
+
}, z.core.$loose>>>;
|
|
231
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
232
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
233
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
234
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
235
|
+
}, z.core.$loose>>>;
|
|
236
|
+
}, z.core.$loose>;
|
|
237
|
+
type SentryMetricAlertEvent = z.infer<typeof metricAlertEventSchema>;
|
|
238
|
+
/**
|
|
239
|
+
* The events this adapter publishes, by resource: an event is named `<resource>.<action>`
|
|
240
|
+
* (`issue.created`, `metric_alert.critical`).
|
|
241
|
+
*/
|
|
242
|
+
declare const events: {
|
|
243
|
+
issue: z.ZodObject<{
|
|
244
|
+
action: z.ZodEnum<{
|
|
245
|
+
created: "created";
|
|
246
|
+
resolved: "resolved";
|
|
247
|
+
assigned: "assigned";
|
|
248
|
+
archived: "archived";
|
|
249
|
+
unresolved: "unresolved";
|
|
250
|
+
}>;
|
|
251
|
+
data: z.ZodObject<{
|
|
252
|
+
issue: z.ZodObject<{
|
|
253
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
254
|
+
shortId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
255
|
+
title: z.ZodString;
|
|
256
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
257
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
258
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
259
|
+
substatus: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
260
|
+
priority: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
261
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
262
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
263
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
264
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
265
|
+
}, z.core.$loose>>>;
|
|
266
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
267
|
+
permalink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
268
|
+
assignedTo: z.ZodOptional<z.ZodUnknown>;
|
|
269
|
+
}, z.core.$loose>;
|
|
270
|
+
}, z.core.$loose>;
|
|
271
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
272
|
+
uuid: z.ZodString;
|
|
273
|
+
}, z.core.$loose>>>;
|
|
274
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
275
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
276
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
277
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
278
|
+
}, z.core.$loose>>>;
|
|
279
|
+
}, z.core.$loose>;
|
|
280
|
+
error: z.ZodObject<{
|
|
281
|
+
action: z.ZodEnum<{
|
|
282
|
+
created: "created";
|
|
283
|
+
}>;
|
|
284
|
+
data: z.ZodObject<{
|
|
285
|
+
error: z.ZodObject<{
|
|
286
|
+
event_id: z.ZodString;
|
|
287
|
+
issue_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
288
|
+
title: z.ZodString;
|
|
289
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
290
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
291
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
292
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
293
|
+
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
294
|
+
release: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
295
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
296
|
+
issue_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
297
|
+
}, z.core.$loose>;
|
|
298
|
+
}, z.core.$loose>;
|
|
299
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
300
|
+
uuid: z.ZodString;
|
|
301
|
+
}, z.core.$loose>>>;
|
|
302
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
303
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
304
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
305
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
306
|
+
}, z.core.$loose>>>;
|
|
307
|
+
}, z.core.$loose>;
|
|
308
|
+
event_alert: z.ZodObject<{
|
|
309
|
+
action: z.ZodEnum<{
|
|
310
|
+
triggered: "triggered";
|
|
311
|
+
}>;
|
|
312
|
+
data: z.ZodObject<{
|
|
313
|
+
event: z.ZodObject<{
|
|
314
|
+
event_id: z.ZodString;
|
|
315
|
+
issue_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
316
|
+
title: z.ZodString;
|
|
317
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
318
|
+
level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
319
|
+
culprit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
320
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
321
|
+
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
322
|
+
release: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
323
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
324
|
+
issue_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
325
|
+
}, z.core.$loose>;
|
|
326
|
+
triggered_rule: z.ZodString;
|
|
327
|
+
}, z.core.$loose>;
|
|
328
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
329
|
+
uuid: z.ZodString;
|
|
330
|
+
}, z.core.$loose>>>;
|
|
331
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
332
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
333
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
334
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
335
|
+
}, z.core.$loose>>>;
|
|
336
|
+
}, z.core.$loose>;
|
|
337
|
+
metric_alert: z.ZodObject<{
|
|
338
|
+
action: z.ZodEnum<{
|
|
339
|
+
resolved: "resolved";
|
|
340
|
+
critical: "critical";
|
|
341
|
+
warning: "warning";
|
|
342
|
+
}>;
|
|
343
|
+
data: z.ZodObject<{
|
|
344
|
+
metric_alert: z.ZodObject<{
|
|
345
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
346
|
+
identifier: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
347
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
348
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
349
|
+
projects: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
350
|
+
alert_rule: z.ZodObject<{
|
|
351
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
352
|
+
name: z.ZodString;
|
|
353
|
+
}, z.core.$loose>;
|
|
354
|
+
}, z.core.$loose>;
|
|
355
|
+
description_title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
356
|
+
description_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
357
|
+
web_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
358
|
+
}, z.core.$loose>;
|
|
359
|
+
installation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
360
|
+
uuid: z.ZodString;
|
|
361
|
+
}, z.core.$loose>>>;
|
|
362
|
+
actor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
363
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
364
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
365
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
366
|
+
}, z.core.$loose>>>;
|
|
367
|
+
}, z.core.$loose>;
|
|
368
|
+
};
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/sentry.d.ts
|
|
371
|
+
/**
|
|
372
|
+
* Sentry needs no options: the Client Secret of the internal integration (Settings → Developer
|
|
373
|
+
* Settings → Custom Integrations) is the source's secret.
|
|
374
|
+
*/
|
|
375
|
+
declare const sentryOptionsSchema: z.ZodObject<{}, z.core.$strip>;
|
|
376
|
+
type SentryOptions = NoOptions;
|
|
377
|
+
/** Whether a resource is one this adapter publishes (`installation`, `comment`, … are not). */
|
|
378
|
+
declare function isResource(resource: string): resource is SentryResource;
|
|
379
|
+
/** Whether an action is one Sentry documents for the resource. */
|
|
380
|
+
declare function isAction(resource: SentryResource, action: string): boolean;
|
|
381
|
+
/** The target of an issue: every event about one Sentry issue shares it. */
|
|
382
|
+
declare function issueTarget(issue: string): string;
|
|
383
|
+
/** The target of a metric alert: its rule, so `critical` and `resolved` of one rule share it. */
|
|
384
|
+
declare function alertRuleTarget(rule: string): string;
|
|
385
|
+
/**
|
|
386
|
+
* The `<resource>.<action>` event of a delivery, its body the delivery as the resource's schema
|
|
387
|
+
* reads it; or the schema's error.
|
|
388
|
+
*/
|
|
389
|
+
declare function toSentryEvent(resource: SentryResource, delivery: SentryDelivery): NewEvent | z.ZodError;
|
|
390
|
+
/** One Sentry integration's webhooks, verified with its Client Secret. */
|
|
391
|
+
declare function sentryInstance(secret: string): AdapterInstance;
|
|
392
|
+
/** The `sentry` adapter's definition, which a JSON config names as `"adapter": "sentry"`. */
|
|
393
|
+
declare const adapter: Adapter<SentryOptions>;
|
|
394
|
+
/**
|
|
395
|
+
* The `sentry` adapter builder, for a source in a TypeScript config:
|
|
396
|
+
*
|
|
397
|
+
* sources: { sentry: sentry({ secret: env("SENTRY_CLIENT_SECRET") }) }
|
|
398
|
+
*/
|
|
399
|
+
declare const sentry: ((input: SentryOptions & {
|
|
400
|
+
readonly secret: string | undefined;
|
|
401
|
+
}) => AdapterBinding<"sentry", typeof events>) & {
|
|
402
|
+
events: {
|
|
403
|
+
readonly issue: {
|
|
404
|
+
readonly created: import("briefkasten").DeliveryBuilder;
|
|
405
|
+
readonly resolved: import("briefkasten").DeliveryBuilder;
|
|
406
|
+
readonly assigned: import("briefkasten").DeliveryBuilder;
|
|
407
|
+
};
|
|
408
|
+
readonly error: {
|
|
409
|
+
readonly created: import("briefkasten").DeliveryBuilder;
|
|
410
|
+
};
|
|
411
|
+
readonly eventAlert: {
|
|
412
|
+
readonly triggered: import("briefkasten").DeliveryBuilder;
|
|
413
|
+
};
|
|
414
|
+
readonly metricAlert: {
|
|
415
|
+
readonly critical: import("briefkasten").DeliveryBuilder;
|
|
416
|
+
readonly warning: import("briefkasten").DeliveryBuilder;
|
|
417
|
+
readonly resolved: import("briefkasten").DeliveryBuilder;
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
/** The Sentry adapter's event tables, for a client's typed handlers. */
|
|
422
|
+
type SentryEvents = typeof events;
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/samples.d.ts
|
|
425
|
+
declare const samples: readonly AdapterSample[];
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/signature.d.ts
|
|
428
|
+
/** HMAC-SHA256 of the raw body, lowercase hex, as Sentry computes it with the client secret. */
|
|
429
|
+
declare function signatureOf(secret: string, body: Uint8Array): string;
|
|
430
|
+
/** Constant-time comparison, so a near-miss signature cannot be found byte by byte. */
|
|
431
|
+
declare function signaturesEqual(expected: string, provided: string): boolean;
|
|
432
|
+
//#endregion
|
|
433
|
+
export { RESOURCES, type SentryDelivery, type SentryErrorEvent, type SentryEventAlertEvent, type SentryEvents, type SentryIssueEvent, type SentryMetricAlertEvent, type SentryOptions, type SentryResource, adapter, alertEventSchema, alertRuleTarget, deliverySchema, errorEventSchema, errorSchema, eventAlertEventSchema, events, isAction, isResource, issueEventSchema, issueSchema, issueTarget, metricAlertEventSchema, metricAlertSchema, samples, sentry, sentryInstance, sentryOptionsSchema, signatureOf, signaturesEqual, toSentryEvent };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { builtSample, defineBinding } from "briefkasten";
|
|
3
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
4
|
+
//#region src/sentry-schemas.ts
|
|
5
|
+
/**
|
|
6
|
+
* Sentry's integration webhooks, as its documentation describes them
|
|
7
|
+
* (https://docs.sentry.io/organization/integrations/integration-platform/webhooks/):
|
|
8
|
+
*
|
|
9
|
+
* headers: Sentry-Hook-Resource: issue, Sentry-Hook-Timestamp, Sentry-Hook-Signature, Request-ID
|
|
10
|
+
* body: { action: "created", installation: { uuid }, data: { issue: { … } }, actor: { … } }
|
|
11
|
+
*
|
|
12
|
+
* The resource names what changed and the action what happened to it. This adapter publishes
|
|
13
|
+
* the four resources an integration subscribes to for errors and alerts:
|
|
14
|
+
*
|
|
15
|
+
* | Resource | Actions | `data` holds |
|
|
16
|
+
* | -------------- | ----------------------------------------------------------- | ---------------------- |
|
|
17
|
+
* | `issue` | `created`, `resolved`, `assigned`, `archived`, `unresolved` | `issue` |
|
|
18
|
+
* | `error` | `created` | `error` |
|
|
19
|
+
* | `event_alert` | `triggered` | `event`, `triggered_rule` |
|
|
20
|
+
* | `metric_alert` | `critical`, `warning`, `resolved` | `metric_alert`, `description_title`, … |
|
|
21
|
+
*
|
|
22
|
+
* The fields this adapter addresses an event by are required; everything else passes through,
|
|
23
|
+
* so a field Sentry adds later does not drop a delivery.
|
|
24
|
+
*/
|
|
25
|
+
/** The actions of each resource this adapter publishes, as Sentry's resource pages list them. */
|
|
26
|
+
const RESOURCES = {
|
|
27
|
+
issue: [
|
|
28
|
+
"created",
|
|
29
|
+
"resolved",
|
|
30
|
+
"assigned",
|
|
31
|
+
"archived",
|
|
32
|
+
"unresolved"
|
|
33
|
+
],
|
|
34
|
+
error: ["created"],
|
|
35
|
+
event_alert: ["triggered"],
|
|
36
|
+
metric_alert: [
|
|
37
|
+
"critical",
|
|
38
|
+
"warning",
|
|
39
|
+
"resolved"
|
|
40
|
+
]
|
|
41
|
+
};
|
|
42
|
+
/** An id Sentry sends as text in one place and as a number in another; always text here. */
|
|
43
|
+
const id = z.union([z.string().min(1), z.number().int().nonnegative()]).transform((value) => String(value));
|
|
44
|
+
/** Who caused it: a user, the integration itself, or Sentry (`{ type: "application" }`). */
|
|
45
|
+
const actorSchema = z.object({
|
|
46
|
+
type: z.string().nullish(),
|
|
47
|
+
id: id.nullish(),
|
|
48
|
+
name: z.string().nullish()
|
|
49
|
+
}).passthrough();
|
|
50
|
+
const installationSchema = z.object({ uuid: z.string().min(1) }).passthrough();
|
|
51
|
+
/** What every delivery has: the action, the installation, the resource's data and the actor. */
|
|
52
|
+
const deliverySchema = z.object({
|
|
53
|
+
action: z.string().min(1),
|
|
54
|
+
installation: installationSchema.nullish(),
|
|
55
|
+
data: z.record(z.string(), z.unknown()),
|
|
56
|
+
actor: actorSchema.nullish()
|
|
57
|
+
}).passthrough();
|
|
58
|
+
/** What every event body has besides its action and data: the delivery as Sentry posted it. */
|
|
59
|
+
const envelope = {
|
|
60
|
+
installation: installationSchema.nullish(),
|
|
61
|
+
actor: actorSchema.nullish()
|
|
62
|
+
};
|
|
63
|
+
const projectSchema = z.object({
|
|
64
|
+
id,
|
|
65
|
+
name: z.string().nullish(),
|
|
66
|
+
slug: z.string().nullish()
|
|
67
|
+
}).passthrough();
|
|
68
|
+
/** An issue: `data.issue` of an `issue` delivery. */
|
|
69
|
+
const issueSchema = z.object({
|
|
70
|
+
id,
|
|
71
|
+
shortId: z.string().nullish(),
|
|
72
|
+
title: z.string(),
|
|
73
|
+
culprit: z.string().nullish(),
|
|
74
|
+
level: z.string().nullish(),
|
|
75
|
+
status: z.string().nullish(),
|
|
76
|
+
substatus: z.string().nullish(),
|
|
77
|
+
priority: z.string().nullish(),
|
|
78
|
+
project: projectSchema.nullish(),
|
|
79
|
+
web_url: z.string().nullish(),
|
|
80
|
+
permalink: z.string().nullish(),
|
|
81
|
+
assignedTo: z.unknown().optional()
|
|
82
|
+
}).passthrough();
|
|
83
|
+
/** An error event: `data.error` of an `error` delivery. */
|
|
84
|
+
const errorSchema = z.object({
|
|
85
|
+
event_id: z.string().min(1),
|
|
86
|
+
issue_id: id,
|
|
87
|
+
title: z.string(),
|
|
88
|
+
project: id.nullish(),
|
|
89
|
+
level: z.string().nullish(),
|
|
90
|
+
culprit: z.string().nullish(),
|
|
91
|
+
datetime: z.string().nullish(),
|
|
92
|
+
environment: z.string().nullish(),
|
|
93
|
+
release: z.string().nullish(),
|
|
94
|
+
web_url: z.string().nullish(),
|
|
95
|
+
issue_url: z.string().nullish()
|
|
96
|
+
}).passthrough();
|
|
97
|
+
/** The event an issue alert fired on: `data.event` of an `event_alert` delivery. */
|
|
98
|
+
const alertEventSchema = errorSchema;
|
|
99
|
+
/** An incident: `data.metric_alert` of a `metric_alert` delivery. */
|
|
100
|
+
const metricAlertSchema = z.object({
|
|
101
|
+
id,
|
|
102
|
+
identifier: id.nullish(),
|
|
103
|
+
title: z.string().nullish(),
|
|
104
|
+
status: z.number().nullish(),
|
|
105
|
+
projects: z.array(z.string()).nullish(),
|
|
106
|
+
alert_rule: z.object({
|
|
107
|
+
id,
|
|
108
|
+
name: z.string()
|
|
109
|
+
}).passthrough()
|
|
110
|
+
}).passthrough();
|
|
111
|
+
/** The body of an `issue.<action>` event: the delivery as Sentry posted it. */
|
|
112
|
+
const issueEventSchema = z.object({
|
|
113
|
+
...envelope,
|
|
114
|
+
action: z.enum(RESOURCES.issue),
|
|
115
|
+
data: z.object({ issue: issueSchema }).passthrough()
|
|
116
|
+
}).passthrough();
|
|
117
|
+
/** The body of an `error.created` event. */
|
|
118
|
+
const errorEventSchema = z.object({
|
|
119
|
+
...envelope,
|
|
120
|
+
action: z.enum(RESOURCES.error),
|
|
121
|
+
data: z.object({ error: errorSchema }).passthrough()
|
|
122
|
+
}).passthrough();
|
|
123
|
+
/** The body of an `event_alert.triggered` event: the event and the rule that fired. */
|
|
124
|
+
const eventAlertEventSchema = z.object({
|
|
125
|
+
...envelope,
|
|
126
|
+
action: z.enum(RESOURCES.event_alert),
|
|
127
|
+
data: z.object({
|
|
128
|
+
event: alertEventSchema,
|
|
129
|
+
triggered_rule: z.string()
|
|
130
|
+
}).passthrough()
|
|
131
|
+
}).passthrough();
|
|
132
|
+
/** The body of a `metric_alert.<action>` event: the incident and its alert rule. */
|
|
133
|
+
const metricAlertEventSchema = z.object({
|
|
134
|
+
...envelope,
|
|
135
|
+
action: z.enum(RESOURCES.metric_alert),
|
|
136
|
+
data: z.object({
|
|
137
|
+
metric_alert: metricAlertSchema,
|
|
138
|
+
description_title: z.string().nullish(),
|
|
139
|
+
description_text: z.string().nullish(),
|
|
140
|
+
web_url: z.string().nullish()
|
|
141
|
+
}).passthrough()
|
|
142
|
+
}).passthrough();
|
|
143
|
+
/**
|
|
144
|
+
* The events this adapter publishes, by resource: an event is named `<resource>.<action>`
|
|
145
|
+
* (`issue.created`, `metric_alert.critical`).
|
|
146
|
+
*/
|
|
147
|
+
const events = {
|
|
148
|
+
issue: issueEventSchema,
|
|
149
|
+
error: errorEventSchema,
|
|
150
|
+
event_alert: eventAlertEventSchema,
|
|
151
|
+
metric_alert: metricAlertEventSchema
|
|
152
|
+
};
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/signature.ts
|
|
155
|
+
/** HMAC-SHA256 of the raw body, lowercase hex, as Sentry computes it with the client secret. */
|
|
156
|
+
function signatureOf(secret, body) {
|
|
157
|
+
return createHmac("sha256", secret).update(body).digest("hex");
|
|
158
|
+
}
|
|
159
|
+
/** Constant-time comparison, so a near-miss signature cannot be found byte by byte. */
|
|
160
|
+
function signaturesEqual(expected, provided) {
|
|
161
|
+
const left = Buffer.from(expected, "utf8");
|
|
162
|
+
const right = Buffer.from(provided, "utf8");
|
|
163
|
+
return left.length === right.length && timingSafeEqual(left, right);
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/samples.ts
|
|
167
|
+
/**
|
|
168
|
+
* Sentry's integration webhooks, typed: a builder per event makes the payload Sentry's resource
|
|
169
|
+
* pages show (invented ids and names) with the fields a caller gives (`number` the issue's id,
|
|
170
|
+
* `title`, `repo` the project's slug, `author` the person who acted), signed the way Sentry signs
|
|
171
|
+
* (`Sentry-Hook-Signature`, HMAC-SHA256 of the raw body with the client secret, lowercase hex),
|
|
172
|
+
* with `Sentry-Hook-Resource`, `Sentry-Hook-Timestamp` (seconds) and `Request-ID`, so it passes
|
|
173
|
+
* the adapter's verification.
|
|
174
|
+
*/
|
|
175
|
+
const MS_PER_SECOND = 1e3;
|
|
176
|
+
const NOW = "2026-12-03T12:00:00.000000Z";
|
|
177
|
+
const ORG = "acme";
|
|
178
|
+
const INSTALLATION = { uuid: "7a9c1e3b-5d7f-4b1d-8f3a-5c7e9b1d3f5a" };
|
|
179
|
+
const SENTRY_ACTOR = {
|
|
180
|
+
type: "application",
|
|
181
|
+
id: "sentry",
|
|
182
|
+
name: "Sentry"
|
|
183
|
+
};
|
|
184
|
+
const ISSUE = {
|
|
185
|
+
id: 5813940217,
|
|
186
|
+
shortId: "ACME-SHOP-3F",
|
|
187
|
+
title: "TypeError: Cannot read properties of undefined (reading 'stamp')",
|
|
188
|
+
culprit: "sort-office/route.ts in sortLetters",
|
|
189
|
+
project: {
|
|
190
|
+
id: "4508123",
|
|
191
|
+
name: "acme-shop",
|
|
192
|
+
slug: "acme-shop",
|
|
193
|
+
platform: "javascript"
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const EVENT_ID = "c3e5a7c9e1b34d5f8a1c3e5a7c9e1b3d";
|
|
197
|
+
/** Signs a payload as Sentry does, with the resource it is about. */
|
|
198
|
+
function signer(resource) {
|
|
199
|
+
return (payload, context) => {
|
|
200
|
+
const body = JSON.stringify(payload);
|
|
201
|
+
return {
|
|
202
|
+
headers: {
|
|
203
|
+
"content-type": "application/json",
|
|
204
|
+
"request-id": context.id,
|
|
205
|
+
"sentry-hook-resource": resource,
|
|
206
|
+
"sentry-hook-timestamp": String(Math.floor(context.now / MS_PER_SECOND)),
|
|
207
|
+
"sentry-hook-signature": signatureOf(context.secret, new TextEncoder().encode(body))
|
|
208
|
+
},
|
|
209
|
+
body
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/** The person who acted, or Sentry when nobody did. */
|
|
214
|
+
function actor(fields) {
|
|
215
|
+
return fields.author === void 0 ? SENTRY_ACTOR : {
|
|
216
|
+
type: "user",
|
|
217
|
+
id: "2817364",
|
|
218
|
+
name: fields.author
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function issueId(fields) {
|
|
222
|
+
return String(fields.number ?? ISSUE.id);
|
|
223
|
+
}
|
|
224
|
+
function slug(fields) {
|
|
225
|
+
return fields.repo ?? ISSUE.project.slug;
|
|
226
|
+
}
|
|
227
|
+
/** `data.issue` as Sentry's issue webhook shows it. */
|
|
228
|
+
function issueData(fields, status) {
|
|
229
|
+
const id = issueId(fields);
|
|
230
|
+
const project = slug(fields);
|
|
231
|
+
return {
|
|
232
|
+
url: `https://sentry.io/api/0/organizations/${ORG}/issues/${id}/`,
|
|
233
|
+
web_url: `https://${ORG}.sentry.io/issues/${id}/`,
|
|
234
|
+
project_url: `https://${ORG}.sentry.io/issues/?project=${ISSUE.project.id}`,
|
|
235
|
+
id,
|
|
236
|
+
shortId: ISSUE.shortId,
|
|
237
|
+
title: fields.title ?? ISSUE.title,
|
|
238
|
+
culprit: ISSUE.culprit,
|
|
239
|
+
permalink: `https://${ORG}.sentry.io/issues/${id}/`,
|
|
240
|
+
level: "error",
|
|
241
|
+
statusDetails: {},
|
|
242
|
+
platform: "javascript",
|
|
243
|
+
project: {
|
|
244
|
+
...ISSUE.project,
|
|
245
|
+
name: project,
|
|
246
|
+
slug: project
|
|
247
|
+
},
|
|
248
|
+
type: "error",
|
|
249
|
+
metadata: {
|
|
250
|
+
type: "TypeError",
|
|
251
|
+
value: "Cannot read properties of undefined (reading 'stamp')"
|
|
252
|
+
},
|
|
253
|
+
issueType: "error",
|
|
254
|
+
issueCategory: "error",
|
|
255
|
+
priority: "high",
|
|
256
|
+
count: "1",
|
|
257
|
+
userCount: 1,
|
|
258
|
+
firstSeen: NOW,
|
|
259
|
+
lastSeen: NOW,
|
|
260
|
+
assignedTo: null,
|
|
261
|
+
...status
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function issue(action, status) {
|
|
265
|
+
return (fields = {}) => ({
|
|
266
|
+
adapter: "sentry",
|
|
267
|
+
event: `issue.${action}`,
|
|
268
|
+
payload: {
|
|
269
|
+
action,
|
|
270
|
+
installation: INSTALLATION,
|
|
271
|
+
data: { issue: issueData(fields, status(fields)) },
|
|
272
|
+
actor: actor(fields)
|
|
273
|
+
},
|
|
274
|
+
sign: signer("issue")
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/** An event of an issue, as `data.error` and `data.event` show it. */
|
|
278
|
+
function eventData(fields) {
|
|
279
|
+
const id = issueId(fields);
|
|
280
|
+
return {
|
|
281
|
+
event_id: EVENT_ID,
|
|
282
|
+
issue_id: id,
|
|
283
|
+
project: Number(ISSUE.project.id),
|
|
284
|
+
title: fields.title ?? ISSUE.title,
|
|
285
|
+
culprit: ISSUE.culprit,
|
|
286
|
+
level: "error",
|
|
287
|
+
platform: "javascript",
|
|
288
|
+
datetime: NOW,
|
|
289
|
+
environment: "production",
|
|
290
|
+
release: `${slug(fields)}@1.4.0`,
|
|
291
|
+
url: `https://sentry.io/api/0/projects/${ORG}/${slug(fields)}/events/${EVENT_ID}/`,
|
|
292
|
+
web_url: `https://${ORG}.sentry.io/issues/${id}/events/${EVENT_ID}/`,
|
|
293
|
+
issue_url: `https://sentry.io/api/0/issues/${id}/`
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
const errorCreated = (fields = {}) => ({
|
|
297
|
+
adapter: "sentry",
|
|
298
|
+
event: "error.created",
|
|
299
|
+
payload: {
|
|
300
|
+
action: "created",
|
|
301
|
+
installation: INSTALLATION,
|
|
302
|
+
data: { error: eventData(fields) },
|
|
303
|
+
actor: SENTRY_ACTOR
|
|
304
|
+
},
|
|
305
|
+
sign: signer("error")
|
|
306
|
+
});
|
|
307
|
+
const RULE = "More than 10 errors in 5 minutes";
|
|
308
|
+
const eventAlertTriggered = (fields = {}) => ({
|
|
309
|
+
adapter: "sentry",
|
|
310
|
+
event: "event_alert.triggered",
|
|
311
|
+
payload: {
|
|
312
|
+
action: "triggered",
|
|
313
|
+
installation: INSTALLATION,
|
|
314
|
+
data: {
|
|
315
|
+
event: eventData(fields),
|
|
316
|
+
triggered_rule: RULE
|
|
317
|
+
},
|
|
318
|
+
actor: SENTRY_ACTOR
|
|
319
|
+
},
|
|
320
|
+
sign: signer("event_alert")
|
|
321
|
+
});
|
|
322
|
+
const METRIC_RULE = {
|
|
323
|
+
id: "7",
|
|
324
|
+
name: "Checkout errors",
|
|
325
|
+
aggregate: "count()",
|
|
326
|
+
dataset: "events"
|
|
327
|
+
};
|
|
328
|
+
function metricAlert(action, title, closed) {
|
|
329
|
+
return (fields = {}) => {
|
|
330
|
+
const name = fields.title ?? METRIC_RULE.name;
|
|
331
|
+
return {
|
|
332
|
+
adapter: "sentry",
|
|
333
|
+
event: `metric_alert.${action}`,
|
|
334
|
+
payload: {
|
|
335
|
+
action,
|
|
336
|
+
installation: INSTALLATION,
|
|
337
|
+
data: {
|
|
338
|
+
description_text: "1000 events in the last 10 minutes\nFilter: level:error",
|
|
339
|
+
description_title: `${title}: ${name}`,
|
|
340
|
+
metric_alert: {
|
|
341
|
+
alert_rule: {
|
|
342
|
+
...METRIC_RULE,
|
|
343
|
+
name,
|
|
344
|
+
query: "level:error",
|
|
345
|
+
time_window: 10,
|
|
346
|
+
projects: [slug(fields)],
|
|
347
|
+
triggers: []
|
|
348
|
+
},
|
|
349
|
+
date_closed: closed ? NOW : null,
|
|
350
|
+
date_created: NOW,
|
|
351
|
+
date_detected: NOW,
|
|
352
|
+
date_started: NOW,
|
|
353
|
+
id: String(fields.number ?? 4),
|
|
354
|
+
identifier: String(fields.number ?? 4),
|
|
355
|
+
projects: [slug(fields)],
|
|
356
|
+
status: closed ? 2 : 1,
|
|
357
|
+
title: name
|
|
358
|
+
},
|
|
359
|
+
web_url: `https://${ORG}.sentry.io/alerts/rules/details/${METRIC_RULE.id}/`
|
|
360
|
+
},
|
|
361
|
+
actor: SENTRY_ACTOR
|
|
362
|
+
},
|
|
363
|
+
sign: signer("metric_alert")
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
/** Sentry's typed event builders: `sentry.events.issue.created({ title })`. */
|
|
368
|
+
const deliveries = {
|
|
369
|
+
issue: {
|
|
370
|
+
created: issue("created", () => ({
|
|
371
|
+
status: "unresolved",
|
|
372
|
+
substatus: "new"
|
|
373
|
+
})),
|
|
374
|
+
resolved: issue("resolved", () => ({
|
|
375
|
+
status: "resolved",
|
|
376
|
+
substatus: null,
|
|
377
|
+
statusDetails: { inNextRelease: true }
|
|
378
|
+
})),
|
|
379
|
+
assigned: issue("assigned", (fields) => ({
|
|
380
|
+
status: "unresolved",
|
|
381
|
+
substatus: "ongoing",
|
|
382
|
+
assignedTo: {
|
|
383
|
+
type: "user",
|
|
384
|
+
id: "2817364",
|
|
385
|
+
name: fields.author ?? "Ada Example",
|
|
386
|
+
email: "ada@example.com"
|
|
387
|
+
}
|
|
388
|
+
}))
|
|
389
|
+
},
|
|
390
|
+
error: { created: errorCreated },
|
|
391
|
+
eventAlert: { triggered: eventAlertTriggered },
|
|
392
|
+
metricAlert: {
|
|
393
|
+
critical: metricAlert("critical", "Critical", false),
|
|
394
|
+
warning: metricAlert("warning", "Warning", false),
|
|
395
|
+
resolved: metricAlert("resolved", "Resolved", true)
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
const samples = [
|
|
399
|
+
builtSample("issue.created", "A new issue was created", deliveries.issue.created),
|
|
400
|
+
builtSample("issue.resolved", "Somebody resolved an issue", deliveries.issue.resolved),
|
|
401
|
+
builtSample("issue.assigned", "An issue was assigned to somebody", deliveries.issue.assigned),
|
|
402
|
+
builtSample("error.created", "An error event was received", deliveries.error.created),
|
|
403
|
+
builtSample("event_alert.triggered", "An issue alert rule fired", deliveries.eventAlert.triggered),
|
|
404
|
+
builtSample("metric_alert.critical", "A metric alert went critical", deliveries.metricAlert.critical),
|
|
405
|
+
builtSample("metric_alert.resolved", "A metric alert resolved", deliveries.metricAlert.resolved)
|
|
406
|
+
];
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/sentry.ts
|
|
409
|
+
/**
|
|
410
|
+
* The Sentry adapter: an internal integration's webhooks become events named
|
|
411
|
+
* `<resource>.<action>` (`issue.created`, `error.created`, `event_alert.triggered`,
|
|
412
|
+
* `metric_alert.critical`), each carrying the delivery as Sentry posted it.
|
|
413
|
+
*
|
|
414
|
+
* Verification is Sentry's own, as documented: HMAC-SHA256 of the **raw body** with the
|
|
415
|
+
* integration's Client Secret, lowercase hex, in `Sentry-Hook-Signature`; anything else fails
|
|
416
|
+
* closed. The resource is `Sentry-Hook-Resource`. Sentry also sends `Sentry-Hook-Timestamp`, but
|
|
417
|
+
* the signature does not cover it, so it proves nothing about when the delivery was made and is
|
|
418
|
+
* not checked: a delivery is as fresh as its signed body says. `Request-ID` identifies a delivery.
|
|
419
|
+
*/
|
|
420
|
+
const SIGNATURE_HEADER = "sentry-hook-signature";
|
|
421
|
+
const RESOURCE_HEADER = "sentry-hook-resource";
|
|
422
|
+
const ACCEPTED = 202;
|
|
423
|
+
const BAD_REQUEST = 400;
|
|
424
|
+
const UNAUTHORIZED = 401;
|
|
425
|
+
/**
|
|
426
|
+
* Sentry needs no options: the Client Secret of the internal integration (Settings → Developer
|
|
427
|
+
* Settings → Custom Integrations) is the source's secret.
|
|
428
|
+
*/
|
|
429
|
+
const sentryOptionsSchema = z.object({});
|
|
430
|
+
/** Whether a resource is one this adapter publishes (`installation`, `comment`, … are not). */
|
|
431
|
+
function isResource(resource) {
|
|
432
|
+
return Object.hasOwn(RESOURCES, resource);
|
|
433
|
+
}
|
|
434
|
+
/** Whether an action is one Sentry documents for the resource. */
|
|
435
|
+
function isAction(resource, action) {
|
|
436
|
+
return RESOURCES[resource].includes(action);
|
|
437
|
+
}
|
|
438
|
+
/** The target of an issue: every event about one Sentry issue shares it. */
|
|
439
|
+
function issueTarget(issue) {
|
|
440
|
+
return `issue:${issue}`;
|
|
441
|
+
}
|
|
442
|
+
/** The target of a metric alert: its rule, so `critical` and `resolved` of one rule share it. */
|
|
443
|
+
function alertRuleTarget(rule) {
|
|
444
|
+
return `alert_rule:${rule}`;
|
|
445
|
+
}
|
|
446
|
+
function reader(schema, target) {
|
|
447
|
+
return (name, delivery) => {
|
|
448
|
+
const parsed = schema.safeParse(delivery);
|
|
449
|
+
return parsed.success ? {
|
|
450
|
+
event: name,
|
|
451
|
+
target: target(parsed.data),
|
|
452
|
+
body: parsed.data
|
|
453
|
+
} : parsed.error;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
const READERS = {
|
|
457
|
+
issue: reader(issueEventSchema, (body) => issueTarget(body.data.issue.id)),
|
|
458
|
+
error: reader(errorEventSchema, (body) => issueTarget(body.data.error.issue_id)),
|
|
459
|
+
event_alert: reader(eventAlertEventSchema, (body) => issueTarget(body.data.event.issue_id)),
|
|
460
|
+
metric_alert: reader(metricAlertEventSchema, (body) => alertRuleTarget(body.data.metric_alert.alert_rule.id))
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* The `<resource>.<action>` event of a delivery, its body the delivery as the resource's schema
|
|
464
|
+
* reads it; or the schema's error.
|
|
465
|
+
*/
|
|
466
|
+
function toSentryEvent(resource, delivery) {
|
|
467
|
+
return READERS[resource](`${resource}.${delivery.action}`, delivery);
|
|
468
|
+
}
|
|
469
|
+
function json(body, status) {
|
|
470
|
+
return new Response(JSON.stringify(body), {
|
|
471
|
+
status,
|
|
472
|
+
headers: { "content-type": "application/json" }
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function refused(status, body) {
|
|
476
|
+
return {
|
|
477
|
+
response: json(body, status),
|
|
478
|
+
events: []
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function ignored(name) {
|
|
482
|
+
return {
|
|
483
|
+
response: json({ ignored: name }, ACCEPTED),
|
|
484
|
+
events: []
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
/** The fields a rejected payload got wrong, path by path: no values, so no event text. */
|
|
488
|
+
function issuesOf(error) {
|
|
489
|
+
return error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`);
|
|
490
|
+
}
|
|
491
|
+
/** The delivery, or why it is not one. */
|
|
492
|
+
function deliveryOf(raw) {
|
|
493
|
+
let decoded;
|
|
494
|
+
try {
|
|
495
|
+
decoded = JSON.parse(new TextDecoder().decode(raw));
|
|
496
|
+
} catch {
|
|
497
|
+
return "payload is not JSON";
|
|
498
|
+
}
|
|
499
|
+
const parsed = deliverySchema.safeParse(decoded);
|
|
500
|
+
return parsed.success ? parsed.data : "payload is not a Sentry delivery";
|
|
501
|
+
}
|
|
502
|
+
/** One Sentry integration's webhooks, verified with its Client Secret. */
|
|
503
|
+
function sentryInstance(secret) {
|
|
504
|
+
return { async handleWebhook(request) {
|
|
505
|
+
const raw = new Uint8Array(await request.arrayBuffer());
|
|
506
|
+
const signature = request.headers.get(SIGNATURE_HEADER);
|
|
507
|
+
if (signature === null || !signaturesEqual(signatureOf(secret, raw), signature)) return refused(UNAUTHORIZED, { error: "invalid signature" });
|
|
508
|
+
const resource = request.headers.get(RESOURCE_HEADER);
|
|
509
|
+
if (resource === null || resource === "") return refused(BAD_REQUEST, { error: "no Sentry-Hook-Resource header" });
|
|
510
|
+
const delivery = deliveryOf(raw);
|
|
511
|
+
if (typeof delivery === "string") return refused(BAD_REQUEST, { error: delivery });
|
|
512
|
+
const name = `${resource}.${delivery.action}`;
|
|
513
|
+
if (!isResource(resource) || !isAction(resource, delivery.action)) return ignored(name);
|
|
514
|
+
const event = toSentryEvent(resource, delivery);
|
|
515
|
+
if (event instanceof z.ZodError) return refused(BAD_REQUEST, {
|
|
516
|
+
error: `unreadable ${resource}`,
|
|
517
|
+
at: issuesOf(event),
|
|
518
|
+
keys: Object.keys(delivery.data)
|
|
519
|
+
});
|
|
520
|
+
return {
|
|
521
|
+
response: json({ ok: true }, ACCEPTED),
|
|
522
|
+
events: [event]
|
|
523
|
+
};
|
|
524
|
+
} };
|
|
525
|
+
}
|
|
526
|
+
/** The `sentry` adapter's definition, which a JSON config names as `"adapter": "sentry"`. */
|
|
527
|
+
const adapter = {
|
|
528
|
+
id: "sentry",
|
|
529
|
+
name: "Sentry",
|
|
530
|
+
samples,
|
|
531
|
+
optionsSchema: sentryOptionsSchema,
|
|
532
|
+
events,
|
|
533
|
+
targetDescription: "a Sentry issue (issue:<issue id>) or metric alert rule (alert_rule:<rule id>)",
|
|
534
|
+
create: (_options, context) => sentryInstance(context.secret)
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* The `sentry` adapter builder, for a source in a TypeScript config:
|
|
538
|
+
*
|
|
539
|
+
* sources: { sentry: sentry({ secret: env("SENTRY_CLIENT_SECRET") }) }
|
|
540
|
+
*/
|
|
541
|
+
const sentry = Object.assign((input) => {
|
|
542
|
+
const { secret, ...options } = input;
|
|
543
|
+
return defineBinding({
|
|
544
|
+
id: "sentry",
|
|
545
|
+
events,
|
|
546
|
+
options,
|
|
547
|
+
secret,
|
|
548
|
+
definition: adapter
|
|
549
|
+
});
|
|
550
|
+
}, { events: deliveries });
|
|
551
|
+
//#endregion
|
|
552
|
+
export { RESOURCES, adapter, alertEventSchema, alertRuleTarget, deliverySchema, errorEventSchema, errorSchema, eventAlertEventSchema, events, isAction, isResource, issueEventSchema, issueSchema, issueTarget, metricAlertEventSchema, metricAlertSchema, samples, sentry, sentryInstance, sentryOptionsSchema, signatureOf, signaturesEqual, toSentryEvent };
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@briefkasten/adapter-sentry",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Sentry adapter for briefkasten: integration webhooks for issues, errors and alerts, verified with Sentry-Hook-Signature",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"adapter",
|
|
7
|
+
"briefkasten",
|
|
8
|
+
"errors",
|
|
9
|
+
"sentry",
|
|
10
|
+
"typescript",
|
|
11
|
+
"webhooks"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://briefkasten.fabrik.computer/docs",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/mateffy/fabrik/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Lukas Mateffy",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/mateffy/fabrik.git",
|
|
22
|
+
"directory": "packages/briefkasten-adapter-sentry"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"main": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.mts",
|
|
36
|
+
"import": "./dist/index.mjs",
|
|
37
|
+
"default": "./dist/index.mjs"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"zod": "^4.4.3",
|
|
45
|
+
"briefkasten": "0.1.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"tsdown": "^0.22.3",
|
|
50
|
+
"typescript": "^5.8.0",
|
|
51
|
+
"vitest": "^4.0.0"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=22"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsdown",
|
|
58
|
+
"typecheck": "tsc --noEmit",
|
|
59
|
+
"test": "vitest run"
|
|
60
|
+
}
|
|
6
61
|
}
|