@gitkraken/core-gitlens 0.5.103 → 0.5.104

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 (94) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/git/models/issue.d.ts +78 -0
  3. package/dist/git/models/issue.d.ts.map +1 -1
  4. package/dist/git/models/issue.js.map +1 -1
  5. package/dist/plus/git-github/api/config.d.ts +12 -0
  6. package/dist/plus/git-github/api/config.d.ts.map +1 -1
  7. package/dist/plus/git-github/api/config.js +12 -1
  8. package/dist/plus/git-github/api/config.js.map +1 -1
  9. package/dist/plus/git-github/api/github.d.ts +77 -7
  10. package/dist/plus/git-github/api/github.d.ts.map +1 -1
  11. package/dist/plus/git-github/api/github.js +241 -120
  12. package/dist/plus/git-github/api/github.js.map +1 -1
  13. package/dist/plus/git-github/api/issueSearchQuery.d.ts +70 -0
  14. package/dist/plus/git-github/api/issueSearchQuery.d.ts.map +1 -0
  15. package/dist/plus/git-github/api/issueSearchQuery.js +143 -0
  16. package/dist/plus/git-github/api/issueSearchQuery.js.map +1 -0
  17. package/dist/plus/integrations/index.d.ts +2 -0
  18. package/dist/plus/integrations/index.d.ts.map +1 -1
  19. package/dist/plus/integrations/integrationService.d.ts +39 -2
  20. package/dist/plus/integrations/integrationService.d.ts.map +1 -1
  21. package/dist/plus/integrations/integrationService.js +17 -0
  22. package/dist/plus/integrations/integrationService.js.map +1 -1
  23. package/dist/plus/integrations/manager.d.ts +88 -2
  24. package/dist/plus/integrations/manager.d.ts.map +1 -1
  25. package/dist/plus/integrations/models/gitHostIntegration.d.ts +61 -3
  26. package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
  27. package/dist/plus/integrations/models/gitHostIntegration.js +51 -0
  28. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  29. package/dist/plus/integrations/models/integration.d.ts +3 -46
  30. package/dist/plus/integrations/models/integration.d.ts.map +1 -1
  31. package/dist/plus/integrations/models/integration.js.map +1 -1
  32. package/dist/plus/integrations/models/issueReads.d.ts +70 -0
  33. package/dist/plus/integrations/models/issueReads.d.ts.map +1 -0
  34. package/dist/plus/integrations/models/issueReads.js +2 -0
  35. package/dist/plus/integrations/models/issueReads.js.map +1 -0
  36. package/dist/plus/integrations/providerFilters.d.ts +10 -0
  37. package/dist/plus/integrations/providerFilters.d.ts.map +1 -1
  38. package/dist/plus/integrations/providers/github.d.ts +26 -3
  39. package/dist/plus/integrations/providers/github.d.ts.map +1 -1
  40. package/dist/plus/integrations/providers/github.js +34 -0
  41. package/dist/plus/integrations/providers/github.js.map +1 -1
  42. package/dist/plus/integrations/providers/models.d.ts +22 -0
  43. package/dist/plus/integrations/providers/models.d.ts.map +1 -1
  44. package/dist/plus/integrations/providers/models.js +26 -0
  45. package/dist/plus/integrations/providers/models.js.map +1 -1
  46. package/dist/plus/integrations/reads/broaden.d.ts +10 -0
  47. package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
  48. package/dist/plus/integrations/reads/broaden.js.map +1 -1
  49. package/dist/plus/integrations/reads/counts.d.ts +64 -0
  50. package/dist/plus/integrations/reads/counts.d.ts.map +1 -0
  51. package/dist/plus/integrations/reads/counts.js +164 -0
  52. package/dist/plus/integrations/reads/counts.js.map +1 -0
  53. package/dist/plus/integrations/reads/filters.d.ts +63 -1
  54. package/dist/plus/integrations/reads/filters.d.ts.map +1 -1
  55. package/dist/plus/integrations/reads/filters.js +125 -0
  56. package/dist/plus/integrations/reads/filters.js.map +1 -1
  57. package/dist/plus/integrations/reads/issues.d.ts.map +1 -1
  58. package/dist/plus/integrations/reads/issues.js +22 -41
  59. package/dist/plus/integrations/reads/issues.js.map +1 -1
  60. package/dist/plus/integrations/reads/paging.d.ts +59 -0
  61. package/dist/plus/integrations/reads/paging.d.ts.map +1 -1
  62. package/dist/plus/integrations/reads/paging.js +60 -0
  63. package/dist/plus/integrations/reads/paging.js.map +1 -1
  64. package/dist/plus/integrations/reads/searchIssues.d.ts +55 -0
  65. package/dist/plus/integrations/reads/searchIssues.d.ts.map +1 -0
  66. package/dist/plus/integrations/reads/searchIssues.js +144 -0
  67. package/dist/plus/integrations/reads/searchIssues.js.map +1 -0
  68. package/dist/plus/integrations/reads/warnings.d.ts +25 -1
  69. package/dist/plus/integrations/reads/warnings.d.ts.map +1 -1
  70. package/dist/plus/integrations/reads/warnings.js +86 -2
  71. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  72. package/docs/integrations.md +110 -2
  73. package/docs/kepler-read-api-parity.md +57 -0
  74. package/package.json +1 -1
  75. package/src/git/models/issue.ts +81 -0
  76. package/src/plus/git-github/api/config.ts +13 -0
  77. package/src/plus/git-github/api/github.ts +332 -148
  78. package/src/plus/git-github/api/issueSearchQuery.ts +165 -0
  79. package/src/plus/integrations/index.ts +5 -0
  80. package/src/plus/integrations/integrationService.ts +47 -1
  81. package/src/plus/integrations/manager.ts +88 -2
  82. package/src/plus/integrations/models/gitHostIntegration.ts +102 -2
  83. package/src/plus/integrations/models/integration.ts +7 -46
  84. package/src/plus/integrations/models/issueReads.ts +73 -0
  85. package/src/plus/integrations/providerFilters.ts +15 -0
  86. package/src/plus/integrations/providers/github.ts +64 -2
  87. package/src/plus/integrations/providers/models.ts +49 -0
  88. package/src/plus/integrations/reads/broaden.ts +10 -0
  89. package/src/plus/integrations/reads/counts.ts +285 -0
  90. package/src/plus/integrations/reads/filters.ts +162 -1
  91. package/src/plus/integrations/reads/issues.ts +22 -45
  92. package/src/plus/integrations/reads/paging.ts +102 -0
  93. package/src/plus/integrations/reads/searchIssues.ts +252 -0
  94. package/src/plus/integrations/reads/warnings.ts +114 -4
