(node: GQLPRNode)
| 3528 | } |
| 3529 | |
| 3530 | function transformGraphQLPRBundle(node: GQLPRNode): PRBundleData { |
| 3531 | const stateMap: Record<string, string> = { |
| 3532 | OPEN: "open", |
| 3533 | CLOSED: "closed", |
| 3534 | MERGED: "closed", |
| 3535 | }; |
| 3536 | const mergeableMap: Record<string, boolean | null> = { |
| 3537 | MERGEABLE: true, |
| 3538 | CONFLICTING: false, |
| 3539 | UNKNOWN: null, |
| 3540 | }; |
| 3541 | |
| 3542 | const pr = { |
| 3543 | number: node.number, |
| 3544 | title: node.title, |
| 3545 | body: node.body, |
| 3546 | state: stateMap[node.state] ?? "open", |
| 3547 | draft: node.isDraft ?? false, |
| 3548 | created_at: node.createdAt, |
| 3549 | merged_at: node.mergedAt ?? null, |
| 3550 | mergeable: mergeableMap[node.mergeable] ?? null, |
| 3551 | additions: node.additions ?? 0, |
| 3552 | deletions: node.deletions ?? 0, |
| 3553 | changed_files: node.changedFiles ?? 0, |
| 3554 | user: node.author |
| 3555 | ? { |
| 3556 | login: node.author.login, |
| 3557 | avatar_url: node.author.avatarUrl, |
| 3558 | type: node.author.__typename, |
| 3559 | } |
| 3560 | : null, |
| 3561 | head: { ref: node.headRefName, sha: node.headRefOid }, |
| 3562 | head_repo_owner: node.headRepository?.owner?.login ?? null, |
| 3563 | head_repo_name: node.headRepository?.name ?? null, |
| 3564 | base: { ref: node.baseRefName, sha: node.baseRefOid }, |
| 3565 | labels: (node.labels?.nodes ?? []).map((l) => ({ |
| 3566 | name: l.name, |
| 3567 | color: l.color ?? null, |
| 3568 | description: l.description ?? null, |
| 3569 | })), |
| 3570 | reactions: mapReactionGroups(node.reactionGroups), |
| 3571 | }; |
| 3572 | |
| 3573 | const issueComments = (node.comments?.nodes ?? []).map((c) => ({ |
| 3574 | id: c.databaseId, |
| 3575 | body: c.body ?? "", |
| 3576 | created_at: c.createdAt, |
| 3577 | user: c.author |
| 3578 | ? { |
| 3579 | login: c.author.login, |
| 3580 | avatar_url: c.author.avatarUrl, |
| 3581 | type: c.author.__typename, |
| 3582 | } |
| 3583 | : null, |
| 3584 | author_association: c.authorAssociation ?? "NONE", |
| 3585 | reactions: mapReactionGroups(c.reactionGroups), |
| 3586 | })); |
| 3587 |
no test coverage detected