@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/events.mjs DELETED
@@ -1,142 +0,0 @@
1
- import { sentryActorSchema, sentryJsonObjectSchema } from "./schemas.mjs";
2
- import { z } from "zod";
3
-
4
- //#region src/events.ts
5
- /**
6
- * Sentry integration-platform webhook payload schemas.
7
- *
8
- * Every payload follows the same envelope:
9
- * { action, installation: { uuid }, data: {...}, actor: {...} }
10
- *
11
- * `action` names the specific event within a resource family; the resource
12
- * family itself is conveyed via the `Sentry-Hook-Resource` header which the
13
- * trigger dispatcher uses for routing. We parse with top-level strictness
14
- * and allow `.passthrough()` on nested payload objects to tolerate field
15
- * additions by Sentry without forcing a schema rev.
16
- */
17
- const sentryInstallationRefSchema = z.object({ uuid: z.string().min(1) }).passthrough();
18
- function envelope(action, dataSchema) {
19
- return z.object({
20
- action: z.literal(action),
21
- installation: sentryInstallationRefSchema,
22
- data: dataSchema,
23
- actor: sentryActorSchema.optional()
24
- }).passthrough();
25
- }
26
- const sentryIssueWebhookDataSchema = z.object({ issue: z.object({
27
- id: z.string().min(1),
28
- shortId: z.string().optional(),
29
- title: z.string().optional(),
30
- culprit: z.string().nullable().optional(),
31
- project: sentryJsonObjectSchema.optional(),
32
- status: z.string().optional(),
33
- level: z.string().optional(),
34
- platform: z.string().nullable().optional(),
35
- url: z.string().url().optional(),
36
- web_url: z.string().url().optional()
37
- }).passthrough() }).passthrough();
38
- const sentryIssueCreatedEventSchema = envelope("created", sentryIssueWebhookDataSchema);
39
- const sentryIssueResolvedEventSchema = envelope("resolved", sentryIssueWebhookDataSchema);
40
- const sentryIssueAssignedEventSchema = envelope("assigned", sentryIssueWebhookDataSchema);
41
- const sentryIssueUnresolvedEventSchema = envelope("unresolved", sentryIssueWebhookDataSchema);
42
- const sentryIssueIgnoredEventSchema = envelope("ignored", sentryIssueWebhookDataSchema);
43
- const sentryIssueArchivedEventSchema = envelope("archived", sentryIssueWebhookDataSchema);
44
- const sentryInstallationWebhookDataSchema = z.object({ installation: z.object({
45
- uuid: z.string().min(1),
46
- status: z.string().optional(),
47
- organization: sentryJsonObjectSchema.optional(),
48
- app: sentryJsonObjectSchema.optional()
49
- }).passthrough() }).passthrough();
50
- const sentryInstallationCreatedEventSchema = envelope("created", sentryInstallationWebhookDataSchema);
51
- const sentryInstallationDeletedEventSchema = envelope("deleted", sentryInstallationWebhookDataSchema);
52
- const sentryErrorWebhookDataSchema = z.object({ error: z.object({
53
- event_id: z.string().optional(),
54
- project: z.union([z.string(), z.number()]).optional(),
55
- issue_id: z.string().optional(),
56
- title: z.string().optional(),
57
- message: z.string().optional(),
58
- datetime: z.string().optional(),
59
- web_url: z.string().url().optional()
60
- }).passthrough() }).passthrough();
61
- const sentryErrorCreatedEventSchema = envelope("created", sentryErrorWebhookDataSchema);
62
- const sentryCommentWebhookDataSchema = z.object({
63
- comment_id: z.union([z.string(), z.number()]).optional(),
64
- comment: z.string().optional(),
65
- issue_id: z.union([z.string(), z.number()]).optional(),
66
- project_slug: z.string().optional(),
67
- timestamp: z.string().optional()
68
- }).passthrough();
69
- const sentryCommentCreatedEventSchema = envelope("created", sentryCommentWebhookDataSchema);
70
- const sentryCommentUpdatedEventSchema = envelope("updated", sentryCommentWebhookDataSchema);
71
- const sentryCommentDeletedEventSchema = envelope("deleted", sentryCommentWebhookDataSchema);
72
- const sentryEventAlertWebhookDataSchema = z.object({
73
- event: sentryJsonObjectSchema.optional(),
74
- triggered_rule: z.string().optional(),
75
- issue_alert: sentryJsonObjectSchema.optional(),
76
- issue_id: z.union([z.string(), z.number()]).optional()
77
- }).passthrough();
78
- const sentryEventAlertTriggeredEventSchema = envelope("triggered", sentryEventAlertWebhookDataSchema);
79
- const sentryMetricAlertWebhookDataSchema = z.object({
80
- metric_alert: z.object({
81
- id: z.union([z.string(), z.number()]),
82
- identifier: z.string().optional(),
83
- status: z.string().optional(),
84
- title: z.string().optional()
85
- }).passthrough(),
86
- description_text: z.string().optional(),
87
- description_title: z.string().optional(),
88
- web_url: z.string().url().optional()
89
- }).passthrough();
90
- const sentryMetricAlertCriticalEventSchema = envelope("critical", sentryMetricAlertWebhookDataSchema);
91
- const sentryMetricAlertWarningEventSchema = envelope("warning", sentryMetricAlertWebhookDataSchema);
92
- const sentryMetricAlertResolvedEventSchema = envelope("resolved", sentryMetricAlertWebhookDataSchema);
93
- const sentrySeerCommonDataSchema = z.object({
94
- run_id: z.number(),
95
- group_id: z.number()
96
- }).passthrough();
97
- const sentrySeerRootCauseCompletedDataSchema = sentrySeerCommonDataSchema.extend({ root_cause: sentryJsonObjectSchema.optional() });
98
- const sentrySeerSolutionCompletedDataSchema = sentrySeerCommonDataSchema.extend({ solution: sentryJsonObjectSchema.optional() });
99
- const sentrySeerCodingCompletedDataSchema = sentrySeerCommonDataSchema.extend({ changes: z.array(sentryJsonObjectSchema).optional() });
100
- const sentrySeerPrCreatedDataSchema = sentrySeerCommonDataSchema.extend({ pull_requests: z.array(sentryJsonObjectSchema).optional() });
101
- const sentrySeerRootCauseStartedEventSchema = envelope("root_cause_started", sentrySeerCommonDataSchema);
102
- const sentrySeerRootCauseCompletedEventSchema = envelope("root_cause_completed", sentrySeerRootCauseCompletedDataSchema);
103
- const sentrySeerSolutionStartedEventSchema = envelope("solution_started", sentrySeerCommonDataSchema);
104
- const sentrySeerSolutionCompletedEventSchema = envelope("solution_completed", sentrySeerSolutionCompletedDataSchema);
105
- const sentrySeerCodingStartedEventSchema = envelope("coding_started", sentrySeerCommonDataSchema);
106
- const sentrySeerCodingCompletedEventSchema = envelope("coding_completed", sentrySeerCodingCompletedDataSchema);
107
- const sentrySeerPrCreatedEventSchema = envelope("pr_created", sentrySeerPrCreatedDataSchema);
108
- const sentryPreprodArtifactCommonDataSchema = z.object({
109
- buildId: z.string().min(1),
110
- organizationSlug: z.string().optional(),
111
- projectSlug: z.string().optional(),
112
- platform: z.string().nullable().optional(),
113
- state: z.enum(["COMPLETED", "FAILED"]),
114
- appInfo: sentryJsonObjectSchema.optional(),
115
- gitInfo: sentryJsonObjectSchema.nullable().optional(),
116
- errorCode: z.string().nullable().optional(),
117
- errorMessage: z.string().nullable().optional()
118
- }).passthrough();
119
- const sentryPreprodArtifactSizeAnalysisCompletedEventSchema = envelope("size_analysis_completed", sentryPreprodArtifactCommonDataSchema);
120
- const sentryPreprodArtifactBuildDistributionCompletedEventSchema = envelope("build_distribution_completed", sentryPreprodArtifactCommonDataSchema);
121
- /**
122
- * Legacy per-project service hooks deliver a simpler envelope that omits the
123
- * `installation` object because the hook is not installed as an
124
- * integration. We accept both `data.event_id` (pre-2022 shape) and
125
- * `event_id` at the top level (newer shape).
126
- */
127
- const sentryServiceHookEventAlertSchema = z.object({
128
- action: z.string(),
129
- project: z.string().optional(),
130
- project_name: z.string().optional(),
131
- event: sentryJsonObjectSchema.optional(),
132
- data: sentryJsonObjectSchema.optional(),
133
- triggered_rule: z.string().optional(),
134
- event_id: z.string().optional()
135
- }).passthrough();
136
- const sentryDiscoverEventsPollResponseSchema = z.object({
137
- data: z.array(sentryJsonObjectSchema),
138
- meta: sentryJsonObjectSchema.optional()
139
- }).passthrough();
140
-
141
- //#endregion
142
- export { sentryCommentCreatedEventSchema, sentryCommentDeletedEventSchema, sentryCommentUpdatedEventSchema, sentryCommentWebhookDataSchema, sentryDiscoverEventsPollResponseSchema, sentryErrorCreatedEventSchema, sentryErrorWebhookDataSchema, sentryEventAlertTriggeredEventSchema, sentryEventAlertWebhookDataSchema, sentryInstallationCreatedEventSchema, sentryInstallationDeletedEventSchema, sentryInstallationRefSchema, sentryInstallationWebhookDataSchema, sentryIssueArchivedEventSchema, sentryIssueAssignedEventSchema, sentryIssueCreatedEventSchema, sentryIssueIgnoredEventSchema, sentryIssueResolvedEventSchema, sentryIssueUnresolvedEventSchema, sentryIssueWebhookDataSchema, sentryMetricAlertCriticalEventSchema, sentryMetricAlertResolvedEventSchema, sentryMetricAlertWarningEventSchema, sentryMetricAlertWebhookDataSchema, sentryPreprodArtifactBuildDistributionCompletedEventSchema, sentryPreprodArtifactCommonDataSchema, sentryPreprodArtifactSizeAnalysisCompletedEventSchema, sentrySeerCodingCompletedDataSchema, sentrySeerCodingCompletedEventSchema, sentrySeerCodingStartedEventSchema, sentrySeerCommonDataSchema, sentrySeerPrCreatedDataSchema, sentrySeerPrCreatedEventSchema, sentrySeerRootCauseCompletedDataSchema, sentrySeerRootCauseCompletedEventSchema, sentrySeerRootCauseStartedEventSchema, sentrySeerSolutionCompletedDataSchema, sentrySeerSolutionCompletedEventSchema, sentrySeerSolutionStartedEventSchema, sentryServiceHookEventAlertSchema };
@@ -1,99 +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/feedback.d.ts
6
- declare const retrieveUserFeedbackForProject: _keystrokehq_core0.Operation<z.ZodObject<{
7
- cursor: z.ZodOptional<z.ZodString>;
8
- per_page: z.ZodOptional<z.ZodNumber>;
9
- query: z.ZodOptional<z.ZodString>;
10
- organization_slug: z.ZodOptional<z.ZodString>;
11
- project_slug: z.ZodString;
12
- }, z.core.$strip>, z.ZodArray<z.ZodObject<{
13
- id: z.ZodOptional<z.ZodString>;
14
- event_id: z.ZodOptional<z.ZodString>;
15
- name: z.ZodOptional<z.ZodString>;
16
- email: z.ZodOptional<z.ZodString>;
17
- comments: z.ZodOptional<z.ZodString>;
18
- dateCreated: z.ZodOptional<z.ZodISODateTime>;
19
- }, z.core.$loose>>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
20
- SENTRY_ACCESS_TOKEN: z.ZodString;
21
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
22
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
23
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
24
- SENTRY_ACCESS_TOKEN: z.ZodString;
25
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
26
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
27
- }, z.core.$strip>>[] | undefined>], undefined>;
28
- declare const submitProjectUserFeedback: _keystrokehq_core0.Operation<z.ZodObject<{
29
- organization_slug: z.ZodOptional<z.ZodString>;
30
- project_slug: z.ZodString;
31
- event_id: z.ZodString;
32
- name: z.ZodString;
33
- email: z.ZodString;
34
- comments: z.ZodString;
35
- }, z.core.$strip>, z.ZodObject<{
36
- id: z.ZodOptional<z.ZodString>;
37
- event_id: z.ZodOptional<z.ZodString>;
38
- name: z.ZodOptional<z.ZodString>;
39
- email: z.ZodOptional<z.ZodString>;
40
- comments: z.ZodOptional<z.ZodString>;
41
- dateCreated: z.ZodOptional<z.ZodISODateTime>;
42
- }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
43
- SENTRY_ACCESS_TOKEN: z.ZodString;
44
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
45
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
46
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
47
- SENTRY_ACCESS_TOKEN: z.ZodString;
48
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
49
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
50
- }, z.core.$strip>>[] | undefined>], undefined>;
51
- declare const sentryFeedbackOperations: {
52
- readonly retrieveUserFeedbackForProject: _keystrokehq_core0.Operation<z.ZodObject<{
53
- cursor: z.ZodOptional<z.ZodString>;
54
- per_page: z.ZodOptional<z.ZodNumber>;
55
- query: z.ZodOptional<z.ZodString>;
56
- organization_slug: z.ZodOptional<z.ZodString>;
57
- project_slug: z.ZodString;
58
- }, z.core.$strip>, z.ZodArray<z.ZodObject<{
59
- id: z.ZodOptional<z.ZodString>;
60
- event_id: z.ZodOptional<z.ZodString>;
61
- name: z.ZodOptional<z.ZodString>;
62
- email: z.ZodOptional<z.ZodString>;
63
- comments: z.ZodOptional<z.ZodString>;
64
- dateCreated: z.ZodOptional<z.ZodISODateTime>;
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 submitProjectUserFeedback: _keystrokehq_core0.Operation<z.ZodObject<{
75
- organization_slug: z.ZodOptional<z.ZodString>;
76
- project_slug: z.ZodString;
77
- event_id: z.ZodString;
78
- name: z.ZodString;
79
- email: z.ZodString;
80
- comments: z.ZodString;
81
- }, z.core.$strip>, z.ZodObject<{
82
- id: z.ZodOptional<z.ZodString>;
83
- event_id: z.ZodOptional<z.ZodString>;
84
- name: z.ZodOptional<z.ZodString>;
85
- email: z.ZodOptional<z.ZodString>;
86
- comments: z.ZodOptional<z.ZodString>;
87
- dateCreated: z.ZodOptional<z.ZodISODateTime>;
88
- }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"sentry", z.ZodObject<{
89
- SENTRY_ACCESS_TOKEN: z.ZodString;
90
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
91
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
92
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
93
- SENTRY_ACCESS_TOKEN: z.ZodString;
94
- SENTRY_REGION_URL: z.ZodOptional<z.ZodString>;
95
- SENTRY_ORG_SLUG: z.ZodOptional<z.ZodString>;
96
- }, z.core.$strip>>[] | undefined>], undefined>;
97
- };
98
- //#endregion
99
- export { retrieveUserFeedbackForProject, sentryFeedbackOperations, submitProjectUserFeedback };
package/dist/feedback.mjs DELETED
@@ -1,63 +0,0 @@
1
- import { orgProjectScopeInputSchema, sentryFeedbackSchema, sentryIdSchema, sentryListInputSchema } 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/feedback.ts
7
- /**
8
- * Sentry user-feedback operations. Maps to PLAN.md §6.18 (2 actions).
9
- */
10
- const ORG_PROJECT = [{
11
- name: "organization_slug",
12
- placeholder: "{organization_slug}"
13
- }, {
14
- name: "project_slug",
15
- placeholder: "{project_slug}"
16
- }];
17
- const retrieveUserFeedbackForProject = defineSentryEndpoint({
18
- id: "sentry.retrieve-user-feedback-for-project",
19
- name: "List User Feedback",
20
- description: "List user feedback submissions for a project.",
21
- method: "GET",
22
- path: "/api/0/projects/{organization_slug}/{project_slug}/user-feedback/",
23
- pathParams: ORG_PROJECT,
24
- input: sentryListInputSchema.merge(orgProjectScopeInputSchema),
25
- queryFields: [
26
- "cursor",
27
- "per_page",
28
- "query"
29
- ],
30
- output: z.array(sentryFeedbackSchema),
31
- pagination: "cursor",
32
- requiredOAuthScopes: [...SENTRY_SCOPE.projectRead]
33
- });
34
- const submitProjectUserFeedback = defineSentryEndpoint({
35
- id: "sentry.submit-project-user-feedback",
36
- name: "Submit User Feedback",
37
- description: "Submit a user-feedback record against an event.",
38
- method: "POST",
39
- path: "/api/0/projects/{organization_slug}/{project_slug}/user-feedback/",
40
- pathParams: ORG_PROJECT,
41
- input: orgProjectScopeInputSchema.extend({
42
- event_id: sentryIdSchema,
43
- name: z.string().min(1),
44
- email: z.string().email(),
45
- comments: z.string().min(1)
46
- }),
47
- bodyFields: [
48
- "event_id",
49
- "name",
50
- "email",
51
- "comments"
52
- ],
53
- output: sentryFeedbackSchema,
54
- needsApproval: true,
55
- requiredOAuthScopes: [...SENTRY_SCOPE.projectWrite]
56
- });
57
- const sentryFeedbackOperations = {
58
- retrieveUserFeedbackForProject,
59
- submitProjectUserFeedback
60
- };
61
-
62
- //#endregion
63
- export { retrieveUserFeedbackForProject, sentryFeedbackOperations, submitProjectUserFeedback };
@@ -1,356 +0,0 @@
1
- import { SENTRY_DEFAULT_BASE_URL } from "./client.mjs";
2
- import { CredentialSet, Operation } from "@keystrokehq/core";
3
- import { z } from "zod";
4
-
5
- //#region ../../packages/integration-authoring/dist/official/runtime.mjs
6
- const REGISTRY_KEY = "__ks_official_integration_metadata_registry";
7
- function getRegistry() {
8
- const globalStore = globalThis;
9
- if (!globalStore[REGISTRY_KEY]) globalStore[REGISTRY_KEY] = /* @__PURE__ */ new WeakMap();
10
- return globalStore[REGISTRY_KEY];
11
- }
12
- function registerOfficialOperation(operation, metadata) {
13
- getRegistry().set(operation, Object.freeze({ ...metadata }));
14
- }
15
-
16
- //#endregion
17
- //#region ../../packages/integration-authoring/dist/official/index.mjs
18
- const OFFICIAL_CREDENTIAL_SET_ID_PREFIX = "keystroke:";
19
- function officialCredentialSetId(id) {
20
- return `${OFFICIAL_CREDENTIAL_SET_ID_PREFIX}${id}`;
21
- }
22
- function stripOfficialCredentialSetIdPrefix(id) {
23
- return id.startsWith(OFFICIAL_CREDENTIAL_SET_ID_PREFIX) ? id.slice(10) : id;
24
- }
25
- /**
26
- * Creates a factory for Keystroke-official integration operations.
27
- *
28
- * It keeps the same flat `run(input, credentials)` ergonomics as the generic
29
- * operation factory, while registering official metadata for builder/runtime
30
- * operation metadata.
31
- */
32
- function createOfficialOperationFactory(credentialSet) {
33
- const integrationId = stripOfficialCredentialSetIdPrefix(credentialSet.id);
34
- return (config) => {
35
- const wrappedRun = async (input, ctx) => {
36
- const creds = ctx.credentials[credentialSet.id];
37
- return config.run(input, creds);
38
- };
39
- const operation = new Operation({
40
- id: config.id,
41
- name: config.name,
42
- description: config.description,
43
- input: config.input,
44
- output: config.output,
45
- credentialSets: [credentialSet],
46
- ...config.tags !== void 0 ? { tags: config.tags } : {},
47
- ...config.needsApproval !== void 0 ? { needsApproval: config.needsApproval } : {},
48
- ...config.requiredOAuthScopes !== void 0 ? { requiredOAuthScopes: config.requiredOAuthScopes } : {},
49
- ...config.retries !== void 0 ? { retries: config.retries } : {},
50
- ...config.timeout !== void 0 ? { timeout: config.timeout } : {},
51
- ...config.maxDurationMs !== void 0 ? { maxDurationMs: config.maxDurationMs } : {},
52
- run: wrappedRun
53
- });
54
- registerOfficialOperation(operation, { integrationId });
55
- return operation;
56
- };
57
- }
58
- /**
59
- * Creates an official integration bundle from a single config object.
60
- *
61
- * - Creates the public `CredentialSet` internally.
62
- * - Accepts optional `internal` fields for Keystroke-owned platform credentials.
63
- */
64
- function defineOfficialIntegration(config) {
65
- const internalCredentialSets = config.internal ?? {};
66
- const allInternalCredentialSets = [
67
- ...internalCredentialSets.providerApp ? [internalCredentialSets.providerApp] : [],
68
- ...internalCredentialSets.providerAppVariants ?? [],
69
- ...internalCredentialSets.webhookVerification ? [internalCredentialSets.webhookVerification] : [],
70
- ...internalCredentialSets.other ?? []
71
- ];
72
- const credentialSet = new CredentialSet({
73
- id: config.id,
74
- name: config.name,
75
- description: config.description,
76
- auth: config.auth,
77
- ...config.connections ? { connections: config.connections } : {},
78
- ...config.proxy ? { proxy: config.proxy } : {},
79
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {}
80
- });
81
- return Object.freeze({
82
- integration: {
83
- id: config.id,
84
- name: config.name,
85
- ...config.description !== void 0 ? { description: config.description } : {},
86
- auth: config.auth,
87
- ...config.proxy ? { proxy: config.proxy } : {},
88
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {},
89
- ...config.connections ? { connections: config.connections } : {}
90
- },
91
- credentialSet,
92
- internalCredentialSets,
93
- allInternalCredentialSets
94
- });
95
- }
96
-
97
- //#endregion
98
- //#region src/_official/provider-app.ts
99
- /**
100
- * Internal Keystroke-owned Sentry app credentials.
101
- *
102
- * For Sentry, `clientSecret` doubles as the webhook signing secret per
103
- * <https://docs.sentry.io/organization/integrations/integration-platform/webhooks/>,
104
- * so `webhookSecret` is kept as a discrete field for symmetry with other
105
- * integrations even though in practice platforms will populate both from the
106
- * same Sentry-issued value.
107
- */
108
- const sentryAppCredentialSet = new CredentialSet({
109
- id: officialCredentialSetId("sentry-app"),
110
- exposure: "platform-only",
111
- name: "Sentry App",
112
- auth: z.object({
113
- clientId: z.string(),
114
- clientSecret: z.string(),
115
- webhookSecret: z.string()
116
- })
117
- });
118
- const sentryOfficialProviderSeed = {
119
- provider: "sentry",
120
- appRef: "sentry-official",
121
- displayName: "Sentry Platform",
122
- credentialSetName: "Keystroke Sentry Platform App",
123
- envShape: {
124
- KEYSTROKE_OFFICIAL_SENTRY_CLIENT_ID: z.string().optional(),
125
- KEYSTROKE_OFFICIAL_SENTRY_CLIENT_SECRET: z.string().optional(),
126
- KEYSTROKE_OFFICIAL_SENTRY_WEBHOOK_SECRET: z.string().optional()
127
- },
128
- requiredEnvKeys: [
129
- "KEYSTROKE_OFFICIAL_SENTRY_CLIENT_ID",
130
- "KEYSTROKE_OFFICIAL_SENTRY_CLIENT_SECRET",
131
- "KEYSTROKE_OFFICIAL_SENTRY_WEBHOOK_SECRET"
132
- ],
133
- externalAppIdEnvKey: "KEYSTROKE_OFFICIAL_SENTRY_CLIENT_ID",
134
- buildCredentials: (env) => ({
135
- clientId: env.KEYSTROKE_OFFICIAL_SENTRY_CLIENT_ID,
136
- clientSecret: env.KEYSTROKE_OFFICIAL_SENTRY_CLIENT_SECRET,
137
- webhookSecret: env.KEYSTROKE_OFFICIAL_SENTRY_WEBHOOK_SECRET
138
- })
139
- };
140
-
141
- //#endregion
142
- //#region ../../packages/credential-connection/dist/defaults-YE9AvLIc.mjs
143
- /**
144
- * Shared OAuth 2.0 token-response plumbing.
145
- *
146
- * `parseOAuthTokenResponse` handles the two common wire formats (JSON and
147
- * form-urlencoded, the latter used by GitHub unless you explicitly ask for
148
- * JSON). `normalizeOAuthTokens` pulls the standard fields out of the parsed
149
- * body in both the flat form and Slack's nested `authed_user.access_token`
150
- * form. These helpers are exposed so integration authors overriding
151
- * `exchangeCode` / `refreshToken` do not have to re-implement them.
152
- */
153
- var TokenExchangeError = class extends Error {
154
- httpStatus;
155
- constructor(httpStatus) {
156
- super(`Token exchange failed: HTTP ${httpStatus}`);
157
- this.name = "TokenExchangeError";
158
- this.httpStatus = httpStatus;
159
- }
160
- };
161
- async function parseOAuthTokenResponse(response) {
162
- const contentType = response.headers.get("content-type")?.toLowerCase() ?? "";
163
- if (contentType.includes("application/json")) return await response.json();
164
- const text = await response.text();
165
- if (!text.trim()) return {};
166
- if (contentType.includes("application/x-www-form-urlencoded") || text.includes("=")) {
167
- const params = new URLSearchParams(text);
168
- return Object.fromEntries(params.entries());
169
- }
170
- throw new Error(`Unsupported OAuth token response content type: ${contentType || "unknown"}`);
171
- }
172
- function normalizeOAuthTokens(tokenData) {
173
- const authedUser = tokenData.authed_user;
174
- const rawAccessToken = tokenData.access_token ?? authedUser?.access_token;
175
- const rawRefreshToken = tokenData.refresh_token;
176
- const rawExpiresIn = tokenData.expires_in;
177
- const rawInstanceUrl = tokenData.instance_url;
178
- return {
179
- accessToken: typeof rawAccessToken === "string" ? rawAccessToken : void 0,
180
- refreshToken: typeof rawRefreshToken === "string" ? rawRefreshToken : void 0,
181
- expiresIn: typeof rawExpiresIn === "number" ? rawExpiresIn : typeof rawExpiresIn === "string" ? Number(rawExpiresIn) || void 0 : void 0,
182
- instanceUrl: typeof rawInstanceUrl === "string" ? rawInstanceUrl : void 0
183
- };
184
- }
185
- function buildAuthUrl(ctx) {
186
- const { oauthClient, redirectUri, state, connection } = ctx;
187
- const scopes = ctx.requestedScopes ?? connection.scopes;
188
- const url = new URL(connection.authUrl);
189
- url.searchParams.set("client_id", oauthClient.clientId);
190
- url.searchParams.set("scope", scopes.join(" "));
191
- url.searchParams.set("redirect_uri", redirectUri);
192
- url.searchParams.set("state", state);
193
- url.searchParams.set("response_type", "code");
194
- return url.toString();
195
- }
196
- async function exchangeToken(params) {
197
- const response = await fetch(params.tokenUrl, {
198
- method: "POST",
199
- headers: {
200
- Accept: "application/json",
201
- "Content-Type": "application/x-www-form-urlencoded"
202
- },
203
- body: params.body
204
- });
205
- if (!response.ok) throw new TokenExchangeError(response.status);
206
- const raw = await parseOAuthTokenResponse(response);
207
- const { accessToken, refreshToken, expiresIn, instanceUrl } = normalizeOAuthTokens(raw);
208
- if (!accessToken) throw new Error("No access token in response");
209
- return {
210
- accessToken,
211
- refreshToken,
212
- expiresIn,
213
- instanceUrl,
214
- raw
215
- };
216
- }
217
- async function exchangeCode(ctx) {
218
- const { oauthClient, code, redirectUri, connection } = ctx;
219
- if (!code) throw new Error("Missing authorization code");
220
- return exchangeToken({
221
- tokenUrl: connection.tokenUrl,
222
- body: new URLSearchParams({
223
- code,
224
- client_id: oauthClient.clientId,
225
- client_secret: oauthClient.clientSecret,
226
- redirect_uri: redirectUri,
227
- grant_type: "authorization_code"
228
- })
229
- });
230
- }
231
- async function refreshToken(ctx) {
232
- const { oauthClient, refreshToken, connection } = ctx;
233
- return exchangeToken({
234
- tokenUrl: connection.tokenUrl,
235
- body: new URLSearchParams({
236
- grant_type: "refresh_token",
237
- refresh_token: refreshToken,
238
- client_id: oauthClient.clientId,
239
- client_secret: oauthClient.clientSecret
240
- })
241
- });
242
- }
243
- const oauthDefaults = {
244
- buildAuthUrl,
245
- exchangeCode,
246
- exchangeToken,
247
- refreshToken
248
- };
249
-
250
- //#endregion
251
- //#region src/oauth-connection.ts
252
- const SENTRY_OAUTH_SCOPES = [
253
- "org:read",
254
- "project:read",
255
- "project:write",
256
- "project:admin",
257
- "team:read",
258
- "team:write",
259
- "team:admin",
260
- "member:read",
261
- "member:write",
262
- "event:read",
263
- "event:admin",
264
- "alerts:read",
265
- "alerts:write",
266
- "release:admin"
267
- ];
268
- const sentryOAuthConnection = {
269
- kind: "oauth",
270
- tokenType: "refreshable",
271
- authUrl: "https://sentry.io/oauth/authorize/",
272
- tokenUrl: "https://sentry.io/oauth/token/",
273
- revokeUrl: null,
274
- scopes: [...SENTRY_OAUTH_SCOPES],
275
- vault: { accessToken: "SENTRY_ACCESS_TOKEN" },
276
- async exchangeCode(ctx) {
277
- const result = await oauthDefaults.exchangeCode(ctx);
278
- const orgResponse = await fetch(`${SENTRY_DEFAULT_BASE_URL}/api/0/organizations/`, {
279
- method: "GET",
280
- headers: {
281
- Authorization: `Bearer ${result.accessToken}`,
282
- Accept: "application/json"
283
- }
284
- });
285
- let firstOrg = null;
286
- if (orgResponse.ok) {
287
- const orgs = await orgResponse.json();
288
- if (Array.isArray(orgs) && orgs.length > 0 && isOrganizationProbe(orgs[0])) firstOrg = orgs[0];
289
- }
290
- result.raw._sentryOrganization = firstOrg;
291
- result.raw._sentryUser = pickUser(result.raw);
292
- result.raw._sentryScopes = typeof result.raw.scope === "string" ? result.raw.scope : void 0;
293
- return result;
294
- },
295
- extractInstallationInfo({ tokenResult }) {
296
- const org = tokenResult.raw._sentryOrganization;
297
- const user = tokenResult.raw._sentryUser;
298
- const metadata = {};
299
- if (org?.name) metadata.organizationName = org.name;
300
- if (org?.slug) metadata.organizationSlug = org.slug;
301
- const regionUrl = org?.links?.regionUrl;
302
- if (regionUrl) metadata.regionUrl = regionUrl;
303
- if (user?.name) metadata.userName = user.name;
304
- if (user?.email) metadata.userEmail = user.email;
305
- return {
306
- externalInstallationId: org?.slug,
307
- externalWorkspaceId: org?.id,
308
- externalBotUserId: user?.id,
309
- metadata
310
- };
311
- }
312
- };
313
- function isOrganizationProbe(value) {
314
- return typeof value === "object" && value !== null;
315
- }
316
- function pickUser(raw) {
317
- const user = raw.user;
318
- if (user == null || typeof user !== "object") return null;
319
- const u = user;
320
- return {
321
- id: typeof u.id === "string" ? u.id : void 0,
322
- name: typeof u.name === "string" ? u.name : void 0,
323
- email: typeof u.email === "string" ? u.email : void 0
324
- };
325
- }
326
-
327
- //#endregion
328
- //#region src/integration.ts
329
- const sentryAuthSchema = z.object({
330
- SENTRY_ACCESS_TOKEN: z.string().min(1),
331
- SENTRY_REGION_URL: z.string().url().optional(),
332
- SENTRY_ORG_SLUG: z.string().min(1).optional()
333
- });
334
- const sentryOfficialIntegration = {
335
- id: "sentry",
336
- name: "Sentry",
337
- description: "Sentry — issue lifecycle, release tracking, alerts, monitors, replays, feedback, and integration-platform webhook triggers",
338
- auth: sentryAuthSchema,
339
- proxy: { hosts: [
340
- "sentry.io",
341
- "us.sentry.io",
342
- "de.sentry.io"
343
- ] },
344
- connections: [{
345
- id: "oauth",
346
- ...sentryOAuthConnection
347
- }]
348
- };
349
- const sentryBundle = defineOfficialIntegration({
350
- ...sentryOfficialIntegration,
351
- internal: { providerApp: sentryAppCredentialSet }
352
- });
353
- const sentry = sentryBundle.credentialSet;
354
-
355
- //#endregion
356
- export { sentryOfficialProviderSeed as a, sentryAppCredentialSet as i, sentryBundle as n, createOfficialOperationFactory as o, sentryOfficialIntegration as r, sentry as t };