@keystrokehq/sentry 0.0.12 → 0.0.16-integration-id-canonicalization.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.
Files changed (80) hide show
  1. package/README.md +40 -187
  2. package/dist/credential-sets/index.d.mts +2 -0
  3. package/dist/credential-sets/index.mjs +4 -0
  4. package/dist/index.d.mts +4 -1
  5. package/dist/index.mjs +6 -1
  6. package/dist/operations/index.d.mts +2 -0
  7. package/dist/operations/index.mjs +3 -0
  8. package/dist/{schemas.d.mts → schemas/index.d.mts} +5 -5
  9. package/dist/schemas/index.mjs +3 -0
  10. package/dist/{schemas.mjs → sentry-api-DjJ24hwX.mjs} +2 -2
  11. package/dist/sentry-app.credential-set-4DLRUKF9.d.mts +59 -0
  12. package/dist/sentry-app.credential-set-Cdj6Qxiz.mjs +23 -0
  13. package/dist/sentry.credential-set-2b3TPFqv.mjs +696 -0
  14. package/dist/view-organization-notification-actions.operation-BI2aB_Mj.mjs +4548 -0
  15. package/dist/view-organization-notification-actions.operation-C7pc8cl_.d.mts +6840 -0
  16. package/package.json +9 -117
  17. package/dist/_official/index.d.mts +0 -46
  18. package/dist/_official/index.mjs +0 -3
  19. package/dist/_runtime/index.d.mts +0 -2
  20. package/dist/_runtime/index.mjs +0 -3
  21. package/dist/alerts.d.mts +0 -551
  22. package/dist/alerts.mjs +0 -300
  23. package/dist/client.d.mts +0 -86
  24. package/dist/client.mjs +0 -233
  25. package/dist/connection.d.mts +0 -3
  26. package/dist/connection.mjs +0 -3
  27. package/dist/dashboards.d.mts +0 -203
  28. package/dist/dashboards.mjs +0 -122
  29. package/dist/debug-files.d.mts +0 -127
  30. package/dist/debug-files.mjs +0 -73
  31. package/dist/deploys.d.mts +0 -103
  32. package/dist/deploys.mjs +0 -67
  33. package/dist/discover.d.mts +0 -235
  34. package/dist/discover.mjs +0 -138
  35. package/dist/endpoint-factory-C0WIFmtK.mjs +0 -95
  36. package/dist/environments.d.mts +0 -121
  37. package/dist/environments.mjs +0 -71
  38. package/dist/errors-DfEFwcTe.mjs +0 -142
  39. package/dist/events-api.d.mts +0 -311
  40. package/dist/events-api.mjs +0 -184
  41. package/dist/events.d.mts +0 -754
  42. package/dist/events.mjs +0 -142
  43. package/dist/feedback.d.mts +0 -99
  44. package/dist/feedback.mjs +0 -63
  45. package/dist/integration-DCNn_9vz.mjs +0 -356
  46. package/dist/integration-rmp485nJ.d.mts +0 -57
  47. package/dist/issues.d.mts +0 -563
  48. package/dist/issues.mjs +0 -324
  49. package/dist/members.d.mts +0 -365
  50. package/dist/members.mjs +0 -156
  51. package/dist/messaging.d.mts +0 -1
  52. package/dist/messaging.mjs +0 -1
  53. package/dist/monitors.d.mts +0 -539
  54. package/dist/monitors.mjs +0 -234
  55. package/dist/notifications.d.mts +0 -221
  56. package/dist/notifications.mjs +0 -133
  57. package/dist/organizations.d.mts +0 -563
  58. package/dist/organizations.mjs +0 -334
  59. package/dist/pagination-PlgAqbZt.mjs +0 -116
  60. package/dist/project-keys.d.mts +0 -287
  61. package/dist/project-keys.mjs +0 -122
  62. package/dist/projects.d.mts +0 -687
  63. package/dist/projects.mjs +0 -378
  64. package/dist/releases.d.mts +0 -949
  65. package/dist/releases.mjs +0 -479
  66. package/dist/replays.d.mts +0 -307
  67. package/dist/replays.mjs +0 -192
  68. package/dist/scim.d.mts +0 -413
  69. package/dist/scim.mjs +0 -249
  70. package/dist/scopes-RRU0vt-a.mjs +0 -36
  71. package/dist/teams.d.mts +0 -561
  72. package/dist/teams.mjs +0 -266
  73. package/dist/triggers.d.mts +0 -97
  74. package/dist/triggers.mjs +0 -106
  75. package/dist/user-emails.d.mts +0 -117
  76. package/dist/user-emails.mjs +0 -60
  77. package/dist/verification.d.mts +0 -30
  78. package/dist/verification.mjs +0 -83
  79. package/dist/webhooks.d.mts +0 -199
  80. package/dist/webhooks.mjs +0 -108
