@gitkraken/core-gitlens 0.9.3 → 0.9.5

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 (160) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/dist/git/models/issue.d.ts +25 -2
  3. package/dist/git/models/issue.js +3 -1
  4. package/dist/git/models/issue.js.map +1 -1
  5. package/dist/git/models/pullRequest.d.ts +55 -5
  6. package/dist/git/models/pullRequest.js +5 -1
  7. package/dist/git/models/pullRequest.js.map +1 -1
  8. package/dist/git/utils/issue.utils.d.ts +4 -0
  9. package/dist/git/utils/issue.utils.js +4 -0
  10. package/dist/git/utils/issue.utils.js.map +1 -1
  11. package/dist/git/utils/pullRequest.utils.d.ts +4 -0
  12. package/dist/git/utils/pullRequest.utils.js +8 -0
  13. package/dist/git/utils/pullRequest.utils.js.map +1 -1
  14. package/dist/plus/git-github/api/github.d.ts +64 -4
  15. package/dist/plus/git-github/api/github.js +232 -15
  16. package/dist/plus/git-github/api/github.js.map +1 -1
  17. package/dist/plus/git-github/models.d.ts +48 -6
  18. package/dist/plus/git-github/models.js +11 -10
  19. package/dist/plus/git-github/models.js.map +1 -1
  20. package/dist/plus/integrations/fieldPresence.d.ts +75 -0
  21. package/dist/plus/integrations/fieldPresence.js +381 -0
  22. package/dist/plus/integrations/fieldPresence.js.map +1 -0
  23. package/dist/plus/integrations/index.d.ts +6 -4
  24. package/dist/plus/integrations/index.js +2 -1
  25. package/dist/plus/integrations/index.js.map +1 -1
  26. package/dist/plus/integrations/integrationService.d.ts +13 -4
  27. package/dist/plus/integrations/integrationService.js.map +1 -1
  28. package/dist/plus/integrations/manager.d.ts +62 -7
  29. package/dist/plus/integrations/models/gitHostIntegration.d.ts +103 -9
  30. package/dist/plus/integrations/models/gitHostIntegration.js +116 -5
  31. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  32. package/dist/plus/integrations/models/integration.d.ts +91 -4
  33. package/dist/plus/integrations/models/integration.js +56 -7
  34. package/dist/plus/integrations/models/integration.js.map +1 -1
  35. package/dist/plus/integrations/models/issueReads.d.ts +14 -0
  36. package/dist/plus/integrations/models/issuesIntegration.d.ts +44 -3
  37. package/dist/plus/integrations/models/issuesIntegration.js +51 -1
  38. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  39. package/dist/plus/integrations/providers/azure/azure.js +3 -3
  40. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  41. package/dist/plus/integrations/providers/azure/models.d.ts +36 -4
  42. package/dist/plus/integrations/providers/azure/models.js +118 -8
  43. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  44. package/dist/plus/integrations/providers/azureDevOps.d.ts +102 -5
  45. package/dist/plus/integrations/providers/azureDevOps.js +264 -45
  46. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  47. package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +30 -6
  48. package/dist/plus/integrations/providers/azureDevOpsServer.js +82 -21
  49. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  50. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +21 -1
  51. package/dist/plus/integrations/providers/bitbucket/bitbucket.js +74 -10
  52. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  53. package/dist/plus/integrations/providers/bitbucket/models.d.ts +45 -8
  54. package/dist/plus/integrations/providers/bitbucket/models.js +32 -9
  55. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  56. package/dist/plus/integrations/providers/bitbucket-server/models.d.ts +2 -6
  57. package/dist/plus/integrations/providers/bitbucket-server/models.js +1 -3
  58. package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
  59. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.d.ts +3 -1
  60. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js +4 -1
  61. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js.map +1 -1
  62. package/dist/plus/integrations/providers/bitbucket-server.d.ts +2 -2
  63. package/dist/plus/integrations/providers/bitbucket-server.js +7 -5
  64. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  65. package/dist/plus/integrations/providers/bitbucket.d.ts +22 -2
  66. package/dist/plus/integrations/providers/bitbucket.js +29 -6
  67. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  68. package/dist/plus/integrations/providers/github.d.ts +40 -3
  69. package/dist/plus/integrations/providers/github.js +133 -11
  70. package/dist/plus/integrations/providers/github.js.map +1 -1
  71. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +34 -1
  72. package/dist/plus/integrations/providers/gitlab/gitlab.js +118 -4
  73. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  74. package/dist/plus/integrations/providers/gitlab/models.d.ts +70 -5
  75. package/dist/plus/integrations/providers/gitlab/models.js +106 -13
  76. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  77. package/dist/plus/integrations/providers/gitlab.d.ts +31 -2
  78. package/dist/plus/integrations/providers/gitlab.js +48 -8
  79. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  80. package/dist/plus/integrations/providers/jira-server.d.ts +3 -2
  81. package/dist/plus/integrations/providers/jira-server.js +18 -9
  82. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  83. package/dist/plus/integrations/providers/jira.d.ts +26 -2
  84. package/dist/plus/integrations/providers/jira.js +120 -9
  85. package/dist/plus/integrations/providers/jira.js.map +1 -1
  86. package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +79 -0
  87. package/dist/plus/integrations/providers/jiraIssueByKey.js +58 -7
  88. package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
  89. package/dist/plus/integrations/providers/linear.d.ts +19 -1
  90. package/dist/plus/integrations/providers/linear.js +105 -7
  91. package/dist/plus/integrations/providers/linear.js.map +1 -1
  92. package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +42 -0
  93. package/dist/plus/integrations/providers/linearIssuesEtag.js +94 -0
  94. package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -0
  95. package/dist/plus/integrations/providers/models.d.ts +70 -8
  96. package/dist/plus/integrations/providers/models.js +59 -21
  97. package/dist/plus/integrations/providers/models.js.map +1 -1
  98. package/dist/plus/integrations/providers/providerErrors.js +8 -1
  99. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  100. package/dist/plus/integrations/providers/providersApi.d.ts +70 -4
  101. package/dist/plus/integrations/providers/providersApi.js +148 -4
  102. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  103. package/dist/plus/integrations/providers/pullRequestReviews.d.ts +13 -0
  104. package/dist/plus/integrations/providers/pullRequestReviews.js +30 -6
  105. package/dist/plus/integrations/providers/pullRequestReviews.js.map +1 -1
  106. package/dist/plus/integrations/providers/trello.js +11 -7
  107. package/dist/plus/integrations/providers/trello.js.map +1 -1
  108. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +11 -0
  109. package/dist/plus/integrations/providers/utils/providerPaging.js +47 -1
  110. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  111. package/dist/plus/integrations/providers/utils.d.ts +1 -1
  112. package/dist/plus/integrations/reads/batchEtags.d.ts +69 -0
  113. package/dist/plus/integrations/reads/batchEtags.js +114 -0
  114. package/dist/plus/integrations/reads/batchEtags.js.map +1 -0
  115. package/dist/plus/integrations/reads/counts.js +2 -2
  116. package/dist/plus/integrations/reads/counts.js.map +1 -1
  117. package/dist/plus/integrations/reads/currentAccount.js +2 -2
  118. package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
  119. package/dist/plus/integrations/reads/cursors.d.ts +8 -0
  120. package/dist/plus/integrations/reads/cursors.js +5 -3
  121. package/dist/plus/integrations/reads/cursors.js.map +1 -1
  122. package/dist/plus/integrations/reads/drains.d.ts +13 -4
  123. package/dist/plus/integrations/reads/drains.js +29 -5
  124. package/dist/plus/integrations/reads/drains.js.map +1 -1
  125. package/dist/plus/integrations/reads/etag.d.ts +26 -0
  126. package/dist/plus/integrations/reads/etag.js +108 -0
  127. package/dist/plus/integrations/reads/etag.js.map +1 -0
  128. package/dist/plus/integrations/reads/filters.d.ts +8 -0
  129. package/dist/plus/integrations/reads/filters.js +2 -1
  130. package/dist/plus/integrations/reads/filters.js.map +1 -1
  131. package/dist/plus/integrations/reads/hierarchy.js +3 -3
  132. package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
  133. package/dist/plus/integrations/reads/issueBatch.d.ts +47 -16
  134. package/dist/plus/integrations/reads/issueBatch.js +55 -87
  135. package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
  136. package/dist/plus/integrations/reads/issueTracker.d.ts +10 -2
  137. package/dist/plus/integrations/reads/issueTracker.js +23 -6
  138. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  139. package/dist/plus/integrations/reads/issues.d.ts +1 -1
  140. package/dist/plus/integrations/reads/issues.js +4 -4
  141. package/dist/plus/integrations/reads/issues.js.map +1 -1
  142. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +44 -6
  143. package/dist/plus/integrations/reads/pullRequestBatch.js +31 -34
  144. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  145. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +5 -2
  146. package/dist/plus/integrations/reads/pullRequestBranches.js +4 -3
  147. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  148. package/dist/plus/integrations/reads/pullRequests.js +8 -4
  149. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  150. package/dist/plus/integrations/reads/sweeps.js +8 -4
  151. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  152. package/dist/plus/integrations/reads/warnings.d.ts +23 -8
  153. package/dist/plus/integrations/reads/warnings.js +43 -19
  154. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  155. package/dist/plus/integrations/results.d.ts +12 -4
  156. package/dist/plus/integrations/results.js +2 -0
  157. package/dist/plus/integrations/results.js.map +1 -1
  158. package/docs/integrations.md +389 -23
  159. package/docs/kepler-read-api-parity.md +16 -2
  160. package/package.json +2 -2
