@sentry/junior-github 0.204.0 → 0.206.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 (2) hide show
  1. package/dist/index.js +31 -18
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2309,22 +2309,27 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
2309
2309
  `GitHub review thread lookup failed with HTTP ${lookupResponse.status}: ${githubError2(lookupPayload)}`
2310
2310
  );
2311
2311
  }
2312
- const thread = z11.object({
2312
+ const threadNodeSchema = z11.object({
2313
+ id: z11.string(),
2314
+ isResolved: z11.boolean(),
2315
+ pullRequest: z11.object({
2316
+ author: z11.object({ databaseId: z11.number().optional() }).passthrough().nullable(),
2317
+ number: z11.number(),
2318
+ repository: z11.object({ nameWithOwner: z11.string() }).passthrough()
2319
+ }).passthrough()
2320
+ }).passthrough();
2321
+ const lookupResultSchema = z11.object({
2313
2322
  data: z11.object({
2314
- node: z11.object({
2315
- id: z11.string(),
2316
- isResolved: z11.boolean(),
2317
- pullRequest: z11.object({
2318
- author: z11.object({ databaseId: z11.number().optional() }).nullable(),
2319
- number: z11.number(),
2320
- repository: z11.object({ nameWithOwner: z11.string() })
2321
- })
2322
- }).nullable()
2323
- })
2324
- }).parse(lookupPayload).data.node;
2325
- if (!thread) {
2323
+ node: z11.unknown().nullable().optional()
2324
+ }).passthrough()
2325
+ }).passthrough();
2326
+ const lookupResult = lookupResultSchema.safeParse(lookupPayload);
2327
+ const rawNode = lookupResult.success ? lookupResult.data.data.node : void 0;
2328
+ const parsedNode = rawNode == null ? void 0 : threadNodeSchema.safeParse(rawNode);
2329
+ if (!parsedNode?.success) {
2326
2330
  throw new PluginToolInputError12("GitHub review thread was not found.");
2327
2331
  }
2332
+ const thread = parsedNode.data;
2328
2333
  const pullRequest = thread.pullRequest;
2329
2334
  const ownsPullRequest = pullRequest.repository.nameWithOwner.toLowerCase() === repo.ref.toLowerCase() && pullRequest.author?.databaseId === botUserId;
2330
2335
  if (!ownsPullRequest) {
@@ -2365,13 +2370,21 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
2365
2370
  `GitHub review thread resolution failed with HTTP ${resolveResponse.status}: ${githubError2(resolvePayload)}`
2366
2371
  );
2367
2372
  }
2368
- const resolved = z11.object({
2373
+ const resolveResultSchema = z11.object({
2369
2374
  data: z11.object({
2370
2375
  resolveReviewThread: z11.object({
2371
- thread: z11.object({ id: z11.string(), isResolved: z11.boolean() })
2372
- })
2373
- })
2374
- }).parse(resolvePayload).data.resolveReviewThread.thread;
2376
+ thread: z11.object({ id: z11.string(), isResolved: z11.boolean() }).passthrough()
2377
+ }).passthrough()
2378
+ }).passthrough()
2379
+ }).passthrough();
2380
+ const resolveResult = resolveResultSchema.safeParse(resolvePayload);
2381
+ if (!resolveResult.success) {
2382
+ throw new Error(
2383
+ "GitHub review thread resolution returned an unexpected response shape.",
2384
+ { cause: resolveResult.error }
2385
+ );
2386
+ }
2387
+ const resolved = resolveResult.data.data.resolveReviewThread.thread;
2375
2388
  if (resolved.id !== thread.id || !resolved.isResolved) {
2376
2389
  throw new Error("GitHub did not resolve the requested review thread.");
2377
2390
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.204.0",
3
+ "version": "0.206.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -31,7 +31,7 @@
31
31
  "@sinclair/typebox": "^0.34.49",
32
32
  "drizzle-orm": "^0.45.2",
33
33
  "zod": "^4.5.4",
34
- "@sentry/junior-plugin-api": "0.204.0"
34
+ "@sentry/junior-plugin-api": "0.206.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oxlint/plugins": "1.79.0",