@gitkraken/core-gitlens 0.5.115 → 0.6.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 (79) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/dist/git/models/issue.d.ts +14 -1
  3. package/dist/git/models/issue.d.ts.map +1 -1
  4. package/dist/git/models/issue.js +5 -1
  5. package/dist/git/models/issue.js.map +1 -1
  6. package/dist/git/models/pullRequest.d.ts +8 -2
  7. package/dist/git/models/pullRequest.d.ts.map +1 -1
  8. package/dist/git/remotes/azure-devops.d.ts +11 -1
  9. package/dist/git/remotes/azure-devops.d.ts.map +1 -1
  10. package/dist/git/remotes/azure-devops.js +47 -12
  11. package/dist/git/remotes/azure-devops.js.map +1 -1
  12. package/dist/git/utils/issue.utils.d.ts.map +1 -1
  13. package/dist/git/utils/issue.utils.js +9 -0
  14. package/dist/git/utils/issue.utils.js.map +1 -1
  15. package/dist/plus/git-github/api/github.d.ts +3 -2
  16. package/dist/plus/git-github/api/github.d.ts.map +1 -1
  17. package/dist/plus/git-github/api/github.js.map +1 -1
  18. package/dist/plus/integrations/manager.d.ts +43 -6
  19. package/dist/plus/integrations/manager.d.ts.map +1 -1
  20. package/dist/plus/integrations/providers/azure/azure.d.ts +13 -0
  21. package/dist/plus/integrations/providers/azure/azure.d.ts.map +1 -1
  22. package/dist/plus/integrations/providers/azure/azure.js +79 -16
  23. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  24. package/dist/plus/integrations/providers/azure/models.d.ts +37 -10
  25. package/dist/plus/integrations/providers/azure/models.d.ts.map +1 -1
  26. package/dist/plus/integrations/providers/azure/models.js +118 -52
  27. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  28. package/dist/plus/integrations/providers/azureDevOps.d.ts +1 -0
  29. package/dist/plus/integrations/providers/azureDevOps.d.ts.map +1 -1
  30. package/dist/plus/integrations/providers/azureDevOps.js +19 -7
  31. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  32. package/dist/plus/integrations/providers/models.d.ts.map +1 -1
  33. package/dist/plus/integrations/providers/models.js +15 -4
  34. package/dist/plus/integrations/providers/models.js.map +1 -1
  35. package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
  36. package/dist/plus/integrations/reads/broaden.js +26 -14
  37. package/dist/plus/integrations/reads/broaden.js.map +1 -1
  38. package/dist/plus/integrations/reads/counts.d.ts.map +1 -1
  39. package/dist/plus/integrations/reads/counts.js +39 -15
  40. package/dist/plus/integrations/reads/counts.js.map +1 -1
  41. package/dist/plus/integrations/reads/filters.d.ts +33 -11
  42. package/dist/plus/integrations/reads/filters.d.ts.map +1 -1
  43. package/dist/plus/integrations/reads/filters.js +114 -25
  44. package/dist/plus/integrations/reads/filters.js.map +1 -1
  45. package/dist/plus/integrations/reads/resolveRepository.d.ts.map +1 -1
  46. package/dist/plus/integrations/reads/resolveRepository.js +2 -0
  47. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
  48. package/dist/plus/integrations/reads/searchIssues.d.ts +1 -5
  49. package/dist/plus/integrations/reads/searchIssues.d.ts.map +1 -1
  50. package/dist/plus/integrations/reads/searchIssues.js +12 -6
  51. package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
  52. package/dist/plus/integrations/reads/searchPullRequests.d.ts +1 -0
  53. package/dist/plus/integrations/reads/searchPullRequests.d.ts.map +1 -1
  54. package/dist/plus/integrations/reads/searchPullRequests.js +8 -3
  55. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  56. package/dist/plus/integrations/reads/warnings.d.ts +16 -0
  57. package/dist/plus/integrations/reads/warnings.d.ts.map +1 -1
  58. package/dist/plus/integrations/reads/warnings.js +18 -0
  59. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  60. package/docs/integrations.md +59 -2
  61. package/docs/kepler-read-api-parity.md +15 -12
  62. package/package.json +1 -1
  63. package/src/git/models/issue.ts +15 -0
  64. package/src/git/models/pullRequest.ts +6 -2
  65. package/src/git/remotes/azure-devops.ts +68 -14
  66. package/src/git/utils/issue.utils.ts +10 -0
  67. package/src/plus/git-github/api/github.ts +3 -2
  68. package/src/plus/integrations/manager.ts +43 -6
  69. package/src/plus/integrations/providers/azure/azure.ts +147 -16
  70. package/src/plus/integrations/providers/azure/models.ts +165 -63
  71. package/src/plus/integrations/providers/azureDevOps.ts +22 -13
  72. package/src/plus/integrations/providers/models.ts +22 -5
  73. package/src/plus/integrations/reads/broaden.ts +35 -16
  74. package/src/plus/integrations/reads/counts.ts +62 -15
  75. package/src/plus/integrations/reads/filters.ts +131 -29
  76. package/src/plus/integrations/reads/resolveRepository.ts +3 -0
  77. package/src/plus/integrations/reads/searchIssues.ts +23 -13
  78. package/src/plus/integrations/reads/searchPullRequests.ts +16 -2
  79. package/src/plus/integrations/reads/warnings.ts +19 -0