@@ -0,0 +1,94 @@
1
+ //#region ../plus/integrations/src/providers/linearIssuesEtag.ts
2
+ const linearGraphQLUrl = "https://api.linear.app/graphql";
3
+ /** The most issue numbers one cheap check asks of one team. */
4
+ const linearIssuesEtagMaxNumbers = 50;
5
+ /**
6
+ * Archived issues are left out of Linear's `issues` connection unless asked for, so `includeArchived` keeps an archived
7
+ * issue answerable here as the full read's `issue(id:)` answers it.
8
+ */
9
+ const linearIssuesEtagQuery = `
10
+ query GetIssuesEtagFields($teamKey: String!, $numbers: [Float!]!) {
11
+ issues(
12
+ first: 50
13
+ includeArchived: true
14
+ filter: { team: { key: { eq: $teamKey } }, number: { in: $numbers } }
15
+ ) {
16
+ pageInfo {
17
+ hasNextPage
18
+ }
19
+ nodes {
20
+ identifier
21
+ number
22
+ updatedAt
23
+ archivedAt
24
+ state {
25
+ type
26
+ }
27
+ }
28
+ }
29
+ }
30
+ `;
31
+ /**
32
+ * The cheap check behind the batch issue read's etags: the change state of up to {@link linearIssuesEtagMaxNumbers}
33
+ * issues of one team in ONE GraphQL request, where the full read sends provider-apis' `issue(id:)` once per issue.
34
+ * Linear returns only the issues it found, in its own order, so a caller matches them by number, never by position.
35
+ *
36
+ * Sent as provider-apis sends every Linear request: the token as the whole `Authorization` header, with no scheme.
37
+ * GraphQL `errors` reject the whole request, as provider-apis rejects them, but keep the response so a throttling
38
+ * code is still classified as one. A next page also rejects it: with every number unique within a team, more
39
+ * issues than were asked for means the filter was not applied as written.
40
+ */
41
+ async function requestLinearIssuesEtagFields(request, accessToken, teamKey, numbers) {
42
+ const response = await request({
43
+ url: linearGraphQLUrl,
44
+ method: "POST",
45
+ headers: {
46
+ Authorization: accessToken,
47
+ "Content-Type": "application/json"
48
+ },
49
+ body: JSON.stringify({
50
+ query: linearIssuesEtagQuery,
51
+ variables: {
52
+ teamKey,
53
+ numbers
54
+ }
55
+ })
56
+ });
57
+ const body = response.body;
58
+ if (body?.errors != null) {
59
+ const error = /* @__PURE__ */ new Error(`Linear GraphQL errors: ${JSON.stringify(body.errors)}`);
60
+ Object.assign(error, { response });
61
+ throw error;
62
+ }
63
+ const issues = body?.data?.issues;
64
+ if (!Array.isArray(issues?.nodes)) throw new Error("Linear returned no issues");
65
+ if (issues.pageInfo?.hasNextPage !== false) throw new Error("Linear returned more issues than were asked for");
66
+ return issues.nodes;
67
+ }
68
+ /**
69
+ * A cheap-checked issue's change state, as the fields the full row's etag reads. The full read's row is provider-apis'
70
+ * Linear issue normalizer (0.61.0) then `fromProviderIssue`, so this mirrors both:
71
+ *
72
+ * - provider-apis maps `state.type` to a category — `completed` and `canceled` to `DONE`, `started` to `IN_PROGRESS`,
73
+ * anything else (`backlog`, `unstarted`, `triage`) to `TO_DO`, and no state to none — and sets `closedDate` from
74
+ * `archivedAt` (a falsy value reads as none);
75
+ * - `fromProviderIssue` closes an issue that has a `closedDate` or a `DONE` category, so an archived issue is closed
76
+ * whatever its state.
77
+ *
78
+ * Throws on a missing or unparseable `updatedAt`, so the target falls through to the full read rather than matching an
79
+ * etag the full row would compute from a fallback date (`fromProviderIssue` falls back to `closedDate`, then
80
+ * `createdDate`).
81
+ */
82
+ function toLinearIssueEtagFields(issue) {
83
+ const updatedDate = new Date(issue.updatedAt || NaN);
84
+ if (Number.isNaN(updatedDate.getTime())) throw new Error(`Linear returned no update time for ${issue.identifier}`);
85
+ const type = issue.state?.type;
86
+ return {
87
+ state: Boolean(issue.archivedAt) || type === "completed" || type === "canceled" ? "closed" : "opened",
88
+ updatedDate
89
+ };
90
+ }
91
+ //#endregion
92
+ export { linearIssuesEtagMaxNumbers, requestLinearIssuesEtagFields, toLinearIssueEtagFields };
93
+
94
+ //# sourceMappingURL=linearIssuesEtag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linearIssuesEtag.js","names":[],"sources":["../../../../../plus/integrations/src/providers/linearIssuesEtag.ts"],"sourcesContent":["import type { IssueEtagFields } from '../models/integration.js';\nimport type { ProviderRequestFunction } from './models.js';\n\nconst linearGraphQLUrl = 'https://api.linear.app/graphql';\n\n/** The most issue numbers one cheap check asks of one team. */\nexport const linearIssuesEtagMaxNumbers = 50;\n\n/**\n * Archived issues are left out of Linear's `issues` connection unless asked for, so `includeArchived` keeps an archived\n * issue answerable here as the full read's `issue(id:)` answers it.\n */\nconst linearIssuesEtagQuery = `\n\tquery GetIssuesEtagFields($teamKey: String!, $numbers: [Float!]!) {\n\t\tissues(\n\t\t\tfirst: ${linearIssuesEtagMaxNumbers}\n\t\t\tincludeArchived: true\n\t\t\tfilter: { team: { key: { eq: $teamKey } }, number: { in: $numbers } }\n\t\t) {\n\t\t\tpageInfo {\n\t\t\t\thasNextPage\n\t\t\t}\n\t\t\tnodes {\n\t\t\t\tidentifier\n\t\t\t\tnumber\n\t\t\t\tupdatedAt\n\t\t\t\tarchivedAt\n\t\t\t\tstate {\n\t\t\t\t\ttype\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n`;\n\nexport type LinearIssueEtagNode = {\n\tidentifier: string;\n\tnumber: number;\n\tupdatedAt?: string | null;\n\tarchivedAt?: string | null;\n\tstate?: { type?: string | null } | null;\n};\n\ntype LinearIssuesEtagResponse = {\n\tdata?: {\n\t\tissues?: { pageInfo?: { hasNextPage?: boolean }; nodes?: LinearIssueEtagNode[] } | null;\n\t} | null;\n\terrors?: unknown[];\n};\n\n/**\n * The cheap check behind the batch issue read's etags: the change state of up to {@link linearIssuesEtagMaxNumbers}\n * issues of one team in ONE GraphQL request, where the full read sends provider-apis' `issue(id:)` once per issue.\n * Linear returns only the issues it found, in its own order, so a caller matches them by number, never by position.\n *\n * Sent as provider-apis sends every Linear request: the token as the whole `Authorization` header, with no scheme.\n * GraphQL `errors` reject the whole request, as provider-apis rejects them, but keep the response so a throttling\n * code is still classified as one. A next page also rejects it: with every number unique within a team, more\n * issues than were asked for means the filter was not applied as written.\n */\nexport async function requestLinearIssuesEtagFields(\n\trequest: ProviderRequestFunction,\n\taccessToken: string,\n\tteamKey: string,\n\tnumbers: readonly number[],\n): Promise<LinearIssueEtagNode[]> {\n\tconst response = await request<LinearIssuesEtagResponse | null>({\n\t\turl: linearGraphQLUrl,\n\t\tmethod: 'POST',\n\t\theaders: { Authorization: accessToken, 'Content-Type': 'application/json' },\n\t\tbody: JSON.stringify({ query: linearIssuesEtagQuery, variables: { teamKey: teamKey, numbers: numbers } }),\n\t});\n\n\tconst body = response.body;\n\tif (body?.errors != null) {\n\t\tconst error = new Error(`Linear GraphQL errors: ${JSON.stringify(body.errors)}`);\n\t\tObject.assign(error, { response: response });\n\t\tthrow error;\n\t}\n\n\tconst issues = body?.data?.issues;\n\tif (!Array.isArray(issues?.nodes)) throw new Error('Linear returned no issues');\n\tif (issues.pageInfo?.hasNextPage !== false) throw new Error('Linear returned more issues than were asked for');\n\n\treturn issues.nodes;\n}\n\n/**\n * A cheap-checked issue's change state, as the fields the full row's etag reads. The full read's row is provider-apis'\n * Linear issue normalizer (0.61.0) then `fromProviderIssue`, so this mirrors both:\n *\n * - provider-apis maps `state.type` to a category — `completed` and `canceled` to `DONE`, `started` to `IN_PROGRESS`,\n * anything else (`backlog`, `unstarted`, `triage`) to `TO_DO`, and no state to none — and sets `closedDate` from\n * `archivedAt` (a falsy value reads as none);\n * - `fromProviderIssue` closes an issue that has a `closedDate` or a `DONE` category, so an archived issue is closed\n * whatever its state.\n *\n * Throws on a missing or unparseable `updatedAt`, so the target falls through to the full read rather than matching an\n * etag the full row would compute from a fallback date (`fromProviderIssue` falls back to `closedDate`, then\n * `createdDate`).\n */\nexport function toLinearIssueEtagFields(issue: LinearIssueEtagNode): IssueEtagFields {\n\tconst updatedDate = new Date(issue.updatedAt || Number.NaN);\n\tif (Number.isNaN(updatedDate.getTime())) {\n\t\tthrow new Error(`Linear returned no update time for ${issue.identifier}`);\n\t}\n\n\tconst type = issue.state?.type;\n\tconst closed = Boolean(issue.archivedAt) || type === 'completed' || type === 'canceled';\n\treturn { state: closed ? 'closed' : 'opened', updatedDate: updatedDate };\n}\n"],"mappings":";AAGA,MAAM,mBAAmB;;AAGzB,MAAa,6BAA6B;;;;;AAM1C,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgD9B,eAAsB,8BACrB,SACA,aACA,SACA,SACiC;CACjC,MAAM,WAAW,MAAM,QAAyC;EAC/D,KAAK;EACL,QAAQ;EACR,SAAS;GAAE,eAAe;GAAa,gBAAgB;EAAmB;EAC1E,MAAM,KAAK,UAAU;GAAE,OAAO;GAAuB,WAAW;IAAW;IAAkB;GAAQ;EAAE,CAAC;CACzG,CAAC;CAED,MAAM,OAAO,SAAS;CACtB,IAAI,MAAM,UAAU,MAAM;EACzB,MAAM,wBAAQ,IAAI,MAAM,0BAA0B,KAAK,UAAU,KAAK,MAAM,GAAG;EAC/E,OAAO,OAAO,OAAO,EAAY,SAAS,CAAC;EAC3C,MAAM;CACP;CAEA,MAAM,SAAS,MAAM,MAAM;CAC3B,IAAI,CAAC,MAAM,QAAQ,QAAQ,KAAK,GAAG,MAAM,IAAI,MAAM,2BAA2B;CAC9E,IAAI,OAAO,UAAU,gBAAgB,OAAO,MAAM,IAAI,MAAM,iDAAiD;CAE7G,OAAO,OAAO;AACf;;;;;;;;;;;;;;;AAgBA,SAAgB,wBAAwB,OAA6C;CACpF,MAAM,cAAc,IAAI,KAAK,MAAM,aAAa,GAAU;CAC1D,IAAI,OAAO,MAAM,YAAY,QAAQ,CAAC,GACrC,MAAM,IAAI,MAAM,sCAAsC,MAAM,YAAY;CAGzE,MAAM,OAAO,MAAM,OAAO;CAE1B,OAAO;EAAE,OADM,QAAQ,MAAM,UAAU,KAAK,SAAS,eAAe,SAAS,aACpD,WAAW;EAAuB;CAAY;AACxE"}
@@ -2,15 +2,15 @@ import { PagedResult } from "../../../utils/paging.js";
2
2
  import { ProviderScope } from "../../../git/models/resourceDescriptor.js";
