@gitkraken/core-gitlens 0.41.0 → 0.43.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 (48) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/git/models/issue.d.ts +2 -0
  3. package/dist/git/models/issue.js.map +1 -1
  4. package/dist/git/models/issueOrPullRequest.d.ts +4 -0
  5. package/dist/git/models/pullRequest.d.ts +2 -0
  6. package/dist/git/models/pullRequest.js.map +1 -1
  7. package/dist/plus/git-github/api/github.d.ts +2 -4
  8. package/dist/plus/git-github/api/github.js +12 -2
  9. package/dist/plus/git-github/api/github.js.map +1 -1
  10. package/dist/plus/git-github/api/issueWrites.d.ts +3 -2
  11. package/dist/plus/git-github/api/issueWrites.js +10 -5
  12. package/dist/plus/git-github/api/issueWrites.js.map +1 -1
  13. package/dist/plus/git-github/models.js +7 -3
  14. package/dist/plus/git-github/models.js.map +1 -1
  15. package/dist/plus/integrations/index.d.ts +2 -2
  16. package/dist/plus/integrations/index.js.map +1 -1
  17. package/dist/plus/integrations/integrationService.d.ts +2 -1
  18. package/dist/plus/integrations/integrationService.js +14 -0
  19. package/dist/plus/integrations/integrationService.js.map +1 -1
  20. package/dist/plus/integrations/manager.d.ts +9 -1
  21. package/dist/plus/integrations/providers/azure/azure.js +20 -14
  22. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  23. package/dist/plus/integrations/providers/azure/models.js +7 -3
  24. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  25. package/dist/plus/integrations/providers/bitbucket/bitbucket.js +18 -13
  26. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  27. package/dist/plus/integrations/providers/bitbucket/models.js +5 -2
  28. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  29. package/dist/plus/integrations/providers/bitbucket-server/models.js +3 -1
  30. package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
  31. package/dist/plus/integrations/providers/github.d.ts +2 -4
  32. package/dist/plus/integrations/providers/github.js.map +1 -1
  33. package/dist/plus/integrations/providers/gitlab/gitlab.js +12 -6
  34. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  35. package/dist/plus/integrations/providers/gitlab/models.js +5 -2
  36. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  37. package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
  38. package/dist/plus/integrations/providers/jiraIssueByKey.js +3 -1
  39. package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
  40. package/dist/plus/integrations/providers/models.js +9 -4
  41. package/dist/plus/integrations/providers/models.js.map +1 -1
  42. package/dist/plus/integrations/providers/providerApiClient.js +10 -7
  43. package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
  44. package/dist/plus/integrations/providers/providersApi.js +3 -1
  45. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  46. package/dist/plus/integrations/reads/drains.d.ts +0 -1
  47. package/docs/integrations.md +15 -9
  48. package/package.json +2 -2
@@ -1,5 +1,6 @@
1
1
  import { Issue } from "../../../../git/models/issue.js";
2
2
  import { PullRequest } from "../../../../git/models/pullRequest.js";
3
+ import { copyReadProvenance } from "@gitkraken/provider-apis/read-provenance";
3
4
  //#region ../plus/integrations/src/providers/bitbucket/models.ts
4
5
  const parseRawBitbucketAuthorRegex = /^(.*) <(.*)>$/;
5
6
  function parseRawBitbucketAuthor(raw) {
@@ -81,16 +82,17 @@ function fromBitbucketRepository(repo) {
81
82
  };
82
83
  }
