@keystrokehq/sentry 0.0.1

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.
Files changed (71) hide show
  1. package/README.md +218 -0
  2. package/dist/_official/index.d.mts +3 -0
  3. package/dist/_official/index.mjs +3 -0
  4. package/dist/_runtime/index.d.mts +2 -0
  5. package/dist/_runtime/index.mjs +3 -0
  6. package/dist/alerts.d.mts +551 -0
  7. package/dist/alerts.mjs +300 -0
  8. package/dist/client.d.mts +86 -0
  9. package/dist/client.mjs +233 -0
  10. package/dist/connection.d.mts +3 -0
  11. package/dist/connection.mjs +3 -0
  12. package/dist/dashboards.d.mts +203 -0
  13. package/dist/dashboards.mjs +122 -0
  14. package/dist/debug-files.d.mts +127 -0
  15. package/dist/debug-files.mjs +73 -0
  16. package/dist/deploys.d.mts +103 -0
  17. package/dist/deploys.mjs +67 -0
  18. package/dist/discover.d.mts +235 -0
  19. package/dist/discover.mjs +138 -0
  20. package/dist/endpoint-factory-BwjbcPwW.mjs +96 -0
  21. package/dist/environments.d.mts +121 -0
  22. package/dist/environments.mjs +71 -0
  23. package/dist/errors-DfEFwcTe.mjs +142 -0
  24. package/dist/events-api.d.mts +311 -0
  25. package/dist/events-api.mjs +184 -0
  26. package/dist/events.d.mts +754 -0
  27. package/dist/events.mjs +142 -0
  28. package/dist/feedback.d.mts +99 -0
  29. package/dist/feedback.mjs +63 -0
  30. package/dist/index.d.mts +1 -0
  31. package/dist/index.mjs +1 -0
  32. package/dist/integration-C8KHkeNG.d.mts +58 -0
  33. package/dist/integration-WwY95cWE.mjs +156 -0
  34. package/dist/issues.d.mts +563 -0
  35. package/dist/issues.mjs +324 -0
  36. package/dist/members.d.mts +365 -0
  37. package/dist/members.mjs +156 -0
  38. package/dist/messaging.d.mts +1 -0
  39. package/dist/messaging.mjs +1 -0
  40. package/dist/monitors.d.mts +539 -0
  41. package/dist/monitors.mjs +234 -0
  42. package/dist/notifications.d.mts +221 -0
  43. package/dist/notifications.mjs +133 -0
  44. package/dist/organizations.d.mts +563 -0
  45. package/dist/organizations.mjs +334 -0
  46. package/dist/pagination-PlgAqbZt.mjs +116 -0
  47. package/dist/project-keys.d.mts +287 -0
  48. package/dist/project-keys.mjs +122 -0
  49. package/dist/projects.d.mts +687 -0
  50. package/dist/projects.mjs +378 -0
  51. package/dist/provider-app-BANn4KOL.d.mts +45 -0
  52. package/dist/releases.d.mts +949 -0
  53. package/dist/releases.mjs +479 -0
  54. package/dist/replays.d.mts +307 -0
  55. package/dist/replays.mjs +192 -0
  56. package/dist/schemas.d.mts +381 -0
  57. package/dist/schemas.mjs +318 -0
  58. package/dist/scim.d.mts +413 -0
  59. package/dist/scim.mjs +249 -0
  60. package/dist/scopes-RRU0vt-a.mjs +36 -0
  61. package/dist/teams.d.mts +561 -0
  62. package/dist/teams.mjs +266 -0
  63. package/dist/triggers.d.mts +83 -0
  64. package/dist/triggers.mjs +263 -0
  65. package/dist/user-emails.d.mts +117 -0
  66. package/dist/user-emails.mjs +60 -0
  67. package/dist/verification.d.mts +30 -0
  68. package/dist/verification.mjs +83 -0
  69. package/dist/webhooks.d.mts +199 -0
  70. package/dist/webhooks.mjs +108 -0
  71. package/package.json +178 -0