@@ -1,7 +1,8 @@
1
1
  import type { IntegrationIds } from '../constants.js';
2
- import type { IssueFilter, PullRequestFilter } from '../providerFilters.js';
2
+ import type { IssueFilter, IssueSearchCapabilities, PullRequestFilter } from '../providerFilters.js';
3
3
  import { providersMetadata } from '../providers/models.js';
4
4
  import type { ProviderWarning } from '../results.js';
5
+ import type { IssueSearchCriteriaRejection } from './filters.js';
5
6
 
6
7
  /**
7
8
  * The warnings the provider facade raises on its OWN terms, as opposed to the ones derived from a caught
@@ -152,7 +153,8 @@ type TruncatedReadKind =
152
153
  | 'Repository'
153
154
  | 'Organization'
154
155
  | 'Project'
155
- | 'Account-wide issue search';
156
+ | 'Account-wide issue search'
157
+ | 'Issue search';
156
158
 
157
159
  /** {@link incompleteReadWarning} for a paged or drained read, phrased per surface. */
158
160
  export function truncationWarning(
@@ -187,6 +189,17 @@ function truncationMessage(id: IntegrationIds, readKind: TruncatedReadKind, caus
187
189
  // is not the same case — that union is the SDK's, and can widen under a dependency bump.)
188
190
  }
189
191
 
192
+ /**
193
+ * The one sentence every "you asked for a narrowing this provider can't express" refusal uses.
194
+ *
195
+ * Shared because the three callers below differ only in a noun: the wording is consumer-visible, and three
196
+ * hand-written copies drift three ways — including the `(supported: …)` clause, which exists to avoid emitting an
197
+ * empty parenthetical and has to be the same guard in all of them.
198
+ */
199
+ function unsupportedNarrowingMessage(id: IntegrationIds, noun: string, requested: string, supported: string): string {
200
+ return `The requested ${noun} (${requested}) are not supported by '${id}'${supported.length > 0 ? ` (supported: ${supported})` : ''}; skipped to avoid returning a wider result than requested.`;
201
+ }
202
+
190
203
  /** Warning for an account-wide issue read whose requested filters the provider can't express server-side. */
191
204
  export function unsupportedAccountWideIssueFiltersWarning(
192
205
  id: IntegrationIds,
@@ -199,7 +212,7 @@ export function unsupportedAccountWideIssueFiltersWarning(
199
212
  id,
200
213
  domain,
201
214
  connectionId,
202
- `The requested account-wide issue filters (${filters.join(', ')}) are not supported by '${id}'${supported.length ? ` (supported: ${supported.join(', ')})` : ''}; skipped to avoid returning a wider result than requested.`,
215
+ unsupportedNarrowingMessage(id, 'account-wide issue filters', filters.join(', '), supported.join(', ')),
203
216
  );
204
217
  }
205
218
 
@@ -215,7 +228,7 @@ export function unsupportedAccountWidePullRequestFiltersWarning(
215
228
  id,
216
229
  domain,
217
230
  connectionId,
218
- `The requested account-wide pull request filters (${filters.join(', ')}) are not supported by '${id}'${supported.length ? ` (supported: ${supported.join(', ')})` : ''}; skipped to avoid returning a wider result than requested.`,
231
+ unsupportedNarrowingMessage(id, 'account-wide pull request filters', filters.join(', '), supported.join(', ')),
219
232
  );
220
233
  }
221
234
 
