@sentry/junior-sentry 0.261.0 → 0.263.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/README.md CHANGED
@@ -50,7 +50,7 @@ For metric alerts, also enable **Alert Rule Action** on the integration and add
50
50
  Junior verifies `Sentry-Hook-Signature`, rejects payloads outside `SENTRY_WEBHOOK_ORG`, and publishes:
51
51
 
52
52
  - `issue.created` for `org/project#issueId` and `org/project`.
53
- - `metric_alert.critical`, `metric_alert.warning`, and `metric_alert.resolved` for `metric-alert:org/alertRuleId`.
53
+ - `metric_alert.critical`, `metric_alert.warning`, and `metric_alert.resolved` for `metric-alert:org/alertRuleId` and for `org/project` of each project on the alert rule.
54
54
 
55
55
  Create watches/event automations before the webhook arrives; unmatched deliveries are not replayed.
56
56
 
@@ -66,7 +66,10 @@ var metricAlertWebhookSchema = z.object({
66
66
  description_text: z.string().optional(),
67
67
  description_title: z.string().optional(),
68
68
  metric_alert: z.object({
69
- alert_rule: z.object({ id: z.coerce.string().min(1) }).passthrough(),
69
+ alert_rule: z.object({
70
+ id: z.coerce.string().min(1),
71
+ projects: z.array(z.string().min(1)).optional()
72
+ }).passthrough(),
70
73
  id: z.coerce.string().min(1)
71
74
  }).passthrough(),
72
75
  web_url: z.string().url()
@@ -161,17 +164,22 @@ function normalizeMetricAlertEvents(input) {
161
164
  data.description_text,
162
165
  `URL: ${data.web_url}`
163
166
  ].filter((part) => Boolean(part)).join("\n");
167
+ const event = {
168
+ // One event per incident state. Sentry retries get new Request-IDs.
169
+ eventKey: `sentry:${resource.identifier}:${incidentId}:${eventType}`,
170
+ eventType,
171
+ occurredAtMs: providerTime(input.hookTimestamp) ?? Date.now(),
172
+ trustedSummary: `${resource.label} is ${parsed.data.action}.`,
173
+ data: { alertRuleId, incidentId, url: data.web_url },
174
+ untrustedText
175
+ };
176
+ const projects = [...new Set(data.metric_alert.alert_rule.projects ?? [])];
164
177
  return [
165
- {
166
- // One event per incident state. Sentry retries get new Request-IDs.
167
- eventKey: `sentry:${resource.identifier}:${incidentId}:${eventType}`,
168
- eventType,
169
- identifier: resource.identifier,
170
- occurredAtMs: providerTime(input.hookTimestamp) ?? Date.now(),
171
- trustedSummary: `${resource.label} is ${parsed.data.action}.`,
172
- data: { alertRuleId, incidentId, url: data.web_url },
173
- untrustedText
174
- }
178
+ { ...event, identifier: resource.identifier },
179
+ ...projects.map((project) => ({
180
+ ...event,
181
+ identifier: sentryProjectResource({ org, project }).identifier
182
+ }))
175
183
  ];
176
184
  }
177
185
  function normalizeSentryEvents(input) {
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  createSentryWebhookRoute,
7
7
  sentryWebhookOrg,
8
8
  sentryWebhookSecret
9
- } from "./chunk-6VG4NPNH.js";
9
+ } from "./chunk-KUDJGV46.js";
10
10
 
11
11
  // src/index.ts
12
12
  import {
@@ -106,8 +106,14 @@ function sentryPlugin() {
106
106
  },
107
107
  {
108
108
  type: "project",
109
- supportedEvents: [...SENTRY_ISSUE_EVENTS],
110
- suggestedEvents: [...SENTRY_ISSUE_EVENTS]
109
+ supportedEvents: [
110
+ ...SENTRY_ISSUE_EVENTS,
111
+ ...SENTRY_METRIC_ALERT_EVENTS
112
+ ],
113
+ suggestedEvents: [
114
+ ...SENTRY_ISSUE_EVENTS,
115
+ ...SENTRY_METRIC_ALERT_SUGGESTED_EVENTS
116
+ ]
111
117
  },
112
118
  {
113
119
  type: "metric_alert",
package/dist/testing.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  sentryProjectResource,
6
6
  sentryWebhookOrg,
7
7
  sentryWebhookSecret
8
- } from "./chunk-6VG4NPNH.js";
8
+ } from "./chunk-KUDJGV46.js";
9
9
  export {
10
10
  createSentryWebhookRoute,
11
11
  normalizeSentryEvents,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-sentry",
3
- "version": "0.261.0",
3
+ "version": "0.263.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "zod": "^4.5.4",
30
- "@sentry/junior-plugin-api": "0.261.0"
30
+ "@sentry/junior-plugin-api": "0.263.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@oxlint/plugins": "1.79.0",
@@ -27,6 +27,7 @@ Before declaring a Sentry data surface unavailable, verify the current CLI help:
27
27
  2. Execute via CLI:
28
28
 
29
29
  - Use `sentry <command>` for structured queries.
30
+ - A repo can put its own `sentry` program first on PATH, for example in a `getsentry/sentry` checkout. If `sentry --help` does not show the Sentry CLI, run `/vercel/sandbox/.junior/bin/sentry` instead.
30
31
  - The runtime authenticates Sentry HTTP traffic for this skill. Do not set or print token env vars.
31
32
  - Read [references/cli-commands.md](references/cli-commands.md) when choosing command shapes, target formats, flags, API fallback, or troubleshooting behavior.
32
33
  - Read [references/sandbox-runtime.md](references/sandbox-runtime.md) before relying on sandbox credentials.