@@ -25,6 +25,7 @@ import {
25
25
  otherWarning,
26
26
  truncationWarning,
27
27
  unsupportedIssueSearchCriteriaWarning,
28
+ unusableSearchScopeMessage,
28
29
  } from './warnings.js';
29
30
 
30
31
  /**
@@ -69,11 +70,7 @@ export async function searchIssuesPage(
69
70
  criteria?: IssueSearchCriteria;
70
71
  page?: number;
71
72
  cursor?: string;
72
- /**
73
- * Page size PER RELATIONSHIP: each one is its own provider query, so a page of an N-relationship search
74
- * returns up to `N × itemsPerPage` items before the url dedupe, and fewer where they overlap.
75
- * `page.itemsPerPage` reports what actually came back.
76
- */
73
+ /** Per relationship, not per page; see {@link IntegrationManager.searchIssuesPage}. */
77
74
  itemsPerPage?: number;
78
75
  forceSync?: boolean;
79
76
  connectionId?: string;
@@ -117,8 +114,18 @@ export async function searchIssuesPage(
117
114
  return refused(issuesUnsupportedWarning(options.providerId, domain, options.connectionId));
118
115
  }
119
116
 
117
+ const resolved = resolveIssueSearchCriteria(options.providerId, options.criteria);
118
+ if (resolved.rejection != null) {
119
+ return refused(
120
+ unsupportedIssueSearchCriteriaWarning(options.providerId, domain, options.connectionId, resolved.rejection),
121
+ );
122
+ }
123
+
124
+ // AFTER the criteria check, which is what reports a provider with no filtered issue search at all: that is
125
+ // the more fundamental refusal, and answering "your scope name is malformed" to a caller whose provider has
126
+ // no such search names the wrong defect. Matches the pull-request twin, which probes existence first.
120
127
  const scope = resolveIssueSearchScope(options.repos, options.org, options.criteria);