83
84
  function fromBitbucketIssue(issue, provider, projection) {
84
- return new Issue(provider, issue.id.toString(), issue.id.toString(), issue.title, issue.links.html.href, new Date(issue.created_on), new Date(issue.updated_on), isClosedBitbucketIssueState(issue.state), bitbucketIssueStateToState(issue.state), fromBitbucketUser(issue.reporter), issue.assignee ? [fromBitbucketUser(issue.assignee)] : [], fromBitbucketRepository(issue.repository), void 0, void 0, void 0, issue.votes, issue.content.html, !issue.repository?.project ? void 0 : {
85
+ const result = new Issue(provider, issue.id.toString(), issue.id.toString(), issue.title, issue.links.html.href, new Date(issue.created_on), new Date(issue.updated_on), isClosedBitbucketIssueState(issue.state), bitbucketIssueStateToState(issue.state), fromBitbucketUser(issue.reporter), issue.assignee ? [fromBitbucketUser(issue.assignee)] : [], fromBitbucketRepository(issue.repository), void 0, void 0, void 0, issue.votes, issue.content.html, !issue.repository?.project ? void 0 : {
85
86
  id: issue.repository.project.uuid,
86
87
  name: issue.repository.project.name,
87
88
  resourceId: issue.repository.project.uuid,
88
89
  resourceName: issue.repository.project.name
89
90
  }, void 0, void 0, void 0, void 0, void 0, projection);
91
+ return copyReadProvenance(result, issue);
90
92
  }
91
93
  function fromBitbucketPullRequest(pr, provider, options) {
92
94
  const author = fromBitbucketUser(pr.author);
93
- return new PullRequest(provider, author, pr.id.toString(), pr.id.toString(), pr.title, pr.links.html.href, fromBitbucketRepository(pr.destination.repository), bitbucketPullRequestStateToState(pr.state), new Date(pr.created_on), new Date(pr.updated_on), pr.closed_by ? new Date(pr.updated_on) : void 0, pr.state === "MERGED" ? new Date(pr.updated_on) : void 0, void 0, void 0, {
95
+ const result = new PullRequest(provider, author, pr.id.toString(), pr.id.toString(), pr.title, pr.links.html.href, fromBitbucketRepository(pr.destination.repository), bitbucketPullRequestStateToState(pr.state), new Date(pr.created_on), new Date(pr.updated_on), pr.closed_by ? new Date(pr.updated_on) : void 0, pr.state === "MERGED" ? new Date(pr.updated_on) : void 0, void 0, void 0, {
94
96
  base: {
95
97
  branch: pr.destination.branch.name,
96
98
  sha: pr.destination.commit.hash,
@@ -109,6 +111,7 @@ function fromBitbucketPullRequest(pr, provider, options) {
109
111
  },
110
112
  isCrossRepository: pr.source.repository.uuid !== pr.destination.repository.uuid
111
113
  }, pr.draft, void 0, void 0, void 0, void 0, getBitbucketReviewDecision(pr), pr.participants?.filter((prt) => prt.role === "REVIEWER").map((prt) => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state)).filter((rv) => rv.state === "REVIEW_REQUESTED"), pr.participants?.filter((prt) => prt.participated_on != null).map((prt) => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state)), void 0, void 0, void 0, void 0, void 0, void 0, void 0, pr.description ?? void 0, pr.id, options?.currentAccount != null ? author.id === options.currentAccount.id : void 0, options?.projection, options?.currentAccount);
114
+ return copyReadProvenance(result, pr);
112
115
  }
113
116
  /** The most pull request ids one etag read asks for: Bitbucket Cloud's largest page of pull requests. */
114
117
  const bitbucketEtagFieldsMaxIds = 50;
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/bitbucket/models.ts"],"sourcesContent":["import type { IssueProjection, IssueRepository } from '@gitlens/git/models/issue.js';\nimport { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequestState } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequestMember, PullRequestProjection, PullRequestReviewer } from '@gitlens/git/models/pullRequest.js';\nimport { PullRequest, PullRequestReviewDecision, PullRequestReviewState } from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { PullRequestEtagFields, PullRequestEtagInclude } from '../../models/integration.js';\n\nexport interface BitbucketRepositoryDescriptor extends ResourceDescriptor {\n\towner: string;\n\tname: string;\n}\n\nexport interface BitbucketWorkspaceDescriptor extends ResourceDescriptor {\n\tid: string;\n\tname: string;\n\tslug: string;\n}\n\nexport type BitbucketPullRequestState = 'OPEN' | 'DECLINED' | 'MERGED' | 'SUPERSEDED';\n\ninterface BitbucketLink {\n\thref: string;\n\tname?: string;\n}\n\n// Bitbucket's `account` schema: a person (`user`) or an app/bot (`app_user`, e.g. a review bot on a PR).\n// An `app_user` has no `links.html` and no `nickname`, and the schema requires none of the links.\ninterface BitbucketUser {\n\ttype: 'user' | 'app_user';\n\tuuid: string;\n\tdisplay_name: string;\n\taccount_id?: string;\n\tnickname?: string;\n\tlinks?: {\n\t\tself?: BitbucketLink;\n\t\tavatar?: BitbucketLink;\n\t\thtml?: BitbucketLink;\n\t};\n}\n\ninterface BitbucketWorkspace {\n\ttype: 'workspace';\n\tuuid: string;\n\tname: string;\n\tslug: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketProject {\n\ttype: 'project';\n\tkey: string;\n\tuuid: string;\n\tname: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketPullRequestParticipant {\n\ttype: 'participant';\n\tuser: BitbucketUser;\n\trole: 'PARTICIPANT' | 'REVIEWER';\n\tapproved: boolean;\n\tstate: null | 'approved' | 'changes_requested';\n\tparticipated_on: null | string;\n}\n\nexport interface BitbucketRepository {\n\ttype: 'repository';\n\tuuid: string;\n\tfull_name: string;\n\tname: string;\n\tslug: string;\n\tdescription?: string;\n\tis_private: boolean;\n\tparent: null | BitbucketRepository;\n\tscm: 'git';\n\towner: BitbucketUser;\n\tworkspace: BitbucketWorkspace;\n\tproject: BitbucketProject;\n\tcreated_on: string;\n\tupdated_on: string;\n\tsize: number;\n\tlanguage: string;\n\thas_issues: boolean;\n\thas_wiki: boolean;\n\tfork_policy: 'allow_forks' | 'no_public_forks' | 'no_forks';\n\twebsite: string;\n\tmainbranch?: BitbucketBranch;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketCommitAuthor {\n\ttype: 'author';\n\traw: string;\n\tuser: BitbucketUser;\n}\n\ntype BitbucketMergeStrategy =\n\t| 'merge_commit'\n\t| 'squash'\n\t| 'fast_forward'\n\t| 'squash_fast_forward'\n\t| 'rebase_fast_forward'\n\t| 'rebase_merge';\n\ninterface BitbucketBranch {\n\tname: string;\n\tmerge_strategies?: BitbucketMergeStrategy[];\n\tdefault_merge_strategy?: BitbucketMergeStrategy;\n}\n\n// It parses a raw author sitring like \"Sergei Shmakov GK <sergei.shmakov@gitkraken.com>\" to name and email\nconst parseRawBitbucketAuthorRegex = /^(.*) <(.*)>$/;\nexport function parseRawBitbucketAuthor(raw: string): { name: string; email: string } {\n\tconst match = raw.match(parseRawBitbucketAuthorRegex);\n\tif (match) {\n\t\treturn { name: match[1], email: match[2] };\n\t}\n\treturn { name: raw, email: '' };\n}\n\nexport interface BitbucketCommit extends BitbucketBriefCommit {\n\tauthor: BitbucketCommitAuthor;\n\tdate: string;\n\tlinks: {\n\t\tapprove: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tdiff: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tself: BitbucketLink;\n\t\tstatuses: BitbucketLink;\n\t};\n\tmessage: string;\n\tparents: BitbucketBriefCommit[];\n\tparticipants: BitbucketPullRequestParticipant[];\n\trendered: {\n\t\tmessage: string;\n\t};\n\trepository: BitbucketRepository;\n\tsummary: {\n\t\ttype: 'rendered';\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n}\n\ninterface BitbucketBriefCommit {\n\ttype: 'commit';\n\thash: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t};\n}\n\nexport type BitbucketIssueState =\n\t| 'submitted'\n\t| 'new'\n\t| 'open'\n\t| 'resolved'\n\t| 'on hold'\n\t| 'invalid'\n\t| 'duplicate'\n\t| 'wontfix'\n\t| 'closed';\n\nexport interface BitbucketPullRequest {\n\ttype: 'pullrequest';\n\tid: number;\n\ttitle: string;\n\tdescription: string;\n\tstate: BitbucketPullRequestState;\n\tdraft?: boolean;\n\tmerge_commit: null | BitbucketBriefCommit;\n\tcomment_count: number;\n\ttask_count: number;\n\tclose_source_branch: boolean;\n\tclosed_by: BitbucketUser | null;\n\tauthor: BitbucketUser;\n\treason: string;\n\tcreated_on: string;\n\tupdated_on: string;\n\tdestination: {\n\t\tbranch: BitbucketBranch;\n\t\tcommit: BitbucketBriefCommit;\n\t\trepository: BitbucketRepository;\n\t};\n\tsource: {\n\t\tbranch: BitbucketBranch;\n\t\tcommit: BitbucketBriefCommit;\n\t\trepository: BitbucketRepository;\n\t};\n\tsummary: {\n\t\ttype: 'rendered';\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n\treviewers?: BitbucketUser[];\n\tparticipants?: BitbucketPullRequestParticipant[];\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tcommits: BitbucketLink;\n\t\tapprove: BitbucketLink;\n\t\t'request-changes': BitbucketLink;\n\t\tdiff: BitbucketLink;\n\t\tdiffstat: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tactivity: BitbucketLink;\n\t\tmerge: BitbucketLink;\n\t\tdecline: BitbucketLink;\n\t\tstatuses: BitbucketLink;\n\t};\n}\n\nexport interface BitbucketIssue {\n\ttype: string;\n\tid: number;\n\ttitle: string;\n\treporter: BitbucketUser;\n\tassignee?: BitbucketUser;\n\tstate: BitbucketIssueState;\n\tcreated_on: string;\n\tupdated_on: string;\n\trepository: BitbucketRepository;\n\tvotes?: number;\n\tcontent: {\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tattachments: BitbucketLink;\n\t\twatch: BitbucketLink;\n\t\tvote: BitbucketLink;\n\t};\n}\n\nexport function bitbucketPullRequestStateToState(state: BitbucketPullRequestState): IssueOrPullRequestState {\n\tswitch (state) {\n\t\tcase 'DECLINED':\n\t\tcase 'SUPERSEDED':\n\t\t\treturn 'closed';\n\t\tcase 'MERGED':\n\t\t\treturn 'merged';\n\t\tcase 'OPEN':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\n\nexport function bitbucketIssueStateToState(state: BitbucketIssueState): IssueOrPullRequestState {\n\tswitch (state) {\n\t\tcase 'resolved':\n\t\tcase 'invalid':\n\t\tcase 'duplicate':\n\t\tcase 'wontfix':\n\t\tcase 'closed':\n\t\t\treturn 'closed';\n\t\tcase 'submitted':\n\t\tcase 'new':\n\t\tcase 'open':\n\t\tcase 'on hold':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\n\nexport function isClosedBitbucketPullRequestState(state: BitbucketPullRequestState): boolean {\n\treturn bitbucketPullRequestStateToState(state) !== 'opened';\n}\n\nexport function isClosedBitbucketIssueState(state: BitbucketIssueState): boolean {\n\treturn bitbucketIssueStateToState(state) !== 'opened';\n}\n\nexport function fromBitbucketUser(user: BitbucketUser): PullRequestMember {\n\treturn {\n\t\tavatarUrl: user.links?.avatar?.href,\n\t\tname: user.display_name,\n\t\tusername: user.nickname,\n\t\turl: user.links?.html?.href,\n\t\tid: user.uuid,\n\t};\n}\n\nexport function fromBitbucketParticipantToReviewer(\n\tprt: BitbucketPullRequestParticipant,\n\tclosedBy: BitbucketUser | null,\n\tprState: BitbucketPullRequestState,\n): PullRequestReviewer {\n\treturn {\n\t\treviewer: fromBitbucketUser(prt.user),\n\t\tstate: prt.approved\n\t\t\t? PullRequestReviewState.Approved\n\t\t\t: prt.state === 'changes_requested'\n\t\t\t\t? PullRequestReviewState.ChangesRequested\n\t\t\t\t: prt.participated_on != null\n\t\t\t\t\t? PullRequestReviewState.Commented\n\t\t\t\t\t: prt.user.uuid === closedBy?.uuid && prState === 'DECLINED'\n\t\t\t\t\t\t? PullRequestReviewState.Dismissed\n\t\t\t\t\t\t: PullRequestReviewState.ReviewRequested,\n\t};\n}\n\n/**\n * The review decision a Bitbucket Cloud row carries, derived from its participants and reviewers. Reads only the\n * participants' `participated_on`, `approved` and `state` and whether there are reviewers, which is what the cheap etag\n * read selects for it.\n */\nexport function getBitbucketReviewDecision(pr: {\n\tparticipants?: readonly Pick<BitbucketPullRequestParticipant, 'approved' | 'state' | 'participated_on'>[];\n\treviewers?: readonly unknown[];\n}): PullRequestReviewDecision | undefined {\n\tif (!pr.participants?.length && pr.reviewers?.length) {\n\t\treturn PullRequestReviewDecision.ReviewRequired;\n\t}\n\tif (!pr.participants) {\n\t\treturn undefined;\n\t}\n\n\tlet hasReviews = false;\n\tlet hasChangeRequests = false;\n\tlet hasApprovals = false;\n\tfor (const prt of pr.participants) {\n\t\tif (prt.participated_on != null) {\n\t\t\thasReviews = true;\n\t\t}\n\t\tif (prt.approved) {\n\t\t\thasApprovals = true;\n\t\t}\n\t\tif (prt.state === 'changes_requested') {\n\t\t\thasChangeRequests = true;\n\t\t}\n\t}\n\tif (hasChangeRequests) return PullRequestReviewDecision.ChangesRequested;\n\tif (hasApprovals) return PullRequestReviewDecision.Approved;\n\tif (hasReviews) return undefined; // not approved, not rejected, but reviewed\n\treturn PullRequestReviewDecision.ReviewRequired; // nobody has reviewed yet.\n}\n\nfunction fromBitbucketRepository(repo: BitbucketRepository): IssueRepository {\n\treturn {\n\t\towner: repo.full_name.split('/')[0],\n\t\trepo: repo.name,\n\t\tid: repo.uuid,\n\t};\n}\n\nexport function fromBitbucketIssue(issue: BitbucketIssue, provider: Provider, projection?: IssueProjection): Issue {\n\treturn new Issue(\n\t\tprovider,\n\t\tissue.id.toString(),\n\t\tissue.id.toString(),\n\t\tissue.title,\n\t\tissue.links.html.href,\n\t\tnew Date(issue.created_on),\n\t\tnew Date(issue.updated_on),\n\t\tisClosedBitbucketIssueState(issue.state),\n\t\tbitbucketIssueStateToState(issue.state),\n\t\tfromBitbucketUser(issue.reporter),\n\t\tissue.assignee ? [fromBitbucketUser(issue.assignee)] : [],\n\t\tfromBitbucketRepository(issue.repository),\n\t\tundefined, // closedDate\n\t\tundefined, // labels\n\t\tundefined, // commentsCount\n\t\tissue.votes, // thumbsUpCount\n\t\tissue.content.html, // body\n\t\t!issue.repository?.project\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tid: issue.repository.project.uuid,\n\t\t\t\t\tname: issue.repository.project.name,\n\t\t\t\t\tresourceId: issue.repository.project.uuid,\n\t\t\t\t\tresourceName: issue.repository.project.name,\n\t\t\t\t},\n\t\tundefined, // number\n\t\tundefined, // issueType\n\t\tundefined, // providerState\n\t\tundefined, // bodyFormat\n\t\tundefined, // iterations\n\t\tprojection,\n\t);\n}\n\nexport function fromBitbucketPullRequest(\n\tpr: BitbucketPullRequest,\n\tprovider: Provider,\n\toptions?: { currentAccount?: { id: string; username?: string }; projection?: PullRequestProjection },\n): PullRequest {\n\tconst author = fromBitbucketUser(pr.author);\n\treturn new PullRequest(\n\t\tprovider,\n\t\tauthor,\n\t\tpr.id.toString(),\n\t\tpr.id.toString(),\n\t\tpr.title,\n\t\tpr.links.html.href,\n\t\tfromBitbucketRepository(pr.destination.repository),\n\t\tbitbucketPullRequestStateToState(pr.state),\n\t\tnew Date(pr.created_on),\n\t\tnew Date(pr.updated_on),\n\t\tpr.closed_by ? new Date(pr.updated_on) : undefined,\n\t\tpr.state === 'MERGED' ? new Date(pr.updated_on) : undefined,\n\t\tundefined, // mergeableState: not read\n\t\tundefined, // viewerCanUpdate\n\t\t{\n\t\t\tbase: {\n\t\t\t\tbranch: pr.destination.branch.name,\n\t\t\t\tsha: pr.destination.commit.hash,\n\t\t\t\trepo: pr.destination.repository.name,\n\t\t\t\towner: pr.destination.repository.full_name.split('/')[0],\n\t\t\t\texists: true,\n\t\t\t\turl: pr.destination.repository.links.html.href,\n\t\t\t},\n\t\t\thead: {\n\t\t\t\tbranch: pr.source.branch.name,\n\t\t\t\tsha: pr.source.commit.hash,\n\t\t\t\trepo: pr.source.repository.name,\n\t\t\t\towner: pr.source.repository.full_name.split('/')[0],\n\t\t\t\texists: true,\n\t\t\t\turl: pr.source.repository.links.html.href,\n\t\t\t},\n\t\t\tisCrossRepository: pr.source.repository.uuid !== pr.destination.repository.uuid,\n\t\t},\n\t\tpr.draft,\n\t\tundefined, // additions\n\t\tundefined, // deletions\n\t\tundefined, // commentsCount\n\t\tundefined, // thumbsCount\n\t\tgetBitbucketReviewDecision(pr),\n\t\tpr.participants // reviewRequests:PullRequestReviewer[]\n\t\t\t?.filter(prt => prt.role === 'REVIEWER')\n\t\t\t.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state))\n\t\t\t.filter(rv => rv.state === PullRequestReviewState.ReviewRequested),\n\t\tpr.participants // latestReviews:PullRequestReviewer[]\n\t\t\t?.filter(prt => prt.participated_on != null)\n\t\t\t.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state)),\n\t\tundefined, // assignees:PullRequestMember[] -- it looks like there is no such thing as assignees on Bitbucket\n\t\tundefined, // PullRequestStatusCheckRollupState\n\t\tundefined, // IssueProject\n\t\tundefined, // version\n\t\tundefined, // commitCount\n\t\tundefined, // stack\n\t\tundefined, // filesChanged\n\t\tpr.description ?? undefined,\n\t\tpr.id,\n\t\toptions?.currentAccount != null ? author.id === options.currentAccount.id : undefined,\n\t\toptions?.projection,\n\t\toptions?.currentAccount,\n\t);\n}\n\n/** The most pull request ids one etag read asks for: Bitbucket Cloud's largest page of pull requests. */\nexport const bitbucketEtagFieldsMaxIds = 50;\n\n/**\n * A pull request as the cheap etag read selects it (`BitbucketApi.getPullRequestsEtagFields`): only the fields\n * {@link fromBitbucketPullRequest} maps into a full row's etag inputs. `participants` and `reviewers` are selected\n * only for the `reviewDecision` include.\n */\nexport interface BitbucketPullRequestEtagNode {\n\tid: number;\n\tstate: BitbucketPullRequestState;\n\tupdated_on: string;\n\tdraft?: boolean;\n\tsource: { commit: { hash: string } };\n\tparticipants?: Pick<BitbucketPullRequestParticipant, 'approved' | 'state' | 'participated_on'>[];\n\treviewers?: unknown[];\n}\n\n/**\n * A cheap etag read's pull request in the vocabulary {@link fromBitbucketPullRequest}'s row ends in, so both reads\n * compute the same etag. That row reads neither a mergeability nor a check rollup, so neither does this.\n */\nexport function toBitbucketPullRequestEtagFields(\n\tnode: BitbucketPullRequestEtagNode,\n\tetagIncludes: readonly PullRequestEtagInclude[],\n): PullRequestEtagFields {\n\tconst fields: PullRequestEtagFields = {\n\t\tstate: bitbucketPullRequestStateToState(node.state),\n\t\tisDraft: node.draft,\n\t\tupdatedDate: new Date(node.updated_on),\n\t\theadSha: node.source.commit.hash,\n\t};\n\n\tif (etagIncludes.includes('reviewDecision')) {\n\t\t// The full read always has both lists, and the decision tells a missing list from an empty one, so a row\n\t\t// without them can't be compared: it rejects, and the full read answers instead.\n\t\tif (node.participants == null || node.reviewers == null) {\n\t\t\tthrow new Error(`Bitbucket returned pull request ${node.id} without its participants or reviewers`);\n\t\t}\n\n\t\tfields.reviewDecision = getBitbucketReviewDecision(node);\n\t}\n\n\treturn fields;\n}\n"],"mappings":";;;AA6HA,MAAM,+BAA+B;AACrC,SAAgB,wBAAwB,KAA8C;CACrF,MAAM,QAAQ,IAAI,MAAM,4BAA4B;CACpD,IAAI,OACH,OAAO;EAAE,MAAM,MAAM;EAAI,OAAO,MAAM;CAAG;CAE1C,OAAO;EAAE,MAAM;EAAK,OAAO;CAAG;AAC/B;AA4HA,SAAgB,iCAAiC,OAA2D;CAC3G,QAAQ,OAAR;EACC,KAAK;EACL,KAAK,cACJ,OAAO;EACR,KAAK,UACJ,OAAO;EAER,SACC,OAAO;CACT;AACD;AAEA,SAAgB,2BAA2B,OAAqD;CAC/F,QAAQ,OAAR;EACC,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,UACJ,OAAO;EAKR,SACC,OAAO;CACT;AACD;AAEA,SAAgB,kCAAkC,OAA2C;CAC5F,OAAO,iCAAiC,KAAK,MAAM;AACpD;AAEA,SAAgB,4BAA4B,OAAqC;CAChF,OAAO,2BAA2B,KAAK,MAAM;AAC9C;AAEA,SAAgB,kBAAkB,MAAwC;CACzE,OAAO;EACN,WAAW,KAAK,OAAO,QAAQ;EAC/B,MAAM,KAAK;EACX,UAAU,KAAK;EACf,KAAK,KAAK,OAAO,MAAM;EACvB,IAAI,KAAK;CACV;AACD;AAEA,SAAgB,mCACf,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AAE,GAC7B,GAAG,cACA,QAAO,QAAO,IAAI,SAAS,UAAU,CAAC,CACvC,KAAI,QAAO,mCAAmC,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC,CAAC,CAC3E,QAAO,OAAM,GAAG,UAAA,kBAAgD,GAClE,GAAG,cACA,QAAO,QAAO,IAAI,mBAAmB,IAAI,CAAC,CAC3C,KAAI,QAAO,mCAAmC,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC,GAC5E,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,GAAG,eAAe,KAAA,GAClB,GAAG,IACH,SAAS,kBAAkB,OAAO,OAAO,OAAO,QAAQ,eAAe,KAAK,KAAA,GAC5E,SAAS,YACT,SAAS,cACV;AACD;;AAGA,MAAa,4BAA4B;;;;;AAqBzC,SAAgB,iCACf,MACA,cACwB;CACxB,MAAM,SAAgC;EACrC,OAAO,iCAAiC,KAAK,KAAK;EAClD,SAAS,KAAK;EACd,aAAa,IAAI,KAAK,KAAK,UAAU;EACrC,SAAS,KAAK,OAAO,OAAO;CAC7B;CAEA,IAAI,aAAa,SAAS,gBAAgB,GAAG;EAG5C,IAAI,KAAK,gBAAgB,QAAQ,KAAK,aAAa,MAClD,MAAM,IAAI,MAAM,mCAAmC,KAAK,GAAG,uCAAuC;EAGnG,OAAO,iBAAiB,2BAA2B,IAAI;CACxD;CAEA,OAAO;AACR"}
1
+ {"version":3,"file":"models.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/bitbucket/models.ts"],"sourcesContent":["import { copyReadProvenance } from '@gitkraken/provider-apis/read-provenance';\nimport type { IssueProjection, IssueRepository } from '@gitlens/git/models/issue.js';\nimport { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequestState } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequestMember, PullRequestProjection, PullRequestReviewer } from '@gitlens/git/models/pullRequest.js';\nimport { PullRequest, PullRequestReviewDecision, PullRequestReviewState } from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { PullRequestEtagFields, PullRequestEtagInclude } from '../../models/integration.js';\n\nexport interface BitbucketRepositoryDescriptor extends ResourceDescriptor {\n\towner: string;\n\tname: string;\n}\n\nexport interface BitbucketWorkspaceDescriptor extends ResourceDescriptor {\n\tid: string;\n\tname: string;\n\tslug: string;\n}\n\nexport type BitbucketPullRequestState = 'OPEN' | 'DECLINED' | 'MERGED' | 'SUPERSEDED';\n\ninterface BitbucketLink {\n\thref: string;\n\tname?: string;\n}\n\n// Bitbucket's `account` schema: a person (`user`) or an app/bot (`app_user`, e.g. a review bot on a PR).\n// An `app_user` has no `links.html` and no `nickname`, and the schema requires none of the links.\ninterface BitbucketUser {\n\ttype: 'user' | 'app_user';\n\tuuid: string;\n\tdisplay_name: string;\n\taccount_id?: string;\n\tnickname?: string;\n\tlinks?: {\n\t\tself?: BitbucketLink;\n\t\tavatar?: BitbucketLink;\n\t\thtml?: BitbucketLink;\n\t};\n}\n\ninterface BitbucketWorkspace {\n\ttype: 'workspace';\n\tuuid: string;\n\tname: string;\n\tslug: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketProject {\n\ttype: 'project';\n\tkey: string;\n\tuuid: string;\n\tname: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketPullRequestParticipant {\n\ttype: 'participant';\n\tuser: BitbucketUser;\n\trole: 'PARTICIPANT' | 'REVIEWER';\n\tapproved: boolean;\n\tstate: null | 'approved' | 'changes_requested';\n\tparticipated_on: null | string;\n}\n\nexport interface BitbucketRepository {\n\ttype: 'repository';\n\tuuid: string;\n\tfull_name: string;\n\tname: string;\n\tslug: string;\n\tdescription?: string;\n\tis_private: boolean;\n\tparent: null | BitbucketRepository;\n\tscm: 'git';\n\towner: BitbucketUser;\n\tworkspace: BitbucketWorkspace;\n\tproject: BitbucketProject;\n\tcreated_on: string;\n\tupdated_on: string;\n\tsize: number;\n\tlanguage: string;\n\thas_issues: boolean;\n\thas_wiki: boolean;\n\tfork_policy: 'allow_forks' | 'no_public_forks' | 'no_forks';\n\twebsite: string;\n\tmainbranch?: BitbucketBranch;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketCommitAuthor {\n\ttype: 'author';\n\traw: string;\n\tuser: BitbucketUser;\n}\n\ntype BitbucketMergeStrategy =\n\t| 'merge_commit'\n\t| 'squash'\n\t| 'fast_forward'\n\t| 'squash_fast_forward'\n\t| 'rebase_fast_forward'\n\t| 'rebase_merge';\n\ninterface BitbucketBranch {\n\tname: string;\n\tmerge_strategies?: BitbucketMergeStrategy[];\n\tdefault_merge_strategy?: BitbucketMergeStrategy;\n}\n\n// It parses a raw author sitring like \"Sergei Shmakov GK <sergei.shmakov@gitkraken.com>\" to name and email\nconst parseRawBitbucketAuthorRegex = /^(.*) <(.*)>$/;\nexport function parseRawBitbucketAuthor(raw: string): { name: string; email: string } {\n\tconst match = raw.match(parseRawBitbucketAuthorRegex);\n\tif (match) {\n\t\treturn { name: match[1], email: match[2] };\n\t}\n\treturn { name: raw, email: '' };\n}\n\nexport interface BitbucketCommit extends BitbucketBriefCommit {\n\tauthor: BitbucketCommitAuthor;\n\tdate: string;\n\tlinks: {\n\t\tapprove: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tdiff: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tself: BitbucketLink;\n\t\tstatuses: BitbucketLink;\n\t};\n\tmessage: string;\n\tparents: BitbucketBriefCommit[];\n\tparticipants: BitbucketPullRequestParticipant[];\n\trendered: {\n\t\tmessage: string;\n\t};\n\trepository: BitbucketRepository;\n\tsummary: {\n\t\ttype: 'rendered';\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n}\n\ninterface BitbucketBriefCommit {\n\ttype: 'commit';\n\thash: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t};\n}\n\nexport type BitbucketIssueState =\n\t| 'submitted'\n\t| 'new'\n\t| 'open'\n\t| 'resolved'\n\t| 'on hold'\n\t| 'invalid'\n\t| 'duplicate'\n\t| 'wontfix'\n\t| 'closed';\n\nexport interface BitbucketPullRequest {\n\ttype: 'pullrequest';\n\tid: number;\n\ttitle: string;\n\tdescription: string;\n\tstate: BitbucketPullRequestState;\n\tdraft?: boolean;\n\tmerge_commit: null | BitbucketBriefCommit;\n\tcomment_count: number;\n\ttask_count: number;\n\tclose_source_branch: boolean;\n\tclosed_by: BitbucketUser | null;\n\tauthor: BitbucketUser;\n\treason: string;\n\tcreated_on: string;\n\tupdated_on: string;\n\tdestination: {\n\t\tbranch: BitbucketBranch;\n\t\tcommit: BitbucketBriefCommit;\n\t\trepository: BitbucketRepository;\n\t};\n\tsource: {\n\t\tbranch: BitbucketBranch;\n\t\tcommit: BitbucketBriefCommit;\n\t\trepository: BitbucketRepository;\n\t};\n\tsummary: {\n\t\ttype: 'rendered';\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n\treviewers?: BitbucketUser[];\n\tparticipants?: BitbucketPullRequestParticipant[];\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tcommits: BitbucketLink;\n\t\tapprove: BitbucketLink;\n\t\t'request-changes': BitbucketLink;\n\t\tdiff: BitbucketLink;\n\t\tdiffstat: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tactivity: BitbucketLink;\n\t\tmerge: BitbucketLink;\n\t\tdecline: BitbucketLink;\n\t\tstatuses: BitbucketLink;\n\t};\n}\n\nexport interface BitbucketIssue {\n\ttype: string;\n\tid: number;\n\ttitle: string;\n\treporter: BitbucketUser;\n\tassignee?: BitbucketUser;\n\tstate: BitbucketIssueState;\n\tcreated_on: string;\n\tupdated_on: string;\n\trepository: BitbucketRepository;\n\tvotes?: number;\n\tcontent: {\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tattachments: BitbucketLink;\n\t\twatch: BitbucketLink;\n\t\tvote: BitbucketLink;\n\t};\n}\n\nexport function bitbucketPullRequestStateToState(state: BitbucketPullRequestState): IssueOrPullRequestState {\n\tswitch (state) {\n\t\tcase 'DECLINED':\n\t\tcase 'SUPERSEDED':\n\t\t\treturn 'closed';\n\t\tcase 'MERGED':\n\t\t\treturn 'merged';\n\t\tcase 'OPEN':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\n\nexport function bitbucketIssueStateToState(state: BitbucketIssueState): IssueOrPullRequestState {\n\tswitch (state) {\n\t\tcase 'resolved':\n\t\tcase 'invalid':\n\t\tcase 'duplicate':\n\t\tcase 'wontfix':\n\t\tcase 'closed':\n\t\t\treturn 'closed';\n\t\tcase 'submitted':\n\t\tcase 'new':\n\t\tcase 'open':\n\t\tcase 'on hold':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\n\nexport function isClosedBitbucketPullRequestState(state: BitbucketPullRequestState): boolean {\n\treturn bitbucketPullRequestStateToState(state) !== 'opened';\n}\n\nexport function isClosedBitbucketIssueState(state: BitbucketIssueState): boolean {\n\treturn bitbucketIssueStateToState(state) !== 'opened';\n}\n\nexport function fromBitbucketUser(user: BitbucketUser): PullRequestMember {\n\treturn {\n\t\tavatarUrl: user.links?.avatar?.href,\n\t\tname: user.display_name,\n\t\tusername: user.nickname,\n\t\turl: user.links?.html?.href,\n\t\tid: user.uuid,\n\t};\n}\n\nexport function fromBitbucketParticipantToReviewer(\n\tprt: BitbucketPullRequestParticipant,\n\tclosedBy: BitbucketUser | null,\n\tprState: BitbucketPullRequestState,\n): PullRequestReviewer {\n\treturn {\n\t\treviewer: fromBitbucketUser(prt.user),\n\t\tstate: prt.approved\n\t\t\t? PullRequestReviewState.Approved\n\t\t\t: prt.state === 'changes_requested'\n\t\t\t\t? PullRequestReviewState.ChangesRequested\n\t\t\t\t: prt.participated_on != null\n\t\t\t\t\t? PullRequestReviewState.Commented\n\t\t\t\t\t: prt.user.uuid === closedBy?.uuid && prState === 'DECLINED'\n\t\t\t\t\t\t? PullRequestReviewState.Dismissed\n\t\t\t\t\t\t: PullRequestReviewState.ReviewRequested,\n\t};\n}\n\n/**\n * The review decision a Bitbucket Cloud row carries, derived from its participants and reviewers. Reads only the\n * participants' `participated_on`, `approved` and `state` and whether there are reviewers, which is what the cheap etag\n * read selects for it.\n */\nexport function getBitbucketReviewDecision(pr: {\n\tparticipants?: readonly Pick<BitbucketPullRequestParticipant, 'approved' | 'state' | 'participated_on'>[];\n\treviewers?: readonly unknown[];\n}): PullRequestReviewDecision | undefined {\n\tif (!pr.participants?.length && pr.reviewers?.length) {\n\t\treturn PullRequestReviewDecision.ReviewRequired;\n\t}\n\tif (!pr.participants) {\n\t\treturn undefined;\n\t}\n\n\tlet hasReviews = false;\n\tlet hasChangeRequests = false;\n\tlet hasApprovals = false;\n\tfor (const prt of pr.participants) {\n\t\tif (prt.participated_on != null) {\n\t\t\thasReviews = true;\n\t\t}\n\t\tif (prt.approved) {\n\t\t\thasApprovals = true;\n\t\t}\n\t\tif (prt.state === 'changes_requested') {\n\t\t\thasChangeRequests = true;\n\t\t}\n\t}\n\tif (hasChangeRequests) return PullRequestReviewDecision.ChangesRequested;\n\tif (hasApprovals) return PullRequestReviewDecision.Approved;\n\tif (hasReviews) return undefined; // not approved, not rejected, but reviewed\n\treturn PullRequestReviewDecision.ReviewRequired; // nobody has reviewed yet.\n}\n\nfunction fromBitbucketRepository(repo: BitbucketRepository): IssueRepository {\n\treturn {\n\t\towner: repo.full_name.split('/')[0],\n\t\trepo: repo.name,\n\t\tid: repo.uuid,\n\t};\n}\n\nexport function fromBitbucketIssue(issue: BitbucketIssue, provider: Provider, projection?: IssueProjection): Issue {\n\tconst result = new Issue(\n\t\tprovider,\n\t\tissue.id.toString(),\n\t\tissue.id.toString(),\n\t\tissue.title,\n\t\tissue.links.html.href,\n\t\tnew Date(issue.created_on),\n\t\tnew Date(issue.updated_on),\n\t\tisClosedBitbucketIssueState(issue.state),\n\t\tbitbucketIssueStateToState(issue.state),\n\t\tfromBitbucketUser(issue.reporter),\n\t\tissue.assignee ? [fromBitbucketUser(issue.assignee)] : [],\n\t\tfromBitbucketRepository(issue.repository),\n\t\tundefined, // closedDate\n\t\tundefined, // labels\n\t\tundefined, // commentsCount\n\t\tissue.votes, // thumbsUpCount\n\t\tissue.content.html, // body\n\t\t!issue.repository?.project\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tid: issue.repository.project.uuid,\n\t\t\t\t\tname: issue.repository.project.name,\n\t\t\t\t\tresourceId: issue.repository.project.uuid,\n\t\t\t\t\tresourceName: issue.repository.project.name,\n\t\t\t\t},\n\t\tundefined, // number\n\t\tundefined, // issueType\n\t\tundefined, // providerState\n\t\tundefined, // bodyFormat\n\t\tundefined, // iterations\n\t\tprojection,\n\t);\n\treturn copyReadProvenance(result, issue);\n}\n\nexport function fromBitbucketPullRequest(\n\tpr: BitbucketPullRequest,\n\tprovider: Provider,\n\toptions?: { currentAccount?: { id: string; username?: string }; projection?: PullRequestProjection },\n): PullRequest {\n\tconst author = fromBitbucketUser(pr.author);\n\tconst result = new PullRequest(\n\t\tprovider,\n\t\tauthor,\n\t\tpr.id.toString(),\n\t\tpr.id.toString(),\n\t\tpr.title,\n\t\tpr.links.html.href,\n\t\tfromBitbucketRepository(pr.destination.repository),\n\t\tbitbucketPullRequestStateToState(pr.state),\n\t\tnew Date(pr.created_on),\n\t\tnew Date(pr.updated_on),\n\t\tpr.closed_by ? new Date(pr.updated_on) : undefined,\n\t\tpr.state === 'MERGED' ? new Date(pr.updated_on) : undefined,\n\t\tundefined, // mergeableState: not read\n\t\tundefined, // viewerCanUpdate\n\t\t{\n\t\t\tbase: {\n\t\t\t\tbranch: pr.destination.branch.name,\n\t\t\t\tsha: pr.destination.commit.hash,\n\t\t\t\trepo: pr.destination.repository.name,\n\t\t\t\towner: pr.destination.repository.full_name.split('/')[0],\n\t\t\t\texists: true,\n\t\t\t\turl: pr.destination.repository.links.html.href,\n\t\t\t},\n\t\t\thead: {\n\t\t\t\tbranch: pr.source.branch.name,\n\t\t\t\tsha: pr.source.commit.hash,\n\t\t\t\trepo: pr.source.repository.name,\n\t\t\t\towner: pr.source.repository.full_name.split('/')[0],\n\t\t\t\texists: true,\n\t\t\t\turl: pr.source.repository.links.html.href,\n\t\t\t},\n\t\t\tisCrossRepository: pr.source.repository.uuid !== pr.destination.repository.uuid,\n\t\t},\n\t\tpr.draft,\n\t\tundefined, // additions\n\t\tundefined, // deletions\n\t\tundefined, // commentsCount\n\t\tundefined, // thumbsCount\n\t\tgetBitbucketReviewDecision(pr),\n\t\tpr.participants // reviewRequests:PullRequestReviewer[]\n\t\t\t?.filter(prt => prt.role === 'REVIEWER')\n\t\t\t.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state))\n\t\t\t.filter(rv => rv.state === PullRequestReviewState.ReviewRequested),\n\t\tpr.participants // latestReviews:PullRequestReviewer[]\n\t\t\t?.filter(prt => prt.participated_on != null)\n\t\t\t.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state)),\n\t\tundefined, // assignees:PullRequestMember[] -- it looks like there is no such thing as assignees on Bitbucket\n\t\tundefined, // PullRequestStatusCheckRollupState\n\t\tundefined, // IssueProject\n\t\tundefined, // version\n\t\tundefined, // commitCount\n\t\tundefined, // stack\n\t\tundefined, // filesChanged\n\t\tpr.description ?? undefined,\n\t\tpr.id,\n\t\toptions?.currentAccount != null ? author.id === options.currentAccount.id : undefined,\n\t\toptions?.projection,\n\t\toptions?.currentAccount,\n\t);\n\treturn copyReadProvenance(result, pr);\n}\n\n/** The most pull request ids one etag read asks for: Bitbucket Cloud's largest page of pull requests. */\nexport const bitbucketEtagFieldsMaxIds = 50;\n\n/**\n * A pull request as the cheap etag read selects it (`BitbucketApi.getPullRequestsEtagFields`): only the fields\n * {@link fromBitbucketPullRequest} maps into a full row's etag inputs. `participants` and `reviewers` are selected\n * only for the `reviewDecision` include.\n */\nexport interface BitbucketPullRequestEtagNode {\n\tid: number;\n\tstate: BitbucketPullRequestState;\n\tupdated_on: string;\n\tdraft?: boolean;\n\tsource: { commit: { hash: string } };\n\tparticipants?: Pick<BitbucketPullRequestParticipant, 'approved' | 'state' | 'participated_on'>[];\n\treviewers?: unknown[];\n}\n\n/**\n * A cheap etag read's pull request in the vocabulary {@link fromBitbucketPullRequest}'s row ends in, so both reads\n * compute the same etag. That row reads neither a mergeability nor a check rollup, so neither does this.\n */\nexport function toBitbucketPullRequestEtagFields(\n\tnode: BitbucketPullRequestEtagNode,\n\tetagIncludes: readonly PullRequestEtagInclude[],\n): PullRequestEtagFields {\n\tconst fields: PullRequestEtagFields = {\n\t\tstate: bitbucketPullRequestStateToState(node.state),\n\t\tisDraft: node.draft,\n\t\tupdatedDate: new Date(node.updated_on),\n\t\theadSha: node.source.commit.hash,\n\t};\n\n\tif (etagIncludes.includes('reviewDecision')) {\n\t\t// The full read always has both lists, and the decision tells a missing list from an empty one, so a row\n\t\t// without them can't be compared: it rejects, and the full read answers instead.\n\t\tif (node.participants == null || node.reviewers == null) {\n\t\t\tthrow new Error(`Bitbucket returned pull request ${node.id} without its participants or reviewers`);\n\t\t}\n\n\t\tfields.reviewDecision = getBitbucketReviewDecision(node);\n\t}\n\n\treturn fields;\n}\n"],"mappings":";;;;AA8HA,MAAM,+BAA+B;AACrC,SAAgB,wBAAwB,KAA8C;CACrF,MAAM,QAAQ,IAAI,MAAM,4BAA4B;CACpD,IAAI,OACH,OAAO;EAAE,MAAM,MAAM;EAAI,OAA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ACrC;;AAGA,MAAa,4BAA4B;;;;;AAqBzC,SAAgB,iCACf,MACA,cACwB;CACxB,MAAM,SAAgC;EACrC,OAAO,iCAAiC,KAAK,KAAK;EAClD,SAAS,KAAK;EACd,aAAa,IAAI,KAAK,KAAK,UAAU;EACrC,SAAS,KAAK,OAAO,OAAO;CAC7B;CAEA,IAAI,aAAa,SAAS,gBAAgB,GAAG;EAG5C,IAAI,KAAK,gBAAgB,QAAQ,KAAK,aAAa,MAClD,MAAM,IAAI,MAAM,mCAAmC,KAAK,GAAG,uCAAuC;EAGnG,OAAO,iBAAiB,2BAA2B,IAAI;CACxD;CAEA,OAAO;AACR"}
@@ -1,3 +1,4 @@
1
+ import { copyReadProvenance } from "@gitkraken/provider-apis/read-provenance";
1
2
  //#region ../plus/integrations/src/providers/bitbucket-server/models.ts
2
3
  const GitPullRequestState = {
3
4
  Open: "OPEN",
@@ -50,7 +51,7 @@ const normalizeBitbucketServerPullRequest = (pr) => {
50
51
  const headSSHUrl = pr.fromRef.repository.links.clone.find((link) => link.name === "ssh")?.href ?? null;
51
52
  let headHTTPSUrl = pr.fromRef.repository.links.clone.find((link) => link.name === "https")?.href ?? null;
52
53
  if (!headHTTPSUrl) headHTTPSUrl = pr.fromRef.repository.links.clone.find((link) => link.name === "http")?.href ?? null;
53
- return {
54
+ const result = {
54
55
  id: pr.id.toString(),
55
56
  number: pr.id,
56
57
  title: pr.title,
@@ -103,6 +104,7 @@ const normalizeBitbucketServerPullRequest = (pr) => {
103
104
  permissions: null,
104
105
  version: pr.version
105
106
  };
107
+ return copyReadProvenance(result, pr);
106
108
  };
107
109
  //#endregion
108
110
  export { GitPullRequestReviewState, GitPullRequestState, normalizeBitbucketServerPullRequest, summarizeReviewDecision };
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/bitbucket-server/models.ts"],"sourcesContent":["import type {\n\tGitPullRequestReviewState as GitPullRequestReviewStateType,\n\tGitPullRequestState as GitPullRequestStateType,\n} from '@gitkraken/provider-apis';\nimport type { ProviderAccount, ProviderPullRequest } from '../models.js';\n\ntype GitPullRequestReviewState = GitPullRequestReviewStateType;\ntype GitPullRequestState = GitPullRequestStateType;\n\n// Local runtime copies of the `@gitkraken/provider-apis` PR string enums. Exported so the enum-parity\n// test can guard them against upstream drift.\nexport const GitPullRequestState = {\n\tOpen: 'OPEN' as GitPullRequestState,\n\tClosed: 'CLOSED' as GitPullRequestState,\n\tMerged: 'MERGED' as GitPullRequestState,\n} as const;\n\nexport const GitPullRequestReviewState = {\n\tApproved: 'APPROVED' as GitPullRequestReviewState,\n\tChangesRequested: 'CHANGES_REQUESTED' as GitPullRequestReviewState,\n\tCommented: 'COMMENTED' as GitPullRequestReviewState,\n\tReviewRequested: 'REVIEW_REQUESTED' as GitPullRequestReviewState,\n} as const;\n\nexport interface BitbucketServerLink {\n\thref: string;\n}\n\nexport interface NamedBitbucketServerLink<T extends string = string> extends BitbucketServerLink {\n\tname: T;\n}\n\nexport interface BitbucketServerPagedResponse<T> {\n\tvalues: T[];\n\tsize: number;\n\tlimit: number;\n\tisLastPage: boolean;\n\tnextPageStart: number;\n\tstart: number;\n}\n\nexport interface BitbucketServerPullRequestRef {\n\tid: string;\n\tdisplayId: string;\n\tlatestCommit: string;\n\ttype: string;\n\trepository: {\n\t\tslug: string;\n\t\tid: number;\n\t\tname: string;\n\t\thierarchyId: string;\n\t\tscmId: string;\n\t\tstate: string;\n\t\tstatusMessage: string;\n\t\tforkable: boolean;\n\t\tproject: {\n\t\t\tkey: string;\n\t\t\tid: number;\n\t\t\tname: string;\n\t\t\tpublic: boolean;\n\t\t\ttype: string;\n\t\t\tlinks: {\n\t\t\t\tself: BitbucketServerLink[];\n\t\t\t};\n\t\t};\n\t\tpublic: boolean;\n\t\tarchived: boolean;\n\t\tlinks: {\n\t\t\tclone: NamedBitbucketServerLink[];\n\t\t\tself: BitbucketServerLink[];\n\t\t};\n\t};\n}\n\nexport interface BitbucketAuthor {\n\tname: string;\n\temailAddress: string;\n\tid: undefined;\n}\n\nexport interface BitbucketServerUser {\n\tname: string;\n\temailAddress: string;\n\tactive: boolean;\n\tdisplayName: string;\n\tid: number;\n\tslug: string;\n\ttype: string;\n\tlinks: {\n\t\tself: BitbucketServerLink[];\n\t};\n\tavatarUrl?: string;\n}\n\nexport interface BitbucketServerPullRequestUser {\n\tuser: BitbucketServerUser;\n\tlastReviewedCommit?: string;\n\trole: 'REVIEWER' | 'AUTHOR' | 'PARTICIPANT';\n\tapproved: boolean;\n\tstatus: 'UNAPPROVED' | 'NEEDS_WORK' | 'APPROVED';\n}\n\nexport interface BitbucketServerBriefCommit {\n\tdisplayId: string;\n\tid: string;\n}\n\nexport interface BitbucketServerCommit extends BitbucketServerBriefCommit {\n\tauthor: BitbucketServerUser | BitbucketAuthor;\n\tauthorTimestamp: number;\n\tcommitter: BitbucketServerUser | BitbucketAuthor;\n\tcommitterTimestamp: number;\n\tmessage: string;\n\tparents: (BitbucketServerCommit | BitbucketServerBriefCommit)[];\n}\n\nexport interface BitbucketServerPullRequest {\n\tid: number;\n\tversion: number;\n\ttitle: string;\n\tdescription: string;\n\t/**\n\t * `SUPERSEDED` is not in the published schema, but a server can still report it for a pull request closed by a\n\t * newer one (the Bitbucket SDK maps it too); it is a closed pull request, like `DECLINED`.\n\t */\n\tstate: 'OPEN' | 'MERGED' | 'DECLINED' | 'SUPERSEDED';\n\t/**\n\t * Drafts shipped in Bitbucket Data Center 8.18 (8.17 exposed the field experimentally); absent means the server\n\t * has no drafts, so not a draft.\n\t */\n\tdraft?: boolean;\n\topen: boolean;\n\tclosed: boolean;\n\tcreatedDate: number;\n\tupdatedDate: number;\n\tclosedDate: number | null;\n\tfromRef: BitbucketServerPullRequestRef;\n\ttoRef: BitbucketServerPullRequestRef;\n\tlocked: boolean;\n\tauthor: BitbucketServerPullRequestUser;\n\treviewers: BitbucketServerPullRequestUser[];\n\tparticipants: BitbucketServerPullRequestUser[];\n\tproperties: {\n\t\tmergeResult: {\n\t\t\toutcome: string;\n\t\t\tcurrent: boolean;\n\t\t};\n\t\tresolvedTaskCount: number;\n\t\tcommentCount: number;\n\t\topenTaskCount: number;\n\t};\n\tlinks: {\n\t\tself: BitbucketServerLink[];\n\t};\n}\n\nconst normalizeUser = (user: BitbucketServerUser): ProviderAccount => ({\n\tname: user.displayName,\n\temail: user.emailAddress,\n\tavatarUrl: user.avatarUrl ?? null,\n\tid: user.id.toString(),\n\tusername: user.name,\n\turl: user.links.self[0].href,\n});\n\nconst reviewDecisionWeightByReviewState = {\n\t[GitPullRequestReviewState.Approved]: 0,\n\t[GitPullRequestReviewState.Commented]: 1,\n\t[GitPullRequestReviewState.ReviewRequested]: 2,\n\t[GitPullRequestReviewState.ChangesRequested]: 3,\n};\n\nexport const summarizeReviewDecision = (\n\treviews: { state: GitPullRequestReviewState }[] | null,\n): GitPullRequestReviewState | null => {\n\tif (!reviews || reviews.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn reviews.reduce(\n\t\t(prev: GitPullRequestReviewState, review) =>\n\t\t\treviewDecisionWeightByReviewState[review.state] > reviewDecisionWeightByReviewState[prev]\n\t\t\t\t? review.state\n\t\t\t\t: prev,\n\t\tGitPullRequestReviewState.Approved,\n\t);\n};\n\nexport const normalizeBitbucketServerPullRequest = (pr: BitbucketServerPullRequest): ProviderPullRequest => {\n\tconst bitbucketStateToGitState = {\n\t\tOPEN: GitPullRequestState.Open,\n\t\tMERGED: GitPullRequestState.Merged,\n\t\tDECLINED: GitPullRequestState.Closed,\n\t\tSUPERSEDED: GitPullRequestState.Closed,\n\t};\n\n\tconst reviewerStatusToGitState = {\n\t\tUNAPPROVED: GitPullRequestReviewState.ReviewRequested,\n\t\tNEEDS_WORK: GitPullRequestReviewState.ChangesRequested,\n\t\tAPPROVED: GitPullRequestReviewState.Approved,\n\t};\n\n\tconst reviews = pr.reviewers.map(reviewer => ({\n\t\treviewer: normalizeUser(reviewer.user),\n\t\tstate: reviewerStatusToGitState[reviewer.status],\n\t}));\n\n\tconst baseSSHUrl = pr.toRef.repository.links.clone.find(link => link.name === 'ssh')?.href ?? null;\n\tlet baseHTTPSUrl = pr.toRef.repository.links.clone.find(link => link.name === 'https')?.href ?? null;\n\tif (!baseHTTPSUrl) {\n\t\tbaseHTTPSUrl = pr.toRef.repository.links.clone.find(link => link.name === 'http')?.href ?? null;\n\t}\n\n\tconst headSSHUrl = pr.fromRef.repository.links.clone.find(link => link.name === 'ssh')?.href ?? null;\n\tlet headHTTPSUrl = pr.fromRef.repository.links.clone.find(link => link.name === 'https')?.href ?? null;\n\tif (!headHTTPSUrl) {\n\t\theadHTTPSUrl = pr.fromRef.repository.links.clone.find(link => link.name === 'http')?.href ?? null;\n\t}\n\n\treturn {\n\t\tid: pr.id.toString(),\n\t\tnumber: pr.id,\n\t\ttitle: pr.title,\n\t\tdescription: pr.description ?? null,\n\t\turl: pr.links.self[0].href,\n\t\tstate: bitbucketStateToGitState[pr.state],\n\t\tisCrossRepository: pr.toRef.repository.id !== pr.fromRef.repository.id,\n\t\tisDraft: pr.draft === true,\n\t\tcreatedDate: new Date(pr.createdDate),\n\t\tupdatedDate: new Date(pr.updatedDate),\n\t\tclosedDate: pr.closedDate ? new Date(pr.closedDate) : null,\n\t\tmergedDate: pr.state === 'MERGED' && pr.closedDate ? new Date(pr.closedDate) : null,\n\t\tbaseRef: {\n\t\t\tname: pr.toRef.displayId,\n\t\t\toid: pr.toRef.latestCommit,\n\t\t},\n\t\theadRef: {\n\t\t\tname: pr.fromRef.displayId,\n\t\t\toid: pr.fromRef.latestCommit,\n\t\t},\n\t\tcommentCount: pr.properties?.commentCount,\n\t\tupvoteCount: null,\n\t\tcommitCount: null,\n\t\tfileCount: null,\n\t\tadditions: null,\n\t\tdeletions: null,\n\t\tauthor: normalizeUser(pr.author.user),\n\t\tassignees: null,\n\t\treviews: reviews,\n\t\treviewDecision: summarizeReviewDecision(reviews),\n\t\trepository: {\n\t\t\tid: pr.toRef.repository.id.toString(),\n\t\t\tname: pr.toRef.repository.name,\n\t\t\towner: {\n\t\t\t\tlogin: pr.toRef.repository.project.key,\n\t\t\t},\n\t\t\tremoteInfo:\n\t\t\t\tbaseHTTPSUrl && baseSSHUrl\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcloneUrlHTTPS: baseHTTPSUrl,\n\t\t\t\t\t\t\tcloneUrlSSH: baseSSHUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t: null,\n\t\t},\n\t\theadRepository: {\n\t\t\tid: pr.fromRef.repository.id.toString(),\n\t\t\tname: pr.fromRef.repository.name,\n\t\t\towner: {\n\t\t\t\tlogin: pr.fromRef.repository.project.key,\n\t\t\t},\n\t\t\tremoteInfo:\n\t\t\t\theadHTTPSUrl && headSSHUrl\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcloneUrlHTTPS: headHTTPSUrl,\n\t\t\t\t\t\t\tcloneUrlSSH: headSSHUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t: null,\n\t\t},\n\t\theadCommit: null,\n\t\tpermissions: null,\n\t\tversion: pr.version,\n\t};\n};\n"],"mappings":";AAWA,MAAa,sBAAsB;CAClC,MAAM;CACN,QAAQ;CACR,QAAQ;AACT;AAEA,MAAa,4BAA4B;CACxC,UAAU;CACV,kBAAkB;CAClB,WAAW;CACX,iBAAiB;AAClB;AAsIA,MAAM,iBAAiB,UAAgD;CACtE,MAAM,KAAK;CACX,OAAO,KAAK;CACZ,WAAW,KAAK,aAAa;CAC7B,IAAI,KAAK,GAAG,SAAS;CACrB,UAAU,KAAK;CACf,KAAK,KAAK,MAAM,KAAK,EAAE,CAAC;AACzB;AAEA,MAAM,oCAAoC;EACxC,0BAA0B,WAAW;EACrC,0BAA0B,YAAY;EACtC,0BAA0B,kBAAkB;EAC5C,0BAA0B,mBAAmB;AAC/C;AAEA,MAAa,2BACZ,YACsC;CACtC,IAAI,CAAC,WAAW,QAAQ,WAAW,GAClC,OAAO;CAGR,OAAO,QAAQ,QACb,MAAiC,WACjC,kC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WAAW,OAAO,GAAG,QAAQ,WAAW;EACpE,SAAS,GAAG,UAAU;EACtB,aAAa,IAAI,KAAK,GAAG,WAAW;EACpC,aAAa,IAAI,KAAK,GAAG,WAAW;EACpC,YAAY,GAAG,aAAa,IAAI,KAAK,GAAG,UAAU,IAAI;EACtD,YAAY,GAAG,UAAU,YAAY,GAAG,aAAa,IAAI,KAAK,GAAG,UAAU,IAAI;EAC/E,SAAS;GACR,MAAM,GAAG,MAAM;GACf,KAAK,GAAG,MAAM;EACf;EACA,SAAS;GACR,MAAM,GAAG,QAAQ;GACjB,KAAK,GAAG,QAAQ;EACjB;EACA,cAAc,GAAG,YAAY;EAC7B,aAAa;EACb,aAAa;EACb,WAAW;EACX,WAAW;EACX,WAAW;EACX,QAAQ,cAAc,GAAG,OAAO,IAAI;EACpC,WAAW;EACF;EACT,gBAAgB,wBAAwB,OAAO;EAC/C,YAAY;GACX,IAAI,GAAG,MAAM,WAAW,GAAG,SAAS;GACpC,MAAM,GAAG,MAAM,WAAW;GAC1B,OAAO,EACN,OAAO,GAAG,MAAM,WAAW,QAAQ,IACpC;GACA,YACC,gBAAgB,aACb;IACA,eAAe;IACf,aAAa;GACd,IACC;EACL;EACA,gBAAgB;GACf,IAAI,GAAG,QAAQ,WAAW,GAAG,SAAS;GACtC,MAAM,GAAG,QAAQ,WAAW;GAC5B,OAAO,EACN,OAAO,GAAG,QAAQ,WAAW,QAAQ,IACtC;GACA,YACC,gBAAgB,aACb;IACA,eAAe;IACf,aAAa;GACd,IACC;EACL;EACA,YAAY;EACZ,aAAa;EACb,SAAS,GAAG;CACb;AACD"}
1
+ {"version":3,"file":"models.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/bitbucket-server/models.ts"],"sourcesContent":["import type {\n\tGitPullRequestReviewState as GitPullRequestReviewStateType,\n\tGitPullRequestState as GitPullRequestStateType,\n} from '@gitkraken/provider-apis';\nimport { copyReadProvenance } from '@gitkraken/provider-apis/read-provenance';\nimport type { ProviderAccount, ProviderPullRequest } from '../models.js';\n\ntype GitPullRequestReviewState = GitPullRequestReviewStateType;\ntype GitPullRequestState = GitPullRequestStateType;\n\n// Local runtime copies of the `@gitkraken/provider-apis` PR string enums. Exported so the enum-parity\n// test can guard them against upstream drift.\nexport const GitPullRequestState = {\n\tOpen: 'OPEN' as GitPullRequestState,\n\tClosed: 'CLOSED' as GitPullRequestState,\n\tMerged: 'MERGED' as GitPullRequestState,\n} as const;\n\nexport const GitPullRequestReviewState = {\n\tApproved: 'APPROVED' as GitPullRequestReviewState,\n\tChangesRequested: 'CHANGES_REQUESTED' as GitPullRequestReviewState,\n\tCommented: 'COMMENTED' as GitPullRequestReviewState,\n\tReviewRequested: 'REVIEW_REQUESTED' as GitPullRequestReviewState,\n} as const;\n\nexport interface BitbucketServerLink {\n\thref: string;\n}\n\nexport interface NamedBitbucketServerLink<T extends string = string> extends BitbucketServerLink {\n\tname: T;\n}\n\nexport interface BitbucketServerPagedResponse<T> {\n\tvalues: T[];\n\tsize: number;\n\tlimit: number;\n\tisLastPage: boolean;\n\tnextPageStart: number;\n\tstart: number;\n}\n\nexport interface BitbucketServerPullRequestRef {\n\tid: string;\n\tdisplayId: string;\n\tlatestCommit: string;\n\ttype: string;\n\trepository: {\n\t\tslug: string;\n\t\tid: number;\n\t\tname: string;\n\t\thierarchyId: string;\n\t\tscmId: string;\n\t\tstate: string;\n\t\tstatusMessage: string;\n\t\tforkable: boolean;\n\t\tproject: {\n\t\t\tkey: string;\n\t\t\tid: number;\n\t\t\tname: string;\n\t\t\tpublic: boolean;\n\t\t\ttype: string;\n\t\t\tlinks: {\n\t\t\t\tself: BitbucketServerLink[];\n\t\t\t};\n\t\t};\n\t\tpublic: boolean;\n\t\tarchived: boolean;\n\t\tlinks: {\n\t\t\tclone: NamedBitbucketServerLink[];\n\t\t\tself: BitbucketServerLink[];\n\t\t};\n\t};\n}\n\nexport interface BitbucketAuthor {\n\tname: string;\n\temailAddress: string;\n\tid: undefined;\n}\n\nexport interface BitbucketServerUser {\n\tname: string;\n\temailAddress: string;\n\tactive: boolean;\n\tdisplayName: string;\n\tid: number;\n\tslug: string;\n\ttype: string;\n\tlinks: {\n\t\tself: BitbucketServerLink[];\n\t};\n\tavatarUrl?: string;\n}\n\nexport interface BitbucketServerPullRequestUser {\n\tuser: BitbucketServerUser;\n\tlastReviewedCommit?: string;\n\trole: 'REVIEWER' | 'AUTHOR' | 'PARTICIPANT';\n\tapproved: boolean;\n\tstatus: 'UNAPPROVED' | 'NEEDS_WORK' | 'APPROVED';\n}\n\nexport interface BitbucketServerBriefCommit {\n\tdisplayId: string;\n\tid: string;\n}\n\nexport interface BitbucketServerCommit extends BitbucketServerBriefCommit {\n\tauthor: BitbucketServerUser | BitbucketAuthor;\n\tauthorTimestamp: number;\n\tcommitter: BitbucketServerUser | BitbucketAuthor;\n\tcommitterTimestamp: number;\n\tmessage: string;\n\tparents: (BitbucketServerCommit | BitbucketServerBriefCommit)[];\n}\n\nexport interface BitbucketServerPullRequest {\n\tid: number;\n\tversion: number;\n\ttitle: string;\n\tdescription: string;\n\t/**\n\t * `SUPERSEDED` is not in the published schema, but a server can still report it for a pull request closed by a\n\t * newer one (the Bitbucket SDK maps it too); it is a closed pull request, like `DECLINED`.\n\t */\n\tstate: 'OPEN' | 'MERGED' | 'DECLINED' | 'SUPERSEDED';\n\t/**\n\t * Drafts shipped in Bitbucket Data Center 8.18 (8.17 exposed the field experimentally); absent means the server\n\t * has no drafts, so not a draft.\n\t */\n\tdraft?: boolean;\n\topen: boolean;\n\tclosed: boolean;\n\tcreatedDate: number;\n\tupdatedDate: number;\n\tclosedDate: number | null;\n\tfromRef: BitbucketServerPullRequestRef;\n\ttoRef: BitbucketServerPullRequestRef;\n\tlocked: boolean;\n\tauthor: BitbucketServerPullRequestUser;\n\treviewers: BitbucketServerPullRequestUser[];\n\tparticipants: BitbucketServerPullRequestUser[];\n\tproperties: {\n\t\tmergeResult: {\n\t\t\toutcome: string;\n\t\t\tcurrent: boolean;\n\t\t};\n\t\tresolvedTaskCount: number;\n\t\tcommentCount: number;\n\t\topenTaskCount: number;\n\t};\n\tlinks: {\n\t\tself: BitbucketServerLink[];\n\t};\n}\n\nconst normalizeUser = (user: BitbucketServerUser): ProviderAccount => ({\n\tname: user.displayName,\n\temail: user.emailAddress,\n\tavatarUrl: user.avatarUrl ?? null,\n\tid: user.id.toString(),\n\tusername: user.name,\n\turl: user.links.self[0].href,\n});\n\nconst reviewDecisionWeightByReviewState = {\n\t[GitPullRequestReviewState.Approved]: 0,\n\t[GitPullRequestReviewState.Commented]: 1,\n\t[GitPullRequestReviewState.ReviewRequested]: 2,\n\t[GitPullRequestReviewState.ChangesRequested]: 3,\n};\n\nexport const summarizeReviewDecision = (\n\treviews: { state: GitPullRequestReviewState }[] | null,\n): GitPullRequestReviewState | null => {\n\tif (!reviews || reviews.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn reviews.reduce(\n\t\t(prev: GitPullRequestReviewState, review) =>\n\t\t\treviewDecisionWeightByReviewState[review.state] > reviewDecisionWeightByReviewState[prev]\n\t\t\t\t? review.state\n\t\t\t\t: prev,\n\t\tGitPullRequestReviewState.Approved,\n\t);\n};\n\nexport const normalizeBitbucketServerPullRequest = (pr: BitbucketServerPullRequest): ProviderPullRequest => {\n\tconst bitbucketStateToGitState = {\n\t\tOPEN: GitPullRequestState.Open,\n\t\tMERGED: GitPullRequestState.Merged,\n\t\tDECLINED: GitPullRequestState.Closed,\n\t\tSUPERSEDED: GitPullRequestState.Closed,\n\t};\n\n\tconst reviewerStatusToGitState = {\n\t\tUNAPPROVED: GitPullRequestReviewState.ReviewRequested,\n\t\tNEEDS_WORK: GitPullRequestReviewState.ChangesRequested,\n\t\tAPPROVED: GitPullRequestReviewState.Approved,\n\t};\n\n\tconst reviews = pr.reviewers.map(reviewer => ({\n\t\treviewer: normalizeUser(reviewer.user),\n\t\tstate: reviewerStatusToGitState[reviewer.status],\n\t}));\n\n\tconst baseSSHUrl = pr.toRef.repository.links.clone.find(link => link.name === 'ssh')?.href ?? null;\n\tlet baseHTTPSUrl = pr.toRef.repository.links.clone.find(link => link.name === 'https')?.href ?? null;\n\tif (!baseHTTPSUrl) {\n\t\tbaseHTTPSUrl = pr.toRef.repository.links.clone.find(link => link.name === 'http')?.href ?? null;\n\t}\n\n\tconst headSSHUrl = pr.fromRef.repository.links.clone.find(link => link.name === 'ssh')?.href ?? null;\n\tlet headHTTPSUrl = pr.fromRef.repository.links.clone.find(link => link.name === 'https')?.href ?? null;\n\tif (!headHTTPSUrl) {\n\t\theadHTTPSUrl = pr.fromRef.repository.links.clone.find(link => link.name === 'http')?.href ?? null;\n\t}\n\n\tconst result: ProviderPullRequest = {\n\t\tid: pr.id.toString(),\n\t\tnumber: pr.id,\n\t\ttitle: pr.title,\n\t\tdescription: pr.description ?? null,\n\t\turl: pr.links.self[0].href,\n\t\tstate: bitbucketStateToGitState[pr.state],\n\t\tisCrossRepository: pr.toRef.repository.id !== pr.fromRef.repository.id,\n\t\tisDraft: pr.draft === true,\n\t\tcreatedDate: new Date(pr.createdDate),\n\t\tupdatedDate: new Date(pr.updatedDate),\n\t\tclosedDate: pr.closedDate ? new Date(pr.closedDate) : null,\n\t\tmergedDate: pr.state === 'MERGED' && pr.closedDate ? new Date(pr.closedDate) : null,\n\t\tbaseRef: {\n\t\t\tname: pr.toRef.displayId,\n\t\t\toid: pr.toRef.latestCommit,\n\t\t},\n\t\theadRef: {\n\t\t\tname: pr.fromRef.displayId,\n\t\t\toid: pr.fromRef.latestCommit,\n\t\t},\n\t\tcommentCount: pr.properties?.commentCount,\n\t\tupvoteCount: null,\n\t\tcommitCount: null,\n\t\tfileCount: null,\n\t\tadditions: null,\n\t\tdeletions: null,\n\t\tauthor: normalizeUser(pr.author.user),\n\t\tassignees: null,\n\t\treviews: reviews,\n\t\treviewDecision: summarizeReviewDecision(reviews),\n\t\trepository: {\n\t\t\tid: pr.toRef.repository.id.toString(),\n\t\t\tname: pr.toRef.repository.name,\n\t\t\towner: {\n\t\t\t\tlogin: pr.toRef.repository.project.key,\n\t\t\t},\n\t\t\tremoteInfo:\n\t\t\t\tbaseHTTPSUrl && baseSSHUrl\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcloneUrlHTTPS: baseHTTPSUrl,\n\t\t\t\t\t\t\tcloneUrlSSH: baseSSHUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t: null,\n\t\t},\n\t\theadRepository: {\n\t\t\tid: pr.fromRef.repository.id.toString(),\n\t\t\tname: pr.fromRef.repository.name,\n\t\t\towner: {\n\t\t\t\tlogin: pr.fromRef.repository.project.key,\n\t\t\t},\n\t\t\tremoteInfo:\n\t\t\t\theadHTTPSUrl && headSSHUrl\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcloneUrlHTTPS: headHTTPSUrl,\n\t\t\t\t\t\t\tcloneUrlSSH: headSSHUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t: null,\n\t\t},\n\t\theadCommit: null,\n\t\tpermissions: null,\n\t\tversion: pr.version,\n\t};\n\treturn copyReadProvenance(result, pr);\n};\n"],"mappings":";;AAYA,MAAa,sBAAsB;CAClC,MAAM;CACN,QAAQ;CACR,QAAQ;AACT;AAEA,MAAa,4BAA4B;CACxC,UAAU;CACV,kBAAkB;CAClB,WAAW;CACX,iBAAiB;AAClB;AAsIA,MAAM,iBAAiB,UAAgD;CACtE,MAAM,KAAK;CACX,OAAO,KAAK;CACZ,WAAW,KAAK,aAAa;CAC7B,IAAI,KAAK,GAAG,SAAS;CACrB,UAAU,KAAK;CACf,KAAK,KAAK,MAAM,KAAK,EAAE,CAAC;AACzB;AAEA,MAAM,oCAAoC;EACxC,0BAA0B,WAAW;EACrC,0BAA0B,YAAY;EACtC,0BAA0B,kBAAkB;EAC5C,0BAA0B,mBAAmB;AAC/C;AAEA,MAAa,2BACZ,YACsC;CACtC,IAAI,CAAC,WAAW,QAAQ,WAAW,GAClC,OAAO;CAGR,OAAO,QAAQ,QACb,MAAiC,WACjC,kCAAkC,OAAO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AW,OAAO,GAAG,QAAQ,WAAW;EACpE,SAAS,GAAG,UAAU;EACtB,aAAa,IAAI,KAAK,GAAG,WAAW;EACpC,aAAa,IAAI,KAAK,GAAG,WAAW;EACpC,YAAY,GAAG,aAAa,IAAI,KAAK,GAAG,UAAU,IAAI;EACtD,YAAY,GAAG,UAAU,YAAY,GAAG,aAAa,IAAI,KAAK,GAAG,UAAU,IAAI;EAC/E,SAAS;GACR,MAAM,GAAG,MAAM;GACf,KAAK,GAAG,MAAM;EACf;EACA,SAAS;GACR,MAAM,GAAG,QAAQ;GACjB,KAAK,GAAG,QAAQ;EACjB;EACA,cAAc,GAAG,YAAY;EAC7B,aAAa;EACb,aAAa;EACb,WAAW;EACX,WAAW;EACX,WAAW;EACX,QAAQ,cAAc,GAAG,OAAO,IAAI;EACpC,WAAW;EACF;EACT,gBAAgB,wBAAwB,OAAO;EAC/C,YAAY;GACX,IAAI,GAAG,MAAM,WAAW,GAAG,SAAS;GACpC,MAAM,GAAG,MAAM,WAAW;GAC1B,OAAO,EACN,OAAO,GAAG,MAAM,WAAW,QAAQ,IACpC;GACA,YACC,gBAAgB,aACb;IACA,eAAe;IACf,aAAa;GACd,IACC;EACL;EACA,gBAAgB;GACf,IAAI,GAAG,QAAQ,WAAW,GAAG,SAAS;GACtC,MAAM,GAAG,QAAQ,WAAW;GAC5B,OAAO,EACN,OAAO,GAAG,QAAQ,WAAW,QAAQ,IACtC;GACA,YACC,gBAAgB,aACb;IACA,eAAe;IACf,aAAa;GACd,IACC;EACL;EACA,YAAY;EACZ,aAAa;EACb,SAAS,GAAG;CACb;CACA,OAAO,mBAAmB,QAAQ,EAAE;AACrC"}
@@ -8,7 +8,7 @@ import { DefaultBranch } from "../../../git/models/defaultBranch.js";
8
8
  import { PullRequestActivityPage } from "../../../git/models/pullRequestActivity.js";
9
9
  import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
10
10
  import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
11
- import { GitHubIssueDelete, GitHubIssueWrite, IssueWriteResult } from "../../git-github/api/issueWrites.js";
11
+ import { GitHubIssueMutation, IssueWriteResult } from "../../git-github/api/issueWrites.js";
12
12
  import { ProviderAuthenticationSession } from "../authentication/models.js";
13
13
  import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from "../constants.js";
14
14
  import { ProviderOrganization, ProviderWarningCause } from "../results.js";
@@ -304,9 +304,7 @@ export declare class GitHubIntegration extends GitHubIntegrationBase<GitCloudHos
304
304
  protected readonly key = GitCloudHostIntegrationId.GitHub;
305
305
  readonly name: string;
306
306
  get domain(): string;
307
- mutateIssue(connectionId: string, input: GitHubIssueWrite | (GitHubIssueDelete & {
308
- action: 'delete';
309
- })): Promise<IssueWriteResult>;
307
+ mutateIssue(connectionId: string, input: GitHubIssueMutation): Promise<IssueWriteResult>;
310
308
  protected apiBaseUrlFor(_session: ProviderAuthenticationSession): string | undefined;
311
309
  access(): Promise<boolean>;
312
310
  refresh(): Promise<void>;