@sentry/junior-github 0.302.0 → 0.304.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 (93) hide show
  1. package/dist/events-DGd7UVVs.js +2452 -0
  2. package/dist/index.d.ts +71 -3
  3. package/dist/index.js +7193 -8134
  4. package/dist/testing.d.ts +51 -1
  5. package/dist/testing.js +1 -6
  6. package/package.json +10 -13
  7. package/dist/account-links.d.ts +0 -8
  8. package/dist/annotations.d.ts +0 -33
  9. package/dist/chunk-6SOJ5TN6.js +0 -2618
  10. package/dist/clone-command.d.ts +0 -7
  11. package/dist/configured-repository.d.ts +0 -10
  12. package/dist/conversation-title-context.d.ts +0 -20
  13. package/dist/credential-support.d.ts +0 -107
  14. package/dist/db/database.d.ts +0 -5
  15. package/dist/db/schema.d.ts +0 -1412
  16. package/dist/default-branch.d.ts +0 -15
  17. package/dist/draft-readiness.d.ts +0 -31
  18. package/dist/egress-policy.d.ts +0 -25
  19. package/dist/events/comment.d.ts +0 -14
  20. package/dist/events/declarations.d.ts +0 -18
  21. package/dist/events/deployment.d.ts +0 -38
  22. package/dist/events/issue.d.ts +0 -42
  23. package/dist/events/pull-request.d.ts +0 -75
  24. package/dist/events/release.d.ts +0 -42
  25. package/dist/events/repository.d.ts +0 -23
  26. package/dist/events/resource-url.d.ts +0 -5
  27. package/dist/events/scope.d.ts +0 -13
  28. package/dist/git-config.d.ts +0 -52
  29. package/dist/github-status.d.ts +0 -16
  30. package/dist/graphql-documents.d.ts +0 -44
  31. package/dist/hooks-path-command.d.ts +0 -5
  32. package/dist/images.d.ts +0 -8
  33. package/dist/issue-outcomes/store.d.ts +0 -42
  34. package/dist/merge-conflict-checks/heartbeat.d.ts +0 -31
  35. package/dist/merge-conflict-checks/policy.d.ts +0 -74
  36. package/dist/merge-conflict-checks/store.d.ts +0 -44
  37. package/dist/merge-conflict-checks/webhooks.d.ts +0 -23
  38. package/dist/object-facts.d.ts +0 -29
  39. package/dist/permissions.d.ts +0 -6
  40. package/dist/plugin.d.ts +0 -45
  41. package/dist/pull-request-outcomes/apply.d.ts +0 -22
  42. package/dist/pull-request-outcomes/commit-composition.d.ts +0 -6
  43. package/dist/pull-request-outcomes/reconcile.d.ts +0 -42
  44. package/dist/pull-request-outcomes/store.d.ts +0 -120
  45. package/dist/pull-request-requesters/draft-reviewers.d.ts +0 -15
  46. package/dist/pull-request-requesters/store.d.ts +0 -41
  47. package/dist/pull-request-review-policy.d.ts +0 -6
  48. package/dist/receive-pack-policy.d.ts +0 -21
  49. package/dist/reply-markdown.d.ts +0 -18
  50. package/dist/sandbox-paths.d.ts +0 -4
  51. package/dist/tool-support/attribution.d.ts +0 -52
  52. package/dist/tool-support/github-api.d.ts +0 -51
  53. package/dist/tool-support/github-text.d.ts +0 -8
  54. package/dist/tool-support/pull-request-description.d.ts +0 -8
  55. package/dist/tools/clone-repository.d.ts +0 -287
  56. package/dist/tools/comment-on-issue.d.ts +0 -289
  57. package/dist/tools/comment-on-pull-request.d.ts +0 -294
  58. package/dist/tools/create-issue.d.ts +0 -300
  59. package/dist/tools/create-pull-request.d.ts +0 -322
  60. package/dist/tools/footer.d.ts +0 -17
  61. package/dist/tools/get-deployment.d.ts +0 -346
  62. package/dist/tools/get-issue.d.ts +0 -330
  63. package/dist/tools/get-pull-request.d.ts +0 -358
  64. package/dist/tools/get-release.d.ts +0 -325
  65. package/dist/tools/get-repository.d.ts +0 -308
  66. package/dist/tools/get-status.d.ts +0 -295
  67. package/dist/tools/react-to-issue.d.ts +0 -289
  68. package/dist/tools/resolve-pull-request-review-thread.d.ts +0 -288
  69. package/dist/tools/stack-pull-request.d.ts +0 -43
  70. package/dist/tools/submit-pull-request-review.d.ts +0 -300
  71. package/dist/tools/update-issue-comment.d.ts +0 -290
  72. package/dist/tools/update-issue.d.ts +0 -331
  73. package/dist/tools/update-pull-request-feedback.d.ts +0 -324
  74. package/dist/tools/update-pull-request.d.ts +0 -338
  75. package/dist/tools.d.ts +0 -13
  76. package/dist/webhooks/check-suite.d.ts +0 -121
  77. package/dist/webhooks/event-targets.d.ts +0 -44
  78. package/dist/webhooks/events.d.ts +0 -23
  79. package/dist/webhooks/fail-open-log.d.ts +0 -10
  80. package/dist/webhooks/handler.d.ts +0 -57
  81. package/dist/webhooks/installation-requests.d.ts +0 -105
  82. package/dist/webhooks/issue-outcome.d.ts +0 -11
  83. package/dist/webhooks/issue-update.d.ts +0 -8
  84. package/dist/webhooks/merge-conflict.d.ts +0 -53
  85. package/dist/webhooks/ownership.d.ts +0 -14
  86. package/dist/webhooks/pull-request-action.d.ts +0 -37
  87. package/dist/webhooks/pull-request-activity.d.ts +0 -11
  88. package/dist/webhooks/pull-request-match-data.d.ts +0 -31
  89. package/dist/webhooks/pull-request-outcome.d.ts +0 -16
  90. package/dist/webhooks/pull-request-people.d.ts +0 -51
  91. package/dist/webhooks/pull-request-preview.d.ts +0 -12
  92. package/dist/webhooks/pull-request-ready-reviewers.d.ts +0 -25
  93. package/dist/workspace-prepare.d.ts +0 -3