3
3
  import { Provider, ProviderReference } from "../../../git/models/remoteProvider.js";
4
4
  import { IssueOrPullRequestState } from "../../../git/models/issueOrPullRequest.js";
5
- import { Issue as Issue$1, IssueProject, IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship, IssueShape, IssueSortField, IssueSorting, IssueStateFilter } from "../../../git/models/issue.js";
6
- import { PullRequest, PullRequestFilter, PullRequestMergeableState, PullRequestRefs, PullRequestRepositoryIdentityDescriptor, PullRequestSearchCapabilities, PullRequestSearchCriteria, PullRequestSortField, PullRequestSorting, PullRequestStateFilter, PullRequestStatusCheckRollupState } from "../../../git/models/pullRequest.js";
5
+ import { Issue as Issue$1, IssueProject, IssueProjection, IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship, IssueShape, IssueSortField, IssueSorting, IssueStateFilter } from "../../../git/models/issue.js";
6
+ import { PullRequest, PullRequestFilter, PullRequestMergeableState, PullRequestProjection, PullRequestRefs, PullRequestRepositoryIdentityDescriptor, PullRequestSearchCapabilities, PullRequestSearchCriteria, PullRequestSortField, PullRequestSorting, PullRequestStateFilter, PullRequestStatusCheckRollupState } from "../../../git/models/pullRequest.js";
7
7
  import { Account as Account$1 } from "../../../git/models/author.js";
