@gitkraken/core-gitlens 0.5.111 → 0.5.113

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 (38) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/dist/plus/git-github/api/github.d.ts +6 -0
  3. package/dist/plus/git-github/api/github.d.ts.map +1 -1
  4. package/dist/plus/git-github/api/github.js +15 -4
  5. package/dist/plus/git-github/api/github.js.map +1 -1
  6. package/dist/plus/integrations/integrationService.d.ts +4 -0
  7. package/dist/plus/integrations/integrationService.d.ts.map +1 -1
  8. package/dist/plus/integrations/integrationService.js.map +1 -1
  9. package/dist/plus/integrations/manager.d.ts +17 -0
  10. package/dist/plus/integrations/manager.d.ts.map +1 -1
  11. package/dist/plus/integrations/models/gitHostIntegration.d.ts +18 -17
  12. package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
  13. package/dist/plus/integrations/models/gitHostIntegration.js +9 -0
  14. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  15. package/dist/plus/integrations/providers/github.d.ts +1 -0
  16. package/dist/plus/integrations/providers/github.d.ts.map +1 -1
  17. package/dist/plus/integrations/providers/github.js +1 -0
  18. package/dist/plus/integrations/providers/github.js.map +1 -1
  19. package/dist/plus/integrations/providers/models.d.ts +2 -1
  20. package/dist/plus/integrations/providers/models.d.ts.map +1 -1
  21. package/dist/plus/integrations/providers/models.js.map +1 -1
  22. package/dist/plus/integrations/reads/pullRequests.d.ts +6 -0
  23. package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -1
  24. package/dist/plus/integrations/reads/pullRequests.js +28 -40
  25. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  26. package/dist/plus/integrations/reads/searchPullRequests.d.ts +2 -0
  27. package/dist/plus/integrations/reads/searchPullRequests.d.ts.map +1 -1
  28. package/dist/plus/integrations/reads/searchPullRequests.js +1 -0
  29. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  30. package/package.json +2 -2
  31. package/src/plus/git-github/api/github.ts +28 -7
  32. package/src/plus/integrations/integrationService.ts +4 -0
  33. package/src/plus/integrations/manager.ts +17 -0
  34. package/src/plus/integrations/models/gitHostIntegration.ts +29 -18
  35. package/src/plus/integrations/providers/github.ts +2 -0
  36. package/src/plus/integrations/providers/models.ts +6 -0
  37. package/src/plus/integrations/reads/pullRequests.ts +51 -70
  38. package/src/plus/integrations/reads/searchPullRequests.ts +3 -0
@@ -48,6 +48,12 @@ export async function listPullRequestsPage(
48
48
  includeReviewRequested?: boolean;
49
49
  page?: number;
50
50
  cursor?: string;
51
+ /**
52
+ * Requests the lightweight row shape (see {@link IntegrationManager.listPullRequestsPage}). Opt-in
53
+ * only, and only on the repo-scoped branch: the account-wide branch has always read the lightweight
54
+ * shape and keeps doing so, so an explicit `false` does not widen it back to the full projection.
55
+ */
56
+ summary?: boolean;
51
57
  itemsPerPage?: number;
52
58
  forceSync?: boolean;
53
59
  connectionId?: string;
@@ -115,45 +121,49 @@ export async function listPullRequestsPage(
115
121
  );
116
122
  }
117
123
 
