@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.
- package/README.md +218 -0
- package/dist/_official/index.d.mts +3 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +2 -0
- package/dist/_runtime/index.mjs +3 -0
- package/dist/alerts.d.mts +551 -0
- package/dist/alerts.mjs +300 -0
- package/dist/client.d.mts +86 -0
- package/dist/client.mjs +233 -0
- package/dist/connection.d.mts +3 -0
- package/dist/connection.mjs +3 -0
- package/dist/dashboards.d.mts +203 -0
- package/dist/dashboards.mjs +122 -0
- package/dist/debug-files.d.mts +127 -0
- package/dist/debug-files.mjs +73 -0
- package/dist/deploys.d.mts +103 -0
- package/dist/deploys.mjs +67 -0
- package/dist/discover.d.mts +235 -0
- package/dist/discover.mjs +138 -0
- package/dist/endpoint-factory-BwjbcPwW.mjs +96 -0
- package/dist/environments.d.mts +121 -0
- package/dist/environments.mjs +71 -0
- package/dist/errors-DfEFwcTe.mjs +142 -0
- package/dist/events-api.d.mts +311 -0
- package/dist/events-api.mjs +184 -0
- package/dist/events.d.mts +754 -0
- package/dist/events.mjs +142 -0
- package/dist/feedback.d.mts +99 -0
- package/dist/feedback.mjs +63 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-C8KHkeNG.d.mts +58 -0
- package/dist/integration-WwY95cWE.mjs +156 -0
- package/dist/issues.d.mts +563 -0
- package/dist/issues.mjs +324 -0
- package/dist/members.d.mts +365 -0
- package/dist/members.mjs +156 -0
- package/dist/messaging.d.mts +1 -0
- package/dist/messaging.mjs +1 -0
- package/dist/monitors.d.mts +539 -0
- package/dist/monitors.mjs +234 -0
- package/dist/notifications.d.mts +221 -0
- package/dist/notifications.mjs +133 -0
- package/dist/organizations.d.mts +563 -0
- package/dist/organizations.mjs +334 -0
- package/dist/pagination-PlgAqbZt.mjs +116 -0
- package/dist/project-keys.d.mts +287 -0
- package/dist/project-keys.mjs +122 -0
- package/dist/projects.d.mts +687 -0
- package/dist/projects.mjs +378 -0
- package/dist/provider-app-BANn4KOL.d.mts +45 -0
- package/dist/releases.d.mts +949 -0
- package/dist/releases.mjs +479 -0
- package/dist/replays.d.mts +307 -0
- package/dist/replays.mjs +192 -0
- package/dist/schemas.d.mts +381 -0
- package/dist/schemas.mjs +318 -0
- package/dist/scim.d.mts +413 -0
- package/dist/scim.mjs +249 -0
- package/dist/scopes-RRU0vt-a.mjs +36 -0
- package/dist/teams.d.mts +561 -0
- package/dist/teams.mjs +266 -0
- package/dist/triggers.d.mts +83 -0
- package/dist/triggers.mjs +263 -0
- package/dist/user-emails.d.mts +117 -0
- package/dist/user-emails.mjs +60 -0
- package/dist/verification.d.mts +30 -0
- package/dist/verification.mjs +83 -0
- package/dist/webhooks.d.mts +199 -0
- package/dist/webhooks.mjs +108 -0
- package/package.json +178 -0
package/dist/teams.mjs
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { orgScopeInputSchema, orgTeamScopeInputSchema, sentryIdSchema, sentryJsonObjectSchema, sentryListInputSchema, sentryMemberSchema, sentryProjectSummarySchema, sentrySlugSchema, sentryTeamSchema } from "./schemas.mjs";
|
|
2
|
+
import { t as defineSentryEndpoint } from "./endpoint-factory-BwjbcPwW.mjs";
|
|
3
|
+
import { t as SENTRY_SCOPE } from "./scopes-RRU0vt-a.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/teams.ts
|
|
7
|
+
/**
|
|
8
|
+
* Sentry team operations. Maps to PLAN.md §6.3 (14 actions).
|
|
9
|
+
*/
|
|
10
|
+
const ORG = [{
|
|
11
|
+
name: "organization_slug",
|
|
12
|
+
placeholder: "{organization_slug}"
|
|
13
|
+
}];
|
|
14
|
+
const ORG_TEAM = [...ORG, {
|
|
15
|
+
name: "team_slug",
|
|
16
|
+
placeholder: "{team_slug}"
|
|
17
|
+
}];
|
|
18
|
+
const ORG_TEAM_MEMBER = [...ORG_TEAM, {
|
|
19
|
+
name: "member_id",
|
|
20
|
+
placeholder: "{member_id}"
|
|
21
|
+
}];
|
|
22
|
+
const listTeamsInOrganization = defineSentryEndpoint({
|
|
23
|
+
id: "list_teams_in_organization",
|
|
24
|
+
name: "List Teams In Organization",
|
|
25
|
+
description: "List the teams in an organization with pagination.",
|
|
26
|
+
method: "GET",
|
|
27
|
+
path: "/api/0/organizations/{organization_slug}/teams/",
|
|
28
|
+
pathParams: ORG,
|
|
29
|
+
input: sentryListInputSchema.merge(orgScopeInputSchema).extend({ detailed: z.string().optional() }),
|
|
30
|
+
queryFields: [
|
|
31
|
+
"query",
|
|
32
|
+
"cursor",
|
|
33
|
+
"per_page",
|
|
34
|
+
"detailed"
|
|
35
|
+
],
|
|
36
|
+
output: z.array(sentryTeamSchema),
|
|
37
|
+
pagination: "cursor",
|
|
38
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamRead]
|
|
39
|
+
});
|
|
40
|
+
const listOrganizationUserTeams = defineSentryEndpoint({
|
|
41
|
+
id: "list_organization_user_teams",
|
|
42
|
+
name: "List Teams For Current User",
|
|
43
|
+
description: "List the teams the authenticated user belongs to in this organization.",
|
|
44
|
+
method: "GET",
|
|
45
|
+
path: "/api/0/organizations/{organization_slug}/user-teams/",
|
|
46
|
+
pathParams: ORG,
|
|
47
|
+
input: orgScopeInputSchema,
|
|
48
|
+
output: z.array(sentryTeamSchema),
|
|
49
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamRead]
|
|
50
|
+
});
|
|
51
|
+
const createOrganizationTeam = defineSentryEndpoint({
|
|
52
|
+
id: "create_organization_team",
|
|
53
|
+
name: "Create Organization Team",
|
|
54
|
+
description: "Create a new team inside the organization.",
|
|
55
|
+
method: "POST",
|
|
56
|
+
path: "/api/0/organizations/{organization_slug}/teams/",
|
|
57
|
+
pathParams: ORG,
|
|
58
|
+
input: orgScopeInputSchema.extend({
|
|
59
|
+
slug: sentrySlugSchema.optional(),
|
|
60
|
+
name: z.string().min(1).optional(),
|
|
61
|
+
idp_provisioned: z.boolean().optional()
|
|
62
|
+
}),
|
|
63
|
+
bodyFields: [
|
|
64
|
+
"slug",
|
|
65
|
+
"name",
|
|
66
|
+
"idp_provisioned"
|
|
67
|
+
],
|
|
68
|
+
output: sentryTeamSchema,
|
|
69
|
+
needsApproval: true,
|
|
70
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamWrite]
|
|
71
|
+
});
|
|
72
|
+
const retrieveTeamInfoViaOrganizationIdOrSlug = defineSentryEndpoint({
|
|
73
|
+
id: "retrieve_team_info_via_organization_id_or_slug",
|
|
74
|
+
name: "Retrieve Team Info",
|
|
75
|
+
description: "Fetch a single team by its slug.",
|
|
76
|
+
method: "GET",
|
|
77
|
+
path: "/api/0/teams/{organization_slug}/{team_slug}/",
|
|
78
|
+
pathParams: ORG_TEAM,
|
|
79
|
+
input: orgTeamScopeInputSchema,
|
|
80
|
+
output: sentryTeamSchema,
|
|
81
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamRead]
|
|
82
|
+
});
|
|
83
|
+
const updateTeamInformationByOrganizationId = defineSentryEndpoint({
|
|
84
|
+
id: "update_team_information_by_organization_id",
|
|
85
|
+
name: "Update Team",
|
|
86
|
+
description: "Update a team’s slug or display name.",
|
|
87
|
+
method: "PUT",
|
|
88
|
+
path: "/api/0/teams/{organization_slug}/{team_slug}/",
|
|
89
|
+
pathParams: ORG_TEAM,
|
|
90
|
+
input: orgTeamScopeInputSchema.extend({
|
|
91
|
+
slug: sentrySlugSchema.optional(),
|
|
92
|
+
name: z.string().min(1).optional()
|
|
93
|
+
}),
|
|
94
|
+
bodyFields: ["slug", "name"],
|
|
95
|
+
output: sentryTeamSchema,
|
|
96
|
+
needsApproval: true,
|
|
97
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamWrite]
|
|
98
|
+
});
|
|
99
|
+
const deleteTeamByOrganizationOrTeamSlug = defineSentryEndpoint({
|
|
100
|
+
id: "delete_team_by_organization_or_team_slug",
|
|
101
|
+
name: "Delete Team",
|
|
102
|
+
description: "Delete a team by slug.",
|
|
103
|
+
method: "DELETE",
|
|
104
|
+
path: "/api/0/teams/{organization_slug}/{team_slug}/",
|
|
105
|
+
pathParams: ORG_TEAM,
|
|
106
|
+
input: orgTeamScopeInputSchema,
|
|
107
|
+
output: z.unknown(),
|
|
108
|
+
needsApproval: true,
|
|
109
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamAdmin]
|
|
110
|
+
});
|
|
111
|
+
const addTeamMemberInOrganization = defineSentryEndpoint({
|
|
112
|
+
id: "add_team_member_in_organization",
|
|
113
|
+
name: "Add Team Member",
|
|
114
|
+
description: "Add a member to a team.",
|
|
115
|
+
method: "POST",
|
|
116
|
+
path: "/api/0/organizations/{organization_slug}/members/{member_id}/teams/{team_slug}/",
|
|
117
|
+
pathParams: ORG_TEAM_MEMBER,
|
|
118
|
+
input: orgTeamScopeInputSchema.extend({ member_id: sentryIdSchema }),
|
|
119
|
+
output: sentryMemberSchema,
|
|
120
|
+
needsApproval: true,
|
|
121
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamWrite]
|
|
122
|
+
});
|
|
123
|
+
const getTeamMembersByIdOrSlug = defineSentryEndpoint({
|
|
124
|
+
id: "get_team_members_by_id_or_slug",
|
|
125
|
+
name: "Get Team Members",
|
|
126
|
+
description: "List the members of a team.",
|
|
127
|
+
method: "GET",
|
|
128
|
+
path: "/api/0/teams/{organization_slug}/{team_slug}/members/",
|
|
129
|
+
pathParams: ORG_TEAM,
|
|
130
|
+
input: sentryListInputSchema.merge(orgTeamScopeInputSchema),
|
|
131
|
+
queryFields: [
|
|
132
|
+
"cursor",
|
|
133
|
+
"per_page",
|
|
134
|
+
"query"
|
|
135
|
+
],
|
|
136
|
+
output: z.array(sentryMemberSchema),
|
|
137
|
+
pagination: "cursor",
|
|
138
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamRead]
|
|
139
|
+
});
|
|
140
|
+
const deleteMemberFromTeam = defineSentryEndpoint({
|
|
141
|
+
id: "delete_member_from_team",
|
|
142
|
+
name: "Remove Member From Team",
|
|
143
|
+
description: "Remove a member from a team.",
|
|
144
|
+
method: "DELETE",
|
|
145
|
+
path: "/api/0/organizations/{organization_slug}/members/{member_id}/teams/{team_slug}/",
|
|
146
|
+
pathParams: ORG_TEAM_MEMBER,
|
|
147
|
+
input: orgTeamScopeInputSchema.extend({ member_id: sentryIdSchema }),
|
|
148
|
+
output: z.unknown(),
|
|
149
|
+
needsApproval: true,
|
|
150
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamWrite]
|
|
151
|
+
});
|
|
152
|
+
const switchTeamRoleForMember = defineSentryEndpoint({
|
|
153
|
+
id: "switch_team_role_for_member",
|
|
154
|
+
name: "Switch Member Team Role",
|
|
155
|
+
description: "Update a member’s role within a team.",
|
|
156
|
+
method: "PUT",
|
|
157
|
+
path: "/api/0/organizations/{organization_slug}/members/{member_id}/teams/{team_slug}/",
|
|
158
|
+
pathParams: ORG_TEAM_MEMBER,
|
|
159
|
+
input: orgTeamScopeInputSchema.extend({
|
|
160
|
+
member_id: sentryIdSchema,
|
|
161
|
+
teamRole: z.string().nullable()
|
|
162
|
+
}),
|
|
163
|
+
bodyFields: ["teamRole"],
|
|
164
|
+
output: sentryMemberSchema,
|
|
165
|
+
needsApproval: true,
|
|
166
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamWrite]
|
|
167
|
+
});
|
|
168
|
+
const retrieveTeamProjects = defineSentryEndpoint({
|
|
169
|
+
id: "retrieve_team_projects",
|
|
170
|
+
name: "Retrieve Team Projects",
|
|
171
|
+
description: "List the projects owned by a team.",
|
|
172
|
+
method: "GET",
|
|
173
|
+
path: "/api/0/teams/{organization_slug}/{team_slug}/projects/",
|
|
174
|
+
pathParams: ORG_TEAM,
|
|
175
|
+
input: sentryListInputSchema.merge(orgTeamScopeInputSchema),
|
|
176
|
+
queryFields: [
|
|
177
|
+
"cursor",
|
|
178
|
+
"per_page",
|
|
179
|
+
"query"
|
|
180
|
+
],
|
|
181
|
+
output: z.array(sentryProjectSummarySchema),
|
|
182
|
+
pagination: "cursor",
|
|
183
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.projectRead]
|
|
184
|
+
});
|
|
185
|
+
const manageTeamExternalIntegrations = defineSentryEndpoint({
|
|
186
|
+
id: "manage_team_external_integrations",
|
|
187
|
+
name: "Manage Team External Integrations",
|
|
188
|
+
description: "Create an external-team link between a Sentry team and a third-party team (Slack, PagerDuty, etc.).",
|
|
189
|
+
method: "POST",
|
|
190
|
+
path: "/api/0/teams/{organization_slug}/{team_slug}/external-teams/",
|
|
191
|
+
pathParams: ORG_TEAM,
|
|
192
|
+
input: orgTeamScopeInputSchema.extend({
|
|
193
|
+
externalName: z.string().min(1),
|
|
194
|
+
provider: z.string().min(1),
|
|
195
|
+
externalId: z.string().optional(),
|
|
196
|
+
integrationId: z.string().optional()
|
|
197
|
+
}),
|
|
198
|
+
bodyFields: [
|
|
199
|
+
"externalName",
|
|
200
|
+
"provider",
|
|
201
|
+
"externalId",
|
|
202
|
+
"integrationId"
|
|
203
|
+
],
|
|
204
|
+
output: sentryJsonObjectSchema,
|
|
205
|
+
needsApproval: true,
|
|
206
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamWrite]
|
|
207
|
+
});
|
|
208
|
+
const updateExternalTeamIntegration = defineSentryEndpoint({
|
|
209
|
+
id: "update_external_team_integration",
|
|
210
|
+
name: "Update External Team Integration",
|
|
211
|
+
description: "Update an existing external-team link by id.",
|
|
212
|
+
method: "PUT",
|
|
213
|
+
path: "/api/0/teams/{organization_slug}/{team_slug}/external-teams/{external_team_id}/",
|
|
214
|
+
pathParams: [...ORG_TEAM, {
|
|
215
|
+
name: "external_team_id",
|
|
216
|
+
placeholder: "{external_team_id}"
|
|
217
|
+
}],
|
|
218
|
+
input: orgTeamScopeInputSchema.extend({
|
|
219
|
+
external_team_id: sentryIdSchema,
|
|
220
|
+
externalName: z.string().min(1).optional(),
|
|
221
|
+
integrationId: z.string().optional(),
|
|
222
|
+
externalId: z.string().optional()
|
|
223
|
+
}),
|
|
224
|
+
bodyFields: [
|
|
225
|
+
"externalName",
|
|
226
|
+
"integrationId",
|
|
227
|
+
"externalId"
|
|
228
|
+
],
|
|
229
|
+
output: sentryJsonObjectSchema,
|
|
230
|
+
needsApproval: true,
|
|
231
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamWrite]
|
|
232
|
+
});
|
|
233
|
+
const deleteExternalTeamById = defineSentryEndpoint({
|
|
234
|
+
id: "delete_external_team_by_id",
|
|
235
|
+
name: "Delete External Team",
|
|
236
|
+
description: "Remove an external-team link by id.",
|
|
237
|
+
method: "DELETE",
|
|
238
|
+
path: "/api/0/teams/{organization_slug}/{team_slug}/external-teams/{external_team_id}/",
|
|
239
|
+
pathParams: [...ORG_TEAM, {
|
|
240
|
+
name: "external_team_id",
|
|
241
|
+
placeholder: "{external_team_id}"
|
|
242
|
+
}],
|
|
243
|
+
input: orgTeamScopeInputSchema.extend({ external_team_id: sentryIdSchema }),
|
|
244
|
+
output: z.unknown(),
|
|
245
|
+
needsApproval: true,
|
|
246
|
+
requiredOAuthScopes: [...SENTRY_SCOPE.teamAdmin]
|
|
247
|
+
});
|
|
248
|
+
const sentryTeamOperations = {
|
|
249
|
+
listTeamsInOrganization,
|
|
250
|
+
listOrganizationUserTeams,
|
|
251
|
+
createOrganizationTeam,
|
|
252
|
+
retrieveTeamInfoViaOrganizationIdOrSlug,
|
|
253
|
+
updateTeamInformationByOrganizationId,
|
|
254
|
+
deleteTeamByOrganizationOrTeamSlug,
|
|
255
|
+
addTeamMemberInOrganization,
|
|
256
|
+
getTeamMembersByIdOrSlug,
|
|
257
|
+
deleteMemberFromTeam,
|
|
258
|
+
switchTeamRoleForMember,
|
|
259
|
+
retrieveTeamProjects,
|
|
260
|
+
manageTeamExternalIntegrations,
|
|
261
|
+
updateExternalTeamIntegration,
|
|
262
|
+
deleteExternalTeamById
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
//#endregion
|
|
266
|
+
export { addTeamMemberInOrganization, createOrganizationTeam, deleteExternalTeamById, deleteMemberFromTeam, deleteTeamByOrganizationOrTeamSlug, getTeamMembersByIdOrSlug, listOrganizationUserTeams, listTeamsInOrganization, manageTeamExternalIntegrations, retrieveTeamInfoViaOrganizationIdOrSlug, retrieveTeamProjects, sentryTeamOperations, switchTeamRoleForMember, updateExternalTeamIntegration, updateTeamInformationByOrganizationId };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { n as sentry } from "./integration-C8KHkeNG.mjs";
|
|
2
|
+
import { n as sentryAppCredentialSet } from "./provider-app-BANn4KOL.mjs";
|
|
3
|
+
import { createSentryClient } from "./client.mjs";
|
|
4
|
+
import { SentryDiscoverEventsPollResponse, sentryCommentCreatedEventSchema, sentryCommentDeletedEventSchema, sentryCommentUpdatedEventSchema, sentryErrorCreatedEventSchema, sentryEventAlertTriggeredEventSchema, sentryInstallationCreatedEventSchema, sentryInstallationDeletedEventSchema, sentryIssueArchivedEventSchema, sentryIssueAssignedEventSchema, sentryIssueCreatedEventSchema, sentryIssueIgnoredEventSchema, sentryIssueResolvedEventSchema, sentryIssueUnresolvedEventSchema, sentryMetricAlertCriticalEventSchema, sentryMetricAlertResolvedEventSchema, sentryMetricAlertWarningEventSchema, sentryPreprodArtifactBuildDistributionCompletedEventSchema, sentryPreprodArtifactSizeAnalysisCompletedEventSchema, sentrySeerCodingCompletedEventSchema, sentrySeerCodingStartedEventSchema, sentrySeerPrCreatedEventSchema, sentrySeerRootCauseCompletedEventSchema, sentrySeerRootCauseStartedEventSchema, sentrySeerSolutionCompletedEventSchema, sentrySeerSolutionStartedEventSchema, sentryServiceHookEventAlertSchema } from "./events.mjs";
|
|
5
|
+
import { BoundTrigger, WebhookRequest } from "@keystrokehq/core";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { IntegrationTriggerBindingFactory, IntegrationTriggerBindingOptions, createPollingTriggerBindingFactory } from "@keystrokehq/integration-authoring";
|
|
8
|
+
import { PollingTriggerManifest, WebhookTriggerManifest } from "@keystrokehq/core/trigger";
|
|
9
|
+
|
|
10
|
+
//#region src/triggers.d.ts
|
|
11
|
+
type Schedule = Parameters<typeof createPollingTriggerBindingFactory>[0]['schedule'];
|
|
12
|
+
type IntegrationWebhookCredentialSets = readonly [typeof sentry, typeof sentryAppCredentialSet];
|
|
13
|
+
type ServiceHookCredentialSets = readonly [typeof sentry];
|
|
14
|
+
type DiscoverPollingCredentialSets = readonly [typeof sentry];
|
|
15
|
+
type SentryWebhookBinding<TPayload> = IntegrationTriggerBindingFactory<TPayload, IntegrationWebhookCredentialSets, WebhookTriggerManifest, TPayload, WebhookRequest>;
|
|
16
|
+
type SentryServiceHookBinding = IntegrationTriggerBindingFactory<z.output<typeof sentryServiceHookEventAlertSchema>, ServiceHookCredentialSets, WebhookTriggerManifest, z.output<typeof sentryServiceHookEventAlertSchema>, WebhookRequest>;
|
|
17
|
+
type SentryOnTriggerNamespace = Readonly<{
|
|
18
|
+
installationCreated: SentryWebhookBinding<z.output<typeof sentryInstallationCreatedEventSchema>>;
|
|
19
|
+
installationDeleted: SentryWebhookBinding<z.output<typeof sentryInstallationDeletedEventSchema>>;
|
|
20
|
+
issueCreated: SentryWebhookBinding<z.output<typeof sentryIssueCreatedEventSchema>>;
|
|
21
|
+
issueResolved: SentryWebhookBinding<z.output<typeof sentryIssueResolvedEventSchema>>;
|
|
22
|
+
issueAssigned: SentryWebhookBinding<z.output<typeof sentryIssueAssignedEventSchema>>;
|
|
23
|
+
issueUnresolved: SentryWebhookBinding<z.output<typeof sentryIssueUnresolvedEventSchema>>;
|
|
24
|
+
issueIgnored: SentryWebhookBinding<z.output<typeof sentryIssueIgnoredEventSchema>>;
|
|
25
|
+
issueArchived: SentryWebhookBinding<z.output<typeof sentryIssueArchivedEventSchema>>;
|
|
26
|
+
errorCreated: SentryWebhookBinding<z.output<typeof sentryErrorCreatedEventSchema>>;
|
|
27
|
+
commentCreated: SentryWebhookBinding<z.output<typeof sentryCommentCreatedEventSchema>>;
|
|
28
|
+
commentUpdated: SentryWebhookBinding<z.output<typeof sentryCommentUpdatedEventSchema>>;
|
|
29
|
+
commentDeleted: SentryWebhookBinding<z.output<typeof sentryCommentDeletedEventSchema>>;
|
|
30
|
+
eventAlertTriggered: SentryWebhookBinding<z.output<typeof sentryEventAlertTriggeredEventSchema>>;
|
|
31
|
+
metricAlertCritical: SentryWebhookBinding<z.output<typeof sentryMetricAlertCriticalEventSchema>>;
|
|
32
|
+
metricAlertWarning: SentryWebhookBinding<z.output<typeof sentryMetricAlertWarningEventSchema>>;
|
|
33
|
+
metricAlertResolved: SentryWebhookBinding<z.output<typeof sentryMetricAlertResolvedEventSchema>>;
|
|
34
|
+
seerRootCauseStarted: SentryWebhookBinding<z.output<typeof sentrySeerRootCauseStartedEventSchema>>;
|
|
35
|
+
seerRootCauseCompleted: SentryWebhookBinding<z.output<typeof sentrySeerRootCauseCompletedEventSchema>>;
|
|
36
|
+
seerSolutionStarted: SentryWebhookBinding<z.output<typeof sentrySeerSolutionStartedEventSchema>>;
|
|
37
|
+
seerSolutionCompleted: SentryWebhookBinding<z.output<typeof sentrySeerSolutionCompletedEventSchema>>;
|
|
38
|
+
seerCodingStarted: SentryWebhookBinding<z.output<typeof sentrySeerCodingStartedEventSchema>>;
|
|
39
|
+
seerCodingCompleted: SentryWebhookBinding<z.output<typeof sentrySeerCodingCompletedEventSchema>>;
|
|
40
|
+
seerPrCreated: SentryWebhookBinding<z.output<typeof sentrySeerPrCreatedEventSchema>>;
|
|
41
|
+
preprodSizeAnalysisCompleted: SentryWebhookBinding<z.output<typeof sentryPreprodArtifactSizeAnalysisCompletedEventSchema>>;
|
|
42
|
+
preprodBuildDistributionCompleted: SentryWebhookBinding<z.output<typeof sentryPreprodArtifactBuildDistributionCompletedEventSchema>>;
|
|
43
|
+
}>;
|
|
44
|
+
declare const on: SentryOnTriggerNamespace;
|
|
45
|
+
type SentryWebhookTriggerNamespace = Readonly<{
|
|
46
|
+
serviceHookEventAlert: SentryServiceHookBinding;
|
|
47
|
+
}>;
|
|
48
|
+
declare const webhooks: SentryWebhookTriggerNamespace;
|
|
49
|
+
interface DiscoverEventsPollParams {
|
|
50
|
+
readonly field: readonly string[];
|
|
51
|
+
readonly query?: string;
|
|
52
|
+
readonly project?: readonly number[];
|
|
53
|
+
readonly environment?: readonly string[];
|
|
54
|
+
readonly statsPeriod?: string;
|
|
55
|
+
readonly dataset?: 'discover' | 'errors' | 'transactions' | 'issuePlatform';
|
|
56
|
+
readonly per_page?: number;
|
|
57
|
+
/** Override the org slug stored on the credentials. */
|
|
58
|
+
readonly organization_slug?: string;
|
|
59
|
+
}
|
|
60
|
+
interface DiscoverBindingOptions<TOutput = SentryDiscoverEventsPollResponse> extends IntegrationTriggerBindingOptions<SentryDiscoverEventsPollResponse, TOutput> {
|
|
61
|
+
readonly schedule?: Schedule;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Pure helper that the polling `poll` callback delegates to. Exported so it
|
|
65
|
+
* can be unit-tested without standing up the full polling harness.
|
|
66
|
+
*/
|
|
67
|
+
declare function executeDiscoverEventsPoll(params: DiscoverEventsPollParams, credentials: {
|
|
68
|
+
readonly SENTRY_ACCESS_TOKEN: string;
|
|
69
|
+
readonly SENTRY_REGION_URL?: string;
|
|
70
|
+
readonly SENTRY_ORG_SLUG?: string;
|
|
71
|
+
}, options?: {
|
|
72
|
+
readonly clientFactory?: typeof createSentryClient;
|
|
73
|
+
}): Promise<SentryDiscoverEventsPollResponse>;
|
|
74
|
+
declare function computeDiscoverEventsPollIdempotencyKey(response: SentryDiscoverEventsPollResponse): string | undefined;
|
|
75
|
+
declare function bindDiscoverEventsPollingTrigger<TOutput = SentryDiscoverEventsPollResponse>(params: DiscoverEventsPollParams, options?: DiscoverBindingOptions<TOutput>): BoundTrigger<SentryDiscoverEventsPollResponse, DiscoverPollingCredentialSets, PollingTriggerManifest, TOutput>;
|
|
76
|
+
declare const polling: Readonly<{
|
|
77
|
+
readonly discoverEvents: typeof bindDiscoverEventsPollingTrigger;
|
|
78
|
+
}>;
|
|
79
|
+
type SentryOnTriggers = typeof on;
|
|
80
|
+
type SentryWebhookTriggers = typeof webhooks;
|
|
81
|
+
type SentryPollingTriggers = typeof polling;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { DiscoverEventsPollParams, SentryOnTriggers, SentryPollingTriggers, SentryWebhookTriggers, computeDiscoverEventsPollIdempotencyKey, executeDiscoverEventsPoll, on, polling, webhooks };
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { i as sentryAppCredentialSet, t as sentry } from "./integration-WwY95cWE.mjs";
|
|
2
|
+
import { createSentryClient } from "./client.mjs";
|
|
3
|
+
import { sentryCommentCreatedEventSchema, sentryCommentDeletedEventSchema, sentryCommentUpdatedEventSchema, sentryDiscoverEventsPollResponseSchema, sentryErrorCreatedEventSchema, sentryEventAlertTriggeredEventSchema, sentryInstallationCreatedEventSchema, sentryInstallationDeletedEventSchema, sentryIssueArchivedEventSchema, sentryIssueAssignedEventSchema, sentryIssueCreatedEventSchema, sentryIssueIgnoredEventSchema, sentryIssueResolvedEventSchema, sentryIssueUnresolvedEventSchema, sentryMetricAlertCriticalEventSchema, sentryMetricAlertResolvedEventSchema, sentryMetricAlertWarningEventSchema, sentryPreprodArtifactBuildDistributionCompletedEventSchema, sentryPreprodArtifactSizeAnalysisCompletedEventSchema, sentrySeerCodingCompletedEventSchema, sentrySeerCodingStartedEventSchema, sentrySeerPrCreatedEventSchema, sentrySeerRootCauseCompletedEventSchema, sentrySeerRootCauseStartedEventSchema, sentrySeerSolutionCompletedEventSchema, sentrySeerSolutionStartedEventSchema, sentryServiceHookEventAlertSchema } from "./events.mjs";
|
|
4
|
+
import { createPollingTriggerBindingFactory, createWebhookTriggerBindingFactory } from "@keystrokehq/integration-authoring";
|
|
5
|
+
|
|
6
|
+
//#region src/triggers.ts
|
|
7
|
+
const INTEGRATION_WEBHOOK_PATH = "/sentry";
|
|
8
|
+
const SERVICE_HOOK_PATH = "/sentry/service-hook";
|
|
9
|
+
const integrationCredentialSets = [sentry, sentryAppCredentialSet];
|
|
10
|
+
const serviceHookCredentialSets = [sentry];
|
|
11
|
+
const discoverPollingCredentialSets = [sentry];
|
|
12
|
+
function createIntegrationWebhookBinding(config) {
|
|
13
|
+
return createWebhookTriggerBindingFactory({
|
|
14
|
+
defaultName: config.defaultName,
|
|
15
|
+
defaultDescription: config.defaultDescription,
|
|
16
|
+
path: INTEGRATION_WEBHOOK_PATH,
|
|
17
|
+
method: "POST",
|
|
18
|
+
payload: config.payload,
|
|
19
|
+
credentialSets: integrationCredentialSets,
|
|
20
|
+
idempotencyKey: (payload) => config.idempotencyKey(payload)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const installationCreatedBind = createIntegrationWebhookBinding({
|
|
24
|
+
defaultName: "Sentry Installation Created",
|
|
25
|
+
defaultDescription: "Fired when the Sentry app is installed on an organization.",
|
|
26
|
+
payload: sentryInstallationCreatedEventSchema,
|
|
27
|
+
idempotencyKey: (p) => `installation.created:${p.installation.uuid}`
|
|
28
|
+
});
|
|
29
|
+
const installationDeletedBind = createIntegrationWebhookBinding({
|
|
30
|
+
defaultName: "Sentry Installation Deleted",
|
|
31
|
+
defaultDescription: "Fired when the Sentry app is uninstalled from an organization.",
|
|
32
|
+
payload: sentryInstallationDeletedEventSchema,
|
|
33
|
+
idempotencyKey: (p) => `installation.deleted:${p.installation.uuid}`
|
|
34
|
+
});
|
|
35
|
+
const issueCreatedBind = createIntegrationWebhookBinding({
|
|
36
|
+
defaultName: "Sentry Issue Created",
|
|
37
|
+
defaultDescription: "Fired when a new Sentry issue is created.",
|
|
38
|
+
payload: sentryIssueCreatedEventSchema,
|
|
39
|
+
idempotencyKey: (p) => `issue.created:${p.data.issue.id}`
|
|
40
|
+
});
|
|
41
|
+
const issueResolvedBind = createIntegrationWebhookBinding({
|
|
42
|
+
defaultName: "Sentry Issue Resolved",
|
|
43
|
+
defaultDescription: "Fired when a Sentry issue transitions to resolved.",
|
|
44
|
+
payload: sentryIssueResolvedEventSchema,
|
|
45
|
+
idempotencyKey: (p) => `issue.resolved:${p.data.issue.id}`
|
|
46
|
+
});
|
|
47
|
+
const issueAssignedBind = createIntegrationWebhookBinding({
|
|
48
|
+
defaultName: "Sentry Issue Assigned",
|
|
49
|
+
defaultDescription: "Fired when a Sentry issue is assigned to a team or user.",
|
|
50
|
+
payload: sentryIssueAssignedEventSchema,
|
|
51
|
+
idempotencyKey: (p) => `issue.assigned:${p.data.issue.id}:${String(p.actor?.id ?? "anon")}`
|
|
52
|
+
});
|
|
53
|
+
const issueUnresolvedBind = createIntegrationWebhookBinding({
|
|
54
|
+
defaultName: "Sentry Issue Unresolved",
|
|
55
|
+
defaultDescription: "Fired when a Sentry issue regresses or is re-opened.",
|
|
56
|
+
payload: sentryIssueUnresolvedEventSchema,
|
|
57
|
+
idempotencyKey: (p) => `issue.unresolved:${p.data.issue.id}`
|
|
58
|
+
});
|
|
59
|
+
const issueIgnoredBind = createIntegrationWebhookBinding({
|
|
60
|
+
defaultName: "Sentry Issue Ignored",
|
|
61
|
+
defaultDescription: "Fired when a Sentry issue is ignored/muted (legacy action; superseded by `archived`).",
|
|
62
|
+
payload: sentryIssueIgnoredEventSchema,
|
|
63
|
+
idempotencyKey: (p) => `issue.ignored:${p.data.issue.id}`
|
|
64
|
+
});
|
|
65
|
+
const issueArchivedBind = createIntegrationWebhookBinding({
|
|
66
|
+
defaultName: "Sentry Issue Archived",
|
|
67
|
+
defaultDescription: "Fired when a Sentry issue is archived (new state model).",
|
|
68
|
+
payload: sentryIssueArchivedEventSchema,
|
|
69
|
+
idempotencyKey: (p) => `issue.archived:${p.data.issue.id}`
|
|
70
|
+
});
|
|
71
|
+
const errorCreatedBind = createIntegrationWebhookBinding({
|
|
72
|
+
defaultName: "Sentry Error Created",
|
|
73
|
+
defaultDescription: "Fired for every new error event delivered when the integration subscribes to the `error` resource. This is high volume — always pair with a filter.",
|
|
74
|
+
payload: sentryErrorCreatedEventSchema,
|
|
75
|
+
idempotencyKey: (p) => `error.created:${p.data.error.event_id ?? "unknown"}`
|
|
76
|
+
});
|
|
77
|
+
const commentCreatedBind = createIntegrationWebhookBinding({
|
|
78
|
+
defaultName: "Sentry Comment Created",
|
|
79
|
+
defaultDescription: "Fired when a new comment is posted on a Sentry issue.",
|
|
80
|
+
payload: sentryCommentCreatedEventSchema,
|
|
81
|
+
idempotencyKey: (p) => `comment.created:${String(p.data.comment_id ?? "unknown")}:${String(p.data.timestamp ?? "")}`
|
|
82
|
+
});
|
|
83
|
+
const commentUpdatedBind = createIntegrationWebhookBinding({
|
|
84
|
+
defaultName: "Sentry Comment Updated",
|
|
85
|
+
defaultDescription: "Fired when a Sentry issue comment is edited.",
|
|
86
|
+
payload: sentryCommentUpdatedEventSchema,
|
|
87
|
+
idempotencyKey: (p) => `comment.updated:${String(p.data.comment_id ?? "unknown")}:${String(p.data.timestamp ?? "")}`
|
|
88
|
+
});
|
|
89
|
+
const commentDeletedBind = createIntegrationWebhookBinding({
|
|
90
|
+
defaultName: "Sentry Comment Deleted",
|
|
91
|
+
defaultDescription: "Fired when a Sentry issue comment is removed.",
|
|
92
|
+
payload: sentryCommentDeletedEventSchema,
|
|
93
|
+
idempotencyKey: (p) => `comment.deleted:${String(p.data.comment_id ?? "unknown")}`
|
|
94
|
+
});
|
|
95
|
+
const eventAlertTriggeredBind = createIntegrationWebhookBinding({
|
|
96
|
+
defaultName: "Sentry Event Alert Triggered",
|
|
97
|
+
defaultDescription: "Fired when a Sentry issue-alert-rule condition fires.",
|
|
98
|
+
payload: sentryEventAlertTriggeredEventSchema,
|
|
99
|
+
idempotencyKey: (p) => `event_alert.triggered:${String(p.data.triggered_rule ?? "rule")}:${String(p.data.issue_id ?? "no-issue")}`
|
|
100
|
+
});
|
|
101
|
+
const metricAlertCriticalBind = createIntegrationWebhookBinding({
|
|
102
|
+
defaultName: "Sentry Metric Alert Critical",
|
|
103
|
+
defaultDescription: "Fired when a Sentry metric alert crosses the critical threshold.",
|
|
104
|
+
payload: sentryMetricAlertCriticalEventSchema,
|
|
105
|
+
idempotencyKey: (p) => `metric_alert.critical:${String(p.data.metric_alert.id)}:${String(p.data.metric_alert.status ?? "")}`
|
|
106
|
+
});
|
|
107
|
+
const metricAlertWarningBind = createIntegrationWebhookBinding({
|
|
108
|
+
defaultName: "Sentry Metric Alert Warning",
|
|
109
|
+
defaultDescription: "Fired when a Sentry metric alert crosses the warning threshold.",
|
|
110
|
+
payload: sentryMetricAlertWarningEventSchema,
|
|
111
|
+
idempotencyKey: (p) => `metric_alert.warning:${String(p.data.metric_alert.id)}:${String(p.data.metric_alert.status ?? "")}`
|
|
112
|
+
});
|
|
113
|
+
const metricAlertResolvedBind = createIntegrationWebhookBinding({
|
|
114
|
+
defaultName: "Sentry Metric Alert Resolved",
|
|
115
|
+
defaultDescription: "Fired when a Sentry metric alert returns to a healthy state.",
|
|
116
|
+
payload: sentryMetricAlertResolvedEventSchema,
|
|
117
|
+
idempotencyKey: (p) => `metric_alert.resolved:${String(p.data.metric_alert.id)}:${String(p.data.metric_alert.status ?? "")}`
|
|
118
|
+
});
|
|
119
|
+
const seerRootCauseStartedBind = createIntegrationWebhookBinding({
|
|
120
|
+
defaultName: "Sentry Seer Root Cause Started",
|
|
121
|
+
defaultDescription: "Fired when Seer root-cause analysis begins.",
|
|
122
|
+
payload: sentrySeerRootCauseStartedEventSchema,
|
|
123
|
+
idempotencyKey: (p) => `seer.root_cause_started:${p.data.run_id}`
|
|
124
|
+
});
|
|
125
|
+
const seerRootCauseCompletedBind = createIntegrationWebhookBinding({
|
|
126
|
+
defaultName: "Sentry Seer Root Cause Completed",
|
|
127
|
+
defaultDescription: "Fired when Seer root-cause analysis completes.",
|
|
128
|
+
payload: sentrySeerRootCauseCompletedEventSchema,
|
|
129
|
+
idempotencyKey: (p) => `seer.root_cause_completed:${p.data.run_id}`
|
|
130
|
+
});
|
|
131
|
+
const seerSolutionStartedBind = createIntegrationWebhookBinding({
|
|
132
|
+
defaultName: "Sentry Seer Solution Started",
|
|
133
|
+
defaultDescription: "Fired when Seer solution generation begins.",
|
|
134
|
+
payload: sentrySeerSolutionStartedEventSchema,
|
|
135
|
+
idempotencyKey: (p) => `seer.solution_started:${p.data.run_id}`
|
|
136
|
+
});
|
|
137
|
+
const seerSolutionCompletedBind = createIntegrationWebhookBinding({
|
|
138
|
+
defaultName: "Sentry Seer Solution Completed",
|
|
139
|
+
defaultDescription: "Fired when Seer has generated a solution.",
|
|
140
|
+
payload: sentrySeerSolutionCompletedEventSchema,
|
|
141
|
+
idempotencyKey: (p) => `seer.solution_completed:${p.data.run_id}`
|
|
142
|
+
});
|
|
143
|
+
const seerCodingStartedBind = createIntegrationWebhookBinding({
|
|
144
|
+
defaultName: "Sentry Seer Coding Started",
|
|
145
|
+
defaultDescription: "Fired when the Seer coding step begins.",
|
|
146
|
+
payload: sentrySeerCodingStartedEventSchema,
|
|
147
|
+
idempotencyKey: (p) => `seer.coding_started:${p.data.run_id}`
|
|
148
|
+
});
|
|
149
|
+
const seerCodingCompletedBind = createIntegrationWebhookBinding({
|
|
150
|
+
defaultName: "Sentry Seer Coding Completed",
|
|
151
|
+
defaultDescription: "Fired when Seer code changes are ready.",
|
|
152
|
+
payload: sentrySeerCodingCompletedEventSchema,
|
|
153
|
+
idempotencyKey: (p) => `seer.coding_completed:${p.data.run_id}`
|
|
154
|
+
});
|
|
155
|
+
const seerPrCreatedBind = createIntegrationWebhookBinding({
|
|
156
|
+
defaultName: "Sentry Seer PR Created",
|
|
157
|
+
defaultDescription: "Fired when Seer opens a pull request with the fix.",
|
|
158
|
+
payload: sentrySeerPrCreatedEventSchema,
|
|
159
|
+
idempotencyKey: (p) => `seer.pr_created:${p.data.run_id}`
|
|
160
|
+
});
|
|
161
|
+
const preprodSizeAnalysisCompletedBind = createIntegrationWebhookBinding({
|
|
162
|
+
defaultName: "Sentry Preprod Size Analysis Completed",
|
|
163
|
+
defaultDescription: "Fired when mobile-build size analysis completes or fails.",
|
|
164
|
+
payload: sentryPreprodArtifactSizeAnalysisCompletedEventSchema,
|
|
165
|
+
idempotencyKey: (p) => `preprod_artifact.size_analysis_completed:${p.data.buildId}`
|
|
166
|
+
});
|
|
167
|
+
const preprodBuildDistributionCompletedBind = createIntegrationWebhookBinding({
|
|
168
|
+
defaultName: "Sentry Preprod Build Distribution Completed",
|
|
169
|
+
defaultDescription: "Fired when build-distribution processing completes or fails for a mobile artifact.",
|
|
170
|
+
payload: sentryPreprodArtifactBuildDistributionCompletedEventSchema,
|
|
171
|
+
idempotencyKey: (p) => `preprod_artifact.build_distribution_completed:${p.data.buildId}`
|
|
172
|
+
});
|
|
173
|
+
const serviceHookEventAlertBind = createWebhookTriggerBindingFactory({
|
|
174
|
+
defaultName: "Sentry Project Service Hook",
|
|
175
|
+
defaultDescription: "Legacy per-project service-hook delivery. Signed with a per-hook secret.",
|
|
176
|
+
path: SERVICE_HOOK_PATH,
|
|
177
|
+
method: "POST",
|
|
178
|
+
payload: sentryServiceHookEventAlertSchema,
|
|
179
|
+
credentialSets: serviceHookCredentialSets,
|
|
180
|
+
idempotencyKey: (payload) => payload.event_id != null ? `service_hook.event.alert:${payload.event_id}` : void 0
|
|
181
|
+
});
|
|
182
|
+
const on = Object.freeze({
|
|
183
|
+
installationCreated: installationCreatedBind,
|
|
184
|
+
installationDeleted: installationDeletedBind,
|
|
185
|
+
issueCreated: issueCreatedBind,
|
|
186
|
+
issueResolved: issueResolvedBind,
|
|
187
|
+
issueAssigned: issueAssignedBind,
|
|
188
|
+
issueUnresolved: issueUnresolvedBind,
|
|
189
|
+
issueIgnored: issueIgnoredBind,
|
|
190
|
+
issueArchived: issueArchivedBind,
|
|
191
|
+
errorCreated: errorCreatedBind,
|
|
192
|
+
commentCreated: commentCreatedBind,
|
|
193
|
+
commentUpdated: commentUpdatedBind,
|
|
194
|
+
commentDeleted: commentDeletedBind,
|
|
195
|
+
eventAlertTriggered: eventAlertTriggeredBind,
|
|
196
|
+
metricAlertCritical: metricAlertCriticalBind,
|
|
197
|
+
metricAlertWarning: metricAlertWarningBind,
|
|
198
|
+
metricAlertResolved: metricAlertResolvedBind,
|
|
199
|
+
seerRootCauseStarted: seerRootCauseStartedBind,
|
|
200
|
+
seerRootCauseCompleted: seerRootCauseCompletedBind,
|
|
201
|
+
seerSolutionStarted: seerSolutionStartedBind,
|
|
202
|
+
seerSolutionCompleted: seerSolutionCompletedBind,
|
|
203
|
+
seerCodingStarted: seerCodingStartedBind,
|
|
204
|
+
seerCodingCompleted: seerCodingCompletedBind,
|
|
205
|
+
seerPrCreated: seerPrCreatedBind,
|
|
206
|
+
preprodSizeAnalysisCompleted: preprodSizeAnalysisCompletedBind,
|
|
207
|
+
preprodBuildDistributionCompleted: preprodBuildDistributionCompletedBind
|
|
208
|
+
});
|
|
209
|
+
const webhooks = Object.freeze({ serviceHookEventAlert: serviceHookEventAlertBind });
|
|
210
|
+
function withDefaultSchedule(schedule) {
|
|
211
|
+
if (schedule === void 0) return "5m";
|
|
212
|
+
return schedule;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Pure helper that the polling `poll` callback delegates to. Exported so it
|
|
216
|
+
* can be unit-tested without standing up the full polling harness.
|
|
217
|
+
*/
|
|
218
|
+
async function executeDiscoverEventsPoll(params, credentials, options) {
|
|
219
|
+
const clientCreds = {
|
|
220
|
+
SENTRY_ACCESS_TOKEN: credentials.SENTRY_ACCESS_TOKEN,
|
|
221
|
+
...credentials.SENTRY_REGION_URL ? { SENTRY_REGION_URL: credentials.SENTRY_REGION_URL } : {},
|
|
222
|
+
...credentials.SENTRY_ORG_SLUG ? { SENTRY_ORG_SLUG: credentials.SENTRY_ORG_SLUG } : {}
|
|
223
|
+
};
|
|
224
|
+
const orgSlug = params.organization_slug ?? credentials.SENTRY_ORG_SLUG;
|
|
225
|
+
if (!orgSlug) throw new Error("Sentry Discover polling trigger requires an organization slug — supply `params.organization_slug` or store `SENTRY_ORG_SLUG` on the credentials.");
|
|
226
|
+
const client = (options?.clientFactory ?? createSentryClient)(clientCreds);
|
|
227
|
+
const query = { field: [...params.field] };
|
|
228
|
+
if (params.query != null) query.query = params.query;
|
|
229
|
+
if (params.project) query.project = [...params.project];
|
|
230
|
+
if (params.environment) query.environment = [...params.environment];
|
|
231
|
+
if (params.statsPeriod) query.statsPeriod = params.statsPeriod;
|
|
232
|
+
if (params.dataset) query.dataset = params.dataset;
|
|
233
|
+
if (params.per_page != null) query.per_page = params.per_page;
|
|
234
|
+
return (await client.get(`/api/0/organizations/${encodeURIComponent(orgSlug)}/events/`, query)).data;
|
|
235
|
+
}
|
|
236
|
+
function computeDiscoverEventsPollIdempotencyKey(response) {
|
|
237
|
+
const first = response.data[0];
|
|
238
|
+
if (!first) return void 0;
|
|
239
|
+
const asRecord = first;
|
|
240
|
+
const id = asRecord.event_id ?? asRecord.id;
|
|
241
|
+
if (typeof id === "string" && id.length > 0) return `discover:${id}`;
|
|
242
|
+
if (typeof id === "number") return `discover:${id}`;
|
|
243
|
+
}
|
|
244
|
+
function bindDiscoverEventsPollingTrigger(params, options) {
|
|
245
|
+
return createPollingTriggerBindingFactory({
|
|
246
|
+
defaultName: "Sentry Discover Events Poll",
|
|
247
|
+
defaultDescription: "Poll the Sentry Discover events endpoint on a schedule and emit new rows as triggers.",
|
|
248
|
+
schedule: withDefaultSchedule(options?.schedule),
|
|
249
|
+
credentialSets: discoverPollingCredentialSets,
|
|
250
|
+
response: sentryDiscoverEventsPollResponseSchema,
|
|
251
|
+
poll: async (ctx) => executeDiscoverEventsPoll(params, ctx.credentials.sentry),
|
|
252
|
+
idempotencyKey: (response) => computeDiscoverEventsPollIdempotencyKey(response)
|
|
253
|
+
})({
|
|
254
|
+
...options?.name ? { name: options.name } : {},
|
|
255
|
+
...options?.description ? { description: options.description } : {},
|
|
256
|
+
...options?.filter ? { filter: options.filter } : {},
|
|
257
|
+
...options?.transform ? { transform: options.transform } : {}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
const polling = Object.freeze({ discoverEvents: bindDiscoverEventsPollingTrigger });
|
|
261
|
+
|
|
262
|
+
//#endregion
|
|
263
|
+
export { computeDiscoverEventsPollIdempotencyKey, executeDiscoverEventsPoll, on, polling, webhooks };
|