@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.
- package/CHANGELOG.md +30 -1
- package/dist/git/models/issue.d.ts +14 -1
- package/dist/git/models/issue.d.ts.map +1 -1
- package/dist/git/models/issue.js +5 -1
- package/dist/git/models/issue.js.map +1 -1
- package/dist/git/models/pullRequest.d.ts +8 -2
- package/dist/git/models/pullRequest.d.ts.map +1 -1
- package/dist/git/remotes/azure-devops.d.ts +11 -1
- package/dist/git/remotes/azure-devops.d.ts.map +1 -1
- package/dist/git/remotes/azure-devops.js +47 -12
- package/dist/git/remotes/azure-devops.js.map +1 -1
- package/dist/git/utils/issue.utils.d.ts.map +1 -1
- package/dist/git/utils/issue.utils.js +9 -0
- package/dist/git/utils/issue.utils.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +3 -2
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +43 -6
- package/dist/plus/integrations/manager.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +13 -0
- package/dist/plus/integrations/providers/azure/azure.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +79 -16
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +37 -10
- package/dist/plus/integrations/providers/azure/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +118 -52
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +1 -0
- package/dist/plus/integrations/providers/azureDevOps.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.js +19 -7
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/models.js +15 -4
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
- package/dist/plus/integrations/reads/broaden.js +26 -14
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/counts.d.ts.map +1 -1
- package/dist/plus/integrations/reads/counts.js +39 -15
- package/dist/plus/integrations/reads/counts.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +33 -11
- package/dist/plus/integrations/reads/filters.d.ts.map +1 -1
- package/dist/plus/integrations/reads/filters.js +114 -25
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.d.ts.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +2 -0
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/reads/searchIssues.d.ts +1 -5
- package/dist/plus/integrations/reads/searchIssues.d.ts.map +1 -1
- package/dist/plus/integrations/reads/searchIssues.js +12 -6
- package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.d.ts +1 -0
- package/dist/plus/integrations/reads/searchPullRequests.d.ts.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.js +8 -3
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +16 -0
- package/dist/plus/integrations/reads/warnings.d.ts.map +1 -1
- package/dist/plus/integrations/reads/warnings.js +18 -0
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/docs/integrations.md +59 -2
- package/docs/kepler-read-api-parity.md +15 -12
- package/package.json +1 -1
- package/src/git/models/issue.ts +15 -0
- package/src/git/models/pullRequest.ts +6 -2
- package/src/git/remotes/azure-devops.ts +68 -14
- package/src/git/utils/issue.utils.ts +10 -0
- package/src/plus/git-github/api/github.ts +3 -2
- package/src/plus/integrations/manager.ts +43 -6
- package/src/plus/integrations/providers/azure/azure.ts +147 -16
- package/src/plus/integrations/providers/azure/models.ts +165 -63
- package/src/plus/integrations/providers/azureDevOps.ts +22 -13
- package/src/plus/integrations/providers/models.ts +22 -5
- package/src/plus/integrations/reads/broaden.ts +35 -16
- package/src/plus/integrations/reads/counts.ts +62 -15
- package/src/plus/integrations/reads/filters.ts +131 -29
- package/src/plus/integrations/reads/resolveRepository.ts +3 -0
- package/src/plus/integrations/reads/searchIssues.ts +23 -13
- package/src/plus/integrations/reads/searchPullRequests.ts +16 -2
- 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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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'
|
|
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,
|