118
- const includeReviewRequested = accountWide ? (options.includeReviewRequested ?? false) : false;
119
- const { value, warning } = await runCaptured(
120
- options.providerId,
121
- domain,
122
- options.connectionId,
123
- () =>
124
- accountWide
125
- ? integration.getMyPullRequestsForUserResult(
126
- {
127
- state: options.states,
128
- cursor: cursor,
129
- includeReviewRequested: includeReviewRequested,
130
- filters: resolvedFilters.filters,
131
- summary: true,
132
- },
133
- options.connectionId,
134
- )
135
- : integration.getMyPullRequestsForReposResult(
136
- options.repos ?? [],
137
- // Forward `page`/`pageSize` alongside the cursor so PagingMode.Repo hosts (GitLab, Bitbucket,
138
- // Azure), whose per-repo cursor path ignores a synthesized page-number cursor, still honor the
139
- // requested page and page size instead of always returning page 1. `filters` scopes the read to
140
- // the current user (the core resolves the account for these), so it returns the user's PRs.
141
- {
142
- state: options.states,
143
- filters: resolvedFilters.filters,
144
- cursor: cursor,
145
- // The normalized `page`, so the number forwarded to the provider can't disagree with the
146
- // page-number cursor beside it — both are built from the same value. Only when the caller
147
- // asked for one: an omitted page is the provider's own first page.
148
- page: options.page != null ? page : undefined,
149
- pageSize: options.itemsPerPage,
150
- },
151
- options.connectionId,
152
- ),
153
- {
154
- warnOnMissingSession: warnOnMissingSessionForDomain(options.providerId, options.domain),
155
- },
156
- );
124
+ // Everything but the cursor, shared by the initial read and the drain's re-reads below so the two cannot
125
+ // drift. `summary` is the reason this matters beyond tidiness: a re-read that dropped it would both
126
+ // revert to the full payload — on the very path that issues the most requests — and return rows of a
127
+ // different shape than the first page, since a summary row reports `headCommit`/`commitCount` as absent.
128
+ // `summary` is pinned true here rather than forwarded: this branch has never had a full projection to
129
+ // fall back to (see the option's doc), so honoring an explicit `false` would promise a widening the read
130
+ // cannot deliver.
131
+ const accountWideInput = {
132
+ state: options.states,
133
+ includeReviewRequested: options.includeReviewRequested ?? false,
134
+ filters: resolvedFilters.filters,
135
+ summary: true,
136
+ };
137
+ // `filters` scopes the read to the current user (the core resolves the account for these), so it returns
138
+ // the user's PRs. `pageSize` rides along so PagingMode.Repo hosts (GitLab, Bitbucket, Azure), whose
139
+ // per-repo cursor path ignores a synthesized page-number cursor, honor the requested size.
140
+ const scopedInput = {
141
+ state: options.states,
142
+ filters: resolvedFilters.filters,
143
+ pageSize: options.itemsPerPage,
144
+ summary: options.summary,
145
+ };
146
+ const readPage = (pageCursor: string | undefined, requestedPage?: number) =>
147
+ runCaptured(
148
+ options.providerId,
149
+ domain,
150
+ options.connectionId,
151
+ () =>
152
+ accountWide
153
+ ? integration.getMyPullRequestsForUserResult(
154
+ { ...accountWideInput, cursor: pageCursor },
155
+ options.connectionId,
156
+ )
157
+ : integration.getMyPullRequestsForReposResult(
158
+ options.repos ?? [],
159
+ { ...scopedInput, cursor: pageCursor, page: requestedPage },
160
+ options.connectionId,
161
+ ),
162
+ {
163
+ warnOnMissingSession: warnOnMissingSessionForDomain(options.providerId, options.domain),
164
+ },
165
+ );
166
+ const { value, warning } = await readPage(cursor, options.page != null ? page : undefined);
157
167
 
158
168
  let items = value?.values ?? [];
159
169
  // Cursor-only account-wide reads start at page 1; a page-only request is advanced through opaque
@@ -180,37 +190,8 @@ export async function listPullRequestsPage(
180
190
  requestedPage: page,
181
191
  itemsPerPage: options.itemsPerPage,
182
192
  warnings: warnings,
183
- readPage: (cursor: string) =>
184
- runCaptured(
185
- options.providerId,
186
- domain,
187
- options.connectionId,
188
- () =>
189
- accountWide
190
- ? integration.getMyPullRequestsForUserResult(
191
- {
192
- state: options.states,
193
- cursor: cursor,
194
- includeReviewRequested: includeReviewRequested,
195
- filters: resolvedFilters.filters,
196
- summary: true,
197
- },
198
- options.connectionId,
199
- )
200
- : integration.getMyPullRequestsForReposResult(
201
- options.repos ?? [],
202
- {
203
- state: options.states,
204
- filters: resolvedFilters.filters,
205
- cursor: cursor,
206
- pageSize: options.itemsPerPage,
207
- },
208
- options.connectionId,
209
- ),
210
- {
211
- warnOnMissingSession: warnOnMissingSessionForDomain(options.providerId, options.domain),
212
- },
213
- ),
193
+ // A drain advances through provider continuations, so only the cursor positions these reads.
194
+ readPage: (cursor: string) => readPage(cursor),
214
195
  },
215
196
  );
216
197
  items = drained.items;
@@ -48,6 +48,8 @@ export async function searchPullRequestsPage(
48
48
  forceSync?: boolean;
49
49
  connectionId?: string;
50
50
  domain?: string;
51
+ /** See {@link IntegrationManager.searchPullRequestsPage}. */
52
+ summary?: boolean;
51
53
  },
52
54
  ): Promise<ProviderPagedResult<PullRequestShape>> {
53
55
  const page = Math.max(1, Math.trunc(options.page ?? 1));
@@ -142,6 +144,7 @@ export async function searchPullRequestsPage(
142
144
  criteria: options.criteria,
143
145
  cursor: cursor,
144
146
  pageSize: options.itemsPerPage,
147
+ summary: options.summary,
145
148
  },
146
149
  undefined,
147
150
  options.connectionId,