package/dist/teams.mjs DELETED
@@ -1,266 +0,0 @@
1
- import { orgScopeInputSchema, orgTeamScopeInputSchema, sentryIdSchema, sentryJsonObjectSchema, sentryListInputSchema, sentryMemberSchema, sentryProjectSummarySchema, sentrySlugSchema, sentryTeamSchema } from "./schemas.mjs";
2
- import { t as defineSentryEndpoint } from "./endpoint-factory-C0WIFmtK.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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: "sentry.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 };
@@ -1,97 +0,0 @@
1
- import { createSentryClient } from "./client.mjs";
2
- import { SentryDiscoverEventsPollResponse } from "./events.mjs";
3
- import { BoundTrigger, Operation, TriggerBindOptions, TriggerManifest } from "@keystrokehq/core";
4
- import { z } from "zod";
5
- import { PollingTriggerManifest, pollingTrigger } from "@keystrokehq/core/trigger";
6
- import { AnyCredentialSet, InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
7
-
8
- //#region ../../packages/integration-authoring/dist/index.d.mts
9
- //#endregion
10
- //#region src/triggers/types.d.ts
11
- interface IntegrationTriggerMetadata {
12
- readonly id?: string;
13
- readonly description?: string;
14
- }
15
- interface IntegrationTriggerBindingOptions<TPayload, TOutput = TPayload, TRequest = undefined> extends IntegrationTriggerMetadata {
16
- readonly transform?: TriggerBindOptions<TPayload, TOutput, TRequest>['transform'];
17
- }
18
- type IntegrationTriggerBindingFactory<TAuthorPayload, TCredentialSets extends readonly AnyCredentialSet[] | undefined, TManifest extends TriggerManifest = TriggerManifest, TRuntimePayload = TAuthorPayload, TRequest = undefined> = <TOutput = TAuthorPayload>(options?: IntegrationTriggerBindingOptions<TAuthorPayload, TOutput, TRequest>) => BoundTrigger<TRuntimePayload, TCredentialSets, TManifest, TOutput, TRequest>; //#endregion
19
- //#region src/triggers/shared.d.ts
20
- type MappedPayloadFn<TPayload, TMappedPayload> = (payload: TPayload) => TMappedPayload | null; //#endregion
21
- //#region src/triggers/polling.d.ts
22
- type PollingPrimitiveConfig<TResponseSchema extends z.ZodTypeAny, TCredentialSets extends readonly AnyCredentialSet[] = readonly []> = Parameters<typeof pollingTrigger<TResponseSchema, TCredentialSets>>[0];
23
- /**
24
- * Authoring config for an integration polling trigger binding.
25
- *
26
- * Notes about the new core surface:
27
- * - Polling no longer supports any form of `idempotencyKey` (only webhook does).
28
- * - `filter` must be a pure Zod schema (no `.refine`, `.transform`, etc.).
29
- * - `mapPayload` curates the validated polling response into the friendlier
30
- * shape surfaced to authors. It is applied as a default `transform` at bind
31
- * time; authors can still pass their own `transform` to override or compose.
32
- */
33
- interface IntegrationPollingTriggerBindingConfig<TResponseSchema extends z.ZodTypeAny, TEvent = z.output<TResponseSchema>, TCredentialSets extends readonly AnyCredentialSet[] = readonly []> {
34
- readonly defaultId: string;
35
- readonly defaultDescription: string;
36
- readonly schedule: PollingPrimitiveConfig<TResponseSchema, TCredentialSets>['schedule'];
37
- readonly response: TResponseSchema;
38
- readonly poll: PollingPrimitiveConfig<TResponseSchema, TCredentialSets>['poll'];
39
- readonly credentialSets?: TCredentialSets;
40
- readonly filter?: z.ZodTypeAny;
41
- readonly mapPayload?: MappedPayloadFn<z.output<TResponseSchema>, TEvent>;
42
- }
43
- declare function createPollingTriggerBindingFactory<TResponseSchema extends z.ZodTypeAny, TEvent = z.output<TResponseSchema>, TCredentialSets extends readonly AnyCredentialSet[] = readonly []>(config: IntegrationPollingTriggerBindingConfig<TResponseSchema, TEvent, TCredentialSets>): IntegrationTriggerBindingFactory<TEvent, TCredentialSets, PollingTriggerManifest, z.output<TResponseSchema>>; //#endregion
44
- //#region src/triggers/webhook.d.ts
45
- /**
46
- * Authoring config for an integration webhook trigger binding.
47
- *
48
- * Notes about the new core surface:
49
- * - The platform owns the HTTP surface for `source: { type: 'custom' }` webhooks
50
- * and authenticates with a Keystroke-issued secret. There is no `path`,
51
- * `method`, `verify`, or `response` here anymore.
52
- * - `filter` must be a pure Zod schema (no `.refine`, `.transform`, etc.).
53
- * Use it to narrow the raw payload to the events this binding is interested
54
- * in. Filtering happens server-side before any VM hop.
55
- * - `idempotencyKey` is declarative (`IdempotencyKeyConfig`) — point it at a
56
- * payload path or a header. Function-style idempotency is no longer
57
- * supported.
58
- * - `mapPayload` curates the validated raw payload into the friendlier shape
59
- * surfaced to authors. It is applied as a default `transform` at bind time;
60
- * authors can still pass their own `transform` to override or compose.
61
- */
62
- //#endregion
63
- //#region src/triggers.d.ts
64
- type Schedule = Parameters<typeof createPollingTriggerBindingFactory>[0]['schedule'];
65
- interface DiscoverEventsPollParams {
66
- readonly field: readonly string[];
67
- readonly query?: string;
68
- readonly project?: readonly number[];
69
- readonly environment?: readonly string[];
70
- readonly statsPeriod?: string;
71
- readonly dataset?: 'discover' | 'errors' | 'transactions' | 'issuePlatform';
72
- readonly per_page?: number;
73
- /** Override the org slug stored on the credentials. */
74
- readonly organization_slug?: string;
75
- }
76
- interface DiscoverBindingOptions<TOutput = SentryDiscoverEventsPollResponse> extends IntegrationTriggerBindingOptions<SentryDiscoverEventsPollResponse, TOutput> {
77
- readonly schedule?: Schedule;
78
- }
79
- /**
80
- * Pure helper that the polling `poll` callback delegates to. Exported so it
81
- * can be unit-tested without standing up the full polling harness.
82
- */
83
- declare function executeDiscoverEventsPoll(params: DiscoverEventsPollParams, credentials: {
84
- readonly SENTRY_ACCESS_TOKEN: string;
85
- readonly SENTRY_REGION_URL?: string;
86
- readonly SENTRY_ORG_SLUG?: string;
87
- }, options?: {
88
- readonly clientFactory?: typeof createSentryClient;
89
- }): Promise<SentryDiscoverEventsPollResponse>;
90
- declare function computeDiscoverEventsPollIdempotencyKey(response: SentryDiscoverEventsPollResponse): string | undefined;
91
- declare function bindDiscoverEventsPollingTrigger<TOutput = SentryDiscoverEventsPollResponse>(params: DiscoverEventsPollParams, options?: DiscoverBindingOptions<TOutput>): BoundTrigger<SentryDiscoverEventsPollResponse, readonly [], PollingTriggerManifest, TOutput>;
92
- declare const polling: Readonly<{
93
- readonly discoverEvents: typeof bindDiscoverEventsPollingTrigger;
94
- }>;
95
- type SentryPollingTriggers = typeof polling;
96
- //#endregion
97
- export { DiscoverEventsPollParams, SentryPollingTriggers, computeDiscoverEventsPollIdempotencyKey, executeDiscoverEventsPoll, polling };
package/dist/triggers.mjs DELETED
@@ -1,106 +0,0 @@
1
- import { createSentryClient } from "./client.mjs";
2
- import { sentryDiscoverEventsPollResponseSchema } from "./events.mjs";
3
- import { Operation } from "@keystrokehq/core";
4
- import { z } from "zod";
5
- import { pollingTrigger } from "@keystrokehq/core/trigger";
6
-
7
- //#region ../../packages/integration-authoring/dist/index.mjs
8
- const IntegrationConfigSchema = z.object({
9
- id: z.string().min(1),
10
- name: z.string().min(1),
11
- description: z.string().optional()
12
- });
13
- function resolveMetadata(metadata, defaults) {
14
- return {
15
- id: metadata?.id ?? defaults.defaultId,
16
- description: metadata?.description ?? defaults.defaultDescription
17
- };
18
- }
19
- function resolveAuthorPayload(payload, mapPayload) {
20
- if (!mapPayload) return payload;
21
- return mapPayload(payload);
22
- }
23
- function createIntegrationTriggerBindingFactory(config) {
24
- const bind = (options) => {
25
- const resolvedMetadata = resolveMetadata(options, config);
26
- const baseTrigger = config.createBaseTrigger(resolvedMetadata);
27
- const userTransform = options?.transform;
28
- return baseTrigger({ transform: userTransform || config.mapPayload ? (runtimePayload, request) => {
29
- const authorPayload = resolveAuthorPayload(runtimePayload, config.mapPayload);
30
- if (authorPayload === null) throw new Error(`Trigger "${resolvedMetadata.id}" mapPayload returned null after the trigger filter passed; tighten the trigger filter schema.`);
31
- if (!userTransform) return authorPayload;
32
- return userTransform(authorPayload, request);
33
- } : void 0 });
34
- };
35
- return Object.freeze(bind);
36
- }
37
- function createPollingTriggerBindingFactory(config) {
38
- return createIntegrationTriggerBindingFactory({
39
- defaultId: config.defaultId,
40
- defaultDescription: config.defaultDescription,
41
- mapPayload: config.mapPayload,
42
- createBaseTrigger: (metadata) => pollingTrigger({
43
- id: metadata.id,
44
- description: metadata.description,
45
- schedule: config.schedule,
46
- response: config.response,
47
- poll: config.poll,
48
- ...config.credentialSets ? { credentialSets: config.credentialSets } : {},
49
- ...config.filter ? { filter: config.filter } : {}
50
- })
51
- });
52
- }
53
-
54
- //#endregion
55
- //#region src/triggers.ts
56
- function withDefaultSchedule(schedule) {
57
- if (schedule === void 0) return "5m";
58
- return schedule;
59
- }
60
- /**
61
- * Pure helper that the polling `poll` callback delegates to. Exported so it
62
- * can be unit-tested without standing up the full polling harness.
63
- */
64
- async function executeDiscoverEventsPoll(params, credentials, options) {
65
- const clientCreds = {
66
- SENTRY_ACCESS_TOKEN: credentials.SENTRY_ACCESS_TOKEN,
67
- ...credentials.SENTRY_REGION_URL ? { SENTRY_REGION_URL: credentials.SENTRY_REGION_URL } : {},
68
- ...credentials.SENTRY_ORG_SLUG ? { SENTRY_ORG_SLUG: credentials.SENTRY_ORG_SLUG } : {}
69
- };
70
- const orgSlug = params.organization_slug ?? credentials.SENTRY_ORG_SLUG;
71
- 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.");
72
- const client = (options?.clientFactory ?? createSentryClient)(clientCreds);
73
- const query = { field: [...params.field] };
74
- if (params.query != null) query.query = params.query;
75
- if (params.project) query.project = [...params.project];
76
- if (params.environment) query.environment = [...params.environment];
77
- if (params.statsPeriod) query.statsPeriod = params.statsPeriod;
78
- if (params.dataset) query.dataset = params.dataset;
79
- if (params.per_page != null) query.per_page = params.per_page;
80
- return (await client.get(`/api/0/organizations/${encodeURIComponent(orgSlug)}/events/`, query)).data;
81
- }
82
- function computeDiscoverEventsPollIdempotencyKey(response) {
83
- const first = response.data[0];
84
- if (!first) return void 0;
85
- const asRecord = first;
86
- const id = asRecord.event_id ?? asRecord.id;
87
- if (typeof id === "string" && id.length > 0) return `discover:${id}`;
88
- if (typeof id === "number") return `discover:${id}`;
89
- }
90
- function bindDiscoverEventsPollingTrigger(params, options) {
91
- return createPollingTriggerBindingFactory({
92
- defaultId: "sentry.discover_events.poll",
93
- defaultDescription: "Poll the Sentry Discover events endpoint on a schedule and emit new rows as triggers.",
94
- schedule: withDefaultSchedule(options?.schedule),
95
- response: sentryDiscoverEventsPollResponseSchema,
96
- poll: async (ctx) => executeDiscoverEventsPoll(params, ctx.credentials.sentry)
97
- })({
98
- ...options?.id ? { id: options.id } : {},
99
- ...options?.description ? { description: options.description } : {},
100
- ...options?.transform ? { transform: options.transform } : {}
101
- });
102
- }
103
- const polling = Object.freeze({ discoverEvents: bindDiscoverEventsPollingTrigger });
104
-
105
- //#endregion
106
- export { computeDiscoverEventsPollIdempotencyKey, executeDiscoverEventsPoll, polling };
@@ -1,117 +0,0 @@
1
- import * as _keystrokehq_core0 from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
-
5
- //#region src/user-emails.d.ts
6
- declare const retrieveUserEmailInformation: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>, z.ZodArray<z.ZodObject<{
7
- email: z.ZodString;
8
- isPrimary: z.ZodOptional<z.ZodBoolean>;
9
- isVerified: z.ZodOptional<z.ZodBoolean>;
10
- }, z.core.$loose>>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
11
- SENTRY_ACCESS_TOKEN: z.ZodString;
12
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
13
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
14
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
15
- SENTRY_ACCESS_TOKEN: z.ZodString;
16
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
17
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
18
- }, z.core.$strip>>[] | undefined>], undefined>;
19
- declare const addRemoveUserEmailById: _keystrokehq_core0.Operation<z.ZodObject<{
20
- email: z.ZodString;
21
- }, z.core.$strip>, z.ZodObject<{
22
- email: z.ZodString;
23
- isPrimary: z.ZodOptional<z.ZodBoolean>;
24
- isVerified: z.ZodOptional<z.ZodBoolean>;
25
- }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
26
- SENTRY_ACCESS_TOKEN: z.ZodString;
27
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
28
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
29
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
30
- SENTRY_ACCESS_TOKEN: z.ZodString;
31
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
32
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
33
- }, z.core.$strip>>[] | undefined>], undefined>;
34
- declare const updateUserEmail: _keystrokehq_core0.Operation<z.ZodObject<{
35
- email: z.ZodString;
36
- }, z.core.$strip>, z.ZodObject<{
37
- email: z.ZodString;
38
- isPrimary: z.ZodOptional<z.ZodBoolean>;
39
- isVerified: z.ZodOptional<z.ZodBoolean>;
40
- }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
41
- SENTRY_ACCESS_TOKEN: z.ZodString;
42
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
43
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
44
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
45
- SENTRY_ACCESS_TOKEN: z.ZodString;
46
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
47
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
48
- }, z.core.$strip>>[] | undefined>], undefined>;
49
- declare const deleteUserEmailsById: _keystrokehq_core0.Operation<z.ZodObject<{
50
- email: z.ZodString;
51
- }, z.core.$strip>, z.ZodUnknown, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
52
- SENTRY_ACCESS_TOKEN: z.ZodString;
53
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
54
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
55
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
56
- SENTRY_ACCESS_TOKEN: z.ZodString;
57
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
58
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
59
- }, z.core.$strip>>[] | undefined>], undefined>;
60
- declare const sentryUserEmailOperations: {
61
- readonly retrieveUserEmailInformation: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>, z.ZodArray<z.ZodObject<{
62
- email: z.ZodString;
63
- isPrimary: z.ZodOptional<z.ZodBoolean>;
64
- isVerified: z.ZodOptional<z.ZodBoolean>;
65
- }, z.core.$loose>>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
66
- SENTRY_ACCESS_TOKEN: z.ZodString;
67
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
68
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
69
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
70
- SENTRY_ACCESS_TOKEN: z.ZodString;
71
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
72
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
73
- }, z.core.$strip>>[] | undefined>], undefined>;
74
- readonly addRemoveUserEmailById: _keystrokehq_core0.Operation<z.ZodObject<{
75
- email: z.ZodString;
76
- }, z.core.$strip>, z.ZodObject<{
77
- email: z.ZodString;
78
- isPrimary: z.ZodOptional<z.ZodBoolean>;
79
- isVerified: z.ZodOptional<z.ZodBoolean>;
80
- }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
81
- SENTRY_ACCESS_TOKEN: z.ZodString;
82
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
83
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
84
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
85
- SENTRY_ACCESS_TOKEN: z.ZodString;
86
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
87
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
88
- }, z.core.$strip>>[] | undefined>], undefined>;
89
- readonly updateUserEmail: _keystrokehq_core0.Operation<z.ZodObject<{
90
- email: z.ZodString;
91
- }, z.core.$strip>, z.ZodObject<{
92
- email: z.ZodString;
93
- isPrimary: z.ZodOptional<z.ZodBoolean>;
94
- isVerified: z.ZodOptional<z.ZodBoolean>;
95
- }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
96
- SENTRY_ACCESS_TOKEN: z.ZodString;
97
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
98
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
99
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
100
- SENTRY_ACCESS_TOKEN: z.ZodString;
101
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
102
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
103
- }, z.core.$strip>>[] | undefined>], undefined>;
104
- readonly deleteUserEmailsById: _keystrokehq_core0.Operation<z.ZodObject<{
105
- email: z.ZodString;
106
- }, z.core.$strip>, z.ZodUnknown, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
107
- SENTRY_ACCESS_TOKEN: z.ZodString;
108
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
109
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
110
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
111
- SENTRY_ACCESS_TOKEN: z.ZodString;
112
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
113
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
114
- }, z.core.$strip>>[] | undefined>], undefined>;
115
- };
116
- //#endregion
117
- export { addRemoveUserEmailById, deleteUserEmailsById, retrieveUserEmailInformation, sentryUserEmailOperations, updateUserEmail };
@@ -1,60 +0,0 @@
1
- import { sentryUserEmailSchema } from "./schemas.mjs";
2
- import { t as defineSentryEndpoint } from "./endpoint-factory-C0WIFmtK.mjs";
3
- import { z } from "zod";
4
-
5
- //#region src/user-emails.ts
6
- /**
7
- * Sentry user-email operations (current-user account scope).
8
- * Maps to PLAN.md §6.21 (4 actions).
9
- */
10
- const retrieveUserEmailInformation = defineSentryEndpoint({
11
- id: "sentry.retrieve-user-email-information",
12
- name: "Retrieve User Emails",
13
- description: "List the emails on the authenticated Sentry account.",
14
- method: "GET",
15
- path: "/api/0/users/me/emails/",
16
- input: z.object({}),
17
- output: z.array(sentryUserEmailSchema)
18
- });
19
- const addRemoveUserEmailById = defineSentryEndpoint({
20
- id: "sentry.add-remove-user-email-by-id",
21
- name: "Add User Email",
22
- description: "Add a new email to the authenticated Sentry account.",
23
- method: "POST",
24
- path: "/api/0/users/me/emails/",
25
- input: z.object({ email: z.string().email() }),
26
- bodyFields: ["email"],
27
- output: sentryUserEmailSchema,
28
- needsApproval: true
29
- });
30
- const updateUserEmail = defineSentryEndpoint({
31
- id: "sentry.update-user-email",
32
- name: "Set Primary Email",
33
- description: "Mark an email as the primary address on the authenticated account.",
34
- method: "PUT",
35
- path: "/api/0/users/me/emails/",
36
- input: z.object({ email: z.string().email() }),
37
- bodyFields: ["email"],
38
- output: sentryUserEmailSchema,
39
- needsApproval: true
40
- });
41
- const deleteUserEmailsById = defineSentryEndpoint({
42
- id: "sentry.delete-user-emails-by-id",
43
- name: "Delete User Email",
44
- description: "Remove an email from the authenticated Sentry account.",
45
- method: "DELETE",
46
- path: "/api/0/users/me/emails/",
47
- input: z.object({ email: z.string().email() }),
48
- queryFields: ["email"],
49
- output: z.unknown(),
50
- needsApproval: true
51
- });
52
- const sentryUserEmailOperations = {
53
- retrieveUserEmailInformation,
54
- addRemoveUserEmailById,
55
- updateUserEmail,
56
- deleteUserEmailsById
57
- };
58
-
59
- //#endregion
60
- export { addRemoveUserEmailById, deleteUserEmailsById, retrieveUserEmailInformation, sentryUserEmailOperations, updateUserEmail };
@@ -1,30 +0,0 @@
1
- //#region src/verification.d.ts
2
- /**
3
- * Webhook-request verification helpers for Sentry.
4
- *
5
- * Two verification paths are exposed:
6
- *
7
- * 1. `verifySentryWebhookRequest` — for integration-platform webhooks,
8
- * signed with HMAC-SHA256 of the raw JSON body using the integration's
9
- * `clientSecret`. Header: `Sentry-Hook-Signature`. Timestamp skew is
10
- * enforced via `Sentry-Hook-Timestamp` with a configurable `maxSkewSeconds`
11
- * default of 300.
12
- * 2. `verifySentryServiceHookRequest` — for legacy project service hooks,
13
- * signed with a per-hook secret rather than the integration secret.
14
- * Same signing algorithm.
15
- *
16
- * Both helpers throw `SentryWebhookVerificationError` on failure and return
17
- * `void` on success. Comparisons use timing-safe equality.
18
- */
19
- interface SentryWebhookVerificationInput {
20
- readonly rawBody: string;
21
- readonly headers: Readonly<Record<string, string>> | Headers;
22
- readonly secret: string;
23
- readonly maxSkewSeconds?: number;
24
- /** Hook for tests to provide a deterministic "now" value. */
25
- readonly now?: () => number;
26
- }
27
- declare function verifySentryWebhookRequest(input: SentryWebhookVerificationInput): void;
28
- declare function verifySentryServiceHookRequest(input: SentryWebhookVerificationInput): void;
29
- //#endregion
30
- export { SentryWebhookVerificationInput, verifySentryServiceHookRequest, verifySentryWebhookRequest };