8
8
  import { IntegrationIds } from "../constants.js";
9
- import { IssueFilter } from "../providerFilters.js";
10
9
  import { ProviderOrganization, ProviderRepositoryShape } from "../results.js";
11
- import { Integration, IntegrationType } from "../models/integration.js";
10
+ import { IssueFilter } from "../providerFilters.js";
12
11
  import { ProviderPullRequestReviews } from "./pullRequestReviews.js";
13
- import { Account, ActionablePullRequest, AnyEntityIdentifierInput, AzureDevOps, AzureOrganization, AzureProject, AzureSetPullRequestInput, Bitbucket, BitbucketServer, BitbucketWorkspaceStub, CollectionMetadata, CursorPageInput, EnterpriseOptions, GetRepoInput, GitBuildStatusState as GitBuildStatusState$1, GitHub, GitHubPullRequestFieldMap, GitIssueState as GitIssueState$1, GitLab, GitLabGroup, GitMergeStrategy, GitPullRequest, GitPullRequestMergeableState as GitPullRequestMergeableState$1, GitPullRequestReviewState as GitPullRequestReviewState$1, GitPullRequestState as GitPullRequestState$1, GitRepository, Issue, Jira, JiraProject, JiraResource, JiraServer, JiraServerProject, Linear, LinearOrganization, LinearTeam, NumberedPageInput, Organization, PullRequestWithUniqueID, RequestFunction, RequestOptions, Response, SetPullRequestInput, Trello } from "@gitkraken/provider-apis";
12
+ import { Integration, IntegrationType } from "../models/integration.js";
13
+ import { Account, ActionablePullRequest, AnyEntityIdentifierInput, AzureDevOps, AzureOrganization, AzureProject, AzureSetPullRequestInput, Bitbucket, BitbucketServer, BitbucketWorkspaceStub, CollectionMetadata, CursorPageInput, EnterpriseOptions, GetRepoInput, GitBuildStatus, GitBuildStatusState as GitBuildStatusState$1, GitHub, GitHubPullRequestFieldMap, GitIssueState as GitIssueState$1, GitLab, GitLabGroup, GitMergeStrategy, GitPullRequest, GitPullRequestMergeableState as GitPullRequestMergeableState$1, GitPullRequestReviewState as GitPullRequestReviewState$1, GitPullRequestState as GitPullRequestState$1, GitRepository, Issue, Jira, JiraProject, JiraResource, JiraServer, JiraServerProject, Linear, LinearOrganization, LinearTeam, NumberedPageInput, Organization, PullRequestWithUniqueID, RequestFunction, RequestOptions, Response, SetPullRequestInput, Trello } from "@gitkraken/provider-apis";
14
14
  //#region ../plus/integrations/src/providers/models.d.ts
