@gitkraken/core-gitlens 0.12.0 → 0.14.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 +78 -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 +5 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/branch.d.ts +20 -2
- package/dist/git/models/branch.js +28 -6
- package/dist/git/models/branch.js.map +1 -1
- package/dist/git/models/reference.d.ts +3 -0
- package/dist/git/models/status.js +2 -2
- 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/parsers/diffParser.js +1 -1
- package/dist/git/providers/branches.d.ts +73 -8
- package/dist/git/providers/operations.d.ts +3 -2
- package/dist/git/providers/pausedOperations.d.ts +6 -0
- package/dist/git/providers/provider.d.ts +45 -2
- package/dist/git/providers/revision.d.ts +17 -3
- 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/run.types.d.ts +12 -0
- 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 +12 -2
- package/dist/git/utils/branch.utils.js +49 -5
- package/dist/git/utils/branch.utils.js.map +1 -1
- package/dist/git/utils/reference.utils.d.ts +1 -0
- package/dist/git/utils/reference.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 +40 -2
- package/dist/git-cli/cliGitProvider.js +182 -18
- 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 +20 -3
- package/dist/git-cli/exec/git.js +63 -19
- 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 +39 -0
- package/dist/git-cli/exec/indexLock.js +160 -0
- package/dist/git-cli/exec/indexLock.js.map +1 -0
- package/dist/git-cli/parsers/blameParser.js +2 -2
- package/dist/git-cli/parsers/refParser.js +4 -2
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/parsers/statusParser.d.ts +6 -0
- package/dist/git-cli/parsers/statusParser.js +33 -3
- package/dist/git-cli/parsers/statusParser.js.map +1 -1
- package/dist/git-cli/parsers/worktreeParser.js +42 -2
- package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
- package/dist/git-cli/providers/branchRemote.d.ts +14 -0
- package/dist/git-cli/providers/branchRemote.js +36 -0
- package/dist/git-cli/providers/branchRemote.js.map +1 -0
- package/dist/git-cli/providers/branches.d.ts +109 -10
- package/dist/git-cli/providers/branches.js +630 -134
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.js +2 -2
- package/dist/git-cli/providers/config.d.ts +9 -5
- package/dist/git-cli/providers/config.js +58 -25
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/contributors.js +1 -1
- package/dist/git-cli/providers/graph.js +9 -6
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +17 -0
- package/dist/git-cli/providers/operations.js +172 -111
- 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 +59 -39
- 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/revision.d.ts +6 -2
- package/dist/git-cli/providers/revision.js +38 -12
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.js +39 -14
- 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 +40 -22
- 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/plus/git-github/providers/github/revision.d.ts +6 -2
- package/dist/plus/git-github/providers/github/revision.js +15 -10
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts +3 -1
- package/dist/plus/git-github/providers/github/status.js +2 -2
- 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 +36 -76
- 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 +21 -12
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js +74 -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/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
|
@@ -435,6 +435,7 @@ export interface IntegrationManager {
|
|
|
435
435
|
summary?: boolean;
|
|
436
436
|
}): Promise<ProviderPagedResult<PullRequestShape>>;
|
|
437
437
|
listIssuesPage(options: {
|
|
438
|
+
state?: IssueStateFilter;
|
|
438
439
|
providerId: IntegrationIds;
|
|
439
440
|
repos?: ProviderRepositoriesInput;
|
|
440
441
|
/**
|
|
@@ -44,11 +44,46 @@ type MyPullRequestsForReposOptions = {
|
|
|
44
44
|
/** Requests the lightweight row shape without per-row build status or commit count. */
|
|
45
45
|
summary?: boolean;
|
|
46
46
|
};
|
|
47
|
+
/** A repository as the batch and branch reads name it. */
|
|
48
|
+
type RepositoryCoordinate = {
|
|
49
|
+
owner: string;
|
|
50
|
+
repo: string;
|
|
51
|
+
project?: string;
|
|
52
|
+
};
|
|
47
53
|
export declare abstract class GitHostIntegration<ID extends IntegrationIds = IntegrationIds, T extends ResourceDescriptor = ResourceDescriptor> extends IntegrationBase<ID> {
|
|
48
54
|
readonly type: IntegrationType;
|
|
49
55
|
/** The self-managed installation `session` addresses, validated against this integration's host. */
|
|
50
56
|
protected getSelfManagedInstallationUrl(session: ProviderAuthenticationSession): string;
|
|
51
57
|
protected getSelfManagedApiBaseUrl(session: ProviderAuthenticationSession): string;
|
|
58
|
+
/**
|
|
59
|
+
* The repositories the repo-scoped, batch and branch reads address, given the coordinates their caller named, in
|
|
60
|
+
* order: those, unless the host names a caller's repository differently than the caller parsed it (see the Azure
|
|
61
|
+
* DevOps Server override). `unsettled` flags a coordinate the host couldn't place, read as given; a batch or
|
|
62
|
+
* branch slot that then reads nothing is rejected rather than reported as absent ({@link rejectUnsettledMisses}).
|
|
63
|
+
*/
|
|
64
|
+
protected resolveRepositoryCoordinates<T extends RepositoryCoordinate>(_session: ProviderAuthenticationSession, coordinates: readonly T[], _cancellation?: AbortSignal): Promise<{
|
|
65
|
+
coordinates: readonly T[];
|
|
66
|
+
unsettled?: readonly boolean[];
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* {@link resolveRepositoryCoordinates} for the repository descriptors the list and search reads take: those, unless
|
|
70
|
+
* the host overrides both.
|
|
71
|
+
*/
|
|
72
|
+
protected resolveRepositoryInputs(_session: ProviderAuthenticationSession, repos: readonly ProviderRepoInput[], _cancellation?: AbortSignal): Promise<ProviderRepoInput[]>;
|
|
73
|
+
/**
|
|
74
|
+
* The repositories a repo-scoped read of `repos` addresses ({@link resolveRepositoryInputs}), for a caller that
|
|
75
|
+
* shapes the read by them before making it. Resolves the session as that read does, and fails as it would: a
|
|
76
|
+
* session that can't be resolved is the read's own failure (refreshing a refused token is claimed here), so the
|
|
77
|
+
* caller reports it rather than making the read. Settling that fails leaves `repos` as given, for the read to
|
|
78
|
+
* settle or report.
|
|
79
|
+
*/
|
|
80
|
+
resolveRepositoryScopes(repos: ProviderReposInput, connectionId?: string): Promise<IntegrationResult<ProviderReposInput>>;
|
|
81
|
+
/**
|
|
82
|
+
* A batch or branch read's slots, settled against the repositories {@link resolveRepositoryCoordinates} settled
|
|
83
|
+
* its coordinates to: a miss for one it couldn't settle is rejected ({@link rejectUnsettledMisses}), and a refusal
|
|
84
|
+
* is recorded against the repository the host read rather than the caller's parse of it.
|
|
85
|
+
*/
|
|
86
|
+
private settleResolvedSlots;
|
|
52
87
|
/** The base the repository-list reads hand the provider client for a self-managed host. */
|
|
53
88
|
protected getRepositoriesApiBaseUrl(session: ProviderAuthenticationSession, _repos: ProviderReposInput): string;
|
|
54
89
|
getAccountForEmail(repo: T, email: string, options?: {
|
|
@@ -83,9 +118,10 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
83
118
|
}): Promise<ProviderRepository | undefined>;
|
|
84
119
|
/**
|
|
85
120
|
* Settles what one repository's refusal of the credential means, as a batch read settles a refused target (see
|
|
86
|
-
* `IntegrationBase.settleBatchRefusals`): the scope failure it is recorded as, against that repository
|
|
87
|
-
* Azure DevOps, its project), with its cause named once the credential checks out.
|
|
88
|
-
*
|
|
121
|
+
* `IntegrationBase.settleBatchRefusals`): the scope failure it is recorded as, against that repository as the host
|
|
122
|
+
* names it (and, on Azure DevOps, its project), with its cause named once the credential checks out. `name` names
|
|
123
|
+
* the repository alone, as a batch target does. A refused credential throws its own error, which the caller reports
|
|
124
|
+
* for the connection instead of the repository's refusal.
|
|
89
125
|
*/
|
|
90
126
|
settleRepositoryRefusal(repo: {
|
|
91
127
|
owner: string;
|
|
@@ -254,7 +290,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
254
290
|
* thrown errors and validation failures into `{ error }` so callers can surface them as warnings
|
|
255
291
|
* rather than swallowing them to `undefined`.
|
|
256
292
|
*/
|
|
257
|
-
getMyIssuesForReposResult(
|
|
293
|
+
getMyIssuesForReposResult(repos: ProviderReposInput, options?: MyIssuesForReposOptions, connectionId?: string): Promise<IntegrationResult<(PagedResult<ProviderIssue> & {
|
|
258
294
|
metadata?: CollectionMetadata;
|
|
259
295
|
}) | undefined>>;
|
|
260
296
|
/**
|
|
@@ -277,7 +313,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
277
313
|
* thrown errors and validation failures into `{ error }` so callers can surface them as warnings
|
|
278
314
|
* rather than swallowing them to `undefined`.
|
|
279
315
|
*/
|
|
280
|
-
getMyPullRequestsForReposResult(
|
|
316
|
+
getMyPullRequestsForReposResult(repos: ProviderReposInput, options?: MyPullRequestsForReposOptions, connectionId?: string): Promise<IntegrationResult<ProviderApiPagedResult<ProviderPullRequest> | undefined>>;
|
|
281
317
|
/** Account-wide (or repo-scoped) search for the current user's pull requests. */
|
|
282
318
|
searchMyPullRequests(repos?: T | T[], cancellation?: AbortSignal, options?: SearchMyPullRequestsOptions & {
|
|
283
319
|
connectionId?: string;
|
|
@@ -5,6 +5,7 @@ import { Logger as _logger } from "../../../utils/logger.js";
|
|
|
5
5
|
import { getScopedLogger } from "../../../utils/logger.scoped.js";
|
|
6
6
|
import { trace } from "../../../utils/decorators/log.js";
|
|
7
7
|
import __decorate from "../../../_virtual/@oxc-project+runtime/helpers/esm/decorate.js";
|
|
8
|
+
import { RequestNotFoundError } from "../../../git/errors.js";
|
|
8
9
|
import { gate } from "../../../utils/decorators/gate.js";
|
|
9
10
|
import "../../../git/models/pullRequest.js";
|
|
10
11
|
import { toError } from "../errors.js";
|
|
@@ -16,7 +17,7 @@ import "../providerFilters.js";
|
|
|
16
17
|
import { areDomainsOnSameHost } from "../utils/domain.utils.js";
|
|
17
18
|
import { getSelfManagedBaseUrl, isGitSelfManagedHostIntegrationId } from "../utils/integration.utils.js";
|
|
18
19
|
import { mergeCollectionMetadata, throwIfAllSettledFailed } from "../providers/utils/providerPaging.js";
|
|
19
|
-
import { toIssueShape, toProviderIssueStates, toProviderPullRequestStates } from "../providers/models.js";
|
|
20
|
+
import { isRepoIdsInput, toIssueShape, toProviderIssueStates, toProviderPullRequestStates } from "../providers/models.js";
|
|
20
21
|
import { IntegrationBase, isReadSessionFailure } from "./integration.js";
|
|
21
22
|
//#region ../plus/integrations/src/models/gitHostIntegration.ts
|
|
22
23
|
/**
|
|
@@ -30,6 +31,18 @@ function sendsBasicCredential(providerId, session) {
|
|
|
30
31
|
return isAzureProviderId(providerId) ? session.type !== "oauth" : void 0;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
34
|
+
* Rejects each slot that read nothing (`isMiss`) for a coordinate whose repository couldn't be settled (see
|
|
35
|
+
* {@link GitHostIntegration.resolveRepositoryCoordinates}): it may have addressed another repository, so its miss is
|
|
36
|
+
* not a proven absence a caller may cache.
|
|
37
|
+
*/
|
|
38
|
+
function rejectUnsettledMisses(slots, unsettled, isMiss) {
|
|
39
|
+
if (!unsettled?.some(Boolean)) return slots;
|
|
40
|
+
return slots.map((slot, i) => unsettled[i] && slot.status === "fulfilled" && isMiss(slot.value) ? {
|
|
41
|
+
status: "rejected",
|
|
42
|
+
reason: /* @__PURE__ */ new Error("Nothing read for a repository that couldn't be settled")
|
|
43
|
+
} : slot);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
33
46
|
* Rejects a read the provider can't serve as asked: logs the reason and returns it as the `{ error }` half of an
|
|
34
47
|
* {@link IntegrationResult}, timed from `start`.
|
|
35
48
|
*
|
|
@@ -70,6 +83,47 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
70
83
|
default: return baseUrl;
|
|
71
84
|
}
|
|
72
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* The repositories the repo-scoped, batch and branch reads address, given the coordinates their caller named, in
|
|
88
|
+
* order: those, unless the host names a caller's repository differently than the caller parsed it (see the Azure
|
|
89
|
+
* DevOps Server override). `unsettled` flags a coordinate the host couldn't place, read as given; a batch or
|
|
90
|
+
* branch slot that then reads nothing is rejected rather than reported as absent ({@link rejectUnsettledMisses}).
|
|
91
|
+
*/
|
|
92
|
+
resolveRepositoryCoordinates(_session, coordinates, _cancellation) {
|
|
93
|
+
return Promise.resolve({ coordinates });
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* {@link resolveRepositoryCoordinates} for the repository descriptors the list and search reads take: those, unless
|
|
97
|
+
* the host overrides both.
|
|
98
|
+
*/
|
|
99
|
+
resolveRepositoryInputs(_session, repos, _cancellation) {
|
|
100
|
+
return Promise.resolve([...repos]);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The repositories a repo-scoped read of `repos` addresses ({@link resolveRepositoryInputs}), for a caller that
|
|
104
|
+
* shapes the read by them before making it. Resolves the session as that read does, and fails as it would: a
|
|
105
|
+
* session that can't be resolved is the read's own failure (refreshing a refused token is claimed here), so the
|
|
106
|
+
* caller reports it rather than making the read. Settling that fails leaves `repos` as given, for the read to
|
|
107
|
+
* settle or report.
|
|
108
|
+
*/
|
|
109
|
+
async resolveRepositoryScopes(repos, connectionId) {
|
|
110
|
+
if (isRepoIdsInput(repos)) return { value: repos };
|
|
111
|
+
const session = await this.resolveReadSession(connectionId, void 0);
|
|
112
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
113
|
+
try {
|
|
114
|
+
return { value: await this.resolveRepositoryInputs(session, repos) };
|
|
115
|
+
} catch {
|
|
116
|
+
return { value: repos };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A batch or branch read's slots, settled against the repositories {@link resolveRepositoryCoordinates} settled
|
|
121
|
+
* its coordinates to: a miss for one it couldn't settle is rejected ({@link rejectUnsettledMisses}), and a refusal
|
|
122
|
+
* is recorded against the repository the host read rather than the caller's parse of it.
|
|
123
|
+
*/
|
|
124
|
+
settleResolvedSlots(session, resolved, slots, isMiss, options) {
|
|
125
|
+
return this.settleBatchRefusals(session, resolved.coordinates, rejectUnsettledMisses(slots, resolved.unsettled, isMiss), options);
|
|
126
|
+
}
|
|
73
127
|
/** The base the repository-list reads hand the provider client for a self-managed host. */
|
|
74
128
|
getRepositoriesApiBaseUrl(session, _repos) {
|
|
75
129
|
return this.getSelfManagedApiBaseUrl(session);
|
|
@@ -122,12 +176,17 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
122
176
|
async getDefaultBranch(repo, options) {
|
|
123
177
|
const scope = getScopedLogger();
|
|
124
178
|
if (await this.prepareSessionLookup() != null) return void 0;
|
|
125
|
-
return this.ctx.cache.getRepositoryDefaultBranch(repo, this, () => ({ value: (async () => {
|
|
179
|
+
return this.ctx.cache.getRepositoryDefaultBranch(repo, this, (cacheable) => ({ value: (async () => {
|
|
126
180
|
try {
|
|
127
181
|
const result = await this.getProviderDefaultBranch(this._session, repo, options?.cancellation);
|
|
182
|
+
if (result == null && options?.cancellation?.aborted) {
|
|
183
|
+
cacheable.invalidate();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
128
186
|
this.resetRequestExceptionCount("getDefaultBranch");
|
|
129
187
|
return result;
|
|
130
188
|
} catch (ex) {
|
|
189
|
+
if (!(ex instanceof RequestNotFoundError)) cacheable.invalidate();
|
|
131
190
|
this.handleProviderException("getDefaultBranch", ex, { scope });
|
|
132
191
|
return;
|
|
133
192
|
}
|
|
@@ -135,18 +194,20 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
135
194
|
}
|
|
136
195
|
/**
|
|
137
196
|
* Settles what one repository's refusal of the credential means, as a batch read settles a refused target (see
|
|
138
|
-
* `IntegrationBase.settleBatchRefusals`): the scope failure it is recorded as, against that repository
|
|
139
|
-
* Azure DevOps, its project), with its cause named once the credential checks out.
|
|
140
|
-
*
|
|
197
|
+
* `IntegrationBase.settleBatchRefusals`): the scope failure it is recorded as, against that repository as the host
|
|
198
|
+
* names it (and, on Azure DevOps, its project), with its cause named once the credential checks out. `name` names
|
|
199
|
+
* the repository alone, as a batch target does. A refused credential throws its own error, which the caller reports
|
|
200
|
+
* for the connection instead of the repository's refusal.
|
|
141
201
|
*/
|
|
142
202
|
async settleRepositoryRefusal(repo, refusal) {
|
|
143
203
|
const session = await this.resolveReadSessionOrThrow(repo.connectionId, void 0);
|
|
144
204
|
if (session == null) return void 0;
|
|
145
|
-
const
|
|
205
|
+
const { coordinates } = await this.resolveRepositoryCoordinates(session, [{
|
|
146
206
|
owner: repo.owner,
|
|
147
207
|
repo: repo.name,
|
|
148
208
|
project: repo.project
|
|
149
|
-
}]
|
|
209
|
+
}]);
|
|
210
|
+
const [slot] = await this.settleBatchRefusals(session, coordinates, [{
|
|
150
211
|
status: "rejected",
|
|
151
212
|
reason: refusal
|
|
152
213
|
}]);
|
|
@@ -155,12 +216,17 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
155
216
|
async getRepositoryMetadata(repo, options) {
|
|
156
217
|
const scope = getScopedLogger();
|
|
157
218
|
if (await this.prepareSessionLookup() != null) return void 0;
|
|
158
|
-
return this.ctx.cache.getRepositoryMetadata(repo, this, () => ({ value: (async () => {
|
|
219
|
+
return this.ctx.cache.getRepositoryMetadata(repo, this, (cacheable) => ({ value: (async () => {
|
|
159
220
|
try {
|
|
160
221
|
const result = await this.getProviderRepositoryMetadata(this._session, repo, options?.cancellation);
|
|
222
|
+
if (result == null && options?.cancellation?.aborted) {
|
|
223
|
+
cacheable.invalidate();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
161
226
|
this.resetRequestExceptionCount("getRepositoryMetadata");
|
|
162
227
|
return result;
|
|
163
228
|
} catch (ex) {
|
|
229
|
+
if (!(ex instanceof RequestNotFoundError)) cacheable.invalidate();
|
|
164
230
|
this.handleProviderException("getRepositoryMetadata", ex, { scope });
|
|
165
231
|
return;
|
|
166
232
|
}
|
|
@@ -464,17 +530,19 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
464
530
|
* thrown errors and validation failures into `{ error }` so callers can surface them as warnings
|
|
465
531
|
* rather than swallowing them to `undefined`.
|
|
466
532
|
*/
|
|
467
|
-
async getMyIssuesForReposResult(
|
|
533
|
+
async getMyIssuesForReposResult(repos, options, connectionId) {
|
|
468
534
|
const scope = getScopedLogger();
|
|
469
535
|
const providerId = this.authProvider.id;
|
|
470
536
|
const states = toProviderIssueStates(options?.state);
|
|
471
537
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
472
538
|
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
473
539
|
const start = performance.now();
|
|
540
|
+
let resolvedRepos;
|
|
474
541
|
let customUrl;
|
|
475
542
|
let api;
|
|
476
543
|
try {
|
|
477
|
-
|
|
544
|
+
resolvedRepos = isRepoIdsInput(repos) ? repos : await this.resolveRepositoryInputs(session, repos);
|
|
545
|
+
customUrl = options?.customUrl ?? (isGitSelfManagedHostIntegrationId(providerId) ? this.getRepositoriesApiBaseUrl(session, resolvedRepos) : void 0);
|
|
478
546
|
api = await this.getProvidersApi();
|
|
479
547
|
} catch (ex) {
|
|
480
548
|
this.handleProviderException("getIssuesForRepos", ex, {
|
|
@@ -486,6 +554,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
486
554
|
duration: performance.now() - start
|
|
487
555
|
};
|
|
488
556
|
}
|
|
557
|
+
const reposOrRepoIds = resolvedRepos;
|
|
489
558
|
const repoIdsInput = api.isRepoIdsInput(reposOrRepoIds);
|
|
490
559
|
if (providerId !== "gitlab" && (repoIdsInput || isAzureProviderId(providerId) && !reposOrRepoIds.every((repo) => repo.project != null && repo.namespace != null))) return unsupportedRead(`Unsupported input for provider ${providerId}`, start, "getIssuesForRepos");
|
|
491
560
|
let getIssuesOptions;
|
|
@@ -794,17 +863,19 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
794
863
|
* thrown errors and validation failures into `{ error }` so callers can surface them as warnings
|
|
795
864
|
* rather than swallowing them to `undefined`.
|
|
796
865
|
*/
|
|
797
|
-
async getMyPullRequestsForReposResult(
|
|
866
|
+
async getMyPullRequestsForReposResult(repos, options, connectionId) {
|
|
798
867
|
const scope = getScopedLogger();
|
|
799
868
|
const providerId = this.authProvider.id;
|
|
800
869
|
const states = toProviderPullRequestStates(options?.state);
|
|
801
870
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
802
871
|
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
803
872
|
const start = performance.now();
|
|
873
|
+
let resolvedRepos;
|
|
804
874
|
let customUrl;
|
|
805
875
|
let api;
|
|
806
876
|
try {
|
|
807
|
-
|
|
877
|
+
resolvedRepos = isRepoIdsInput(repos) ? repos : await this.resolveRepositoryInputs(session, repos);
|
|
878
|
+
customUrl = options?.customUrl ?? (isGitSelfManagedHostIntegrationId(providerId) ? this.getRepositoriesApiBaseUrl(session, resolvedRepos) : void 0);
|
|
808
879
|
api = await this.getProvidersApi();
|
|
809
880
|
} catch (ex) {
|
|
810
881
|
this.handleProviderException("getPullRequestsForRepos", ex, {
|
|
@@ -816,6 +887,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
816
887
|
duration: performance.now() - start
|
|
817
888
|
};
|
|
818
889
|
}
|
|
890
|
+
const reposOrRepoIds = resolvedRepos;
|
|
819
891
|
if (providerId !== "gitlab" && (api.isRepoIdsInput(reposOrRepoIds) || isAzureProviderId(providerId) && !reposOrRepoIds.every((repo) => repo.project != null && repo.namespace != null))) return unsupportedRead(`Unsupported input for provider ${providerId}`, start);
|
|
820
892
|
let getPullRequestsOptions;
|
|
821
893
|
if (options?.filters != null) {
|
|
@@ -1230,7 +1302,8 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1230
1302
|
const start = performance.now();
|
|
1231
1303
|
let slots;
|
|
1232
1304
|
try {
|
|
1233
|
-
|
|
1305
|
+
const targets = await this.resolveRepositoryCoordinates(session, coordinates, cancellation);
|
|
1306
|
+
slots = await this.getProviderIssuesBatch?.(session, targets.coordinates, cancellation);
|
|
1234
1307
|
if (slots == null) {
|
|
1235
1308
|
this.resetRequestExceptionCount("getIssuesBatch");
|
|
1236
1309
|
return {
|
|
@@ -1238,9 +1311,9 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1238
1311
|
duration: performance.now() - start
|
|
1239
1312
|
};
|
|
1240
1313
|
}
|
|
1241
|
-
const settled = await this.
|
|
1314
|
+
const settled = await this.settleResolvedSlots(session, targets, slots, (issue) => issue == null);
|
|
1242
1315
|
this.resetRequestExceptionCount("getIssuesBatch");
|
|
1243
|
-
this.reportDeferredRequestFailures(
|
|
1316
|
+
this.reportDeferredRequestFailures(settled, false);
|
|
1244
1317
|
return {
|
|
1245
1318
|
value: settled,
|
|
1246
1319
|
duration: performance.now() - start
|
|
@@ -1281,7 +1354,8 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1281
1354
|
const start = performance.now();
|
|
1282
1355
|
let slots;
|
|
1283
1356
|
try {
|
|
1284
|
-
|
|
1357
|
+
const targets = await this.resolveRepositoryCoordinates(session, coordinates, cancellation);
|
|
1358
|
+
slots = await this.getProviderPullRequestsBatch?.(session, targets.coordinates, options, cancellation);
|
|
1285
1359
|
if (slots == null) {
|
|
1286
1360
|
this.resetRequestExceptionCount("getPullRequestsBatch");
|
|
1287
1361
|
return {
|
|
@@ -1289,9 +1363,9 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1289
1363
|
duration: performance.now() - start
|
|
1290
1364
|
};
|
|
1291
1365
|
}
|
|
1292
|
-
const settled = await this.
|
|
1366
|
+
const settled = await this.settleResolvedSlots(session, targets, slots, (pr) => pr == null);
|
|
1293
1367
|
this.resetRequestExceptionCount("getPullRequestsBatch");
|
|
1294
|
-
this.reportDeferredRequestFailures(
|
|
1368
|
+
this.reportDeferredRequestFailures(settled, false);
|
|
1295
1369
|
return {
|
|
1296
1370
|
value: settled,
|
|
1297
1371
|
duration: performance.now() - start
|
|
@@ -1328,13 +1402,14 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1328
1402
|
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1329
1403
|
const start = performance.now();
|
|
1330
1404
|
try {
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1405
|
+
const targets = await this.resolveRepositoryCoordinates(session, coordinates, cancellation);
|
|
1406
|
+
const read = await this.getProviderIssuesEtagFields?.(session, targets.coordinates, options, cancellation);
|
|
1407
|
+
if (read == null) return {
|
|
1333
1408
|
value: void 0,
|
|
1334
1409
|
duration: performance.now() - start
|
|
1335
1410
|
};
|
|
1336
|
-
const settled = await this.
|
|
1337
|
-
if (
|
|
1411
|
+
const settled = await this.settleResolvedSlots(session, targets, read, (fields) => fields == null, { keepOtherFailures: true });
|
|
1412
|
+
if (settled.some((slot) => slot.status === "fulfilled")) this.resetRequestExceptionCount("getIssuesEtagFields");
|
|
1338
1413
|
return {
|
|
1339
1414
|
value: settled,
|
|
1340
1415
|
duration: performance.now() - start
|
|
@@ -1364,13 +1439,14 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1364
1439
|
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1365
1440
|
const start = performance.now();
|
|
1366
1441
|
try {
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1442
|
+
const targets = await this.resolveRepositoryCoordinates(session, coordinates, cancellation);
|
|
1443
|
+
const read = await this.getProviderPullRequestsEtagFields?.(session, targets.coordinates, options, cancellation);
|
|
1444
|
+
if (read == null) return {
|
|
1369
1445
|
value: void 0,
|
|
1370
1446
|
duration: performance.now() - start
|
|
1371
1447
|
};
|
|
1372
|
-
const settled = await this.
|
|
1373
|
-
if (
|
|
1448
|
+
const settled = await this.settleResolvedSlots(session, targets, read, (fields) => fields == null, { keepOtherFailures: true });
|
|
1449
|
+
if (settled.some((slot) => slot.status === "fulfilled")) this.resetRequestExceptionCount("getPullRequestsEtagFields");
|
|
1374
1450
|
return {
|
|
1375
1451
|
value: settled,
|
|
1376
1452
|
duration: performance.now() - start
|
|
@@ -1408,7 +1484,8 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1408
1484
|
const start = performance.now();
|
|
1409
1485
|
let slots;
|
|
1410
1486
|
try {
|
|
1411
|
-
|
|
1487
|
+
const resolved = await this.resolveRepositoryCoordinates(session, targets, cancellation);
|
|
1488
|
+
slots = await this.getProviderPullRequestsForBranches?.(session, resolved.coordinates, options, cancellation);
|
|
1412
1489
|
if (slots == null) {
|
|
1413
1490
|
this.resetRequestExceptionCount("getPullRequestsForBranches");
|
|
1414
1491
|
return {
|
|
@@ -1416,9 +1493,9 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1416
1493
|
duration: performance.now() - start
|
|
1417
1494
|
};
|
|
1418
1495
|
}
|
|
1419
|
-
const settled = await this.
|
|
1496
|
+
const settled = await this.settleResolvedSlots(session, resolved, slots, (found) => found.pullRequests.length === 0 && !found.truncated);
|
|
1420
1497
|
this.resetRequestExceptionCount("getPullRequestsForBranches");
|
|
1421
|
-
this.reportDeferredRequestFailures(
|
|
1498
|
+
this.reportDeferredRequestFailures(settled, false);
|
|
1422
1499
|
return {
|
|
1423
1500
|
value: settled,
|
|
1424
1501
|
duration: performance.now() - start
|