package/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # @keystrokehq/sentry
2
+
3
+ Official Keystroke integration for [Sentry](https://sentry.io).
4
+
5
+ - **176 operations** across 21 resource domains (issues, releases, projects,
6
+ monitors, replays, dashboards, alerts, Discover, SCIM, …).
7
+ - **27 direct-binding triggers**: 16 integration-platform webhooks (issue /
8
+ error / comment / alert lifecycle), 7 Seer Autofix events, 2 preprod-artifact
9
+ events, 1 legacy project service-hook, and 1 parameterised Discover polling
10
+ trigger.
11
+ - **OAuth 2.0 (refreshable)** public connection with provider-specific
12
+ `exchangeCode` and `extractInstallationInfo` hooks. Bearer-token tenants
13
+ (user / organisation / internal-integration tokens) run through the same
14
+ runtime path — the token is resolved into the same `Authorization: Bearer`
15
+ header.
16
+ - Built-in HMAC-SHA256 verification, region-URL override for
17
+ `us.sentry.io` / `de.sentry.io` / self-hosted deployments, RFC 5988
18
+ `Link`-header pagination, and DSN-vs-token guard-rails.
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ pnpm add @keystrokehq/sentry
24
+ ```
25
+
26
+ The package is ESM-only, side-effect free, and ships typed subpath exports.
27
+ End-user authoring code imports from subpaths (`./connection`, `./issues`,
28
+ `./triggers`, …) — never from the package root.
29
+
30
+ ## Credentials
31
+
32
+ Most customers connect via OAuth. The platform persists the access token
33
+ under `SENTRY_ACCESS_TOKEN`, the refresh token under `SENTRY_REFRESH_TOKEN`,
34
+ and (when resolved at install time) the installed organisation slug plus
35
+ region URL. Workflow authors receive the resolved `SentryIntegrationCredentials`
36
+ shape:
37
+
38
+ ```ts
39
+ import type { SentryIntegrationCredentials } from '@keystrokehq/sentry/connection';
40
+ ```
41
+
42
+ | Field | Required | Notes |
43
+ | ------------------- | -------- | ------------------------------------------------------ |
44
+ | `SENTRY_ACCESS_TOKEN` | ✅ | OAuth access token or long-lived auth token. |
45
+ | `SENTRY_REGION_URL` | optional | Defaults to `https://sentry.io`. Set for `us.` / `de.` multi-region, or a self-hosted host. |
46
+ | `SENTRY_ORG_SLUG` | optional | Default organisation slug used when an operation omits `organization_slug`. |
47
+
48
+ Platform operators supply the Sentry app credentials (`client_id`,
49
+ `client_secret`, `webhook_secret`) through the environment keys
50
+ `KEYSTROKE_PLATFORM_SENTRY_CLIENT_ID`, `_CLIENT_SECRET`, and `_WEBHOOK_SECRET`.
51
+ These are internal — they never reach authored workflow code.
52
+
53
+ ### OAuth scope matrix
54
+
55
+ | Capability | Scopes you need |
56
+ | -------------------------------------------- | ------------------------------------------------ |
57
+ | Read orgs, projects, teams, members, issues | `org:read project:read event:read member:read team:read` |
58
+ | Update issue status / assignee / archive | `event:admin project:write` |
59
+ | Manage alert rules (metric + issue) | `alerts:read alerts:write` |
60
+ | Create and update releases / deploys / files | `release:admin` |
61
+ | Manage project keys (DSN rotation) | `project:admin` |
62
+ | SCIM user / group provisioning | `member:write team:admin` |
63
+
64
+ The default OAuth flow requests the superset above. Trim the scope list in
65
+ your platform config if you only need a narrower subset.
66
+
67
+ ## Quickstart — Sentry → Linear + Slack fan-out
68
+
69
+ ```ts
70
+ import { getOrganizationIssueDetails, updateIssueAttributesInOrganization } from '@keystrokehq/sentry/issues';
71
+ import { on } from '@keystrokehq/sentry/triggers';
72
+ import { createIssue } from '@keystrokehq/linear/issues';
73
+ import { sendMessage } from '@keystrokehq/slack/platform/messages';
74
+ import { Workflow } from '@keystrokehq/core';
75
+
76
+ export const sentryFanOut = new Workflow({
77
+ id: 'sentry-fan-out',
78
+ name: 'Sentry → Linear + Slack',
79
+ triggers: [
80
+ on.issueCreated({
81
+ filter: (event) => event.data.issue.level !== 'info',
82
+ transform: (event) => ({
83
+ sentryIssueId: event.data.issue.id,
84
+ title: event.data.issue.title ?? 'Unknown Sentry issue',
85
+ url: event.data.issue.web_url ?? null,
86
+ }),
87
+ }),
88
+ ],
89
+ run: async ({ input, run }) => {
90
+ const issue = await run(getOrganizationIssueDetails, {
91
+ input: { issue_id: input.sentryIssueId },
92
+ });
93
+
94
+ const linearIssue = await run(createIssue, {
95
+ input: {
96
+ teamId: 'TEAM_UUID',
97
+ title: issue.title ?? input.title,
98
+ description: `Sentry: ${input.url ?? 'no url'}`,
99
+ },
100
+ });
101
+
102
+ await run(sendMessage, {
103
+ input: {
104
+ channel: '#oncall',
105
+ text: `:rotating_light: ${input.title}\nLinear: ${linearIssue.issue?.url ?? 'pending'}\nSentry: ${input.url ?? ''}`,
106
+ },
107
+ });
108
+
109
+ await run(updateIssueAttributesInOrganization, {
110
+ input: {
111
+ id: [input.sentryIssueId],
112
+ assignedTo: 'team:oncall',
113
+ statusDetails: { linear_url: linearIssue.issue?.url },
114
+ },
115
+ });
116
+ },
117
+ });
118
+ ```
119
+
120
+ ## Public surface
121
+
122
+ ### End-user authoring (operations)
123
+
124
+ | Subpath | Domain |
125
+ | ----------------------------------------------- | ---------------------------------------------------------- |
126
+ | `@keystrokehq/sentry/organizations` | 15 operations — orgs, stats, integrations |
127
+ | `@keystrokehq/sentry/members` | 7 operations — member CRUD + invites |
128
+ | `@keystrokehq/sentry/teams` | 14 operations — team CRUD + external-team links |
129
+ | `@keystrokehq/sentry/projects` | 19 operations — project CRUD, filters, ownership, symbols |
130
+ | `@keystrokehq/sentry/project-keys` | 5 operations — DSN / client key management |
131
+ | `@keystrokehq/sentry/issues` | 13 operations — issue lifecycle + external-issue links |
132
+ | `@keystrokehq/sentry/events-api` | 7 operations — issue events, project events, Discover |
133
+ | `@keystrokehq/sentry/releases` | 21 operations — releases, files, repos, commits |
134
+ | `@keystrokehq/sentry/deploys` | 2 operations — record + list deploys per release |
135
+ | `@keystrokehq/sentry/environments` | 3 operations — project environment management |
136
+ | `@keystrokehq/sentry/alerts` | 11 operations — metric + issue alert rules |
137
+ | `@keystrokehq/sentry/notifications` | 5 operations — notification actions |
138
+ | `@keystrokehq/sentry/monitors` | 10 operations — cron monitors + check-ins |
139
+ | `@keystrokehq/sentry/dashboards` | 5 operations — organisation dashboards |
140
+ | `@keystrokehq/sentry/discover` | 5 operations — saved Discover queries |
141
+ | `@keystrokehq/sentry/webhooks` | 5 operations — legacy project service hook CRUD |
142
+ | `@keystrokehq/sentry/replays` | 9 operations — Session Replay |
143
+ | `@keystrokehq/sentry/feedback` | 2 operations — user feedback |
144
+ | `@keystrokehq/sentry/debug-files` | 3 operations — DIF / dSYM upload |
145
+ | `@keystrokehq/sentry/scim` | 11 operations — SCIM + SAML + external users |
146
+ | `@keystrokehq/sentry/user-emails` | 4 operations — account email management |
147
+
148
+ ### End-user authoring (triggers)
149
+
150
+ ```ts
151
+ import { on, webhooks, polling } from '@keystrokehq/sentry/triggers';
152
+ ```
153
+
154
+ - `on.<event>({ filter, transform, name, description })` — integration-platform
155
+ webhooks. Available events:
156
+ - `installationCreated`, `installationDeleted`
157
+ - `issueCreated`, `issueResolved`, `issueAssigned`, `issueUnresolved`,
158
+ `issueIgnored`, `issueArchived`
159
+ - `errorCreated`
160
+ - `commentCreated`, `commentUpdated`, `commentDeleted`
161
+ - `eventAlertTriggered`
162
+ - `metricAlertCritical`, `metricAlertWarning`, `metricAlertResolved`
163
+ - Seer: `seerRootCauseStarted`, `seerRootCauseCompleted`,
164
+ `seerSolutionStarted`, `seerSolutionCompleted`, `seerCodingStarted`,
165
+ `seerCodingCompleted`, `seerPrCreated`
166
+ - Preprod artifacts: `preprodSizeAnalysisCompleted`,
167
+ `preprodBuildDistributionCompleted`
168
+ - `webhooks.serviceHookEventAlert({ filter, transform })` — legacy per-project
169
+ service-hook binding. Signs with the per-hook secret, not the integration
170
+ client secret.
171
+ - `polling.discoverEvents(params, options?)` — parameterised polling over
172
+ `/api/0/organizations/{slug}/events/`. Supply `field`, `query`, `project`,
173
+ `environment`, `statsPeriod`, `dataset`, and optionally `schedule`.
174
+
175
+ ### Support surfaces
176
+
177
+ ```ts
178
+ import { sentry, type SentryIntegrationCredentials } from '@keystrokehq/sentry/connection';
179
+ import { createSentryClient, type SentryCredentials } from '@keystrokehq/sentry/client';
180
+ import { sentryIssueSchema, sentryProjectSummarySchema } from '@keystrokehq/sentry/schemas';
181
+ import { sentryIssueCreatedEventSchema } from '@keystrokehq/sentry/events';
182
+ import { verifySentryWebhookRequest, verifySentryServiceHookRequest } from '@keystrokehq/sentry/verification';
183
+ ```
184
+
185
+ ### Internal (do not import from application code)
186
+
187
+ - `@keystrokehq/sentry/_official` — bundle export used
188
+ by `@keystrokehq/official-integration-catalog`.
189
+ - `@keystrokehq/sentry/_runtime` — reserved for hosted runtime
190
+ plumbing.
191
+
192
+ ## Caveats
193
+
194
+ - **DSN ≠ auth token.** The client rejects any value that parses as a Sentry
195
+ DSN (a URL with a `user@host` component). DSNs are ingest-only.
196
+ - **Region routing.** If a customer installs from `us.sentry.io` or
197
+ `de.sentry.io`, the OAuth hook captures the region URL at install time.
198
+ Self-hosted deployments must explicitly set `SENTRY_REGION_URL` on the
199
+ credentials or the client will default to `https://sentry.io`.
200
+ - **Webhook timing.** Integration-platform webhooks must respond within one
201
+ second per Sentry's docs. Keep the transform path cheap and push work onto
202
+ `run` callbacks.
203
+ - **Issue state migration.** Sentry is migrating from `ignored` → `archived`;
204
+ both triggers are exposed. Collapse them in `transform` if you want a
205
+ single "muted" state downstream.
206
+ - **Service hooks are deprecated.** Prefer the integration-webhook path for
207
+ new installs. The service-hook operations + trigger remain for backward
208
+ compatibility.
209
+
210
+ ## Not yet supported
211
+
212
+ - `seer.coding_completed` and preprod webhooks currently pass through raw
213
+ payloads. When the payload schemas stabilise upstream, we will upgrade
214
+ them to a strict shape.
215
+
216
+ ---
217
+
218
+ License: MIT.
@@ -0,0 +1,3 @@
1
+ import { i as sentryOfficialIntegration, r as sentryBundle } from "../integration-C8KHkeNG.mjs";
2
+ import { n as sentryAppCredentialSet, r as sentryPlatformProviderSeed, t as SentryAppCredentials } from "../provider-app-BANn4KOL.mjs";
3
+ export { SentryAppCredentials, sentryAppCredentialSet, sentryBundle, sentryOfficialIntegration, sentryPlatformProviderSeed };
@@ -0,0 +1,3 @@
1
+ import { a as sentryPlatformProviderSeed, i as sentryAppCredentialSet, n as sentryBundle, r as sentryOfficialIntegration } from "../integration-WwY95cWE.mjs";
2
+
3
+ export { sentryAppCredentialSet, sentryBundle, sentryOfficialIntegration, sentryPlatformProviderSeed };
@@ -0,0 +1,2 @@
1
+ import { i as sentryOfficialIntegration, r as sentryBundle } from "../integration-C8KHkeNG.mjs";
2
+ export { sentryBundle, sentryOfficialIntegration };
@@ -0,0 +1,3 @@
1
+ import { n as sentryBundle, r as sentryOfficialIntegration } from "../integration-WwY95cWE.mjs";
2
+
3
+ export { sentryBundle, sentryOfficialIntegration };