chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { SentryIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildErrorOutputs,
|
||||
buildSentryExtraFields,
|
||||
sentrySetupInstructions,
|
||||
sentryTriggerOptions,
|
||||
} from '@/triggers/sentry/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const sentryErrorCreatedTrigger: TriggerConfig = {
|
||||
id: 'sentry_error_created',
|
||||
name: 'Sentry Error Created',
|
||||
provider: 'sentry',
|
||||
description: 'Trigger workflow when a new error event is created in Sentry',
|
||||
version: '1.0.0',
|
||||
icon: SentryIcon,
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'sentry_error_created',
|
||||
triggerOptions: sentryTriggerOptions,
|
||||
setupInstructions: sentrySetupInstructions('Error'),
|
||||
extraFields: buildSentryExtraFields('sentry_error_created'),
|
||||
}),
|
||||
outputs: buildErrorOutputs(),
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Sentry-Hook-Resource': 'error',
|
||||
'Sentry-Hook-Signature': 'hmac-sha256-hex',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export { sentryErrorCreatedTrigger } from './error_created'
|
||||
export { sentryIssueAlertTrigger } from './issue_alert'
|
||||
export { sentryIssueCreatedTrigger } from './issue_created'
|
||||
export { sentryIssueResolvedTrigger } from './issue_resolved'
|
||||
export { sentryMetricAlertTrigger } from './metric_alert'
|
||||
@@ -0,0 +1,33 @@
|
||||
import { SentryIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIssueAlertOutputs,
|
||||
buildSentryExtraFields,
|
||||
sentrySetupInstructions,
|
||||
sentryTriggerOptions,
|
||||
} from '@/triggers/sentry/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const sentryIssueAlertTrigger: TriggerConfig = {
|
||||
id: 'sentry_issue_alert',
|
||||
name: 'Sentry Issue Alert',
|
||||
provider: 'sentry',
|
||||
description: 'Trigger workflow when a Sentry issue alert rule fires',
|
||||
version: '1.0.0',
|
||||
icon: SentryIcon,
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'sentry_issue_alert',
|
||||
triggerOptions: sentryTriggerOptions,
|
||||
setupInstructions: sentrySetupInstructions('Issue Alert'),
|
||||
extraFields: buildSentryExtraFields('sentry_issue_alert'),
|
||||
}),
|
||||
outputs: buildIssueAlertOutputs(),
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Sentry-Hook-Resource': 'event_alert',
|
||||
'Sentry-Hook-Signature': 'hmac-sha256-hex',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { SentryIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIssueOutputs,
|
||||
buildSentryExtraFields,
|
||||
sentrySetupInstructions,
|
||||
sentryTriggerOptions,
|
||||
} from '@/triggers/sentry/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const sentryIssueCreatedTrigger: TriggerConfig = {
|
||||
id: 'sentry_issue_created',
|
||||
name: 'Sentry Issue Created',
|
||||
provider: 'sentry',
|
||||
description: 'Trigger workflow when a new issue is created in Sentry',
|
||||
version: '1.0.0',
|
||||
icon: SentryIcon,
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'sentry_issue_created',
|
||||
triggerOptions: sentryTriggerOptions,
|
||||
includeDropdown: true,
|
||||
setupInstructions: sentrySetupInstructions('Issue'),
|
||||
extraFields: buildSentryExtraFields('sentry_issue_created'),
|
||||
}),
|
||||
outputs: buildIssueOutputs(),
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Sentry-Hook-Resource': 'issue',
|
||||
'Sentry-Hook-Signature': 'hmac-sha256-hex',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { SentryIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIssueOutputs,
|
||||
buildSentryExtraFields,
|
||||
sentrySetupInstructions,
|
||||
sentryTriggerOptions,
|
||||
} from '@/triggers/sentry/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const sentryIssueResolvedTrigger: TriggerConfig = {
|
||||
id: 'sentry_issue_resolved',
|
||||
name: 'Sentry Issue Resolved',
|
||||
provider: 'sentry',
|
||||
description: 'Trigger workflow when an issue is resolved in Sentry',
|
||||
version: '1.0.0',
|
||||
icon: SentryIcon,
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'sentry_issue_resolved',
|
||||
triggerOptions: sentryTriggerOptions,
|
||||
setupInstructions: sentrySetupInstructions('Issue'),
|
||||
extraFields: buildSentryExtraFields('sentry_issue_resolved'),
|
||||
}),
|
||||
outputs: buildIssueOutputs(),
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Sentry-Hook-Resource': 'issue',
|
||||
'Sentry-Hook-Signature': 'hmac-sha256-hex',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { SentryIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildMetricAlertOutputs,
|
||||
buildSentryExtraFields,
|
||||
sentrySetupInstructions,
|
||||
sentryTriggerOptions,
|
||||
} from '@/triggers/sentry/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const sentryMetricAlertTrigger: TriggerConfig = {
|
||||
id: 'sentry_metric_alert',
|
||||
name: 'Sentry Metric Alert',
|
||||
provider: 'sentry',
|
||||
description:
|
||||
'Trigger workflow when a Sentry metric alert changes state (critical, warning, resolved)',
|
||||
version: '1.0.0',
|
||||
icon: SentryIcon,
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'sentry_metric_alert',
|
||||
triggerOptions: sentryTriggerOptions,
|
||||
setupInstructions: sentrySetupInstructions('Metric Alert'),
|
||||
extraFields: buildSentryExtraFields('sentry_metric_alert'),
|
||||
}),
|
||||
outputs: buildMetricAlertOutputs(),
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Sentry-Hook-Resource': 'metric_alert',
|
||||
'Sentry-Hook-Signature': 'hmac-sha256-hex',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
import type { SubBlockConfig } from '@/blocks/types'
|
||||
import type { TriggerOutput } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Shared trigger dropdown options for all Sentry triggers.
|
||||
*/
|
||||
export const sentryTriggerOptions = [
|
||||
{ label: 'Issue Created', id: 'sentry_issue_created' },
|
||||
{ label: 'Issue Resolved', id: 'sentry_issue_resolved' },
|
||||
{ label: 'Error Created', id: 'sentry_error_created' },
|
||||
{ label: 'Issue Alert Triggered', id: 'sentry_issue_alert' },
|
||||
{ label: 'Metric Alert', id: 'sentry_metric_alert' },
|
||||
]
|
||||
|
||||
/**
|
||||
* Generate HTML setup instructions for creating a Sentry Internal Integration
|
||||
* with a webhook. Sentry signs webhooks with the integration's Client Secret,
|
||||
* which the user pastes into the trigger configuration (manual setup model).
|
||||
*/
|
||||
export function sentrySetupInstructions(eventType: string): string {
|
||||
const instructions = [
|
||||
'In Sentry, go to <strong>Settings > Developer Settings > Custom Integrations</strong> (Internal Integration) and click <strong>Create New Integration</strong>.',
|
||||
'Give the integration a name, then paste the <strong>Webhook URL</strong> shown above into the <strong>Webhook URL</strong> field and toggle <strong>Alert Rule Action</strong> on if you plan to use alerts.',
|
||||
'Under <strong>Permissions</strong>, grant at least <strong>Read</strong> access to <strong>Issue & Event</strong>.',
|
||||
`Under <strong>Webhooks</strong>, enable the resource for this trigger: <strong>${eventType}</strong>.`,
|
||||
'Click <strong>Save</strong>. Copy the generated <strong>Client Secret</strong> and paste it into the <strong>Client Secret</strong> field below.',
|
||||
'For <strong>Issue Alert</strong> and <strong>Metric Alert</strong> triggers, add this integration as an action on the relevant alert rule in <strong>Alerts</strong>.',
|
||||
'Click "Save" above to activate your trigger.',
|
||||
]
|
||||
return instructions
|
||||
.map(
|
||||
(instruction, index) =>
|
||||
`<div class="mb-3"><strong>${index + 1}.</strong> ${instruction}</div>`
|
||||
)
|
||||
.join('')
|
||||
}
|
||||
|
||||
/**
|
||||
* Extra fields shared by all Sentry triggers. The Client Secret is the
|
||||
* Internal Integration secret used to verify the `sentry-hook-signature`
|
||||
* HMAC-SHA256 header.
|
||||
*/
|
||||
export function buildSentryExtraFields(triggerId: string): SubBlockConfig[] {
|
||||
return [
|
||||
{
|
||||
id: 'clientSecret',
|
||||
title: 'Client Secret',
|
||||
type: 'short-input',
|
||||
placeholder: "Paste your Sentry Internal Integration's Client Secret",
|
||||
password: true,
|
||||
paramVisibility: 'user-only',
|
||||
required: true,
|
||||
mode: 'trigger',
|
||||
condition: { field: 'selectedTriggerId', value: triggerId },
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Common envelope fields present on every Sentry webhook payload.
|
||||
*/
|
||||
const commonEnvelopeOutputs = {
|
||||
action: {
|
||||
type: 'string',
|
||||
description: 'The action that triggered the webhook (e.g., created, resolved, triggered)',
|
||||
},
|
||||
installation: {
|
||||
type: 'json',
|
||||
description: 'Installation object containing the integration installation uuid',
|
||||
},
|
||||
actor: {
|
||||
type: 'json',
|
||||
description: 'Who triggered the webhook (user, the integration application, or Sentry)',
|
||||
},
|
||||
} as const
|
||||
|
||||
/**
|
||||
* Output schema for issue webhooks (resource `issue`).
|
||||
* Payload envelope: { action, installation, data: { issue }, actor }.
|
||||
*/
|
||||
export function buildIssueOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEnvelopeOutputs,
|
||||
issue: {
|
||||
id: { type: 'string', description: 'Issue ID' },
|
||||
shortId: { type: 'string', description: 'Short human-readable issue ID' },
|
||||
shareId: { type: 'string', description: 'Share ID for the issue' },
|
||||
title: { type: 'string', description: 'Issue title' },
|
||||
culprit: { type: 'string', description: 'Issue culprit (location/transaction)' },
|
||||
logger: { type: 'string', description: 'Logger name' },
|
||||
level: { type: 'string', description: 'Issue level (error, warning, etc.)' },
|
||||
status: { type: 'string', description: 'Issue status (unresolved, resolved, ignored)' },
|
||||
substatus: { type: 'string', description: 'Issue substatus' },
|
||||
statusDetails: { type: 'json', description: 'Status details (inRelease, inCommit, ignore*)' },
|
||||
platform: { type: 'string', description: 'Platform of the issue' },
|
||||
eventType: {
|
||||
type: 'string',
|
||||
description: "Issue type (the payload's `type` field; `type` is reserved)",
|
||||
},
|
||||
issueType: { type: 'string', description: 'Specific issue type classification' },
|
||||
issueCategory: { type: 'string', description: 'Issue category' },
|
||||
isUnhandled: { type: 'boolean', description: 'Whether the issue is unhandled' },
|
||||
isPublic: { type: 'boolean', description: 'Whether the issue is public' },
|
||||
isBookmarked: { type: 'boolean', description: 'Whether the issue is bookmarked' },
|
||||
isSubscribed: { type: 'boolean', description: 'Whether the viewer is subscribed' },
|
||||
hasSeen: { type: 'boolean', description: 'Whether the issue has been seen' },
|
||||
numComments: { type: 'number', description: 'Number of comments on the issue' },
|
||||
count: { type: 'string', description: 'Total event count' },
|
||||
userCount: { type: 'number', description: 'Number of affected users' },
|
||||
firstSeen: { type: 'string', description: 'Timestamp when first seen' },
|
||||
lastSeen: { type: 'string', description: 'Timestamp when last seen' },
|
||||
priority: { type: 'string', description: 'Issue priority' },
|
||||
assignedTo: { type: 'json', description: 'Assignee (user or team), or null' },
|
||||
annotations: { type: 'json', description: 'Issue annotations' },
|
||||
metadata: { type: 'json', description: 'Issue metadata (title, type, value, sdk, severity)' },
|
||||
project: {
|
||||
id: { type: 'string', description: 'Project ID' },
|
||||
name: { type: 'string', description: 'Project name' },
|
||||
slug: { type: 'string', description: 'Project slug' },
|
||||
platform: { type: 'string', description: 'Project platform' },
|
||||
},
|
||||
url: { type: 'string', description: 'API URL for the issue' },
|
||||
web_url: { type: 'string', description: 'Browser URL for the issue' },
|
||||
project_url: { type: 'string', description: 'Browser URL for the project' },
|
||||
permalink: { type: 'string', description: 'Permalink to the issue' },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output schema for error webhooks (resource `error`).
|
||||
* Payload envelope: { action, installation, data: { error }, actor }.
|
||||
*/
|
||||
export function buildErrorOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEnvelopeOutputs,
|
||||
error: {
|
||||
event_id: { type: 'string', description: 'Unique event ID' },
|
||||
issue_id: { type: 'string', description: 'ID of the issue this error belongs to' },
|
||||
issue_url: { type: 'string', description: 'API URL of the issue' },
|
||||
project: { type: 'number', description: 'Project ID' },
|
||||
key_id: { type: 'string', description: 'Project key ID' },
|
||||
level: { type: 'string', description: 'Error level' },
|
||||
title: { type: 'string', description: 'Error title' },
|
||||
eventType: {
|
||||
type: 'string',
|
||||
description: "Event type (the payload's `type` field; `type` is reserved)",
|
||||
},
|
||||
message: { type: 'string', description: 'Error message' },
|
||||
culprit: { type: 'string', description: 'Error culprit (location/transaction)' },
|
||||
platform: { type: 'string', description: 'Platform' },
|
||||
logger: { type: 'string', description: 'Logger name' },
|
||||
timestamp: { type: 'number', description: 'Event timestamp (epoch seconds)' },
|
||||
datetime: { type: 'string', description: 'Event datetime (ISO 8601)' },
|
||||
received: { type: 'number', description: 'Received timestamp (epoch seconds)' },
|
||||
dist: { type: 'string', description: 'Distribution identifier' },
|
||||
release: { type: 'string', description: 'Release version' },
|
||||
fingerprint: { type: 'json', description: 'Grouping fingerprint' },
|
||||
tags: { type: 'json', description: 'Event tags' },
|
||||
user: { type: 'json', description: 'User context' },
|
||||
request: { type: 'json', description: 'HTTP request context' },
|
||||
contexts: { type: 'json', description: 'Additional contexts (browser, os, device)' },
|
||||
sdk: { type: 'json', description: 'SDK information' },
|
||||
exception: { type: 'json', description: 'Exception details including stack frames' },
|
||||
metadata: { type: 'json', description: 'Error metadata' },
|
||||
url: { type: 'string', description: 'API URL for the event' },
|
||||
web_url: { type: 'string', description: 'Browser URL for the event' },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output schema for issue alert webhooks (resource `event_alert`).
|
||||
* Payload envelope: { action: 'triggered', installation,
|
||||
* data: { event, triggered_rule, issue_alert }, actor }.
|
||||
*/
|
||||
export function buildIssueAlertOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEnvelopeOutputs,
|
||||
event: { type: 'json', description: 'The event that triggered the alert rule' },
|
||||
triggered_rule: { type: 'string', description: 'Label of the alert rule that was triggered' },
|
||||
issue_alert: {
|
||||
title: { type: 'string', description: 'Alert rule name' },
|
||||
settings: { type: 'json', description: 'Alert rule action settings (name/value pairs)' },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output schema for metric alert webhooks (resource `metric_alert`).
|
||||
* Payload envelope: { action: 'critical'|'warning'|'resolved', installation,
|
||||
* data: { metric_alert, description_text, description_title }, actor }.
|
||||
*/
|
||||
export function buildMetricAlertOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEnvelopeOutputs,
|
||||
metric_alert: {
|
||||
type: 'json',
|
||||
description: 'Metric alert object (alert_rule + incident details)',
|
||||
},
|
||||
description_text: { type: 'string', description: 'Human-friendly description of the alert' },
|
||||
description_title: { type: 'string', description: 'Human-friendly title of the alert' },
|
||||
web_url: { type: 'string', description: 'API URL for the incident' },
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps each Sentry trigger ID to the `sentry-hook-resource` header value and
|
||||
* the allowed top-level `action` values. When `actions` is undefined, any
|
||||
* action for that resource matches.
|
||||
*/
|
||||
export const SENTRY_EVENT_MATCH: Record<string, { resource: string; actions?: string[] }> = {
|
||||
sentry_issue_created: { resource: 'issue', actions: ['created'] },
|
||||
sentry_issue_resolved: { resource: 'issue', actions: ['resolved'] },
|
||||
sentry_error_created: { resource: 'error', actions: ['created'] },
|
||||
sentry_issue_alert: { resource: 'event_alert', actions: ['triggered'] },
|
||||
sentry_metric_alert: { resource: 'metric_alert' },
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a Sentry webhook matches the configured trigger. The resource
|
||||
* comes from the `sentry-hook-resource` header and the action from the payload.
|
||||
*/
|
||||
export function isSentryEventMatch(
|
||||
triggerId: string,
|
||||
resource: string | null | undefined,
|
||||
action: string | null | undefined
|
||||
): boolean {
|
||||
const match = SENTRY_EVENT_MATCH[triggerId]
|
||||
if (!match) {
|
||||
return true
|
||||
}
|
||||
if (!resource || resource !== match.resource) {
|
||||
return false
|
||||
}
|
||||
if (match.actions && (!action || !match.actions.includes(action))) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user