@@ -1,121 +0,0 @@
1
- /**
2
- * GitHub check suite events.
3
- */
4
- import type { EventInput, EventPublisher, PluginLogger } from "@sentry/junior-plugin-api";
5
- import type { GitHubStatusIncident } from "../github-status.js";
6
- type CheckSuiteEventType = "pull_request.checks.failed" | "pull_request.checks.passed" | "pull_request.checks.recovered";
7
- export type GitHubFailingCheck = {
8
- checkRunId: number;
9
- conclusion: string;
10
- htmlUrl?: string;
11
- name: string;
12
- };
13
- /** Pull request values filled in when a match filter needs them. */
14
- export type GitHubCheckSuitePullRequestFacts = {
15
- openerEmail?: string;
16
- openerUsername?: string;
17
- isDraft?: boolean;
18
- };
19
- /** Optional values for one check suite event. */
20
- export type GitHubCheckSuiteFacts = {
21
- failingChecks?: GitHubFailingCheck[];
22
- /** Open or recent githubstatus.com incidents when the suite failed. */
23
- githubIncidents?: GitHubStatusIncident[];
24
- /**
25
- * True when this suite passed and every other check suite on its head
26
- * commit passed too. Set only when something listens for
27
- * `pull_request.checks.passed`.
28
- */
29
- allCheckSuitesPassed?: boolean;
30
- /** Pull request values by number when a match filter needs them. */
31
- pullRequestFactsByNumber?: Record<number, GitHubCheckSuitePullRequestFacts>;
32
- };
33
- /** Build a browser URL for one check suite. GitHub does not send html_url. */
34
- export declare function buildCheckSuiteUrl(args: {
35
- checkSuiteId: number;
36
- headSha: string;
37
- repo: string;
38
- }): string;
39
- /** Build the trusted data and summary for one check-suite event. */
40
- export declare function buildCheckSuiteEvent(args: {
41
- appName?: string;
42
- openerEmail?: string;
43
- openerUsername?: string;
44
- checkSuiteId?: number;
45
- deliveryId: string;
46
- eventType: CheckSuiteEventType;
47
- failingChecks?: GitHubFailingCheck[];
48
- githubIncidents?: GitHubStatusIncident[];
49
- headBranch?: string;
50
- headSha?: string;
51
- isDraft?: boolean;
52
- latestCheckRunsCount?: number;
53
- /** Pull request number when GitHub attached one. */
54
- pullRequestNumber?: number;
55
- repo: string;
56
- suiteConclusion: string;
57
- }): EventInput;
58
- /** Keep only failed check runs from one suite. */
59
- export declare function selectFailingChecks(checkRuns: unknown, options?: {
60
- checkSuiteId?: number;
61
- }): GitHubFailingCheck[];
62
- /** Normalize a completed check suite for attached PRs, or the repository alone. */
63
- export declare function normalizeCheckSuiteEvents(deliveryId: string, body: unknown, options?: GitHubCheckSuiteFacts): EventInput[];
64
- /** The same-repository pull requests of one completed check suite. */
65
- export declare function checkSuitePullRequests(body: unknown): Array<{
66
- number: number;
67
- repositoryFullName: string;
68
- }>;
69
- /** Identifiers and event types one completed check suite may publish. */
70
- export declare function parseCheckSuitePublishTargets(body: unknown): {
71
- data: {
72
- repo: string;
73
- };
74
- eventTypes: string[];
75
- identifiers: string[];
76
- } | undefined;
77
- /**
78
- * True when a Watch or event automation may want `pull_request.checks.passed`
79
- * for this check suite, so the webhook reads the other suites on the commit
80
- * only then. A filter on a value that loads later counts as a match, so the
81
- * check never drops an Event that someone wants.
82
- */
83
- export declare function wantsCheckSuitePassed(args: {
84
- body: unknown;
85
- deliveryId: string;
86
- hasMatch: EventPublisher["hasMatch"];
87
- neededMatchKeys: EventPublisher["neededMatchKeys"];
88
- }): Promise<boolean>;
89
- /** Read which check suite values still need a GitHub API load. */
90
- export declare function parseCheckSuiteFactsTarget(body: unknown, options?: {
91
- loadCheckSuites?: boolean;
92
- loadPullRequestFacts?: boolean;
93
- }): {
94
- checkSuiteId: number;
95
- headSha: string;
96
- loadCheckSuites: boolean;
97
- loadFailingChecks: boolean;
98
- loadPullRequestFacts: boolean;
99
- owner: string;
100
- pullRequestNumbers: number[];
101
- repoName: string;
102
- } | undefined;
103
- /** True when active match filters need pull request fields from the API. */
104
- export declare function needsCheckSuitePullRequestFacts(matchKeys: Iterable<string>): boolean;
105
- /**
106
- * Load failed check runs, whether every check suite on the commit passed,
107
- * and optional pull request match fields.
108
- */
109
- export declare function loadCheckSuiteFacts(args: {
110
- appIdEnv: string;
111
- body: unknown;
112
- installationIdEnv: string;
113
- /** Read the other suites on the commit for `pull_request.checks.passed`. */
114
- loadCheckSuites?: boolean;
115
- /** Open or recent githubstatus.com incidents, shared through a cache. */
116
- loadGitHubIncidents?(): Promise<GitHubStatusIncident[]>;
117
- loadPullRequestFacts?: boolean;
118
- log?: Pick<PluginLogger, "error" | "warn">;
119
- privateKeyEnv: string;
120
- }): Promise<GitHubCheckSuiteFacts | undefined>;
121
- export {};
@@ -1,44 +0,0 @@
1
- /**
2
- * Event data, event key, and target helpers shared by the GitHub webhook
3
- * normalizers.
4
- */
5
- import type { EventInput } from "@sentry/junior-plugin-api";
6
- import * as z from "zod";
7
- /**
8
- * The user who sent a webhook. GitHub authenticates this user, so on a comment
9
- * or review it is the author, and on an issue update it made the change.
10
- * Match on the numeric id; logins can be renamed and reused.
11
- */
12
- export declare const gitHubSenderSchema: z.ZodObject<{
13
- id: z.ZodNumber;
14
- login: z.ZodString;
15
- }, z.core.$strip>;
16
- /** Trusted event data that names who sent a webhook. */
17
- export declare function gitHubSenderData(sender: z.output<typeof gitHubSenderSchema> | undefined): {
18
- senderId?: number;
19
- senderLogin?: string;
20
- };
21
- /** The GitHub user who did what an Event describes, when GitHub names one. */
22
- export declare function gitHubDoneBy(login: string | undefined): Pick<EventInput, "doneBy"> | undefined;
23
- /** The text of a webhook value, or undefined when it is missing or blank. */
24
- export declare function nonBlank(value: string | null | undefined): string | undefined;
25
- /** The title and body of an issue or pull request, as untrusted text. */
26
- export declare function titleAndBodyText(item: {
27
- body?: string | null;
28
- title?: string;
29
- }): string | undefined;
30
- /** Convert an optional provider timestamp for receipt-time fallback ordering. */
31
- export declare function providerTime(value: string | null | undefined): number | undefined;
32
- /**
33
- * Drop missing values from event data. A filter on a value that GitHub did not
34
- * send then does not match.
35
- */
36
- export declare function definedValues(data: Record<string, unknown>): Record<string, unknown>;
37
- /** Build the event key for one event type from one webhook delivery. */
38
- export declare function gitHubEventKey(deliveryId: string, eventType: string): string;
39
- /**
40
- * Address a pull request event through both the pull request and its
41
- * repository. Only the pull request copy keeps `terminal`, so a terminal
42
- * event never completes a repository Watch.
43
- */
44
- export declare function pullRequestTargets(event: EventInput, repo: string): EventInput[];
@@ -1,23 +0,0 @@
1
- import type { EventInput } from "@sentry/junior-plugin-api";
2
- import { type GitHubCheckSuiteFacts } from "./check-suite.js";
3
- export type { GitHubCheckSuiteFacts, GitHubCheckSuitePullRequestFacts, GitHubFailingCheck, } from "./check-suite.js";
4
- export { buildCheckSuiteEvent, buildCheckSuiteUrl, loadCheckSuiteFacts, needsCheckSuitePullRequestFacts, parseCheckSuiteFactsTarget, parseCheckSuitePublishTargets, selectFailingChecks, } from "./check-suite.js";
5
- /**
6
- * Build the merged or closed_unmerged events of one closed pull request.
7
- * The webhook and the daily reconcile both publish them. The key names the
8
- * close, not the webhook delivery, so a Watch gets the close once.
9
- */
10
- export declare function gitHubPullRequestTerminalEvents(body: unknown): EventInput[];
11
- /**
12
- * Normalize one verified GitHub delivery into conversation events.
13
- *
14
- * Comments and reviews written by the configured bot are dropped, so Junior
15
- * does not react to or act on its own feedback.
16
- */
17
- export declare function normalizeGitHubEvents(args: {
18
- body: unknown;
19
- botEmail?: string;
20
- checkSuiteFacts?: GitHubCheckSuiteFacts;
21
- deliveryId: string;
22
- eventName: string;
23
- }): EventInput[];
@@ -1,10 +0,0 @@
1
- /**
2
- * Logging for optional webhook work that fails open.
3
- */
4
- import type { PluginLogger } from "@sentry/junior-plugin-api";
5
- /**
6
- * Log a failure of optional webhook work. A GitHub 5xx is a GitHub outage,
7
- * not a Junior bug, so it is a warning with the HTTP status. Other failures
8
- * stay errors.
9
- */
10
- export declare function logFailOpenFailure(log: Pick<PluginLogger, "error" | "warn"> | undefined, message: string, error: unknown, metadata: Record<string, unknown>): void;
@@ -1,57 +0,0 @@
1
- import type { GitHubStatusIncident } from "../github-status.js";
2
- import type { CodeChangePublisher, PluginConversationAnnotations, PluginConversationReviewItems, PluginLogger, PluginRoute, EventPublisher, PluginState } from "@sentry/junior-plugin-api";
3
- import * as z from "zod";
4
- import type { GitHubDb } from "../db/database.js";
5
- import type { GitHubPullRequestCommitComposition } from "../db/schema.js";
6
- import { type GitHubPullRequestRef } from "./merge-conflict.js";
7
- import { type GitHubRoleTarget } from "./pull-request-match-data.js";
8
- import { type GitHubCommitPageLoader, type GitHubPullRequestTarget } from "./pull-request-people.js";
9
- /** The pull request comment data that the feedback reaction needs. */
10
- declare const feedbackTargetSchema: z.ZodObject<{
11
- commentId: z.ZodNumber;
12
- commentKind: z.ZodEnum<{
13
- conversation: "conversation";
14
- review: "review";
15
- review_body: "review_body";
16
- }>;
17
- pullRequest: z.ZodNumber;
18
- repo: z.ZodString;
19
- }, z.core.$strip>;
20
- type FeedbackTarget = z.output<typeof feedbackTargetSchema>;
21
- /** Create the public, signed GitHub webhook route owned by the plugin. */
22
- export declare function createGitHubWebhookRoute(args: {
23
- annotations: PluginConversationAnnotations;
24
- appIdEnv: string;
25
- botEmail(): string | undefined;
26
- classifyPullRequestCommits?(input: {
27
- number: number;
28
- repositoryFullName: string;
29
- }): Promise<GitHubPullRequestCommitComposition | undefined>;
30
- codeChanges: CodeChangePublisher;
31
- db: GitHubDb;
32
- installationId(): string | undefined;
33
- installationIdEnv: string;
34
- /**
35
- * Read a pull request's commits for the `authors` field and the people
36
- * involved.
37
- */
38
- loadPullRequestCommitPages?(target: GitHubPullRequestTarget): Promise<GitHubCommitPageLoader>;
39
- /** Read open and recent GitHub incidents for failed check suites. */
40
- loadGitHubIncidents?(): Promise<GitHubStatusIncident[]>;
41
- /** Read one pull request for its mergeability. */
42
- loadPullRequest?(pullRequest: GitHubPullRequestRef): Promise<unknown>;
43
- /** Read one pull request's history for the merge conflict policy. */
44
- loadPullRequestConflictHistory?(pullRequest: GitHubPullRequestRef): Promise<unknown>;
45
- /** Load a repository role for `openerRole`. */
46
- loadRepositoryRole?(target: GitHubRoleTarget): Promise<string>;
47
- /** Linked GitHub login of the user of one Junior identity, if any. */
48
- loadGitHubLogin?(identityId: string): Promise<string | undefined>;
49
- log?: Pick<PluginLogger, "error" | "warn">;
50
- markFeedbackReviewing(input: FeedbackTarget): Promise<void>;
51
- privateKeyEnv: string;
52
- events: EventPublisher;
53
- reviewItems: PluginConversationReviewItems;
54
- state: PluginState;
55
- webhookSecret(): string | undefined;
56
- }): PluginRoute;
57
- export {};
@@ -1,105 +0,0 @@
1
- /**
2
- * GitHub requests that webhook handling makes with installation tokens.
3
- *
4
- * A webhook delivery has no Turn and no egress context, so these requests
5
- * call GitHub directly. Other plugin code must use host egress.
6
- */
7
- import type { PluginCache } from "@sentry/junior-plugin-api";
8
- /** Environment variable names for the GitHub App installation. */
9
- export interface GitHubInstallationEnv {
10
- appIdEnv: string;
11
- installationIdEnv: string;
12
- privateKeyEnv: string;
13
- }
14
- /** Return a reader for pages of a pull request's commits, with a read-only token. */
15
- export declare function loadPullRequestCommitPages(env: GitHubInstallationEnv, pullRequest: {
16
- number: number;
17
- repositoryFullName: string;
18
- }): Promise<(page: number, perPage: number) => Promise<unknown>>;
19
- /** Read one pull request, with a read-only token. */
20
- export declare function loadPullRequest(env: GitHubInstallationEnv, pullRequest: {
21
- number: number;
22
- repositoryFullName: string;
23
- }): Promise<unknown>;
24
- /** GitHub cannot reach a repository: it is gone, or the installation lost it. */
25
- export declare class GitHubRepositoryUnreachableError extends Error {
26
- constructor(repositoryId: number);
27
- }
28
- /**
29
- * Read the lifecycle of some pull requests of one repository in one GraphQL
30
- * query, with a read-only token. Each pull request has the alias `pr<index>`.
31
- * The repository is found by its id, because a rename changes its name.
32
- */
33
- export declare function loadPullRequestLifecycles(env: GitHubInstallationEnv, input: {
34
- numbers: number[];
35
- repositoryId: number;
36
- }): Promise<unknown>;
37
- /**
38
- * Read one page of a repository's open pull requests by one author, with
39
- * their mergeability, through GraphQL search and a read-only token.
40
- */
41
- export declare function searchOpenPullRequestMergeability(env: GitHubInstallationEnv, input: {
42
- after?: string;
43
- author: string;
44
- repositoryFullName: string;
45
- }): Promise<unknown>;
46
- /** Read the merge conflict history of one pull request, with a read-only token. */
47
- export declare function loadPullRequestConflictHistory(env: GitHubInstallationEnv, pullRequest: {
48
- number: number;
49
- repositoryFullName: string;
50
- }): Promise<unknown>;
51
- /** Ask people to review one pull request, with a pull request write token. */
52
- export declare function requestPullRequestReviewers(env: GitHubInstallationEnv, input: {
53
- number: number;
54
- repositoryFullName: string;
55
- reviewers: string[];
56
- }): Promise<void>;
57
- /** Add the "reviewing" reaction to one pull request comment or review body. */
58
- export declare function markPullRequestFeedbackReviewing(env: GitHubInstallationEnv, target: {
59
- commentId: number;
60
- commentKind: "conversation" | "review" | "review_body";
61
- pullRequest: number;
62
- repo: string;
63
- }): Promise<void>;
64
- /**
65
- * Read one user's role on a repository, with a metadata-only token. GitHub
66
- * returns "none" for accounts without access, such as most bots. Roles are
67
- * cached for ten minutes.
68
- */
69
- export declare function loadRepositoryRole(env: GitHubInstallationEnv, cache: PluginCache, target: {
70
- login: string;
71
- repositoryFullName: string;
72
- }): Promise<string>;
73
- /** The pull request facts that decide its next action. */
74
- export interface GitHubPullRequestMergeState {
75
- /**
76
- * At least one approval, and no reviewer still requests changes. Read
77
- * only when GitHub says the pull request can merge cleanly.
78
- */
79
- approved: boolean;
80
- /** A person turned on auto-merge, so GitHub merges it without them. */
81
- autoMerge: boolean;
82
- draft: boolean;
83
- /**
84
- * GitHub's `mergeable_state`, such as `clean` or `blocked`. `clean` means
85
- * that the required reviews and every check and status passed, and there
86
- * are no conflicts. Undefined when GitHub has not computed it yet.
87
- */
88
- mergeableState?: string;
89
- /** Logins of the people whose review GitHub still requests. */
90
- requestedReviewers: string[];
91
- state: "closed" | "merged" | "open";
92
- title: string;
93
- url: string;
94
- }
95
- /**
96
- * Read whether a pull request is ready to merge, with a read-only token.
97
- * GitHub computes `mergeable_state` after a change, so an unknown state is
98
- * read once more. Reviews load only for an open pull request that is not a
99
- * draft, has no auto-merge, and can merge cleanly. Each reviewer counts by their latest
100
- * approval, change request, or dismissal. Comments do not change the result.
101
- */
102
- export declare function loadPullRequestMergeState(env: GitHubInstallationEnv, pullRequest: {
103
- number: number;
104
- repositoryFullName: string;
105
- }): Promise<GitHubPullRequestMergeState>;
@@ -1,11 +0,0 @@
1
- import type { GitHubIssueConversationsInput, GitHubIssueOutcomeInput } from "../issue-outcomes/store.js";
2
- /** Normalize only the fields required for the Junior-owned issue projection. */
3
- export declare function normalizeGitHubIssueOutcome(args: {
4
- body: unknown;
5
- botEmail?: string;
6
- }): GitHubIssueOutcomeInput | undefined;
7
- /** Normalize native conversation ids written to a Junior-owned issue by its bot. */
8
- export declare function normalizeGitHubIssueConversations(args: {
9
- body: unknown;
10
- botEmail?: string;
11
- }): GitHubIssueConversationsInput | undefined;
@@ -1,8 +0,0 @@
1
- import type { EventInput } from "@sentry/junior-plugin-api";
2
- /**
3
- * Normalize an issue edit, label, assignee, or milestone change into
4
- * `issue.updated` for the issue and its repository. Return undefined when the
5
- * delivery is not one of these updates. Changes that the bot makes publish
6
- * nothing, so Junior's own issue updates do not wake its Watches.
7
- */
8
- export declare function normalizeIssueUpdateEvents(deliveryId: string, body: unknown, botEmail: string | undefined): EventInput[] | undefined;
@@ -1,53 +0,0 @@
1
- /**
2
- * Merge conflict checks on pull request webhook events.
3
- *
4
- * GitHub sends no webhook when a pull request gets a conflict, and a
5
- * conflicted pull request gets no new checks. So when a webhook delivers
6
- * another event for a watched pull request, such as a comment, a review, or a
7
- * check result, the webhook also reads its mergeability and publishes
8
- * `pull_request.merge_conflict`. A push to the default branch also starts a
9
- * check of the repository's open Junior pull requests. See
10
- * `merge-conflict-checks/`.
11
- */
12
- import type { EventInput, EventPublisher, PluginConversationReviewItems, PluginLogger } from "@sentry/junior-plugin-api";
13
- import type { GitHubDb } from "../db/database.js";
14
- /** Values that GitHub reports for a conflicted pull request. */
15
- export interface GitHubMergeConflict {
16
- baseBranch: string;
17
- headSha: string;
18
- url?: string;
19
- }
20
- /** One pull request in one repository. */
21
- export interface GitHubPullRequestRef {
22
- number: number;
23
- repositoryFullName: string;
24
- }
25
- /**
26
- * Build the `pull_request.merge_conflict` copies for one pull request. With
27
- * no conflict, the copies have only the values that filters can match. The
28
- * event key names the head commit, so each head commit publishes once.
29
- */
30
- export declare function gitHubMergeConflictEvents(input: GitHubPullRequestRef & {
31
- conflict?: GitHubMergeConflict;
32
- }): EventInput[];
33
- /**
34
- * Return `pull_request.merge_conflict` events for the open pull requests that
35
- * these events are about, when a Watch or event automation wants them and
36
- * GitHub reports a conflict. A `pull_request` webhook payload gives the
37
- * mergeability when GitHub knows it. Otherwise the check reads the pull
38
- * request, which also makes GitHub calculate its mergeability. When GitHub
39
- * does not know it yet, a later event reads it again. The policy in
40
- * `merge-conflict-checks/policy.ts` decides if a conflict publishes.
41
- */
42
- export declare function loadGitHubMergeConflictEvents(args: {
43
- db: GitHubDb;
44
- deliveryId: string;
45
- events: EventInput[];
46
- hasMatch: EventPublisher["hasMatch"];
47
- loadPullRequest?(ref: GitHubPullRequestRef): Promise<unknown>;
48
- loadConflictHistory?(ref: GitHubPullRequestRef): Promise<unknown>;
49
- log?: Pick<PluginLogger, "error" | "warn">;
50
- /** The body of a `pull_request` webhook. */
51
- pullRequestPayload?: unknown;
52
- reviewItems: PluginConversationReviewItems;
53
- }): Promise<EventInput[]>;
@@ -1,14 +0,0 @@
1
- /** Derive the provider login encoded in a standard GitHub noreply address. */
2
- export declare function botLoginFromEmail(value: string | undefined): string | undefined;
3
- /** Check whether a GitHub login is the bot encoded in the configured bot email. */
4
- export declare function isBotLogin(login: string | null | undefined, botEmail: string | undefined): boolean;
5
- /** Derive the GitHub user id encoded in a standard GitHub noreply address. */
6
- export declare function botUserIdFromEmail(value: string | undefined): number | undefined;
7
- /**
8
- * Check whether the author's own text mentions the bot encoded in the
9
- * configured bot email. GitHub sends mentions only as comment text, with no
10
- * structured field, so this reads the App slug: the bot login without `[bot]`.
11
- * This shows only that the comment addresses the bot. It does not grant trust;
12
- * match the commenter's `senderId` for that.
13
- */
14
- export declare function mentionsBotLogin(text: string, botEmail: string | undefined): boolean;
@@ -1,37 +0,0 @@
1
- /**
2
- * The next action of a Junior pull request for its requester, and its one
3
- * item on the review desk.
4
- *
5
- * The action derives from GitHub state. It is "merge" when the pull request
6
- * is open, not a draft, approved, auto-merge is off, and GitHub's merge state
7
- * is `clean`. Otherwise it is "review" when GitHub still asks the requester
8
- * for a review. The requester takes one of them, not both, so one item per
9
- * pull request shows the action. Each webhook that can change one of these
10
- * facts reads them again from GitHub. Junior saves the derived action and
11
- * changes the item only when the action changes.
12
- *
13
- * The item goes to the Conversation where a person asked Junior to open the
14
- * pull request. It is assigned to that person only when they are in that
15
- * Conversation, and it waits on them. Junior maps a GitHub login to a person
16
- * only through the requester's linked GitHub account.
17
- */
18
- import type { PluginConversationReviewItems, PluginLogger } from "@sentry/junior-plugin-api";
19
- import type { GitHubDb } from "../db/database.js";
20
- import { type GitHubInstallationEnv } from "./installation-requests.js";
21
- import type { GitHubPullRequestTarget } from "./pull-request-people.js";
22
- /** Return the pull requests whose next action one webhook delivery can change. */
23
- export declare function pullRequestActionTargets(eventName: string, body: unknown): GitHubPullRequestTarget[];
24
- /**
25
- * Add, change, or close the next-action item of each Junior pull request that
26
- * a webhook delivery can change. The item is optional, so a failure is logged
27
- * and does not fail the delivery.
28
- */
29
- export declare function syncGitHubPullRequestActions(args: {
30
- db: GitHubDb;
31
- deliveryId: string;
32
- env: GitHubInstallationEnv;
33
- loadGitHubLogin?(identityId: string): Promise<string | undefined>;
34
- log?: Pick<PluginLogger, "error" | "warn">;
35
- reviewItems: PluginConversationReviewItems;
36
- targets: GitHubPullRequestTarget[];
37
- }): Promise<void>;
@@ -1,11 +0,0 @@
1
- /** One push, review, or comment by a person on a pull request. */
2
- export interface GitHubPullRequestActivity {
3
- at: Date;
4
- number: number;
5
- repositoryProviderId: string;
6
- }
7
- /** Read a person's pull request activity from a webhook, if it has any. */
8
- export declare function normalizeGitHubPullRequestActivity(input: {
9
- body: unknown;
10
- eventName: string;
11
- }): GitHubPullRequestActivity | undefined;
@@ -1,31 +0,0 @@
1
- import type { EventInput, EventPublisher, PluginLogger } from "@sentry/junior-plugin-api";
2
- import type { GitHubDb } from "../db/database.js";
3
- import type { GitHubPullRequestTarget } from "./pull-request-people.js";
4
- /** The login whose repository role a lookup reads. */
5
- export interface GitHubRoleTarget {
6
- login: string;
7
- repositoryFullName: string;
8
- }
9
- /**
10
- * Add who opened and who wrote each pull request to its events.
11
- * `openerUsername` is the GitHub user who opened it, or on Junior's pull
12
- * requests the person who asked Junior to open it. `openerRole` is that
13
- * person's repository role. `authors` lists the commit authors and
14
- * `Co-authored-by` people. These values need database or GitHub calls. They
15
- * load first when a Watch or event automation filters on them, and the rest
16
- * load only when an event matches, so the agent sees them all.
17
- */
18
- export declare function withGitHubPullRequestMatchData(args: {
19
- body: unknown;
20
- botEmail: string | undefined;
21
- db: GitHubDb;
22
- deliveryId: string;
23
- events: EventInput[];
24
- hasMatch: EventPublisher["hasMatch"];
25
- loadAuthors?(target: GitHubPullRequestTarget): Promise<string[]>;
26
- /** Linked GitHub login of the user of one Junior identity, if any. */
27
- loadGitHubLogin?(identityId: string): Promise<string | undefined>;
28
- loadRole?(target: GitHubRoleTarget): Promise<string>;
29
- log?: Pick<PluginLogger, "error">;
30
- neededMatchKeys: EventPublisher["neededMatchKeys"];
31
- }): Promise<EventInput[]>;
@@ -1,16 +0,0 @@
1
- import type { GitHubPullRequestConversationsInput, GitHubPullRequestLinkedIssuesInput, GitHubPullRequestOutcomeInput } from "../pull-request-outcomes/store.js";
2
- /** Normalize only the fields required for the Junior-owned PR projection. */
3
- export declare function normalizeGitHubPullRequestOutcome(args: {
4
- body: unknown;
5
- botEmail?: string;
6
- }): GitHubPullRequestOutcomeInput | undefined;
7
- /** Normalize native conversation ids written to a Junior-owned PR by its bot. */
8
- export declare function normalizeGitHubPullRequestConversations(args: {
9
- body: unknown;
10
- botEmail?: string;
11
- }): GitHubPullRequestConversationsInput | undefined;
12
- /** Normalize linked issues written into a Junior-owned PR body by its bot. */
13
- export declare function normalizeGitHubPullRequestLinkedIssues(args: {
14
- body: unknown;
15
- botEmail?: string;
16
- }): GitHubPullRequestLinkedIssuesInput | undefined;
@@ -1,51 +0,0 @@
1
- import type { EventInput, EventPerson, EventPublisher, PluginLogger } from "@sentry/junior-plugin-api";
2
- /** One pull request in a repository. */
3
- export interface GitHubPullRequestTarget {
4
- number: number;
5
- repositoryFullName: string;
6
- }
7
- /** The pull request that a people lookup reads. */
8
- export interface GitHubPullRequestPeopleTarget extends GitHubPullRequestTarget {
9
- /** Pull request opener and assignees from the webhook. */
10
- logins: string[];
11
- }
12
- /** Loads one page of a pull request's commits from GitHub. */
13
- export type GitHubCommitPageLoader = (page: number, perPage: number) => Promise<unknown>;
14
- /**
15
- * Share commit page loads within one webhook delivery, so the `authors` field
16
- * and the people involved read each page once.
17
- */
18
- export declare function shareCommitPages(load: (target: GitHubPullRequestTarget) => Promise<GitHubCommitPageLoader>): (target: GitHubPullRequestTarget) => GitHubCommitPageLoader;
19
- /**
20
- * Collect the people involved in a pull request: the webhook logins, commit
21
- * authors, and `Co-authored-by` trailers. Junior adds a trailer for each
22
- * person whose instructions a run accepted, so people who steer later are
23
- * included. Noreply emails become logins. `[bot]` accounts are skipped.
24
- */
25
- export declare function loadGitHubPullRequestPeople(args: {
26
- logins: readonly string[];
27
- loadPage: GitHubCommitPageLoader;
28
- }): Promise<EventPerson[]>;
29
- /**
30
- * Collect the GitHub logins of a pull request's commit authors and
31
- * `Co-authored-by` people, for the `authors` event field. Bots stay in the
32
- * list, so Junior's own commits name `sentry-junior[bot]` and the people it
33
- * credits. A co-author without a noreply email has no known login and is
34
- * left out.
35
- */
36
- export declare function loadGitHubPullRequestAuthors(args: {
37
- loadPage: GitHubCommitPageLoader;
38
- }): Promise<string[]>;
39
- /**
40
- * Add the people involved to approval and merge events. It loads them only
41
- * when a Watch or event automation matches, so other deliveries make no extra
42
- * GitHub calls. People only add context, so a failed load keeps the events.
43
- */
44
- export declare function withGitHubPullRequestPeople(args: {
45
- body: unknown;
46
- deliveryId: string;
47
- events: EventInput[];
48
- hasMatch: EventPublisher["hasMatch"];
49
- load?(target: GitHubPullRequestPeopleTarget): Promise<EventPerson[]>;
50
- log?: Pick<PluginLogger, "error">;
51
- }): Promise<EventInput[]>;
@@ -1,12 +0,0 @@
1
- import type { PluginConversationAnnotations, PluginLogger } from "@sentry/junior-plugin-api";
2
- import type { GitHubDb } from "../db/database.js";
3
- /**
4
- * Set or clear the preview image fact on each chip of a Junior pull request
5
- * from the webhook body. One failed conversation does not stop the others.
6
- */
7
- export declare function refreshGitHubPullRequestPreview(args: {
8
- annotations: PluginConversationAnnotations;
9
- body: unknown;
10
- db: GitHubDb;
11
- log?: Pick<PluginLogger, "error">;
12
- }): Promise<void>;
@@ -1,25 +0,0 @@
1
- /**
2
- * The review request for a Junior draft pull request when it becomes ready.
3
- *
4
- * Junior asks for no review while a pull request is a draft. When GitHub
5
- * marks the draft ready for review, Junior asks the reviewers that the person
6
- * named, or else the requester's linked GitHub account.
7
- */
8
- import type { PluginLogger, PluginState } from "@sentry/junior-plugin-api";
9
- import type { GitHubDb } from "../db/database.js";
10
- import { type GitHubInstallationEnv } from "./installation-requests.js";
11
- /**
12
- * Ask for the review of a Junior pull request that GitHub marked ready for
13
- * review. The request is optional, so a failure is logged and does not fail
14
- * the delivery.
15
- */
16
- export declare function requestGitHubReviewersWhenReady(args: {
17
- body: unknown;
18
- db: GitHubDb;
19
- deliveryId: string;
20
- env: GitHubInstallationEnv;
21
- eventName: string;
22
- loadGitHubLogin?(identityId: string): Promise<string | undefined>;
23
- log?: Pick<PluginLogger, "warn">;
24
- state: PluginState;
25
- }): Promise<void>;
@@ -1,3 +0,0 @@
1
- import type { WorkspaceFinalize, WorkspacePrepareHookContext } from "@sentry/junior-plugin-api";
2
- /** Clone missing GitHub repositories or refresh existing Workspace checkouts. */
3
- export declare function prepareWorkspace(ctx: WorkspacePrepareHookContext): Promise<WorkspaceFinalize>;