@gitkraken/core-gitlens 0.12.0 → 0.13.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 +57 -1
- package/dist/git/cache.d.ts +84 -29
- package/dist/git/cache.js +188 -54
- package/dist/git/cache.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.js +4 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/branch.d.ts +15 -2
- package/dist/git/models/branch.js +27 -5
- package/dist/git/models/branch.js.map +1 -1
- package/dist/git/models/status.js +1 -1
- package/dist/git/models/worktree.d.ts +4 -1
- package/dist/git/models/worktree.js +4 -2
- package/dist/git/models/worktree.js.map +1 -1
- package/dist/git/providers/branches.d.ts +73 -8
- package/dist/git/providers/pausedOperations.d.ts +6 -0
- package/dist/git/providers/provider.d.ts +34 -2
- package/dist/git/providers/status.d.ts +8 -2
- package/dist/git/remotes/azure-devops.js +61 -53
- package/dist/git/remotes/azure-devops.js.map +1 -1
- package/dist/git/service.d.ts +8 -5
- package/dist/git/service.js +16 -8
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/branch.utils.d.ts +8 -1
- package/dist/git/utils/branch.utils.js +30 -1
- package/dist/git/utils/branch.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts +13 -2
- package/dist/git/watching/changeEvent.js +17 -3
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/gitDirPoller.d.ts +111 -0
- package/dist/git/watching/gitDirPoller.js +266 -0
- package/dist/git/watching/gitDirPoller.js.map +1 -0
- package/dist/git/watching/provider.d.ts +16 -0
- package/dist/git/watching/watchGroup.d.ts +40 -4
- package/dist/git/watching/watchGroup.js +143 -17
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +70 -1
- package/dist/git/watching/watchService.js +158 -13
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +44 -0
- package/dist/git/watching/watchSession.js +91 -6
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts +21 -0
- package/dist/git/watching/watcherPatterns.js +67 -1
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +34 -7
- package/dist/git/watching/worktreeSummary.js +39 -12
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +34 -2
- package/dist/git-cli/cliGitProvider.js +119 -17
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/commandClassifier.d.ts +15 -0
- package/dist/git-cli/exec/commandClassifier.js +48 -2
- package/dist/git-cli/exec/commandClassifier.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +15 -3
- package/dist/git-cli/exec/git.js +38 -17
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +2 -0
- package/dist/git-cli/exec/gitQueue.js +2 -1
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/exec/indexLock.d.ts +38 -0
- package/dist/git-cli/exec/indexLock.js +150 -0
- package/dist/git-cli/exec/indexLock.js.map +1 -0
- package/dist/git-cli/parsers/worktreeParser.js +42 -2
- package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +109 -10
- package/dist/git-cli/providers/branches.js +624 -131
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +9 -5
- package/dist/git-cli/providers/config.js +60 -27
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +17 -0
- package/dist/git-cli/providers/operations.js +153 -96
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +8 -0
- package/dist/git-cli/providers/pausedOperations.js +60 -40
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.js +11 -8
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/remotes.js +19 -10
- package/dist/git-cli/providers/remotes.js.map +1 -1
- package/dist/git-cli/providers/staging.js +40 -15
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts +2 -0
- package/dist/git-cli/providers/stash.js +33 -18
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +3 -1
- package/dist/git-cli/providers/status.js +38 -20
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/tags.js +6 -4
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts +1 -0
- package/dist/git-cli/providers/worktrees.js +60 -31
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts +6 -0
- package/dist/git-cli/service.js +5 -2
- package/dist/git-cli/service.js.map +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts +3 -1
- package/dist/plus/git-github/providers/github/status.js +1 -1
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.d.ts +13 -2
- package/dist/plus/integrations/collectionMetadata.js +14 -2
- package/dist/plus/integrations/collectionMetadata.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +2 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +1 -0
- package/dist/plus/integrations/integrationService.js +1 -1
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +41 -5
- package/dist/plus/integrations/models/gitHostIntegration.js +106 -29
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/issueReads.d.ts +17 -4
- package/dist/plus/integrations/providers/apiClients.d.ts +2 -0
- package/dist/plus/integrations/providers/apiClients.js +7 -1
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +5 -4
- package/dist/plus/integrations/providers/azure/azure.js +37 -77
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.utils.js +20 -17
- package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +2 -2
- package/dist/plus/integrations/providers/azure/models.js +4 -4
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azure/workItemStateCategories.d.ts +18 -14
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js +69 -17
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +44 -0
- package/dist/plus/integrations/providers/azureDevOps.js +108 -17
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +45 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js +121 -6
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/jira-server.js +18 -14
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.js +18 -14
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +1 -2
- package/dist/plus/integrations/providers/models.js +9 -2
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +7 -17
- package/dist/plus/integrations/providers/providersApi.js +85 -78
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.d.ts +22 -0
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.js +69 -9
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.js +8 -2
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +3 -3
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +2 -1
- package/dist/plus/integrations/reads/issueBatch.js +1 -1
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +23 -14
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts +2 -1
- package/dist/plus/integrations/reads/issues.js +18 -3
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.js +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +12 -3
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +11 -4
- package/dist/plus/integrations/reads/warnings.js +15 -5
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +36 -2
- package/dist/plus/integrations/results.js +33 -13
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/dist/utils/promiseCache.d.ts +10 -0
- package/dist/utils/promiseCache.js +17 -2
- package/dist/utils/promiseCache.js.map +1 -1
- package/docs/integrations.md +52 -20
- package/package.json +2 -2
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { mapSettledBounded } from "../../../utils/promise.js";
|
|
2
|
-
import { PromiseCache } from "../../../utils/promiseCache.js";
|
|
3
2
|
import { RequestNotFoundError } from "../../../git/errors.js";
|
|
4
3
|
import { base64 } from "../../../utils/base64.js";
|
|
5
|
-
import { isTerminalIssueStateCategory } from "../../../git/utils/issue.utils.js";
|
|
6
4
|
import { toError } from "../errors.js";
|
|
7
5
|
import "../constants.js";
|
|
8
6
|
import { UnexpectedHtmlResponseError, getProviderResponseBodyMessage, isAzureProviderId, isProviderIssueNotFoundError, throwProviderError } from "./providerErrors.js";
|
|
9
7
|
import { isIncompleteCollection, toCollectionScopeFailure } from "../collectionMetadata.js";
|
|
10
8
|
import { toTokenWithInfo } from "../authentication/models.js";
|
|
11
9
|
import { collectProviderPagedResult, mergeCollectionMetadata, parsePageCursor, toPageCursor } from "./utils/providerPaging.js";
|
|
12
|
-
import {
|
|
13
|
-
import { azureWorkItemEtagFieldNames, encodeAzurePathSegment, fromAzureWorkItemToProviderIssue } from "./azure/models.js";
|
|
14
|
-
import { getAzureWorkItemTypeStatesUrl,
|
|
10
|
+
import { isRepoIdsInput, providersMetadata } from "./models.js";
|
|
11
|
+
import { azureIssueStateCategory, azureWorkItemEtagFieldNames, encodeAzurePathSegment, fromAzureWorkItemToProviderIssue } from "./azure/models.js";
|
|
12
|
+
import { AzureWorkItemStatesCache, getAzureWorkItemTypeStatesUrl, getAzureWorkItemTypesUrl } from "./azure/workItemStateCategories.js";
|
|
15
13
|
import { requestJiraIssueByKey, requestJiraIssuesEtagFields } from "./jiraIssueByKey.js";
|
|
16
14
|
import { requestLinearIssuesEtagFields } from "./linearIssuesEtag.js";
|
|
17
15
|
import { requestBitbucketServerProjects, requestBitbucketServerRepositories } from "./bitbucket-server/discovery.js";
|
|
18
16
|
import { countBitbucketServerPullRequests, searchBitbucketServerPullRequestsPage } from "./bitbucket-server/pullRequestSearch.js";
|
|
19
|
-
import ProviderApis from "@gitkraken/provider-apis";
|
|
17
|
+
import ProviderApis, { GitIssueState } from "@gitkraken/provider-apis";
|
|
20
18
|
//#region ../plus/integrations/src/providers/providersApi.ts
|
|
21
19
|
const createProviderApis = ProviderApis.default ?? ProviderApis;
|
|
22
20
|
const repoNotFoundMessage = /^Repository .+ not found$/i;
|
|
@@ -49,21 +47,6 @@ function azureAuthorization(token, isPAT) {
|
|
|
49
47
|
return isPAT ? `Basic ${base64(`:${token}`)}` : `Bearer ${token}`;
|
|
50
48
|
}
|
|
51
49
|
const azureDevOpsBaseUrl = "https://dev.azure.com";
|
|
52
|
-
/**
|
|
53
|
-
* The work items of an Azure list read that are in the states it asked for. provider-apis selects them by their closed
|
|
54
|
-
* and resolved dates (no state asks for open ones), while a row now also closes on its workflow category: a Removed work
|
|
55
|
-
* item has neither date, so an open read would otherwise list it, closed. A read of closed work items is left as the
|
|
56
|
-
* query selected it, since a resolved date alone selects one that carries no closed date or, when its type's states
|
|
57
|
-
* could not be read, no category; and it can't be completed either, as the query never selects a dateless one.
|
|
58
|
-
*/
|
|
59
|
-
function withRequestedAzureIssueStates(issues, states) {
|
|
60
|
-
if (!(!states?.length || states.includes(GitIssueState$1.Open) && !states.includes(GitIssueState$1.Closed))) return issues;
|
|
61
|
-
return issues.filter((i) => i.closedDate == null && !isTerminalIssueStateCategory(i.state?.category));
|
|
62
|
-
}
|
|
63
|
-
/** How long a work item type's states classify its work items before they are read again. */
|
|
64
|
-
const azureWorkItemTypeStatesTTL = 3e5;
|
|
65
|
-
/** The most work item type state reads kept, across hosts, projects, types and credentials. */
|
|
66
|
-
const azureWorkItemTypeStatesCapacity = 256;
|
|
67
50
|
/** The most group descriptors one identity batch read resolves. */
|
|
68
51
|
const azureIdentityBatchSize = 100;
|
|
69
52
|
/** Azure DevOps Services serves the identity APIs from its own host, below the organization like the main one. */
|
|
@@ -137,19 +120,12 @@ function toJiraIssuePage(result) {
|
|
|
137
120
|
}
|
|
138
121
|
var ProvidersApi = class {
|
|
139
122
|
authenticationService;
|
|
123
|
+
azureWorkItemTypeStates;
|
|
140
124
|
providers;
|
|
141
125
|
request;
|
|
142
|
-
|
|
143
|
-
* Each work item type's states, by URL (host, organization, project and type) and credential: coalesces the reads
|
|
144
|
-
* of the same type, and never answers one credential with what another one read. A failed read is not kept, so the
|
|
145
|
-
* next read retries it.
|
|
146
|
-
*/
|
|
147
|
-
azureWorkItemTypeStates = new PromiseCache({
|
|
148
|
-
createTTL: azureWorkItemTypeStatesTTL,
|
|
149
|
-
capacity: azureWorkItemTypeStatesCapacity
|
|
150
|
-
});
|
|
151
|
-
constructor(authenticationService) {
|
|
126
|
+
constructor(authenticationService, azureWorkItemTypeStates = new AzureWorkItemStatesCache()) {
|
|
152
127
|
this.authenticationService = authenticationService;
|
|
128
|
+
this.azureWorkItemTypeStates = azureWorkItemTypeStates;
|
|
153
129
|
const http = authenticationService.ctx.http;
|
|
154
130
|
const userAgent = http.userAgent;
|
|
155
131
|
const customFetch = async ({ url, ...options }) => {
|
|
@@ -1144,17 +1120,30 @@ var ProvidersApi = class {
|
|
|
1144
1120
|
}
|
|
1145
1121
|
async getIssuesForAzureProject(tokenOptInfo, namespace, project, options) {
|
|
1146
1122
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getIssuesForAzureProjectFn");
|
|
1147
|
-
const
|
|
1123
|
+
const workItemTypeStates = options?.states?.includes(GitIssueState.Open) && options.states.includes(GitIssueState.Closed) ? void 0 : await this.getAzureProjectWorkItemStates(tokenWithInfo, namespace, project, options);
|
|
1124
|
+
const page = await this.getPagedResult({
|
|
1148
1125
|
namespace,
|
|
1149
1126
|
project,
|
|
1150
|
-
...options
|
|
1127
|
+
...options,
|
|
1128
|
+
workItemTypeStates
|
|
1151
1129
|
}, provider.getIssuesForAzureProjectFn, tokenWithInfo, options?.cursor, options?.isPAT, options?.baseUrl);
|
|
1130
|
+
const result = workItemTypeStates?.metadata == null ? page : {
|
|
1131
|
+
...page,
|
|
1132
|
+
metadata: mergeCollectionMetadata(page.metadata, workItemTypeStates.metadata),
|
|
1133
|
+
paging: {
|
|
1134
|
+
...page.paging ?? {
|
|
1135
|
+
cursor: "{}",
|
|
1136
|
+
more: false
|
|
1137
|
+
},
|
|
1138
|
+
truncated: true
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1152
1141
|
try {
|
|
1153
|
-
await this.classifyAzureIssueStates(result.values, tokenWithInfo, namespace, project, options);
|
|
1142
|
+
await this.classifyAzureIssueStates(result.values, tokenWithInfo, namespace, project, options, workItemTypeStates);
|
|
1154
1143
|
} catch (ex) {
|
|
1155
1144
|
return {
|
|
1156
1145
|
...result,
|
|
1157
|
-
values:
|
|
1146
|
+
values: result.values,
|
|
1158
1147
|
paging: {
|
|
1159
1148
|
...result.paging ?? {
|
|
1160
1149
|
cursor: "{}",
|
|
@@ -1172,60 +1161,78 @@ var ProvidersApi = class {
|
|
|
1172
1161
|
})
|
|
1173
1162
|
};
|
|
1174
1163
|
}
|
|
1164
|
+
return result;
|
|
1165
|
+
}
|
|
1166
|
+
azureStatesScope(token, namespace, project, options) {
|
|
1175
1167
|
return {
|
|
1176
|
-
|
|
1177
|
-
|
|
1168
|
+
baseUrl: options?.baseUrl ?? azureDevOpsBaseUrl,
|
|
1169
|
+
namespace,
|
|
1170
|
+
project,
|
|
1171
|
+
token: token.accessToken,
|
|
1172
|
+
isPAT: options?.isPAT === true
|
|
1178
1173
|
};
|
|
1179
1174
|
}
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
const
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
});
|
|
1210
|
-
return parseAzureWorkItemTypeStates(response.body);
|
|
1211
|
-
} catch (ex) {
|
|
1212
|
-
return this.handleProviderError(tokenWithInfo, ex);
|
|
1175
|
+
async readAzureStatesMetadata(token, url, isPAT) {
|
|
1176
|
+
try {
|
|
1177
|
+
return (await this.request({
|
|
1178
|
+
url,
|
|
1179
|
+
headers: { Authorization: azureAuthorization(token.accessToken, isPAT) }
|
|
1180
|
+
})).body;
|
|
1181
|
+
} catch (ex) {
|
|
1182
|
+
return this.handleProviderError(token, ex);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
getAzureTypeStates(token, scope, type) {
|
|
1186
|
+
return this.azureWorkItemTypeStates.getStates(scope, type, () => this.readAzureStatesMetadata(token, getAzureWorkItemTypeStatesUrl(scope.baseUrl, scope.namespace, scope.project, type), scope.isPAT));
|
|
1187
|
+
}
|
|
1188
|
+
async getAzureProjectWorkItemStates(token, namespace, project, options) {
|
|
1189
|
+
const scope = this.azureStatesScope(token, namespace, project, options);
|
|
1190
|
+
const failureScope = {
|
|
1191
|
+
providerId: token.providerId,
|
|
1192
|
+
resourceId: namespace,
|
|
1193
|
+
projectId: project
|
|
1194
|
+
};
|
|
1195
|
+
let types;
|
|
1196
|
+
try {
|
|
1197
|
+
types = await this.azureWorkItemTypeStates.getTypes(scope, () => this.readAzureStatesMetadata(token, getAzureWorkItemTypesUrl(scope.baseUrl, namespace, project), scope.isPAT));
|
|
1198
|
+
} catch (ex) {
|
|
1199
|
+
return {
|
|
1200
|
+
types: [],
|
|
1201
|
+
metadata: {
|
|
1202
|
+
completeness: "partial",
|
|
1203
|
+
failures: [toCollectionScopeFailure(failureScope, ex)]
|
|
1213
1204
|
}
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
const results = await mapSettledBounded(types, 6, async (type) => ({
|
|
1208
|
+
name: type,
|
|
1209
|
+
states: await this.getAzureTypeStates(token, scope, type)
|
|
1210
|
+
}));
|
|
1211
|
+
const failures = results.flatMap((r) => r.status === "rejected" ? [toCollectionScopeFailure(failureScope, r.reason)] : []);
|
|
1212
|
+
return {
|
|
1213
|
+
types: results.map((r, i) => r.status === "fulfilled" ? r.value : { name: types[i] }),
|
|
1214
|
+
...failures.length ? { metadata: {
|
|
1215
|
+
completeness: "partial",
|
|
1216
|
+
failures
|
|
1217
|
+
} } : {}
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
async classifyAzureIssueStates(issues, tokenWithInfo, namespace, project, options, snapshot) {
|
|
1221
|
+
const scope = this.azureStatesScope(tokenWithInfo, namespace, project, options);
|
|
1222
|
+
const snapshotTypes = new Map(snapshot?.types.map((type) => [type.name, type.states]));
|
|
1223
|
+
const types = [...new Set(issues.flatMap((i) => i.state?.name && i.type && !snapshotTypes.has(i.type) ? [i.type] : []))];
|
|
1224
|
+
const results = await mapSettledBounded(types, 6, async (type) => [type, await this.getAzureTypeStates(tokenWithInfo, scope, type)]);
|
|
1225
|
+
const statesByType = new Map([...snapshotTypes, ...results.flatMap((r) => r.status === "fulfilled" ? [r.value] : [])]);
|
|
1220
1226
|
for (const issue of issues) {
|
|
1221
1227
|
const states = issue.type ? statesByType.get(issue.type) : void 0;
|
|
1222
1228
|
if (states == null || issue.state == null) continue;
|
|
1223
1229
|
issue.state = {
|
|
1224
1230
|
...issue.state,
|
|
1225
|
-
category: states.
|
|
1231
|
+
category: azureIssueStateCategory(states.find((s) => s.name === issue.state?.name)?.category)
|
|
1226
1232
|
};
|
|
1227
1233
|
}
|
|
1228
|
-
|
|
1234
|
+
const failure = results.find((r) => r.status === "rejected");
|
|
1235
|
+
if (failure?.status === "rejected") throw failure.reason;
|
|
1229
1236
|
}
|
|
1230
1237
|
async getIssuesForProject(tokenOptInfo, project, resourceId, options) {
|
|
1231
1238
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getIssuesForProjectFn");
|