15
15
  type GitBuildStatusState = GitBuildStatusState$1;
16
16
  type GitIssueState = GitIssueState$1;
@@ -77,8 +77,13 @@ export type ProviderRepoInput = GetRepoInput;
77
77
  * from the parameter type.
78
78
  */
79
79
  export declare function isRepoIdsInput(input: unknown): input is (string | number)[];
80
- export type ProviderPullRequest = Omit<GitPullRequest, 'reviews'> & {
80
+ /**
81
+ * provider-apis' pull request. `mergeableState` is optional because {@link toProviderPullRequest} also converts
82
+ * GitLens' own rows, and a read that didn't select it has none to give.
83
+ */
84
+ export type ProviderPullRequest = Omit<GitPullRequest, 'reviews' | 'mergeableState'> & {
81
85
  reviews: ProviderPullRequestReviews;
86
+ mergeableState?: GitPullRequestMergeableState;
82
87
  };
83
88
  export type ProviderRepository = GitRepository;
84
89
  export type ProviderIssue = Issue;
@@ -98,7 +103,7 @@ export type ProviderGitLabGroup = GitLabGroup;
98
103
  * so an id alone is never safe for deduplication across a multi-repository fan-out. Repository identity wins
99
104
  * when available so the same row still deduplicates when a later facet adds or removes its URL.
100
105
  */
101
- export declare function getProviderPullRequestIdentity(pr: Pick<ProviderPullRequest, 'id' | 'repository' | 'url'>): string | undefined;
106
+ export declare function getProviderPullRequestIdentity(pr: Pick<ProviderPullRequest, 'id' | 'repository' | 'url'> | Pick<PullRequest, 'id' | 'repository' | 'url'>): string | undefined;
102
107
  export type ProviderHierarchyResult<T> = PagedResult<T> & {
103
108
  readonly truncated?: boolean;
104
109
  /**
@@ -367,6 +372,8 @@ export type GetIssuesForCurrentUserInput = PagingInput & {
367
372
  assigneeUsername?: string;
368
373
  authorUsername?: string;
369
374
  pageSize?: number;
375
+ /** Linear only (GitLab's REST read has its own `state`, not threaded here). Omitted reads open issues. */
376
+ states?: GitIssueState[];
370
377
  /** See {@link GetIssuesOptions.sort}. */
371
378
  sort?: IssueSorting;
372
379
  };
@@ -440,6 +447,7 @@ export type GetLinearIssuesFn = (input: {
440
447
  teams?: string[];
441
448
  projects?: string[];
442
449
  labels?: string[];
450
+ states?: GitIssueState[];
443
451
  } & PagingInput, options?: EnterpriseOptions) => Promise<{
444
452
  data: ProviderIssue[];
445
453
  pageInfo?: PageInfo;
@@ -661,6 +669,16 @@ export interface ProviderMetadata {
661
669
  * honor, which is what makes intersecting against it sufficient.
662
670
  */
663
671
  supportedAccountWideIssueSorts?: IssueSorting[];
672
+ /**
673
+ * Whether an issue tracker's reads (the project-scoped read, which is `listIssueTrackerIssuesPage`, and its
674
+ * account-wide read) can be asked for a `state` other than open, and honor it server-side.
675
+ *
676
+ * A tracker read is open-only unless asked otherwise, so absent does not mean the read returns every state: it
677
+ * means only `'open'` is expressible, and `'closed'`/`'all'` are refused rather than served as the open list.
678
+ * Server-side, because each read drains to a page backstop: dropping states afterwards would let a project full
679
+ * of done work spend that budget before reaching the open issues.
680
+ */
681
+ supportsIssueStates?: boolean;
664
682
  /**
665
683
  * What the provider's FILTERED issue search (`searchIssuesPage`, and the `countIssues` probe over the same
666
684
  * criteria) can express server-side. A third, wider surface than either filter set above: it is not bound to
@@ -697,6 +715,7 @@ export declare const providersMetadata: ProvidersMetadata;
697
715
  export declare function getReasonsForUserIssue(issue: ProviderIssue, userLogin: string): string[];
698
716
  export declare function toIssueShape(issue: ProviderIssue, provider: ProviderReference, options?: {
699
717
  reliableStateCategory?: boolean;
718
+ projection?: IssueProjection;
700
719
  }): IssueShape | undefined;
701
720
  /**
702
721
  * Maps a raw provider-apis {@link ProviderRepository} to the GitLens-owned {@link ProviderRepositoryShape}
@@ -724,6 +743,13 @@ export declare const fromProviderBuildStatusState: {
724
743
  [GitBuildStatusState.Running]: undefined;
725
744
  [GitBuildStatusState.Warning]: undefined;
726
745
  };
746
+ /** Rolls every check context up into one state, the way a provider's own rollup does: failed, errored, or
747
+ * action-required fails; else pending or running is pending; else success — reading only the first context
748
+ * would call a pull request passing on the strength of whichever check happens to come back first. States
749
+ * carrying no verdict (cancelled, skipped, optional action required, warning) don't vote. Reads the raw
750
+ * state rather than `fromProviderBuildStatusState`, which drops errored and running to `undefined` and
751
+ * would let a lone success outvote a check still in flight. */
752
+ export declare function toStatusCheckRollupState(statuses: GitBuildStatus[] | null | undefined): PullRequestStatusCheckRollupState | undefined;
727
753
  export declare const toProviderPullRequestMergeableState: {
728
754
  Mergeable: GitPullRequestMergeableState$1;
729
755
  Conflicting: GitPullRequestMergeableState$1;
@@ -746,7 +772,12 @@ export declare function fromProviderPullRequestState(state: GitPullRequestState)
746
772
  type PullRequestStateInput = IssueOrPullRequestState | PullRequestStateFilter;
747
773
  /** Maps PR include/state filters to the SDK's `states` input. `undefined`/omitted preserves the open-only default. */
748
774
  export declare function toProviderPullRequestStates(state: PullRequestStateInput | PullRequestStateInput[] | undefined): GitPullRequestState[] | undefined;
749
- /** Maps an issue state filter to the SDK's `states` input. `undefined`/omitted preserves the open-only default. */
775
+ /**
776
+ * Maps an issue state filter to the SDK's `states` input. `undefined`/omitted preserves the open-only default.
777
+ *
778
+ * Throws on any other value, which only an untyped caller can pass: read as omitted it would serve open issues as
779
+ * the state that was asked for. Called before a read's first request, so the throw refuses the whole read.
780
+ */
750
781
  export declare function toProviderIssueStates(state: IssueStateFilter | undefined): GitIssueState[] | undefined;
751
782
  /**
752
783
  * Resolves a normalized {@link ProviderScope} to the provider-appropriate read inputs, dispatching on the
@@ -770,9 +801,40 @@ export declare function fromProviderPullRequest(pr: ProviderPullRequest, provide
770
801
  id: string;
771
802
  username?: string;
772
803
  };
804
+ projection?: PullRequestProjection;
805
+ }): PullRequest;
806
+ /**
807
+ * A GitLens-native row (GitHub's own reads) tagged for the read that returned it, with `authoredByMe` and `viewer`
808
+ * resolved by the same rule {@link fromProviderPullRequest} applies. Returns a copy: the mapper's row stays as it was
809
+ * built.
810
+ */
811
+ export declare function stampNativePullRequest(pr: PullRequest, options: {
812
+ currentAccount?: {
813
+ id: string;
814
+ username?: string;
815
+ };
816
+ projection?: PullRequestProjection;
773
817
  }): PullRequest;
818
+ /**
819
+ * A row of an account-wide read as a `PullRequest`. GitHub's are GitLens-native, which {@link stampNativePullRequest}
820
+ * tags; every other host's are provider-apis', which {@link fromProviderPullRequest} converts.
821
+ */
822
+ export declare function toPullRequestRow(pr: ProviderPullRequest | PullRequest, provider: Provider, options: {
823
+ currentAccount?: {
824
+ id: string;
825
+ username?: string;
826
+ };
827
+ projection?: PullRequestProjection;
828
+ }): PullRequest;
829
+ /**
830
+ * By shape rather than by class, which a second copy of the model module fails: a native row is a `'pullrequest'` that
831
+ * names its provider, which provider-apis' rows never do. Both, so a key provider-apis adds later can't reroute its
832
+ * rows.
833
+ */
834
+ export declare function isNativePullRequest(pr: ProviderPullRequest | PullRequest): pr is PullRequest;
774
835
  export declare function fromProviderIssue(issue: ProviderIssue, integration: Integration, options?: {
775
836
  project?: IssueProject;
837
+ projection?: IssueProjection;
776
838
  }): Issue$1;
777
839
  export declare function toProviderPullRequestWithUniqueId(pr: PullRequest): PullRequestWithUniqueID;
778
840
  export type ProviderActionablePullRequest = ActionablePullRequest;
@@ -78,7 +78,7 @@ function getProviderPullRequestIdentity(pr) {
78
78
  const owner = typeof repository.owner === "string" ? repository.owner : repository.owner?.login;
79
79
  const repositoryId = repository.id != null ? String(repository.id).trim() : "";
80
80
  if (repositoryId !== "") return `repository:${repositoryId}:pull-request:${pr.id}`;
81
- const name = repository.name?.trim() ?? "";
81
+ const name = (repository.name ?? repository.repo)?.trim() ?? "";
82
82
  const namespace = (repository.namespace ?? owner)?.trim() ?? "";
83
83
  const project = repository.project?.trim() ?? "";
84
84
  if (name !== "" && (namespace !== "" || project !== "")) return `repository:${namespace}/${project}/${name}:pull-request:${pr.id}`;
@@ -515,7 +515,8 @@ const providersMetadata = {
515
515
  "assignee",
516
516
  "mention"
517
517
  ],
518
- supportedIssueSorts: jiraIssueSorts
518
+ supportedIssueSorts: jiraIssueSorts,
519
+ supportsIssueStates: true
519
520
  },
520
521
  ["jira-server"]: {
521
522
  domain: "",
@@ -529,7 +530,8 @@ const providersMetadata = {
529
530
  "assignee",
530
531
  "mention"
531
532
  ],
532
- supportedIssueSorts: jiraIssueSorts
533
+ supportedIssueSorts: jiraIssueSorts,
534
+ supportsIssueStates: true
533
535
  },
534
536
  ["linear"]: {
535
537
  domain: "linear.app",
@@ -539,7 +541,8 @@ const providersMetadata = {
539
541
  iconKey: "linear",
540
542
  scopes: [],
541
543
  supportedIssueFilters: ["assignee"],
542
- supportedIssueSorts: linearIssueSorts
544
+ supportedIssueSorts: linearIssueSorts,
545
+ supportsIssueStates: true
543
546
  },
544
547
  ["trello"]: {
545
548
  domain: "trello.com",
@@ -617,7 +620,7 @@ function toIssueShape(issue, provider, options) {
617
620
  repository: issue.repository?.owner?.login != null ? {
618
621
  owner: issue.repository.owner.login,
619
622
  repo: issue.repository.name,
620
- id: issue.repository.id
623
+ id: issue.repository.id || void 0
621
624
  } : void 0,
622
625
  labels: issue.labels.map((label) => ({
623
626
  color: label.color ?? void 0,
@@ -628,7 +631,8 @@ function toIssueShape(issue, provider, options) {
628
631
  body: issue.description ?? void 0,
629
632
  bodyFormat: isJira ? "jira-wiki" : void 0,
630
633
  issueType: issue.type ?? void 0,
631
- iterations: toIssueIterations(issue)
634
+ iterations: toIssueIterations(issue),
635
+ ...options?.projection != null ? { projection: options.projection } : {}
632
636
  };
633
637
  }
634
638
  function toIssueIterations(issue) {
@@ -760,13 +764,19 @@ function toProviderPullRequestStates(state) {
760
764
  const states = (Array.isArray(state) ? state : [state]).flatMap((s) => toProviderPullRequestStatesCore(s));
761
765
  return states.length > 0 ? [...new Set(states)] : void 0;
762
766
  }
763
- /** Maps an issue state filter to the SDK's `states` input. `undefined`/omitted preserves the open-only default. */
767
+ /**
768
+ * Maps an issue state filter to the SDK's `states` input. `undefined`/omitted preserves the open-only default.
769
+ *
770
+ * Throws on any other value, which only an untyped caller can pass: read as omitted it would serve open issues as
771
+ * the state that was asked for. Called before a read's first request, so the throw refuses the whole read.
772
+ */
764
773
  function toProviderIssueStates(state) {
765
774
  switch (state) {
775
+ case void 0: return;
766
776
  case "open": return [GitIssueState.Open];
767
777
  case "closed": return [GitIssueState.Closed];
768
778
  case "all": return [GitIssueState.Open, GitIssueState.Closed];
769
- default: return;
779
+ default: throw new Error(`Unknown issue state; expected one of open, closed, all`);
770
780
  }
771
781
  }
772
782
  /**
@@ -820,7 +830,7 @@ function toProviderPullRequest(pr) {
820
830
  commentCount: pr.commentsCount ?? null,
821
831
  upvoteCount: pr.thumbsUpCount ?? null,
822
832
  commitCount: pr.commitCount ?? null,
823
- fileCount: null,
833
+ fileCount: pr.filesChanged ?? null,
824
834
  additions: pr.additions ?? null,
825
835
  deletions: pr.deletions ?? null,
826
836
  author: toProviderAccount(pr.author),
@@ -863,10 +873,10 @@ function toProviderPullRequest(pr) {
863
873
  url: ""
864
874
  }] } : null,
865
875
  permissions: pr.viewerCanUpdate == null ? null : {
866
- canMerge: pr.viewerCanUpdate === true && pr.repository.accessLevel != null && pr.repository.accessLevel >= 30,
876
+ canMerge: pr.viewerCanUpdate === true && (pr.repository.accessLevel == null || pr.repository.accessLevel >= 30),
867
877
  canMergeAndBypassProtections: pr.viewerCanUpdate === true && pr.repository.accessLevel != null && pr.repository.accessLevel >= 100
868
878
  },
869
- mergeableState: pr.mergeableState ? toProviderPullRequestMergeableState[pr.mergeableState] : GitPullRequestMergeableState.Unknown
879
+ mergeableState: pr.mergeableState ? toProviderPullRequestMergeableState[pr.mergeableState] : void 0
870
880
  };
871
881
  }
872
882
  function fromProviderPullRequest(pr, provider, options) {
@@ -879,8 +889,7 @@ function fromProviderPullRequest(pr, provider, options) {
879
889
  return new PullRequest(provider, fromProviderAccount(pr.author), pr.id, pr.graphQLId || pr.id, pr.title, pr.url ?? "", {
880
890
  owner: repositoryOwner,
881
891
  repo: repositoryName,
882
- accessLevel: 30,
883
- id: repository?.id ?? ""
892
+ id: repository?.id || void 0
884
893
  }, fromProviderPullRequestState(pr.state), pr.createdDate, pr.updatedDate, pr.closedDate ?? void 0, pr.mergedDate ?? void 0, pr.mergeableState ? fromProviderPullRequestMergeableState[pr.mergeableState] : void 0, pr.permissions?.canMerge || pr.permissions?.canMergeAndBypassProtections ? true : void 0, {
885
894
  base: {
886
895
  branch: pr.baseRef?.name ?? "",
@@ -904,7 +913,35 @@ function fromProviderPullRequest(pr, provider, options) {
904
913
  isFork: headRepository?.isFork
905
914
  },
906
915
  isCrossRepository: pr.isCrossRepository
907
- }, pr.isDraft, pr.additions ?? void 0, pr.deletions ?? void 0, pr.commentCount ?? void 0, pr.upvoteCount ?? void 0, pr.reviewDecision ? fromPullRequestReviewDecision[pr.reviewDecision] : void 0, toReviewRequests(pr.reviews), toCompletedReviews(pr.reviews), pr.assignees?.map(fromProviderAccount) ?? void 0, toStatusCheckRollupState(pr.headCommit?.buildStatuses), options?.project, pr.version, pr.commitCount ?? void 0, void 0, pr.fileCount ?? void 0, pr.description ?? void 0, pr.number, options?.currentAccount != null ? authoredByCurrentAccount(pr, provider, options.currentAccount) : void 0);
916
+ }, pr.isDraft, pr.additions ?? void 0, pr.deletions ?? void 0, pr.commentCount ?? void 0, pr.upvoteCount ?? void 0, pr.reviewDecision ? fromPullRequestReviewDecision[pr.reviewDecision] : void 0, toReviewRequests(pr.reviews), toCompletedReviews(pr.reviews), pr.assignees?.map(fromProviderAccount) ?? void 0, toStatusCheckRollupState(pr.headCommit?.buildStatuses), options?.project, pr.version, pr.commitCount ?? void 0, void 0, pr.fileCount ?? void 0, pr.description ?? void 0, pr.number, options?.currentAccount != null ? authoredByCurrentAccount(pr.author, provider, options.currentAccount) : void 0, options?.projection, options?.currentAccount);
917
+ }
918
+ /**
919
+ * A GitLens-native row (GitHub's own reads) tagged for the read that returned it, with `authoredByMe` and `viewer`
920
+ * resolved by the same rule {@link fromProviderPullRequest} applies. Returns a copy: the mapper's row stays as it was
921
+ * built.
922
+ */
923
+ function stampNativePullRequest(pr, options) {
924
+ return Object.assign(Object.create(PullRequest.prototype), pr, {
925
+ authoredByMe: options.currentAccount != null ? authoredByCurrentAccount(pr.author, pr.provider, options.currentAccount) : void 0,
926
+ viewer: options.currentAccount,
927
+ projection: options.projection
928
+ });
929
+ }
930
+ /**
931
+ * A row of an account-wide read as a `PullRequest`. GitHub's are GitLens-native, which {@link stampNativePullRequest}
932
+ * tags; every other host's are provider-apis', which {@link fromProviderPullRequest} converts.
933
+ */
934
+ function toPullRequestRow(pr, provider, options) {
935
+ return isNativePullRequest(pr) ? stampNativePullRequest(pr, options) : fromProviderPullRequest(pr, provider, options);
936
+ }
937
+ /**
938
+ * By shape rather than by class, which a second copy of the model module fails: a native row is a `'pullrequest'` that
939
+ * names its provider, which provider-apis' rows never do. Both, so a key provider-apis adds later can't reroute its
940
+ * rows.
941
+ */
942
+ function isNativePullRequest(pr) {
943
+ const row = pr;
944
+ return row.type === "pullrequest" && row.provider != null && typeof row.provider === "object";
908
945
  }
909
946
  /**
910
947
  * GitLens' own GitHub GraphQL client keys people by login, while the current account's `id` is GitHub's
@@ -912,9 +949,9 @@ function fromProviderPullRequest(pr, provider, options) {
912
949
  * GitHub row shape, so the username fallback is safe there; elsewhere `toProviderAccount` fills `username`
913
950
  * from a display name that two people can share, so only GitHub and GitHub Enterprise get the fallback.
914
951
  */
915
- function authoredByCurrentAccount(pr, provider, currentAccount) {
916
- if (pr.author?.id === currentAccount.id) return true;
917
- return (provider.id === "github" || provider.id === "cloud-github-enterprise") && currentAccount.username != null && pr.author?.username === currentAccount.username;
952
+ function authoredByCurrentAccount(author, provider, currentAccount) {
953
+ if (author?.id === currentAccount.id) return true;
954
+ return (provider.id === "github" || provider.id === "cloud-github-enterprise") && currentAccount.username != null && author?.username === currentAccount.username;
918
955
  }
919
956
  function fromProviderIssue(issue, integration, options) {
920
957
  const identifier = toIssueIdentifier(issue.number);
@@ -922,7 +959,7 @@ function fromProviderIssue(issue, integration, options) {
922
959
  return new Issue(integration, identifier, issue.graphQLId ?? issue.id, issue.title, issue.url ?? "", issue.createdDate, issue.updatedDate ?? issue.closedDate ?? issue.createdDate, closed, closed ? "closed" : "opened", fromProviderAccount(issue.author), issue.assignees?.map(fromProviderAccount) ?? void 0, issue.repository != null ? {
923
960
  owner: issue.repository.owner.login ?? "",
924
961
  repo: issue.repository.name,
925
- id: issue.repository.id
962
+ id: issue.repository.id || void 0
926
963
  } : void 0, issue.closedDate ?? void 0, issue.labels?.map((label) => ({
927
964
  name: label.name,
928
965
  color: label.color ?? void 0
@@ -936,12 +973,13 @@ function fromProviderIssue(issue, integration, options) {
936
973
  name: issue.project.name,
937
974
  resourceId: issue.project.resourceId,
938
975
  resourceName: issue.project.namespace
939
- } : void 0, identifier, issue.type ?? void 0, toIssueProviderState(issue.state, integration.id !== "jira"), integration.id === "jira" ? "jira-wiki" : void 0, toIssueIterations(issue));
976
+ } : void 0, identifier, issue.type ?? void 0, toIssueProviderState(issue.state, integration.id !== "jira"), integration.id === "jira" ? "jira-wiki" : void 0, toIssueIterations(issue), options?.projection);
940
977
  }
941
978
  function toProviderPullRequestWithUniqueId(pr) {
942
- const { reviews, ...providerPr } = toProviderPullRequest(pr);
979
+ const { reviews, mergeableState, ...providerPr } = toProviderPullRequest(pr);
943
980
  return {
944
981
  ...providerPr,
982
+ mergeableState: mergeableState ?? (pr.provider.id === "bitbucket" ? GitPullRequestMergeableState.Mergeable : GitPullRequestMergeableState.Unknown),
945
983
  reviews: reviews?.filter((r) => r.state !== "DISMISSED") ?? null,
946
984
  uuid: EntityIdentifierUtils.encode(getEntityIdentifierInput(pr))
947
985
  };
@@ -965,6 +1003,6 @@ function supportsCodeSuggest(provider) {
965
1003
  return isGitHubDotCom(provider.domain);
966
1004
  }
967
1005
  //#endregion
968
- export { GitBuildStatusState, GitIssueState, GitPullRequestMergeableState, GitPullRequestReviewState, GitPullRequestState, IssueFilter, PagingMode, ProviderBuildStatusState, ProviderPullRequestReviewState, PullRequestFilter, fromProviderBuildStatusState, fromProviderIssue, fromProviderPullRequest, fromProviderPullRequestMergeableState, fromProviderPullRequestState, getActionablePullRequests, getProviderPullRequestIdentity, getReasonsForUserIssue, isAzureCloudDomain, isBitbucketCloudDomain, isGitHubDotCom, isGitLabDotCom, isRepoIdsInput, issueFilterToReason, providerPullRequestMatchesSearch, providersMetadata, resolveProviderScope, supportsCodeSuggest, toAccount, toIssueShape, toProviderBuildStatusState, toProviderIssueStates, toProviderPullRequest, toProviderPullRequestMergeableState, toProviderPullRequestState, toProviderPullRequestStates, toProviderPullRequestWithUniqueId, toProviderRepositoryShape };
1006
+ export { GitBuildStatusState, GitIssueState, GitPullRequestMergeableState, GitPullRequestReviewState, GitPullRequestState, IssueFilter, PagingMode, ProviderBuildStatusState, ProviderPullRequestReviewState, PullRequestFilter, fromProviderBuildStatusState, fromProviderIssue, fromProviderPullRequest, fromProviderPullRequestMergeableState, fromProviderPullRequestState, getActionablePullRequests, getProviderPullRequestIdentity, getReasonsForUserIssue, isAzureCloudDomain, isBitbucketCloudDomain, isGitHubDotCom, isGitLabDotCom, isNativePullRequest, isRepoIdsInput, issueFilterToReason, providerPullRequestMatchesSearch, providersMetadata, resolveProviderScope, stampNativePullRequest, supportsCodeSuggest, toAccount, toIssueShape, toProviderBuildStatusState, toProviderIssueStates, toProviderPullRequest, toProviderPullRequestMergeableState, toProviderPullRequestState, toProviderPullRequestStates, toProviderPullRequestWithUniqueId, toProviderRepositoryShape, toPullRequestRow, toStatusCheckRollupState };
969
1007
 
970
1008
  //# sourceMappingURL=models.js.map