121
- switch (scope.rejection) {
128
+ switch (scope.rejection?.reason) {
122
129
  case 'unscoped':
123
130
  return refused(
124
131
  otherWarning(
@@ -140,13 +147,16 @@ export async function searchIssuesPage(
140
147
  'A filtered issue search cannot be scoped by repository id; pass repository descriptors (namespace + name) instead.',
141
148
  ),
142
149
  );
143
- }
144
-
145
- const resolved = resolveIssueSearchCriteria(options.providerId, options.criteria);
146
- if (resolved.rejection != null) {
147
- return refused(
148
- unsupportedIssueSearchCriteriaWarning(options.providerId, domain, options.connectionId, resolved.rejection),
149
- );
150
+ // A scope the query cannot spell, refused rather than sanitized — see `isUsableSearchScopeName`.
151
+ case 'unusable-scope':
152
+ return refused(
153
+ otherWarning(
154
+ options.providerId,
155
+ domain,
156
+ options.connectionId,
157
+ unusableSearchScopeMessage('issue search scopes', scope.rejection.scopes),
158
+ ),
159
+ );
150
160
  }
151
161
 
152
162
  const readPage = (cursor: string | undefined) =>
@@ -24,6 +24,7 @@ import {
24
24
  pullRequestSearchCapResultWarning,
25
25
  truncationWarning,
26
26
  unsupportedPullRequestSearchCriteriaWarning,
27
+ unusableSearchScopeMessage,
27
28
  } from './warnings.js';
28
29
 
29
30
  /**
@@ -44,6 +45,7 @@ export async function searchPullRequestsPage(
44
45
  criteria?: PullRequestSearchCriteria;
45
46
  page?: number;
46
47
  cursor?: string;
48
+ /** Per relationship × state facet, not per page; see {@link IntegrationManager.searchPullRequestsPage}. */
47
49
  itemsPerPage?: number;
48
50
  forceSync?: boolean;
49
51
  connectionId?: string;
@@ -100,7 +102,7 @@ export async function searchPullRequestsPage(
100
102
  }
101
103
 
102
104
  const scope = resolvePullRequestSearchScope(options.providerId, options.repos, options.org, options.criteria);
103
- switch (scope.rejection) {
105
+ switch (scope.rejection?.reason) {
104
106
  case 'unscoped':
105
107
  return refused(
106
108
  otherWarning(
@@ -125,10 +127,22 @@ export async function searchPullRequestsPage(
125
127
  unsupportedPullRequestSearchCriteriaWarning(options.providerId, domain, options.connectionId, {
126
128
  reason: 'unsupported-criteria',
127
129
  criteria: [
128
- scope.rejection === 'unsupported-repository-scope' ? 'repositoryScope' : 'organizationScope',
130
+ scope.rejection.reason === 'unsupported-repository-scope'
131
+ ? 'repositoryScope'
132
+ : 'organizationScope',
129
133
  ],
130
134
  }),
131
135
  );
136
+ // A scope the query cannot spell, refused rather than sanitized — see `isUsableSearchScopeName`.
137
+ case 'unusable-scope':
138
+ return refused(
139
+ otherWarning(
140
+ options.providerId,
141
+ domain,
142
+ options.connectionId,
143
+ unusableSearchScopeMessage('pull request search scopes', scope.rejection.scopes),
144
+ ),
145
+ );
132
146
  }
133
147
 
134
148
  const readPage = (cursor: string | undefined) =>
@@ -261,6 +261,25 @@ export function unsupportedFiltersWarning(
261
261
  );
262
262
  }
263
263
 
264
+ /**
265
+ * The one sentence every `unusable-scope` refusal uses — the five surfaces that validate a search scope (both
266
+ * searches, both count probes, and issue broadening) differ only in the noun and in whether they name a count
267
+ * key, so the reason a scope is unusable is written once. `prefix` is what the count probes put in front of it
268
+ * to name their key.
269
+ *
270
+ * NAMES the offending values, because which failure mode applied is not deducible from the value: a quote makes
271
+ * `git"kraken` a request for the real and different org `gitkraken`, a space makes `my org` a search of `my`
272
+ * filtered by the text `org`, and a value of only quotes or whitespace leaves no scope at all. The caller is the
273
+ * only layer that knows which scope it meant.
274
+ *
275
+ * Says how to fix it rather than what was stripped: a consumer cannot mirror this rule (unlike free-text
276
+ * sanitizing, whose rules are published for exactly that), so "pass the scope as the provider names it" is the
277
+ * actionable half.
278
+ */
279
+ export function unusableSearchScopeMessage(noun: string, scopes: readonly string[], prefix?: string): string {
280
+ return `${prefix != null ? `${prefix}: ` : ''}The requested ${noun} (${scopes.map(s => JSON.stringify(s)).join(', ')}) cannot be used as given: a scope name cannot contain quotes, or an inner space or control character, which a query would drop or read as a second qualifier — searching a different scope, or none. Pass the scope exactly as the provider names it.`;
281
+ }
282
+
264
283
  /** Warning for a filtered pull-request search the provider cannot run as requested. */
265
284
  export function unsupportedPullRequestSearchCriteriaWarning(
266
285
  id: IntegrationIds,