@@ -233,6 +246,103 @@ export function unsupportedFiltersWarning(
233
246
  );
234
247
  }
235
248
 
249
+ /**
250
+ * Warning for a filtered issue search whose criteria the provider can't serve — either it has no such search at
251
+ * all, or it can't express what was asked for, or the set contradicts itself.
252
+ *
253
+ * One builder for all three because they are one decision from the caller's side ("this search can't be run as
254
+ * asked") and the remedy differs only in what the message says. The rejection shape carries which case it is, so
255
+ * the wording can't drift from the check that produced it (see {@link resolveIssueSearchCriteria}).
256
+ */
257
+ export function unsupportedIssueSearchCriteriaWarning(
258
+ id: IntegrationIds,
259
+ domain: string | undefined,
260
+ connectionId: string | undefined,
261
+ rejection: IssueSearchCriteriaRejection,
262
+ ): ProviderWarning {
263
+ let message: string;
264
+ switch (rejection.reason) {
265
+ case 'unsupported-search':
266
+ message = `Filtered issue search is not supported by '${id}'; use \`listIssuesPage\` for its own issue reads.`;
267
+ break;
268
+ case 'unsupported-criteria': {
269
+ const supported = providersMetadata[id]?.supportedIssueSearch;
270
+ message = unsupportedNarrowingMessage(
271
+ id,
272
+ 'issue search criteria',
273
+ rejection.criteria.join(', '),
274
+ supported != null ? describeIssueSearchCapabilities(supported) : '',
275
+ );
276
+ break;
277
+ }
278
+ case 'contradictory-relationships':
279
+ message = `The relationships \`any-assignee\` and \`unassigned\` are contradictory — they partition the scope between them, so no issue satisfies both; pass only one.`;
280
+ break;
281
+ }
282
+ // No `default`: the union is declared alongside the validator, so `noImplicitReturns` fails the build here if
283
+ // a rejection reason is added without its own wording.
284
+
285
+ return otherWarning(id, domain, connectionId, message);
286
+ }
287
+
288
+ /** The criteria a provider CAN express, for the "supported: …" half of a refusal message. */
289
+ function describeIssueSearchCapabilities(capabilities: IssueSearchCapabilities): string {
290
+ const flags: [name: string, supported: boolean][] = [
291
+ ['text', capabilities.text],
292
+ ['labels', capabilities.labels],
293
+ ['milestone', capabilities.milestone],
294
+ ['updatedAfter', capabilities.updatedAfter],
295
+ ['createdAfter', capabilities.createdAfter],
296
+ ['withoutLinkedPullRequest', capabilities.withoutLinkedPullRequest],
297
+ ['state', capabilities.states],
298
+ ];
299
+ return [
300
+ ...capabilities.relationships.map(r => `relationships:${r}`),
301
+ ...flags.filter(([, supported]) => supported).map(([name]) => name),
302
+ ].join(', ');
303
+ }
304
+
305
+ /**
306
+ * The omission for a filtered issue search that hit the provider's RESULT CEILING: more issues matched than the
307
+ * provider will ever serve for one query, however it is paged.
308
+ *
309
+ * Distinct from {@link truncationWarning} because this is the one incompleteness this read can quantify —
310
+ * `totalCount` is how many matched, `limit` how many are reachable — which is what lets a consumer say "19.240
311
+ * matched, showing the 1.000 most recently updated" instead of a bare "results may be incomplete". `recovery:
312
+ * 'none'` because the items past the ceiling are UNREACHABLE, not merely unfetched: no budget, no retry, and no
313
+ * cursor would return them. Narrowing the criteria is the only way through, which is a decision for the caller.
314
+ *
315
+ * Returns `undefined` when the provider declares no ceiling, so the caller falls back to the generic wording
316
+ * rather than reporting a limit it invented.
317
+ */
318
+ export function issueSearchCapResultWarning(
319
+ id: IntegrationIds,
320
+ domain: string | undefined,
321
+ connectionId: string | undefined,
322
+ totalCount: number | undefined,
323
+ ): ProviderWarning | undefined {
324
+ const limit = providersMetadata[id]?.issueSearchResultLimit;
325
+ if (limit == null) return undefined;
326
+ // Below the ceiling this warning would be a false claim; the caller's truncation had another cause.
327
+ if (totalCount == null || totalCount <= limit) return undefined;
328
+
329
+ return {
330
+ ...otherWarning(
331
+ id,
332
+ domain,
333
+ connectionId,
334
+ `Issue search matched ${totalCount} results, but '${id}' serves at most ${limit}; narrow the search to read the rest.`,
335
+ ),
336
+ omission: {
337
+ kind: 'provider-limit',
338
+ // The items past the ceiling can't be fetched by anything, so never offer a "load more".
339
+ recovery: 'none',
340
+ limit: limit,
341
+ totalCount: totalCount,
342
+ },
343
+ };
344
+ }
345
+
236
346
  /** Warning for a git host that doesn't expose issues on this surface (e.g. Bitbucket, deprecated in favor of Jira). */
237
347
  export function issuesUnsupportedWarning(
238
348
  id: IntegrationIds,