@gitkraken/core-gitlens 0.59.0 → 0.60.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 +8 -1
- package/dist/plus/integrations/index.d.ts +2 -1
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +7 -0
- package/dist/plus/integrations/integrationService.js +36 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +6 -0
- package/dist/plus/integrations/models/gitlabIssueWrites.d.ts +86 -0
- package/dist/plus/integrations/models/gitlabIssueWrites.js +9 -0
- package/dist/plus/integrations/models/gitlabIssueWrites.js.map +1 -0
- package/dist/plus/integrations/models/publicIntegration.d.ts +1 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +4 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.js +4 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.d.ts +11 -0
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.js +73 -0
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab/issueWrites.d.ts +33 -0
- package/dist/plus/integrations/providers/gitlab/issueWrites.js +325 -0
- package/dist/plus/integrations/providers/gitlab/issueWrites.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab.d.ts +7 -1
- package/dist/plus/integrations/providers/gitlab.js +24 -0
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/reads/drains.d.ts +1 -0
- package/docs/integrations.md +25 -0
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ import { WorkItemAddress, WorkItemCreateOptions, WorkItemCreateOptionsResult, Wo
|
|
|
13
13
|
import { AzurePullRequestCreateCapabilityOptions, AzurePullRequestCreateCapabilityResult, AzurePullRequestWriteOptions, AzurePullRequestWriteResult, AzurePullRequestWriteTargetOptions, AzurePullRequestWriteTargetResult, AzureServerPullRequestWriteOptions, AzureServerPullRequestWriteScope, AzureServerPullRequestWriteTargetOptions } from "./models/azurePullRequestWrites.js";
|
|
14
14
|
import { BitbucketPullRequestCreateCapabilityOptions, BitbucketPullRequestCreateCapabilityResult, BitbucketPullRequestMergeStatusOptions, BitbucketPullRequestMergeStatusResult, BitbucketPullRequestWriteOptions, BitbucketPullRequestWriteReleaseOptions, BitbucketPullRequestWriteReleaseResult, BitbucketPullRequestWriteResult, BitbucketPullRequestWriteTargetOptions, BitbucketPullRequestWriteTargetResult } from "./models/bitbucketPullRequestWrites.js";
|
|
15
15
|
import { BitbucketServerPullRequestCreateCapabilityResult, BitbucketServerPullRequestWriteOptions, BitbucketServerPullRequestWriteResult, BitbucketServerPullRequestWriteScope, BitbucketServerPullRequestWriteTargetOptions, BitbucketServerPullRequestWriteTargetResult } from "./models/bitbucketServerPullRequestWrites.js";
|
|
16
|
+
import { GitLabIssueCreateOptions, GitLabIssueCreateOptionsResult, GitLabIssueDeleteOptions, GitLabIssueWriteAddress, GitLabIssueWriteOptions, GitLabIssueWriteOptionsResult, GitLabIssueWriteResult, GitLabIssueWriteTargetOptions, GitLabIssueWriteTargetResult } from "./models/gitlabIssueWrites.js";
|
|
16
17
|
import { CaptureRelationshipCurrency, IssueRelationshipWriteOptions, IssueRelationshipWriteResult, IssueRelationshipsOptions, IssueRelationshipsResult } from "./models/issueRelationships.js";
|
|
17
18
|
import { IssueFilter, SupportedFilters } from "./providerFilters.js";
|
|
18
19
|
import { IssueEtagInclude, PullRequestEtagInclude } from "./reads/etag.js";
|
|
@@ -1196,6 +1197,11 @@ export interface IntegrationManager {
|
|
|
1196
1197
|
writeWorkItem(options: WorkItemWriteOptions): Promise<WorkItemWriteResult>;
|
|
1197
1198
|
resolveWorkItemWriteTarget(options: WorkItemWriteTargetOptions): Promise<WorkItemWriteTargetResult>;
|
|
1198
1199
|
deleteWorkItem(options: WorkItemDeleteOptions): Promise<WorkItemDeleteResult>;
|
|
1200
|
+
getGitLabIssueCreateOptions(options: GitLabIssueCreateOptions): Promise<GitLabIssueCreateOptionsResult>;
|
|
1201
|
+
getGitLabIssueWriteOptions(options: GitLabIssueWriteAddress): Promise<GitLabIssueWriteOptionsResult>;
|
|
1202
|
+
resolveGitLabIssueWriteTarget(options: GitLabIssueWriteTargetOptions): Promise<GitLabIssueWriteTargetResult>;
|
|
1203
|
+
writeGitLabIssue(options: GitLabIssueWriteOptions): Promise<GitLabIssueWriteResult>;
|
|
1204
|
+
deleteGitLabIssue(options: GitLabIssueDeleteOptions): Promise<GitLabIssueWriteResult>;
|
|
1199
1205
|
getIssueTrackerCreateOptions(options: IssueTrackerCreateOptions): Promise<IssueTrackerCreateOptionsResult>;
|
|
1200
1206
|
getIssueTrackerIssueWriteOptions(options: IssueTrackerIssueWriteOptions): Promise<IssueTrackerIssueWriteOptionsResult>;
|
|
1201
1207
|
writeIssueTrackerIssue(options: IssueTrackerWriteOptions): Promise<IssueTrackerWriteResult>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { GitCloudHostIntegrationId } from "../constants.js";
|
|
2
|
+
import { IssueTrackerWriteFailure } from "./issueTrackerWrites.js";
|
|
3
|
+
//#region ../plus/integrations/src/models/gitlabIssueWrites.d.ts
|
|
4
|
+
export declare const gitLabIssueWriteBaseUrl = "https://gitlab.com";
|
|
5
|
+
export declare function isGitLabDecimalId(value: unknown): boolean;
|
|
6
|
+
export type GitLabIssueWriteScope = {
|
|
7
|
+
providerId: GitCloudHostIntegrationId.GitLab;
|
|
8
|
+
connectionId: string;
|
|
9
|
+
baseUrl: typeof gitLabIssueWriteBaseUrl;
|
|
10
|
+
expectedAccountId?: string;
|
|
11
|
+
};
|
|
12
|
+
export type GitLabIssueCreateOptions = GitLabIssueWriteScope & {
|
|
13
|
+
project: string;
|
|
14
|
+
};
|
|
15
|
+
export type GitLabIssueWriteAddress = GitLabIssueCreateOptions & {
|
|
16
|
+
iid: string;
|
|
17
|
+
expectedIssueId?: string;
|
|
18
|
+
};
|
|
19
|
+
export type GitLabIssueWriteTargetOptions = GitLabIssueWriteAddress & {
|
|
20
|
+
intent?: 'delete';
|
|
21
|
+
};
|
|
22
|
+
type GitLabIssueMutationScope = GitLabIssueWriteScope & {
|
|
23
|
+
projectId: string;
|
|
24
|
+
expectedAccountId: string;
|
|
25
|
+
};
|
|
26
|
+
export type GitLabIssueDeleteOptions = GitLabIssueMutationScope & {
|
|
27
|
+
iid: string;
|
|
28
|
+
expectedIssueId: string;
|
|
29
|
+
};
|
|
30
|
+
export type GitLabIssueWriteOptions = (GitLabIssueMutationScope & {
|
|
31
|
+
action: 'create';
|
|
32
|
+
title: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
}) | (GitLabIssueDeleteOptions & {
|
|
35
|
+
action: 'edit';
|
|
36
|
+
title?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
}) | (GitLabIssueDeleteOptions & {
|
|
39
|
+
action: 'close' | 'reopen';
|
|
40
|
+
});
|
|
41
|
+
export type GitLabIssueWriteFailure = Omit<IssueTrackerWriteFailure, 'reason'> & {
|
|
42
|
+
reason: IssueTrackerWriteFailure['reason'] | 'provider-policy';
|
|
43
|
+
};
|
|
44
|
+
export type GitLabIssueWriteCapability = {
|
|
45
|
+
allowed: true;
|
|
46
|
+
} | {
|
|
47
|
+
allowed: false;
|
|
48
|
+
reason: Extract<GitLabIssueWriteFailure['reason'], 'forbidden' | 'insufficient-scope' | 'provider-policy' | 'unsupported' | 'transition-unavailable'>;
|
|
49
|
+
};
|
|
50
|
+
export type GitLabIssueWriteField = {
|
|
51
|
+
id: 'title' | 'description';
|
|
52
|
+
required: boolean;
|
|
53
|
+
};
|
|
54
|
+
export type GitLabIssueReceipt = {
|
|
55
|
+
id: string;
|
|
56
|
+
iid: string;
|
|
57
|
+
url: string;
|
|
58
|
+
title: string;
|
|
59
|
+
description: string;
|
|
60
|
+
state: 'opened' | 'closed';
|
|
61
|
+
};
|
|
62
|
+
export type GitLabIssueWriteContext = Omit<GitLabIssueWriteScope, 'expectedAccountId'> & {
|
|
63
|
+
accountId: string;
|
|
64
|
+
project: {
|
|
65
|
+
id: string;
|
|
66
|
+
fullPath: string;
|
|
67
|
+
url: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
type GitLabIssueWriteSuccess = GitLabIssueWriteContext & {
|
|
71
|
+
ok: true;
|
|
72
|
+
issue: GitLabIssueReceipt;
|
|
73
|
+
};
|
|
74
|
+
export type GitLabIssueCreateOptionsResult = GitLabIssueWriteFailure | (GitLabIssueWriteContext & {
|
|
75
|
+
ok: true;
|
|
76
|
+
fields: readonly GitLabIssueWriteField[];
|
|
77
|
+
createCapability: GitLabIssueWriteCapability;
|
|
78
|
+
});
|
|
79
|
+
export type GitLabIssueWriteOptionsResult = GitLabIssueWriteFailure | (GitLabIssueWriteSuccess & {
|
|
80
|
+
fields: readonly GitLabIssueWriteField[];
|
|
81
|
+
capabilities: Record<'edit' | 'close' | 'reopen' | 'delete', GitLabIssueWriteCapability>;
|
|
82
|
+
});
|
|
83
|
+
export type GitLabIssueWriteResult = GitLabIssueWriteFailure | GitLabIssueWriteSuccess;
|
|
84
|
+
export type GitLabIssueWriteTargetResult = GitLabIssueWriteResult;
|
|
85
|
+
//#endregion
|
|
86
|
+
//# sourceMappingURL=gitlabIssueWrites.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region ../plus/integrations/src/models/gitlabIssueWrites.ts
|
|
2
|
+
const gitLabIssueWriteBaseUrl = "https://gitlab.com";
|
|
3
|
+
function isGitLabDecimalId(value) {
|
|
4
|
+
return typeof value === "string" && /^[1-9]\d*$/.test(value);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { gitLabIssueWriteBaseUrl, isGitLabDecimalId };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=gitlabIssueWrites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlabIssueWrites.js","names":[],"sources":["../../../../../plus/integrations/src/models/gitlabIssueWrites.ts"],"sourcesContent":["import type { GitCloudHostIntegrationId } from '../constants.js';\nimport type { IssueTrackerWriteFailure } from './issueTrackerWrites.js';\n\nexport const gitLabIssueWriteBaseUrl = 'https://gitlab.com';\n\nexport function isGitLabDecimalId(value: unknown): boolean {\n\treturn typeof value === 'string' && /^[1-9]\\d*$/.test(value);\n}\n\nexport type GitLabIssueWriteScope = {\n\tproviderId: GitCloudHostIntegrationId.GitLab;\n\tconnectionId: string;\n\tbaseUrl: typeof gitLabIssueWriteBaseUrl;\n\texpectedAccountId?: string;\n};\n\nexport type GitLabIssueCreateOptions = GitLabIssueWriteScope & { project: string };\nexport type GitLabIssueWriteAddress = GitLabIssueCreateOptions & { iid: string; expectedIssueId?: string };\nexport type GitLabIssueWriteTargetOptions = GitLabIssueWriteAddress & { intent?: 'delete' };\n\ntype GitLabIssueMutationScope = GitLabIssueWriteScope & { projectId: string; expectedAccountId: string };\nexport type GitLabIssueDeleteOptions = GitLabIssueMutationScope & { iid: string; expectedIssueId: string };\nexport type GitLabIssueWriteOptions =\n\t| (GitLabIssueMutationScope & { action: 'create'; title: string; description?: string })\n\t| (GitLabIssueDeleteOptions & { action: 'edit'; title?: string; description?: string })\n\t| (GitLabIssueDeleteOptions & { action: 'close' | 'reopen' });\n\nexport type GitLabIssueWriteFailure = Omit<IssueTrackerWriteFailure, 'reason'> & {\n\treason: IssueTrackerWriteFailure['reason'] | 'provider-policy';\n};\n\nexport type GitLabIssueWriteCapability =\n\t| { allowed: true }\n\t| {\n\t\t\tallowed: false;\n\t\t\treason: Extract<\n\t\t\t\tGitLabIssueWriteFailure['reason'],\n\t\t\t\t'forbidden' | 'insufficient-scope' | 'provider-policy' | 'unsupported' | 'transition-unavailable'\n\t\t\t>;\n\t };\n\nexport type GitLabIssueWriteField = { id: 'title' | 'description'; required: boolean };\nexport type GitLabIssueReceipt = {\n\tid: string;\n\tiid: string;\n\turl: string;\n\ttitle: string;\n\tdescription: string;\n\tstate: 'opened' | 'closed';\n};\n\nexport type GitLabIssueWriteContext = Omit<GitLabIssueWriteScope, 'expectedAccountId'> & {\n\taccountId: string;\n\tproject: { id: string; fullPath: string; url: string };\n};\n\ntype GitLabIssueWriteSuccess = GitLabIssueWriteContext & { ok: true; issue: GitLabIssueReceipt };\n\nexport type GitLabIssueCreateOptionsResult =\n\t| GitLabIssueWriteFailure\n\t| (GitLabIssueWriteContext & {\n\t\t\tok: true;\n\t\t\tfields: readonly GitLabIssueWriteField[];\n\t\t\tcreateCapability: GitLabIssueWriteCapability;\n\t });\n\nexport type GitLabIssueWriteOptionsResult =\n\t| GitLabIssueWriteFailure\n\t| (GitLabIssueWriteSuccess & {\n\t\t\tfields: readonly GitLabIssueWriteField[];\n\t\t\tcapabilities: Record<'edit' | 'close' | 'reopen' | 'delete', GitLabIssueWriteCapability>;\n\t });\n\nexport type GitLabIssueWriteResult = GitLabIssueWriteFailure | GitLabIssueWriteSuccess;\nexport type GitLabIssueWriteTargetResult = GitLabIssueWriteResult;\n"],"mappings":";AAGA,MAAa,0BAA0B;AAEvC,SAAgB,kBAAkB,OAAyB;CAC1D,OAAO,OAAO,UAAU,YAAY,aAAa,KAAK,KAAK;AAC5D"}
|
|
@@ -10,6 +10,7 @@ import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
|
|
|
10
10
|
import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
|
|
11
11
|
import { GitCloudHostIntegrationId, IntegrationIds, IssuesCloudHostIntegrationId, IssuesHostIntegrationIds } from "../constants.js";
|
|
12
12
|
import { Sources } from "../telemetry.js";
|
|
13
|
+
import "../providerFilters.js";
|
|
13
14
|
import { ProviderRepositoryShape } from "../results.js";
|
|
14
15
|
import { ProviderRepositoriesInput } from "../manager.js";
|
|
15
16
|
//#region ../plus/integrations/src/models/publicIntegration.d.ts
|
|
@@ -5,10 +5,12 @@ import { PullRequest } from "../../../../git/models/pullRequest.js";
|
|
|
5
5
|
import { Account } from "../../../../git/models/author.js";
|
|
6
6
|
import { DefaultBranch } from "../../../../git/models/defaultBranch.js";
|
|
7
7
|
import { RepositoryMetadata } from "../../../../git/models/repositoryMetadata.js";
|
|
8
|
-
import { TokenWithInfo } from "../../authentication/models.js";
|
|
8
|
+
import { ProviderAuthenticationSession, TokenWithInfo } from "../../authentication/models.js";
|
|
9
|
+
import { GitLabIssueWriteScope } from "../../models/gitlabIssueWrites.js";
|
|
9
10
|
import { IssueEtagInclude, PullRequestEtagInclude } from "../../reads/etag.js";
|
|
10
11
|
import { IntegrationServiceContext } from "../../context.js";
|
|
11
12
|
import { ProviderApiConfig } from "../apiConfig.js";
|
|
13
|
+
import { GitLabIssueWriter } from "./issueWrites.js";
|
|
12
14
|
import { GitLabIssueEtagNode, GitLabMergeRequestEtagNode, GitLabMergeRequestState, GitLabSshKey } from "./models.js";
|
|
13
15
|
//#region ../plus/integrations/src/providers/gitlab/gitlab.d.ts
|
|
14
16
|
export declare class GitLabApi implements Disposable {
|
|
@@ -20,6 +22,7 @@ export declare class GitLabApi implements Disposable {
|
|
|
20
22
|
private _projectLookupBackoffs;
|
|
21
23
|
private _reauthenticationPrompted;
|
|
22
24
|
constructor(config: ProviderApiConfig);
|
|
25
|
+
getIssueWriter(scope: GitLabIssueWriteScope, session: ProviderAuthenticationSession, isCurrent: () => Promise<boolean>, isRetired: () => boolean): GitLabIssueWriter;
|
|
23
26
|
dispose(): void;
|
|
24
27
|
clearProjectLookupBackoff(provider: Provider): void;
|
|
25
28
|
private resetCaches;
|
|
@@ -15,6 +15,7 @@ import { selectBranchPullRequests } from "../utils/providerPaging.js";
|
|
|
15
15
|
import { FailureBackoff } from "../../utils/failureBackoff.js";
|
|
16
16
|
import { selectGitLabUserForCommit } from "./gitlab.utils.js";
|
|
17
17
|
import { baseProviderApiConfig } from "../apiConfig.js";
|
|
18
|
+
import { GitLabIssueWriter } from "./issueWrites.js";
|
|
18
19
|
import { fromGitLabMergeRequest, fromGitLabMergeRequestREST, fromGitLabMergeRequestState, getRepoName, getRepoNamespace, toGitLabMergeRequestState } from "./models.js";
|
|
19
20
|
import * as l10n from "@vscode/l10n";
|
|
20
21
|
import { captureReadNodes, copyReadProvenance, createReadCapture } from "@gitkraken/provider-apis/read-provenance";
|
|
@@ -58,6 +59,9 @@ var GitLabApi = class {
|
|
|
58
59
|
this.config = config;
|
|
59
60
|
this._disposable = config.onConfigChanged?.(() => this.resetCaches());
|
|
60
61
|
}
|
|
62
|
+
getIssueWriter(scope, session, isCurrent, isRetired) {
|
|
63
|
+
return new GitLabIssueWriter(this.config, scope, session, isCurrent, isRetired);
|
|
64
|
+
}
|
|
61
65
|
dispose() {
|
|
62
66
|
this._disposable?.dispose();
|
|
63
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab.js","names":["Logger"],"sources":["../../../../../../plus/integrations/src/providers/gitlab/gitlab.ts"],"sourcesContent":["import { captureReadNodes, copyReadProvenance, createReadCapture } from '@gitkraken/provider-apis/read-provenance';\nimport * as l10n from '@vscode/l10n';\nimport { reportRequestFailure, takeDeferredRequestFailure } from '@gitlens/git/errors.js';\nimport type { Account } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { IssueOrPullRequest } from '@gitlens/git/models/issueOrPullRequest.js';\nimport { PullRequest } from '@gitlens/git/models/pullRequest.js';\nimport type { PullRequestState } from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport { AbortAggregate, CancellationError, isCancellationError, raceWithSignal } from '@gitlens/utils/cancellation.js';\nimport { trace } from '@gitlens/utils/decorators/log.js';\nimport type { Disposable } from '@gitlens/utils/disposable.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport type { ScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { mapSettledBounded } from '@gitlens/utils/promise.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { equalsIgnoreCase } from '@gitlens/utils/string.js';\nimport { joinUriPath, parseUri } from '@gitlens/utils/uri.js';\nimport type { TokenWithInfo } from '../../authentication/models.js';\nimport type { IntegrationServiceContext } from '../../context.js';\nimport {\n\tAuthenticationError,\n\tAuthenticationErrorReason,\n\tisRateLimitResponse,\n\tLookupBackedOffError,\n\tProviderFetchError,\n\tRequestClientError,\n\tRequestNotFoundError,\n\tRequestRateLimitError,\n\ttoRateLimitError,\n} from '../../errors.js';\nimport type { IssueEtagInclude, PullRequestEtagInclude } from '../../reads/etag.js';\nimport { FailureBackoff } from '../../utils/failureBackoff.js';\nimport type { ProviderApiConfig } from '../apiConfig.js';\nimport { baseProviderApiConfig } from '../apiConfig.js';\nimport { isNotFoundResponse } from '../providerErrors.js';\nimport { providerFanOutConcurrency, selectBranchPullRequests } from '../utils/providerPaging.js';\nimport type { GitLabUser } from './gitlab.utils.js';\nimport { selectGitLabUserForCommit } from './gitlab.utils.js';\nimport type {\n\tGitLabCommit,\n\tGitLabIssue,\n\tGitLabIssueEtagNode,\n\tGitLabMergeRequest,\n\tGitLabMergeRequestEtagNode,\n\tGitLabMergeRequestFull,\n\tGitLabMergeRequestREST,\n\tGitLabMergeRequestState,\n\tGitLabProjectREST,\n\tGitLabSshKey,\n} from './models.js';\nimport {\n\tfromGitLabMergeRequest,\n\tfromGitLabMergeRequestREST,\n\tfromGitLabMergeRequestState,\n\tgetRepoName,\n\tgetRepoNamespace,\n\tgitLabEtagFieldsMaxIids,\n\ttoGitLabMergeRequestState,\n} from './models.js';\n\n// drop it as soon as we switch to @gitkraken/providers-api\nconst gitlabUserIdPrefix = 'gid://gitlab/User/';\nconst gitlabMergeRequestIdPrefix = 'gid://gitlab/MergeRequest/';\n\nfunction buildGitLabUserId(id: string | number | undefined): string | undefined {\n\treturn typeof id === 'string' && id?.startsWith(gitlabUserIdPrefix)\n\t\t? id.substring(gitlabUserIdPrefix.length)\n\t\t: String(id);\n}\n\n/** Merge requests one search returns; a bigger amount exceeds the max GraphQL complexity of the detail query. */\nconst searchPageSize = 20;\n\n/**\n * Merge requests taken best-ranked first across `lists` (each already in rank order), skipping a repeated id,\n * up to `limit`.\n */\nfunction interleaveByRank(\n\tlists: readonly (readonly GitLabMergeRequestREST[])[],\n\tlimit: number,\n): GitLabMergeRequestREST[] {\n\tconst seen = new Set<number>();\n\tconst merged: GitLabMergeRequestREST[] = [];\n\tconst longest = Math.max(0, ...lists.map(l => l.length));\n\tfor (let rank = 0; rank < longest; rank++) {\n\t\tfor (const list of lists) {\n\t\t\tconst mr = list[rank];\n\t\t\tif (mr == null || seen.has(mr.id)) continue;\n\n\t\t\tif (merged.length >= limit) return merged;\n\n\t\t\tseen.add(mr.id);\n\t\t\tmerged.push(mr);\n\t\t}\n\t}\n\treturn merged;\n}\n\ninterface ProjectLookupCallers {\n\tbackoff: boolean;\n\treportFailure: boolean;\n}\n\ninterface ProjectLookupBackoffs {\n\treadonly failed: FailureBackoff;\n\treadonly refused: FailureBackoff;\n}\n\nfunction isRefusedProjectLookup(ex: unknown): boolean {\n\treturn ex instanceof AuthenticationError && ex.reason !== AuthenticationErrorReason.Forbidden;\n}\n\nexport class GitLabApi implements Disposable {\n\tprivate readonly _disposable: Disposable | undefined;\n\tprivate _projectIds = new Map<string, Promise<string | undefined>>();\n\tprivate readonly _projectLookupCallers = new WeakMap<Promise<string | undefined>, ProjectLookupCallers>();\n\tprivate readonly _projectLookupAborts = new WeakMap<Promise<string | undefined>, AbortAggregate>();\n\tprivate _projectLookupBackoffs = new WeakMap<Provider, ProjectLookupBackoffs>();\n\tprivate _reauthenticationPrompted = new Set<string>();\n\n\tconstructor(private readonly config: ProviderApiConfig) {\n\t\tthis._disposable = config.onConfigChanged?.(() => this.resetCaches());\n\t}\n\n\tdispose(): void {\n\t\tthis._disposable?.dispose();\n\t}\n\n\tclearProjectLookupBackoff(provider: Provider): void {\n\t\tthis._projectLookupBackoffs.delete(provider);\n\t}\n\n\tprivate resetCaches(): void {\n\t\tthis._projectIds.clear();\n\t\tthis._projectLookupBackoffs = new WeakMap();\n\t\tthis._reauthenticationPrompted.clear();\n\t}\n\n\tprivate getProjectLookupBackoffs(provider: Provider): ProjectLookupBackoffs {\n\t\tlet backoffs = this._projectLookupBackoffs.get(provider);\n\t\tif (backoffs == null) {\n\t\t\tbackoffs = { failed: new FailureBackoff(), refused: new FailureBackoff() };\n\t\t\tthis._projectLookupBackoffs.set(provider, backoffs);\n\t\t}\n\t\treturn backoffs;\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t}),\n\t})\n\tasync getAccountForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<Account | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation);\n\t\tif (!projectId) return undefined;\n\n\t\ttry {\n\t\t\tconst commit = await this.request<GitLabCommit>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\t`v4/projects/${projectId}/repository/commits/${rev}?stats=false`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t// ...options,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tlet users = await this.findUser(provider, token, commit.author_name, options, cancellation);\n\t\t\tlet user = selectGitLabUserForCommit(users, commit.author_name, commit.author_email);\n\n\t\t\t// If the name search was ambiguous (multiple users share the name), try an email-scoped search to\n\t\t\t// disambiguate before giving up — otherwise we'd show a stranger's avatar (see #2205)\n\t\t\tif (user == null && commit.author_email) {\n\t\t\t\tconst exactNameMatches = users.filter(u => equalsIgnoreCase(u.name, commit.author_name)).length;\n\t\t\t\tif (exactNameMatches > 1) {\n\t\t\t\t\tusers = await this.findUser(provider, token, commit.author_email, options, cancellation);\n\t\t\t\t\tuser = selectGitLabUserForCommit(users, commit.author_name, commit.author_email);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (user == null) return undefined;\n\n\t\t\t// If the avatarUrl is a relative URL, make it absolute using the webUrl (assuming the webUrl is the root URL with the username tacked on)\n\t\t\tif (user.avatarUrl && !/^([a-zA-Z][\\w+.-]+):/.test(user.avatarUrl)) {\n\t\t\t\tuser.avatarUrl = joinUriPath(parseUri(user.webUrl), '..', user.avatarUrl).toString();\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\tid: String(user.id),\n\t\t\t\tname: user.name || undefined,\n\t\t\t\temail: commit.author_email || undefined,\n\t\t\t\tavatarUrl: user.avatarUrl || undefined,\n\t\t\t\tusername: user.username || undefined,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, _owner, _repo, email) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\temail: email,\n\t\t}),\n\t})\n\tasync getAccountForEmail(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\t_owner: string,\n\t\t_repo: string,\n\t\temail: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t},\n\t): Promise<Account | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst [user] = await this.findUser(provider, token, email, options);\n\t\t\tif (user == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\tid: String(user.id),\n\t\t\t\tname: user.name || undefined,\n\t\t\t\temail: user.publicEmail || undefined,\n\t\t\t\tavatarUrl: user.avatarUrl || undefined,\n\t\t\t\tusername: user.username || undefined,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, userId) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tuserId: userId,\n\t\t}),\n\t})\n\tasync getUserSigningKeys(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tuserId: string | number,\n\t\toptions?: { baseUrl?: string },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitLabSshKey[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\t// SSH keys are public, so this works for any user with the current token (covered by the `read_user` scope).\n\t\ttry {\n\t\t\tconst keys = await this.request<GitLabSshKey[]>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\t`v4/users/${userId}/keys`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\t// Exclude auth-only keys — only signing-capable keys belong in an allowed_signers file.\n\t\t\treturn keys?.filter(k => k.usage_type === 'signing' || k.usage_type === 'auth_and_signing') ?? [];\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return [];\n\n\t\t\tthis.handleException(ex, provider, scope);\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t}),\n\t})\n\tasync getDefaultBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<DefaultBranch | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject:\n\t\t\t\t\t| {\n\t\t\t\t\t\t\trepository: { rootRef: string } | null | undefined;\n\t\t\t\t\t }\n\t\t\t\t\t| null\n\t\t\t\t\t| undefined;\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getDefaultBranch(\n\t$fullPath: ID!\n) {\n\tproject(fullPath: $fullPath) {\n\t\trepository {\n\t\t\trootRef\n\t\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${owner}/${repo}`,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tconst defaultBranch = rsp?.data?.project?.repository?.rootRef ?? undefined;\n\t\t\tif (defaultBranch == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\tname: defaultBranch,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, number) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tnumber: number,\n\t\t}),\n\t})\n\tasync getIssueOrPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: {\n\t\t\t\t\tmergeRequest: GitLabMergeRequest | null;\n\t\t\t\t\tissue: GitLabIssue | null;\n\t\t\t\t} | null;\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getIssueOrMergeRequest(\n\t$fullPath: ID!\n\t$iid: String!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tmergeRequest(iid: $iid) {\n\t\t\tauthor {\n\t\t\t\tid\n\t\t\t\tname\n\t\t\t\tavatarUrl\n\t\t\t\twebUrl\n\t\t\t}\n\t\t\tiid\n\t\t\ttitle\n\t\t\tdescription\n\t\t\tstate\n\t\t\tcreatedAt\n\t\t\tupdatedAt\n\t\t\tmergedAt\n\t\t\twebUrl\n\t\t}\n\t\tissue(iid: $iid) {\n\t\t\tauthor {\n\t\t\t\tid\n\t\t\t\tname\n\t\t\t\tavatarUrl\n\t\t\t\twebUrl\n\t\t\t}\n\t\t\tiid\n\t\t\ttitle\n\t\t\tdescription\n\t\t\tstate\n\t\t\tcreatedAt\n\t\t\tupdatedAt\n\t\t\tclosedAt\n\t\t\twebUrl\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${owner}/${repo}`,\n\t\t\t\t\tiid: String(number),\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tif (rsp?.data?.project?.issue != null) {\n\t\t\t\tconst issue = rsp.data.project.issue;\n\t\t\t\tconst result: IssueOrPullRequest = {\n\t\t\t\t\tprovider: provider,\n\t\t\t\t\ttype: 'issue',\n\t\t\t\t\tid: issue.iid,\n\t\t\t\t\tnodeId: undefined,\n\t\t\t\t\tcreatedDate: new Date(issue.createdAt),\n\t\t\t\t\tupdatedDate: new Date(issue.updatedAt),\n\t\t\t\t\ttitle: issue.title,\n\t\t\t\t\tclosed: issue.state === 'closed',\n\t\t\t\t\tclosedDate: issue.closedAt == null ? undefined : new Date(issue.closedAt),\n\t\t\t\t\turl: issue.webUrl,\n\t\t\t\t\tstate: issue.state === 'locked' ? 'closed' : issue.state,\n\t\t\t\t};\n\t\t\t\treturn copyReadProvenance(result, issue);\n\t\t\t}\n\n\t\t\tif (rsp?.data?.project?.mergeRequest != null) {\n\t\t\t\tconst mergeRequest = rsp.data.project.mergeRequest;\n\t\t\t\tconst result: IssueOrPullRequest = {\n\t\t\t\t\tprovider: provider,\n\t\t\t\t\ttype: 'pullrequest',\n\t\t\t\t\tid: mergeRequest.iid,\n\t\t\t\t\tnodeId: undefined,\n\t\t\t\t\tcreatedDate: new Date(mergeRequest.createdAt),\n\t\t\t\t\tupdatedDate: new Date(mergeRequest.updatedAt),\n\t\t\t\t\ttitle: mergeRequest.title,\n\t\t\t\t\tclosed: mergeRequest.state === 'closed',\n\t\t\t\t\t// TODO@eamodio this isn't right, but GitLab doesn't seem to provide a closedAt on merge requests in GraphQL\n\t\t\t\t\tclosedDate: mergeRequest.state === 'closed' ? new Date(mergeRequest.updatedAt) : undefined,\n\t\t\t\t\turl: mergeRequest.webUrl,\n\t\t\t\t\tstate: mergeRequest.state === 'locked' ? 'closed' : mergeRequest.state,\n\t\t\t\t};\n\t\t\t\treturn copyReadProvenance(result, mergeRequest);\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * Whether `owner/repo` has issue `iid`. Strict like {@link getPullRequest}'s `strict`: `false` only for a `null`\n\t * project or issue, which is how GitLab's GraphQL answers a missing one; GraphQL `errors`, an empty response and\n\t * any HTTP error (a 404 means a wrong endpoint) all throw instead of reading as absent.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, iid) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tiid: iid,\n\t\t}),\n\t})\n\tasync hasIssue(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tiid: number,\n\t\toptions: { baseUrl?: string; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: { project: { issue: { iid: string } | null } | null } | null;\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query hasIssue(\n\t$fullPath: ID!\n\t$iid: String!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tissue(iid: $iid) {\n\t\t\tiid\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{ fullPath: `${owner}/${repo}`, iid: String(iid) },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (rsp?.data == null) throw new Error('GitLab returned no data for the issue');\n\n\t\t\treturn rsp.data.project?.issue != null;\n\t\t} catch (ex) {\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t}),\n\t})\n\tasync getPullRequestForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t\tinclude?: GitLabMergeRequestState[];\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: {\n\t\t\t\t\tmergeRequests?: {\n\t\t\t\t\t\tnodes: GitLabMergeRequest[];\n\t\t\t\t\t} | null;\n\t\t\t\t\topened?: {\n\t\t\t\t\t\tnodes: GitLabMergeRequest[];\n\t\t\t\t\t} | null;\n\t\t\t\t\tclosed?: {\n\t\t\t\t\t\tnodes: GitLabMergeRequest[];\n\t\t\t\t\t} | null;\n\t\t\t\t\tmerged?: {\n\t\t\t\t\t\tnodes: GitLabMergeRequest[];\n\t\t\t\t\t} | null;\n\t\t\t\t} | null;\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst fragment = `\n\t\t\tnodes {\n\t\t\t\tiid\n\t\t\t\tauthor {\n\t\t\t\t\tid\n\t\t\t\t\tname\n\t\t\t\t\tavatarUrl\n\t\t\t\t\twebUrl\n\t\t\t\t}\n\t\t\t\ttitle\n\t\t\t\tdescription\n\t\t\t\tstate\n\t\t\t\tcreatedAt\n\t\t\t\tupdatedAt\n\t\t\t\tmergedAt\n\t\t\t\twebUrl\n\t\t\t}`;\n\n\t\t\tconst query = `query getMergeRequestForBranch(\n\t$fullPath: ID!\n\t$branches: [String!]\n) {\n\tproject(fullPath: $fullPath) {\n\t\t${\n\t\t\toptions?.include == null\n\t\t\t\t? `mergeRequests(sourceBranches: $branches sort: UPDATED_DESC first: 1) {\n\t\t\t${fragment}\n\t\t}`\n\t\t\t\t: ''\n\t\t}\n\t\t${\n\t\t\toptions?.include?.includes('opened')\n\t\t\t\t? `opened: mergeRequests(sourceBranches: $branches state: opened sort: UPDATED_DESC first: 1) {\n\t\t\t${fragment}\n\t\t}`\n\t\t\t\t: ''\n\t\t}\n\t\t${\n\t\t\toptions?.include?.includes('merged')\n\t\t\t\t? `merged: mergeRequests(sourceBranches: $branches state: merged sort: UPDATED_DESC first: 1) {\n\t\t\t${fragment}\n\t\t}`\n\t\t\t\t: ''\n\t\t}\n\t\t${\n\t\t\toptions?.include?.includes('closed')\n\t\t\t\t? `closed: mergeRequests(sourceBranches: $branches state: closed sort: UPDATED_DESC first: 1) {\n\t\t\t${fragment}\n\t\t}`\n\t\t\t\t: ''\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${owner}/${repo}`,\n\t\t\t\t\tbranches: [branch],\n\t\t\t\t\tstate: options?.include,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tlet pr: GitLabMergeRequest | undefined;\n\n\t\t\tif (options?.include == null) {\n\t\t\t\tpr = rsp?.data?.project?.mergeRequests?.nodes?.[0];\n\t\t\t} else {\n\t\t\t\tfor (const state of options.include) {\n\t\t\t\t\tlet mr;\n\t\t\t\t\tif (state === 'opened') {\n\t\t\t\t\t\tmr = rsp?.data?.project?.opened?.nodes?.[0];\n\t\t\t\t\t} else if (state === 'merged') {\n\t\t\t\t\t\tmr = rsp?.data?.project?.merged?.nodes?.[0];\n\t\t\t\t\t} else if (state === 'closed') {\n\t\t\t\t\t\tmr = rsp?.data?.project?.closed?.nodes?.[0];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (mr != null && (pr == null || new Date(mr.updatedAt) > new Date(pr.updatedAt))) {\n\t\t\t\t\t\tpr = mr;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (pr == null) return undefined;\n\n\t\t\t// A caller holding a remote's descriptor split a nested group at its first slash.\n\t\t\tconst fullPath = `${owner}/${repo}`;\n\t\t\tconst result = new PullRequest(\n\t\t\t\tprovider,\n\t\t\t\t{\n\t\t\t\t\tid: buildGitLabUserId(pr.author?.id) ?? '',\n\t\t\t\t\t// An absent author stays absent: no `'Unknown'` name a consumer can't tell from a real one, and no\n\t\t\t\t\t// `''` url/avatar that passes a presence check and renders as a link to nowhere. Matches\n\t\t\t\t\t// `fromProviderAccount`/`toIssueShape`.\n\t\t\t\t\tname: pr.author?.name ?? undefined,\n\t\t\t\t\tavatarUrl: pr.author?.avatarUrl ?? undefined,\n\t\t\t\t\turl: pr.author?.webUrl ?? undefined,\n\t\t\t\t},\n\t\t\t\t// oxlint-disable-next-line typescript/no-unnecessary-type-conversion\n\t\t\t\tString(pr.iid),\n\t\t\t\tundefined,\n\t\t\t\tpr.title,\n\t\t\t\tpr.webUrl,\n\t\t\t\t{ owner: getRepoNamespace(fullPath), repo: getRepoName(fullPath) },\n\t\t\t\tfromGitLabMergeRequestState(pr.state),\n\t\t\t\tnew Date(pr.createdAt),\n\t\t\t\tnew Date(pr.updatedAt),\n\t\t\t\t// TODO@eamodio this isn't right, but GitLab doesn't seem to provide a closedAt on merge requests in GraphQL\n\t\t\t\tpr.state !== 'closed' ? undefined : new Date(pr.updatedAt),\n\t\t\t\tpr.mergedAt == null ? undefined : new Date(pr.mergedAt),\n\t\t\t\tundefined, // mergeableState\n\t\t\t\tundefined, // viewerCanUpdate\n\t\t\t\tundefined, // refs\n\t\t\t\tundefined, // isDraft\n\t\t\t\tundefined, // additions\n\t\t\t\tundefined, // deletions\n\t\t\t\tundefined, // commentsCount\n\t\t\t\tundefined, // thumbsUpCount\n\t\t\t\tundefined, // reviewDecision\n\t\t\t\tundefined, // reviewRequests\n\t\t\t\tundefined, // latestReviews\n\t\t\t\tundefined, // assignees\n\t\t\t\tundefined, // statusCheckRollupState\n\t\t\t\tundefined, // project\n\t\t\t\tundefined, // version\n\t\t\t\tundefined, // commitCount\n\t\t\t\tundefined, // stack\n\t\t\t\tundefined, // filesChanged\n\t\t\t\tundefined, // body\n\t\t\t\tundefined, // number\n\t\t\t\tundefined, // authoredByMe\n\t\t\t\t'point',\n\t\t\t);\n\t\t\treturn copyReadProvenance(result, pr);\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t}),\n\t})\n\tasync getPullRequestForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t\t/**\n\t\t\t * For a batch read: a failed request throws without the re-authentication prompt, which the batch settles\n\t\t\t * once for the whole call (a missing project or commit still answers `undefined`), and the batch reports a\n\t\t\t * server error once rather than each request showing its own.\n\t\t\t */\n\t\t\tdeferFailure?: boolean;\n\t\t\tbackoff?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation, {\n\t\t\tstrict: true,\n\t\t\tbackoff: options?.backoff ?? !options?.deferFailure,\n\t\t\tdeferFailure: options?.deferFailure,\n\t\t});\n\t\tif (!projectId) return undefined;\n\n\t\ttry {\n\t\t\tconst mrs = await this.request<GitLabMergeRequestREST[]>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\t`v4/projects/${projectId}/repository/commits/${rev}/merge_requests`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t// ...options,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\tif (mrs == null || mrs.length === 0) return undefined;\n\n\t\t\tif (mrs.length > 1) {\n\t\t\t\tmrs.sort(\n\t\t\t\t\t(a, b) =>\n\t\t\t\t\t\t(a.state === 'opened' ? -1 : 1) - (b.state === 'opened' ? -1 : 1) ||\n\t\t\t\t\t\tnew Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// A caller holding a remote's descriptor split a nested group at its first slash.\n\t\t\tconst fullPath = `${owner}/${repo}`;\n\t\t\treturn fromGitLabMergeRequestREST(\n\t\t\t\tmrs[0],\n\t\t\t\tprovider,\n\t\t\t\t{ owner: getRepoNamespace(fullPath), repo: getRepoName(fullPath) },\n\t\t\t\t'point',\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tif (options?.deferFailure) {\n\t\t\t\tif (isNotFoundResponse(ex)) return undefined;\n\n\t\t\t\tscope?.error(ex);\n\t\t\t\tthrow ex;\n\t\t\t}\n\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, id) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t}),\n\t})\n\tasync getPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: number,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\t/**\n\t\t\t * Returns `undefined` only for a `null` project or merge request, which is how GitLab's GraphQL\n\t\t\t * answers a missing one. A thrown not-found or an empty response means the endpoint is wrong, so\n\t\t\t * both throw instead of reading as absent.\n\t\t\t */\n\t\t\tstrict?: boolean;\n\t\t\tdeferFailure?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: {\n\t\t\t\t\tmergeRequest: GitLabMergeRequestFull | null;\n\t\t\t\t} | null;\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getMergeRequest(\n\t$fullPath: ID!\n\t$iid: String!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tmergeRequest(iid: $iid) {\n\t\t\tid,\n\t\t\tiid\n\t\t\tstate,\n\t\t\tauthor {\n\t\t\t\tid\n\t\t\t\tname\n\t\t\t\tavatarUrl\n\t\t\t\twebUrl\n\t\t\t}\n\t\t\tdiffRefs {\n\t\t\t\tbaseSha\n\t\t\t\theadSha\n\t\t\t}\n\t\t\ttitle\n\t\t\tdescription\n\t\t\twebUrl\n\t\t\tcreatedAt\n\t\t\tupdatedAt\n\t\t\tmergedAt\n\t\t\ttargetBranch\n\t\t\tsourceBranch\n\t\t\tproject {\n\t\t\t\tid\n\t\t\t\tfullPath\n\t\t\t\twebUrl\n\t\t\t}\n\t\t\tsourceProject {\n\t\t\t\tid\n\t\t\t\tfullPath\n\t\t\t\twebUrl\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${owner}/${repo}`,\n\t\t\t\t\tiid: String(id),\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\n\t\t\tif (rsp?.data == null) {\n\t\t\t\tif (options?.strict) throw new Error('GitLab returned no data for the merge request');\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (rsp.data.project?.mergeRequest == null) return undefined;\n\n\t\t\tconst pr = rsp.data.project.mergeRequest;\n\t\t\treturn fromGitLabMergeRequest(pr, provider, 'point');\n\t\t} catch (ex) {\n\t\t\tif (!options?.strict && ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * The iids of the merge requests into `owner/repo` whose source is `branch`, in any state, newest first, at most\n\t * `limit`: from the project itself when `headOwner` is omitted, otherwise from a fork in the `headOwner`\n\t * namespace. Only the iids, so a caller resolves the rows through the same read as its by-number lookups.\n\t *\n\t * Keyed on the source branch NAME, so a merged request whose branch was deleted still matches. Strict like\n\t * {@link getPullRequest}'s `strict`: an empty list means GitLab answered, a `null` project included; a 404 or\n\t * an empty response means the endpoint is wrong and throws. Requests from a deleted fork carry no source\n\t * project and so match nothing.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t}),\n\t})\n\tasync getPullRequestNumbersForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\toptions: { baseUrl?: string; headOwner?: string; limit: number; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<{ numbers: number[]; truncated: boolean }> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface MergeRequestHead {\n\t\t\tiid: string;\n\t\t\tupdatedAt: string;\n\t\t\tsourceBranch: string;\n\t\t\tproject: { id: string };\n\t\t\tsourceProject: { id: string; fullPath: string } | null;\n\t\t}\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: {\n\t\t\t\t\tmergeRequests: {\n\t\t\t\t\t\tcount: number;\n\t\t\t\t\t\tpageInfo: { hasNextPage: boolean };\n\t\t\t\t\t\tnodes: MergeRequestHead[];\n\t\t\t\t\t} | null;\n\t\t\t\t} | null;\n\t\t\t} | null;\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getMergeRequestsForBranch(\n\t$fullPath: ID!\n\t$branches: [String!]\n\t$limit: Int!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tmergeRequests(sourceBranches: $branches, state: all, sort: UPDATED_DESC, first: $limit) {\n\t\t\tcount\n\t\t\tpageInfo {\n\t\t\t\thasNextPage\n\t\t\t}\n\t\t\tnodes {\n\t\t\t\tiid\n\t\t\t\tupdatedAt\n\t\t\t\tsourceBranch\n\t\t\t\tproject {\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t\tsourceProject {\n\t\t\t\t\tid\n\t\t\t\t\tfullPath\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{ fullPath: `${owner}/${repo}`, branches: [branch], limit: options.limit },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (rsp?.data == null) throw new Error('GitLab returned no data for the merge requests by branch');\n\n\t\t\tconst project = rsp.data.project;\n\t\t\tif (project == null) return { numbers: [], truncated: false };\n\n\t\t\tconst connection = project.mergeRequests;\n\t\t\tif (connection == null) {\n\t\t\t\tthrow new Error(`GitLab returned no merge requests for ${owner}/${repo}:${branch}`);\n\t\t\t}\n\n\t\t\tconst headOwner = options.headOwner;\n\t\t\tconst { values, truncated } = selectBranchPullRequests(connection.nodes, {\n\t\t\t\tmatchesHead: mr => {\n\t\t\t\t\tif (mr.sourceBranch !== branch || mr.sourceProject == null) return false;\n\t\t\t\t\tif (headOwner == null) return mr.sourceProject.id === mr.project.id;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tmr.sourceProject.id !== mr.project.id &&\n\t\t\t\t\t\tequalsIgnoreCase(getRepoNamespace(mr.sourceProject.fullPath), headOwner)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tupdatedAt: mr => Date.parse(mr.updatedAt),\n\t\t\t\tmap: mr => {\n\t\t\t\t\tconst iid = Number(mr.iid);\n\t\t\t\t\tif (!Number.isSafeInteger(iid)) throw new Error(`GitLab returned a merge request iid '${mr.iid}'`);\n\n\t\t\t\t\treturn iid;\n\t\t\t\t},\n\t\t\t\tlimit: options.limit,\n\t\t\t\tmore: connection.pageInfo.hasNextPage || connection.count > connection.nodes.length,\n\t\t\t});\n\t\t\treturn { numbers: values, truncated: truncated };\n\t\t} catch (ex) {\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * The change state of merge requests `iids` in `fullPath` — the cheap check behind the batch pull request read's\n\t * etags. Selects only what provider-apis' `getPullRequestForRepo` maps into a full row's etag inputs, plus the\n\t * fields of each of `options.etagIncludes`, in ONE request for up to {@link gitLabEtagFieldsMaxIids} iids. One\n\t * entry per input iid, in order; `undefined` is a PROVEN ABSENCE (see {@link getEtagFieldsByIid}).\n\t */\n\t@trace({\n\t\targs: (provider, token, fullPath, iids) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tfullPath: fullPath,\n\t\t\tiids: iids.length,\n\t\t}),\n\t})\n\tasync getMergeRequestsEtagFields(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tfullPath: string,\n\t\tiids: readonly number[],\n\t\toptions: { baseUrl?: string; etagIncludes: readonly PullRequestEtagInclude[]; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<(GitLabMergeRequestEtagNode | undefined)[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst selections = ['iid', 'state', 'draft', 'updatedAt', 'diffRefs { headSha }'];\n\t\tif (options.etagIncludes.includes('mergeable')) {\n\t\t\tselections.push('mergeStatusEnum');\n\t\t}\n\t\tif (options.etagIncludes.includes('reviewDecision')) {\n\t\t\tselections.push('reviewers { nodes { mergeRequestInteraction { reviewState } } }');\n\t\t}\n\t\tif (options.etagIncludes.includes('checks')) {\n\t\t\tselections.push('headPipeline { stages { nodes { jobs { nodes { status allowFailure } } } } }');\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getMergeRequestsEtagFields(\n\t$fullPath: ID!\n\t$iids: [String!]\n\t$first: Int!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tmergeRequests(iids: $iids, state: all, first: $first) {\n\t\t\tpageInfo {\n\t\t\t\thasNextPage\n\t\t\t}\n\t\t\tnodes {\n\t\t\t\t${selections.join('\\n\\t\\t\\t\\t')}\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n\t\t\treturn await this.getEtagFieldsByIid<GitLabMergeRequestEtagNode>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t'mergeRequests',\n\t\t\t\tfullPath,\n\t\t\t\tiids,\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * The change state of issues `iids` in `fullPath` — the cheap check behind the batch issue read's etags — selecting\n\t * only what provider-apis' issue read maps into a full row's etag inputs, plus the field of each of\n\t * `options.etagIncludes`, in ONE request for up to {@link gitLabEtagFieldsMaxIids} iids. One entry per input iid,\n\t * in order; `undefined` is a PROVEN ABSENCE (see {@link getEtagFieldsByIid}).\n\t */\n\t@trace({\n\t\targs: (provider, token, fullPath, iids) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tfullPath: fullPath,\n\t\t\tiids: iids.length,\n\t\t}),\n\t})\n\tasync getIssuesEtagFields(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tfullPath: string,\n\t\tiids: readonly number[],\n\t\toptions: { baseUrl?: string; etagIncludes: readonly IssueEtagInclude[]; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<(GitLabIssueEtagNode | undefined)[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst selections = ['iid', 'closedAt', 'updatedAt'];\n\t\tif (options.etagIncludes.includes('reactions')) {\n\t\t\tselections.push('upvotes');\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getIssuesEtagFields(\n\t$fullPath: ID!\n\t$iids: [String!]\n\t$first: Int!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tissues(iids: $iids, state: all, first: $first) {\n\t\t\tpageInfo {\n\t\t\t\thasNextPage\n\t\t\t}\n\t\t\tnodes {\n\t\t\t\t${selections.join('\\n\\t\\t\\t\\t')}\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n\t\t\treturn await this.getEtagFieldsByIid<GitLabIssueEtagNode>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t'issues',\n\t\t\t\tfullPath,\n\t\t\t\tiids,\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * Runs an etag read's `query` and maps its `connection`'s nodes back to `iids`, positionally.\n\t *\n\t * Strict like {@link getPullRequest}'s `strict`: an iid is absent only when the project is `null`, or when it is\n\t * missing from a complete page of an error-free reply — the answers that prove a miss to the full read's own\n\t * confirming read. GraphQL `errors`, an empty response, a `null` connection, a page that has more and any HTTP\n\t * error (a 404 means a wrong endpoint) throw instead. The query asks for `state: all`, so no default state filter\n\t * can hide a closed or merged item and have it read as missing.\n\t */\n\tprivate async getEtagFieldsByIid<T extends { iid: string }>(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string | undefined,\n\t\tquery: string,\n\t\tconnection: 'mergeRequests' | 'issues',\n\t\tfullPath: string,\n\t\tiids: readonly number[],\n\t\tcancellation: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure: boolean | undefined,\n\t): Promise<(T | undefined)[]> {\n\t\tif (!iids.length) return [];\n\t\tif (iids.length > gitLabEtagFieldsMaxIids) {\n\t\t\tthrow new Error(`Cannot read more than ${gitLabEtagFieldsMaxIids} GitLab iids in one request`);\n\t\t}\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: Partial<\n\t\t\t\t\tRecord<'mergeRequests' | 'issues', { pageInfo: { hasNextPage: boolean }; nodes: T[] } | null>\n\t\t\t\t> | null;\n\t\t\t} | null;\n\t\t}\n\n\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\tquery,\n\t\t\t{ fullPath: fullPath, iids: iids.map(String), first: iids.length },\n\t\t\tcancellation,\n\t\t\tscope,\n\t\t\tdeferFailure,\n\t\t);\n\t\tif (rsp?.data == null) throw new Error(`GitLab returned no data for the ${connection} of ${fullPath}`);\n\n\t\tconst project = rsp.data.project;\n\t\tif (project == null) return iids.map(() => undefined);\n\n\t\tconst page = project[connection];\n\t\tif (page?.nodes == null) throw new Error(`GitLab returned no ${connection} for ${fullPath}`);\n\t\tif (page.pageInfo.hasNextPage) throw new Error(`GitLab returned a partial page of ${connection}`);\n\n\t\tconst byIid = new Map(page.nodes.map(node => [node.iid, node]));\n\t\treturn iids.map(iid => byIid.get(String(iid)));\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t}),\n\t})\n\tasync getRepositoryMetadata(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tbackoff?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<RepositoryMetadata | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation, {\n\t\t\tstrict: true,\n\t\t\tbackoff: options?.backoff,\n\t\t}).catch((ex: unknown) => {\n\t\t\tthrow ex instanceof RequestNotFoundError ? ex.original : ex;\n\t\t});\n\t\tif (!projectId) return undefined;\n\n\t\ttry {\n\t\t\tconst proj = await this.request<GitLabProjectREST>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\t`v4/projects/${projectId}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t// ...options,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tif (proj == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\towner: proj.namespace.full_path,\n\t\t\t\tname: proj.path,\n\t\t\t\tisFork: proj.forked_from_project != null,\n\t\t\t\tparent:\n\t\t\t\t\tproj.forked_from_project != null\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\towner: proj.forked_from_project.namespace.full_path,\n\t\t\t\t\t\t\t\tname: proj.forked_from_project.path,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: undefined,\n\t\t\t} satisfies RepositoryMetadata;\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({ args: (provider, token) => ({ provider: provider.name, token: `<token:${token.microHash}>` }) })\n\tasync searchPullRequests(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\toptions?: {\n\t\t\tsearch?: string;\n\t\t\tuser?: string;\n\t\t\trepos?: string[];\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t\tinclude?: PullRequestState[];\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest[]> {\n\t\tconst scope = getScopedLogger();\n\t\tconst search = options?.search;\n\t\tif (!search) {\n\t\t\treturn [];\n\t\t}\n\n\t\ttry {\n\t\t\tconst include = options?.include?.length ? options.include : undefined;\n\t\t\tconst searchQuery = `scope=merge_requests&search=${encodeURIComponent(search)}&per_page=${searchPageSize}`;\n\t\t\t// A repository-scoped search reads only those projects (by URL-encoded full path, which covers nested\n\t\t\t// namespaces) rather than the whole instance, so it never reads more than the caller asked for.\n\t\t\tconst repos = options?.repos?.length\n\t\t\t\t? [...new Map(options.repos.map(r => [r.toLowerCase(), r])).values()]\n\t\t\t\t: undefined;\n\n\t\t\tlet restPRs: GitLabMergeRequestREST[];\n\t\t\tif (repos == null) {\n\t\t\t\trestPRs = await this.searchMergeRequests(\n\t\t\t\t\tprovider,\n\t\t\t\t\ttoken,\n\t\t\t\t\toptions?.baseUrl,\n\t\t\t\t\t`v4/search/?${searchQuery}`,\n\t\t\t\t\tinclude,\n\t\t\t\t\tcancellation,\n\t\t\t\t\tscope,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst settled = await mapSettledBounded(repos, providerFanOutConcurrency, repo =>\n\t\t\t\t\tthis.searchMergeRequests(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\ttoken,\n\t\t\t\t\t\toptions?.baseUrl,\n\t\t\t\t\t\t`v4/projects/${encodeURIComponent(repo)}/search?${searchQuery}`,\n\t\t\t\t\t\tinclude,\n\t\t\t\t\t\tcancellation,\n\t\t\t\t\t\tscope,\n\t\t\t\t\t).catch((ex: unknown) => {\n\t\t\t\t\t\t// A project that is gone or not visible has nothing to find, as the instance-wide search would\n\t\t\t\t\t\t// not have listed it either.\n\t\t\t\t\t\tif (ex instanceof RequestNotFoundError) return [];\n\t\t\t\t\t\tthrow ex;\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst perProject: GitLabMergeRequestREST[][] = [];\n\t\t\t\tlet failure: { reason: unknown } | undefined;\n\t\t\t\tfor (const result of settled) {\n\t\t\t\t\tif (result.status === 'fulfilled') {\n\t\t\t\t\t\tperProject.push(result.value);\n\t\t\t\t\t} else if (isCancellationError(result.reason)) {\n\t\t\t\t\t\tthrow result.reason;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfailure ??= { reason: result.reason };\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// One failing project doesn't discard what the others found, but a search that found nothing anywhere\n\t\t\t\t// must not read as \"no matches\".\n\t\t\t\tif (failure != null) {\n\t\t\t\t\tif (perProject.length === 0) throw failure.reason;\n\n\t\t\t\t\tscope?.error(failure.reason, \"Failed to search a project; returning the other projects' matches\");\n\t\t\t\t}\n\n\t\t\t\t// Relevance only orders results within a single search, so interleave the projects' results (each still\n\t\t\t\t// in its own relevance order) to give every project a fair share of the one search's cap.\n\t\t\t\trestPRs = interleaveByRank(perProject, searchPageSize);\n\t\t\t}\n\t\t\tif (restPRs.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tinterface QueryResult {\n\t\t\t\tdata: Record<`mergeRequest_${number}`, GitLabMergeRequestFull>;\n\t\t\t}\n\n\t\t\tconst queryArgs = restPRs.map((_, i) => `$id_${i}: MergeRequestID!`).join('\\n');\n\t\t\tconst queryFields = restPRs\n\t\t\t\t.map((_, i) => `mergeRequest_${i}: mergeRequest(id: $id_${i}) { ...mergeRequestFields }`)\n\t\t\t\t.join('\\n');\n\t\t\t// Set of fields includes only additional fields that are not included in GitLabMergeRequestREST.\n\t\t\t// It's limited as much as possible to reduce complexity of the query.\n\t\t\tconst queryMrFields = `fragment mergeRequestFields on MergeRequest {\n\t\t\t\tdiffRefs {\n\t\t\t\t\tbaseSha\n\t\t\t\t\theadSha\n\t\t\t\t}\n\t\t\t\tproject {\n\t\t\t\t\tid\n\t\t\t\t\tfullPath\n\t\t\t\t\twebUrl\n\t\t\t\t}\n\t\t\t\tsourceProject {\n\t\t\t\t\tid\n\t\t\t\t\tfullPath\n\t\t\t\t\twebUrl\n\t\t\t\t}\n\t\t\t}`;\n\t\t\tconst query = `query getMergeRequests (${queryArgs}) {${queryFields}} ${queryMrFields}`;\n\n\t\t\tconst params = restPRs.reduce<Record<`id_${number}`, string>>((ids, gitlabRestPr, i) => {\n\t\t\t\tids[`id_${i}`] = `${gitlabMergeRequestIdPrefix}${gitlabRestPr.id}`;\n\t\t\t\treturn ids;\n\t\t\t}, {});\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\tparams,\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tif (rsp?.data != null) {\n\t\t\t\tconst resultPRs = restPRs.reduce<PullRequest[]>((accum, restPR, i) => {\n\t\t\t\t\tconst graphQlPR = rsp.data[`mergeRequest_${i}`];\n\t\t\t\t\tif (graphQlPR == null) {\n\t\t\t\t\t\treturn accum;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst fullPr: GitLabMergeRequestFull = {\n\t\t\t\t\t\t...graphQlPR,\n\t\t\t\t\t\tiid: String(restPR.iid),\n\t\t\t\t\t\tid: String(restPR.id),\n\t\t\t\t\t\tstate: restPR.state,\n\t\t\t\t\t\t// An absent REST author stays absent (`null`, as GitLab's own shape expresses it) rather than a\n\t\t\t\t\t\t// synthesized `'Unknown'` stub: `fromGitLabMergeRequest` collapses `null` to an absent\n\t\t\t\t\t\t// `PullRequestMember.name`, whereas a placeholder here would launder into a real-looking name.\n\t\t\t\t\t\tauthor:\n\t\t\t\t\t\t\trestPR.author != null\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tid: buildGitLabUserId(restPR.author.id) ?? '',\n\t\t\t\t\t\t\t\t\t\tname: restPR.author.name,\n\t\t\t\t\t\t\t\t\t\tavatarUrl: restPR.author.avatar_url ?? null,\n\t\t\t\t\t\t\t\t\t\twebUrl: restPR.author.web_url,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\ttitle: restPR.title,\n\t\t\t\t\t\tdescription: restPR.description,\n\t\t\t\t\t\twebUrl: restPR.web_url,\n\t\t\t\t\t\tcreatedAt: restPR.created_at,\n\t\t\t\t\t\tupdatedAt: restPR.updated_at,\n\t\t\t\t\t\tmergedAt: restPR.merged_at,\n\t\t\t\t\t\tsourceBranch: restPR.source_branch,\n\t\t\t\t\t\ttargetBranch: restPR.target_branch,\n\t\t\t\t\t};\n\t\t\t\t\taccum.push(copyReadProvenance(fromGitLabMergeRequest(fullPr, provider, 'text-search'), restPR));\n\t\t\t\t\treturn accum;\n\t\t\t\t}, []);\n\t\t\t\treturn resultPRs;\n\t\t\t}\n\t\t\treturn [];\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return [];\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * One search's merge requests, filtered to `include`. The search API returns MRs of all states in relevance\n\t * order, so a requested state may not appear on the first page. A single state is pushed server-side\n\t * (`&state=`); several states have no single-value qualifier, so those are filtered client-side. Either way,\n\t * paging accumulates matches until the detail-query cap (`searchPageSize`) is filled or the results run out,\n\t * which stays correct whether or not `&state=` takes effect. Bounded by `maxSearchPages` like the other paged\n\t * provider drains in this package so a large, low-match result set can't fan out into an unbounded request\n\t * loop.\n\t */\n\tprivate async searchMergeRequests(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string | undefined,\n\t\tsearchPath: string,\n\t\tinclude: PullRequestState[] | undefined,\n\t\tcancellation: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t): Promise<GitLabMergeRequestREST[]> {\n\t\tif (include == null) {\n\t\t\t// Unfiltered search returns the first page as-is (as it did before state filtering existed).\n\t\t\treturn this.request<GitLabMergeRequestREST[]>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\tsearchPath,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t}\n\n\t\tif (include.length === 1) {\n\t\t\tsearchPath += `&state=${encodeURIComponent(toGitLabMergeRequestState(include[0]))}`;\n\t\t}\n\n\t\tconst maxSearchPages = 20;\n\t\tconst matches: GitLabMergeRequestREST[] = [];\n\t\tfor (let page = 1; page <= maxSearchPages; page++) {\n\t\t\tconst pagePRs = await this.request<GitLabMergeRequestREST[]>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`${searchPath}&page=${page}`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tfor (const pr of pagePRs) {\n\t\t\t\tif (include.includes(fromGitLabMergeRequestState(pr.state))) {\n\t\t\t\t\tmatches.push(pr);\n\t\t\t\t\tif (matches.length >= searchPageSize) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Stop once we've filled the cap or hit the last (partial or empty) page.\n\t\t\tif (matches.length >= searchPageSize || pagePRs.length < searchPageSize) break;\n\t\t}\n\t\treturn matches;\n\t}\n\n\tprivate async findUser(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tsearch: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitLabUser[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tusers: {\n\t\t\t\t\tnodes: {\n\t\t\t\t\t\tid: string;\n\t\t\t\t\t\tname: string;\n\t\t\t\t\t\tusername: string;\n\t\t\t\t\t\tpublicEmail?: string;\n\t\t\t\t\t\tstate: string;\n\t\t\t\t\t\tavatarUrl: string;\n\t\t\t\t\t\twebUrl: string;\n\t\t\t\t\t}[];\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query findUser(\n$search: String!\n) {\n\tusers(search: $search) {\n\t\tnodes {\n\t\t\tid\n\t\t\tname\n\t\t\tusername,\n\t\t\tpublicEmail,\n\t\t\tstate\n\t\t\tavatarUrl\n\t\t\twebUrl\n\t\t}\n\t}\n}`;\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tsearch: search,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tconst matches = rsp?.data?.users?.nodes;\n\t\t\tif (matches == null || matches.length === 0) return [];\n\n\t\t\tconst users: GitLabUser[] = [];\n\n\t\t\tfor (const user of matches) {\n\t\t\t\tconst match = /gid:\\/\\/gitlab\\/User\\/([0-9]+)\\b/.exec(user.id);\n\t\t\t\tif (match == null) continue;\n\n\t\t\t\tusers.push({\n\t\t\t\t\tid: parseInt(match[1], 10),\n\t\t\t\t\tname: user.name,\n\t\t\t\t\tusername: user.username,\n\t\t\t\t\tpublicEmail: user.publicEmail || undefined,\n\t\t\t\t\tstate: user.state,\n\t\t\t\t\tavatarUrl: user.avatarUrl,\n\t\t\t\t\twebUrl: user.webUrl,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn users;\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return [];\n\n\t\t\tthis.handleException(ex, provider, scope);\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tgetProjectId(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tgroup: string,\n\t\trepo: string,\n\t\tbaseUrl: string | undefined,\n\t\tcancellation: AbortSignal | undefined,\n\t\toptions?: { strict?: boolean; backoff?: boolean; deferFailure?: boolean },\n\t): Promise<string | undefined> {\n\t\tconst { accessToken } = token;\n\t\tconst key = `${accessToken}|${group}/${repo}`;\n\t\tconst backoff = options?.backoff ?? true;\n\t\tconst strict = options?.strict ?? false;\n\t\tconst reportFailure = !options?.deferFailure;\n\n\t\tif (cancellation?.aborted) {\n\t\t\treturn strict ? Promise.reject(new CancellationError()) : Promise.resolve(undefined);\n\t\t}\n\n\t\tlet projectId = this._projectIds.get(key);\n\t\tif (projectId != null && this._projectLookupAborts.get(projectId)?.signal.aborted) {\n\t\t\tprojectId = undefined;\n\t\t}\n\t\tif (projectId == null && backoff) {\n\t\t\tconst backoffs = this.getProjectLookupBackoffs(provider);\n\t\t\tconst now = Date.now();\n\t\t\tconst until =\n\t\t\t\tbackoffs.failed.backedOffUntil(key, now) ??\n\t\t\t\t(strict ? undefined : backoffs.refused.backedOffUntil(key, now));\n\t\t\tif (until != null) {\n\t\t\t\tif (!strict) return Promise.resolve(undefined);\n\n\t\t\t\treturn Promise.reject(new LookupBackedOffError(until, `The GitLab project lookup of ${group}/${repo}`));\n\t\t\t}\n\t\t}\n\n\t\tif (projectId == null) {\n\t\t\tconst callers: ProjectLookupCallers = { backoff: backoff, reportFailure: reportFailure };\n\t\t\tconst aborts = new AbortAggregate();\n\t\t\tconst lookup = this.getProjectIdCore(provider, token, group, repo, baseUrl, callers, aborts.signal);\n\t\t\tthis._projectIds.set(key, lookup);\n\t\t\tthis._projectLookupCallers.set(lookup, callers);\n\t\t\tthis._projectLookupAborts.set(lookup, aborts);\n\t\t\tconst settle = () => {\n\t\t\t\taborts.dispose();\n\t\t\t\tthis._projectLookupAborts.delete(lookup);\n\t\t\t};\n\t\t\tvoid lookup.then(\n\t\t\t\t() => {\n\t\t\t\t\tsettle();\n\t\t\t\t\tconst backoffs = this._projectLookupBackoffs.get(provider);\n\t\t\t\t\tbackoffs?.failed.clear(key);\n\t\t\t\t\tbackoffs?.refused.clear(key);\n\t\t\t\t},\n\t\t\t\t(ex: unknown) => {\n\t\t\t\t\tsettle();\n\t\t\t\t\tif (this._projectIds.get(key) === lookup) {\n\t\t\t\t\t\tthis._projectIds.delete(key);\n\t\t\t\t\t}\n\t\t\t\t\tif (callers.backoff && (!isCancellationError(ex) || ex.reason === 'timeout')) {\n\t\t\t\t\t\tconst backoffs = this.getProjectLookupBackoffs(provider);\n\t\t\t\t\t\t(isRefusedProjectLookup(ex) ? backoffs.refused : backoffs.failed).fail(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tDate.now(),\n\t\t\t\t\t\t\tex instanceof RequestRateLimitError && ex.resetAt != null ? ex.resetAt * 1000 : undefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectId = lookup;\n\t\t} else {\n\t\t\tconst callers = this._projectLookupCallers.get(projectId);\n\t\t\tif (callers != null) {\n\t\t\t\tcallers.backoff ||= backoff;\n\t\t\t\tcallers.reportFailure ||= reportFailure;\n\t\t\t}\n\t\t}\n\n\t\tconst lookup = projectId;\n\t\tthis._projectLookupAborts.get(lookup)?.add(cancellation);\n\n\t\tconst awaited = cancellation != null ? raceWithSignal(lookup, cancellation) : lookup;\n\t\treturn strict ? awaited : awaited.catch(() => undefined);\n\t}\n\n\tprivate async getProjectIdCore(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tgroup: string,\n\t\trepo: string,\n\t\tbaseUrl: string | undefined,\n\t\tcallers: ProjectLookupCallers,\n\t\tcancellation: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: { project: { id: string } };\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getProjectId(\n\t$fullPath: ID!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tid\n\t}\n}`;\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${group}/${repo}`,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\ttrue,\n\t\t\t);\n\n\t\t\tconst gid = rsp?.data?.project?.id;\n\t\t\tif (gid == null) return undefined;\n\n\t\t\tconst match = /gid:\\/\\/gitlab\\/Project\\/([0-9]+)\\b/.exec(gid);\n\t\t\tif (match == null) return undefined;\n\n\t\t\tconst projectId = match[1];\n\n\t\t\tscope?.addExitInfo(`projectId=${projectId}`);\n\t\t\treturn projectId;\n\t\t} catch (ex) {\n\t\t\tif (isCancellationError(ex) && ex.reason !== 'timeout') throw ex;\n\n\t\t\tif (ex instanceof AuthenticationError) {\n\t\t\t\tif (!callers.reportFailure || this._reauthenticationPrompted.has(token.accessToken)) {\n\t\t\t\t\tscope?.error(ex);\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\n\t\t\t\tthis._reauthenticationPrompted.add(token.accessToken);\n\t\t\t} else if (callers.reportFailure) {\n\t\t\t\tconst notify = takeDeferredRequestFailure(ex);\n\t\t\t\tif (notify != null) {\n\t\t\t\t\tprovider.trackRequestException({ connectionId: token.connectionId });\n\t\t\t\t\tnotify();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\tprivate async graphql<T extends object>(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string | undefined,\n\t\tquery: string,\n\t\tvariables: Record<string, any>,\n\t\tcancellation: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure?: boolean,\n\t): Promise<T | undefined> {\n\t\tconst { accessToken } = token;\n\t\tlet rsp: Response;\n\t\ttry {\n\t\t\tconst sw = maybeStopWatch(`[GITLAB] POST ${baseUrl}`, { log: { onlyExit: true } });\n\n\t\t\ttry {\n\t\t\t\tif (cancellation?.aborted) throw new CancellationError();\n\n\t\t\t\tconst capture = createReadCapture();\n\t\t\t\trsp = await this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () =>\n\t\t\t\t\tthis.config.fetch(`${baseUrl ?? 'https://gitlab.com/api'}/graphql`, {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json' },\n\t\t\t\t\t\tsignal: cancellation,\n\t\t\t\t\t\tbody: JSON.stringify({ query: query, variables: variables }),\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (rsp.ok) {\n\t\t\t\t\tconst data = captureReadNodes(await rsp.json(), capture) as T | { errors: { message: string }[] };\n\n\t\t\t\t\tif ('errors' in data) throw new ProviderFetchError('GitLab', rsp, data.errors);\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// Reads the body so the 403 branch below can tell a throttled request from a permission failure.\n\t\t\t\tthrow await ProviderFetchError.fromResponse('GitLab', rsp);\n\t\t\t} finally {\n\t\t\t\tconst match = /(^[^({\\n]+)/.exec(query);\n\t\t\t\tconst message = ` ${match?.[1].trim() ?? query}`;\n\n\t\t\t\tsw?.stop({ message: message });\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof ProviderFetchError || ex.name === 'AbortError') {\n\t\t\t\tthis.handleRequestError(provider, token, ex, scope, deferFailure);\n\t\t\t} else if (Logger.isDebugging) {\n\t\t\t\tthis.config.onError?.(`GitLab request failed: ${ex.message}`);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\tprivate async request<T>(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string | undefined,\n\t\troute: string,\n\t\toptions: { method: RequestInit['method'] } & Record<string, unknown>,\n\t\tcancellation: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure?: boolean,\n\t): Promise<T> {\n\t\tconst { accessToken } = token;\n\t\tconst url = `${baseUrl ?? 'https://gitlab.com/api'}/${route}`;\n\n\t\tlet rsp: Response;\n\t\ttry {\n\t\t\tconst sw = maybeStopWatch(`[GITLAB] ${options?.method ?? 'GET'} ${url}`, { log: { onlyExit: true } });\n\n\t\t\ttry {\n\t\t\t\tif (cancellation?.aborted) throw new CancellationError();\n\n\t\t\t\tconst capture = createReadCapture();\n\t\t\t\trsp = await this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () =>\n\t\t\t\t\tthis.config.fetch(url, {\n\t\t\t\t\t\theaders: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json' },\n\t\t\t\t\t\tsignal: cancellation,\n\t\t\t\t\t\t...options,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (rsp.ok) {\n\t\t\t\t\treturn captureReadNodes(await rsp.json(), capture) as T;\n\t\t\t\t}\n\n\t\t\t\t// Reads the body so the 403 branch below can tell a throttled request from a permission failure.\n\t\t\t\tthrow await ProviderFetchError.fromResponse('GitLab', rsp);\n\t\t\t} finally {\n\t\t\t\tsw?.stop();\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof ProviderFetchError || ex.name === 'AbortError') {\n\t\t\t\tthis.handleRequestError(provider, token, ex, scope, deferFailure);\n\t\t\t} else if (Logger.isDebugging) {\n\t\t\t\tthis.config.onError?.(`GitLab request failed: ${ex.message}`);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\tprivate handleRequestError(\n\t\tprovider: Provider | undefined,\n\t\ttoken: TokenWithInfo,\n\t\tex: ProviderFetchError | (Error & { name: 'AbortError' }),\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure: boolean | undefined,\n\t): void {\n\t\tif (ex.name === 'AbortError' || !(ex instanceof ProviderFetchError)) throw new CancellationError(ex);\n\n\t\tconst { accessToken, ...tokenInfo } = token;\n\t\tswitch (ex.status) {\n\t\t\tcase 404: // Not found\n\t\t\tcase 410: // Gone\n\t\t\tcase 422: // Unprocessable Entity\n\t\t\t\tthrow new RequestNotFoundError(ex);\n\t\t\tcase 429: // Too Many Requests\n\t\t\t\tthrow toRateLimitError(ex, accessToken);\n\t\t\tcase 401: // Unauthorized\n\t\t\t\tthrow new AuthenticationError(tokenInfo, AuthenticationErrorReason.Unauthorized, ex);\n\t\t\tcase 403: // Forbidden\n\t\t\t\t// GitLab returns 403 for both a permission failure and a throttled request, so the message is the\n\t\t\t\t// discriminant (see `isRateLimitResponse`, shared with Bitbucket/Azure).\n\t\t\t\tif (isRateLimitResponse(ex)) throw toRateLimitError(ex, accessToken);\n\n\t\t\t\tthrow new AuthenticationError(tokenInfo, AuthenticationErrorReason.Forbidden, ex);\n\t\t\tcase 500: // Internal Server Error\n\t\t\t\tscope?.error(ex);\n\t\t\t\tif (ex.response != null) {\n\t\t\t\t\treportRequestFailure(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\tex,\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\tthis.config.onRequestFailed?.(\n\t\t\t\t\t\t\t\tprovider == null || provider.id === 'gitlab'\n\t\t\t\t\t\t\t\t\t? l10n.t(\n\t\t\t\t\t\t\t\t\t\t\t'{0} failed to respond and might be experiencing issues. Please visit the [GitLab status page](https://status.gitlab.com) for more information.',\n\t\t\t\t\t\t\t\t\t\t\tprovider?.name ?? 'GitLab',\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: l10n.t('{0} failed to respond and might be experiencing issues.', provider.name),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\tdeferFailure,\n\t\t\t\t\t\ttoken.connectionId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase 502: // Bad Gateway\n\t\t\t\tscope?.error(ex);\n\t\t\t\t// GitHub seems to return this status code for timeouts\n\t\t\t\tif (ex.message.includes('timeout')) {\n\t\t\t\t\treportRequestFailure(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\tex,\n\t\t\t\t\t\t() => this.config.onRequestTimedOut?.(provider?.name ?? 'GitLab'),\n\t\t\t\t\t\tdeferFailure,\n\t\t\t\t\t\ttoken.connectionId,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (ex.status >= 400 && ex.status < 500) throw new RequestClientError(ex);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tscope?.error(ex);\n\t\tif (Logger.isDebugging) {\n\t\t\tthis.config.onError?.(`GitLab request failed: ${(ex.response as any)?.errors?.[0]?.message ?? ex.message}`);\n\t\t}\n\t}\n\n\tprivate handleException(ex: Error, provider: Provider, scope: ScopedLogger | undefined): Error {\n\t\tscope?.error(ex);\n\t\t// debugger;\n\n\t\tif (ex instanceof AuthenticationError) {\n\t\t\tvoid this.showAuthenticationErrorMessage(ex, provider);\n\t\t}\n\t\treturn ex;\n\t}\n\n\tprivate async showAuthenticationErrorMessage(ex: AuthenticationError, provider: Provider) {\n\t\tif (ex.reason === AuthenticationErrorReason.Unauthorized || ex.reason === AuthenticationErrorReason.Forbidden) {\n\t\t\tconst reauthenticate = await this.config.onReauthenticationRequired?.(\n\t\t\t\tex.reason === AuthenticationErrorReason.Forbidden\n\t\t\t\t\t? l10n.t('{0}. Would you like to try reauthenticating to provide additional access?', ex.message)\n\t\t\t\t\t: l10n.t('{0}. Would you like to try reauthenticating?', ex.message),\n\t\t\t);\n\n\t\t\tif (reauthenticate) {\n\t\t\t\tawait provider.reauthenticate();\n\t\t\t\tthis.resetCaches();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.config.onError?.(ex.message);\n\t\t}\n\t}\n}\n\n/** Wires a {@link GitLabApi} from the full runtime context, mapping `ctx` down to the narrow config. */\nexport function createGitLabApi(ctx: IntegrationServiceContext): GitLabApi {\n\tconst config: ProviderApiConfig = {\n\t\t...baseProviderApiConfig(ctx),\n\t\t// Self-hosted GitLab keys its API base off `remotes`, so reset on both HTTP proxy and remotes changes.\n\t\tonConfigChanged: listener =>\n\t\t\tctx.config.onDidChange(e => {\n\t\t\t\tif (e.httpProxy || e.remotes) {\n\t\t\t\t\tlistener();\n\t\t\t\t}\n\t\t\t}),\n\t\tonReauthenticationRequired: message =>\n\t\t\tctx.hooks?.onReauthenticationRequired?.(message) ?? Promise.resolve(false),\n\t\tonRequestTimedOut: providerName => ctx.hooks?.ui?.onRequestTimedOut?.(providerName),\n\t};\n\n\treturn new GitLabApi(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,qBAAqB;AAC3B,MAAM,6BAA6B;AAEnC,SAAS,kBAAkB,IAAqD;CAC/E,OAAO,OAAO,OAAO,YAAY,IAAI,WAAW,kBAAkB,IAC/D,GAAG,UAAU,EAAyB,IACtC,OAAO,EAAE;AACb;;AAGA,MAAM,iBAAiB;;;;;AAMvB,SAAS,iBACR,OACA,OAC2B;CAC3B,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAAmC,CAAC;CAC1C,MAAM,UAAU,KAAK,IAAI,GAAG,GAAG,MAAM,KAAI,MAAK,EAAE,MAAM,CAAC;CACvD,KAAK,IAAI,OAAO,GAAG,OAAO,SAAS,QAClC,KAAK,MAAM,QAAQ,OAAO;EACzB,MAAM,KAAK,KAAK;EAChB,IAAI,MAAM,QAAQ,KAAK,IAAI,GAAG,EAAE,GAAG;EAEnC,IAAI,OAAO,UAAU,OAAO,OAAO;EAEnC,KAAK,IAAI,GAAG,EAAE;EACd,OAAO,KAAK,EAAE;CACf;CAED,OAAO;AACR;AAYA,SAAS,uBAAuB,IAAsB;CACrD,OAAO,cAAc,uBAAuB,GAAG,WAAA;AAChD;AAEA,IAAa,YAAb,MAA6C;CAQf;CAP7B;CACA,8BAAsB,IAAI,IAAyC;CACnE,wCAAyC,IAAI,QAA2D;CACxG,uCAAwC,IAAI,QAAqD;CACjG,yCAAiC,IAAI,QAAyC;CAC9E,4CAAoC,IAAI,IAAY;CAEpD,YA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AAU,OAAO,OAAO,UAAU;CACxC,UAAU,SAAS;CACnB,OAAO,UAAU,MAAM,UAAU;CAC1B;CACD;AACP,GACD,CAAC,CAAA,GAAA,UAAA,WAAA,yBAAA,IAAA;AAyDA,WAAA,CAAA,MAAM,EAAE,OAAO,UAAU,WAAW;CAAE,UAAU,SAAS;CAAM,OAAO,UAAU,MAAM,UAAU;AAAG,GAAG,CAAC,CAAA,GAAA,UAAA,WAAA,sBAAA,IAAA;;AA8pBzG,SAAgB,gBAAgB,KAA2C;CAe1E,OAAO,IAAI,UAAU;EAbpB,GAAG,sBAAsB,GAAG;EAE5B,kBAAiB,aAChB,IAAI,OAAO,aAAY,MAAK;GAC3B,IAAI,EAAE,aAAa,EAAE,SACpB,SAAS;EAEX,CAAC;EACF,6BAA4B,YAC3B,IAAI,OAAO,6BAA6B,OAAO,KAAK,QAAQ,QAAQ,KAAK;EAC1E,oBAAmB,iBAAgB,IAAI,OAAO,IAAI,oBAAoB,YAAY;CAG9D,CAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"gitlab.js","names":["Logger"],"sources":["../../../../../../plus/integrations/src/providers/gitlab/gitlab.ts"],"sourcesContent":["import { captureReadNodes, copyReadProvenance, createReadCapture } from '@gitkraken/provider-apis/read-provenance';\nimport * as l10n from '@vscode/l10n';\nimport { reportRequestFailure, takeDeferredRequestFailure } from '@gitlens/git/errors.js';\nimport type { Account } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { IssueOrPullRequest } from '@gitlens/git/models/issueOrPullRequest.js';\nimport { PullRequest } from '@gitlens/git/models/pullRequest.js';\nimport type { PullRequestState } from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport { AbortAggregate, CancellationError, isCancellationError, raceWithSignal } from '@gitlens/utils/cancellation.js';\nimport { trace } from '@gitlens/utils/decorators/log.js';\nimport type { Disposable } from '@gitlens/utils/disposable.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport type { ScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { mapSettledBounded } from '@gitlens/utils/promise.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { equalsIgnoreCase } from '@gitlens/utils/string.js';\nimport { joinUriPath, parseUri } from '@gitlens/utils/uri.js';\nimport type { ProviderAuthenticationSession, TokenWithInfo } from '../../authentication/models.js';\nimport type { IntegrationServiceContext } from '../../context.js';\nimport {\n\tAuthenticationError,\n\tAuthenticationErrorReason,\n\tisRateLimitResponse,\n\tLookupBackedOffError,\n\tProviderFetchError,\n\tRequestClientError,\n\tRequestNotFoundError,\n\tRequestRateLimitError,\n\ttoRateLimitError,\n} from '../../errors.js';\nimport type { GitLabIssueWriteScope } from '../../models/gitlabIssueWrites.js';\nimport type { IssueEtagInclude, PullRequestEtagInclude } from '../../reads/etag.js';\nimport { FailureBackoff } from '../../utils/failureBackoff.js';\nimport type { ProviderApiConfig } from '../apiConfig.js';\nimport { baseProviderApiConfig } from '../apiConfig.js';\nimport { isNotFoundResponse } from '../providerErrors.js';\nimport { providerFanOutConcurrency, selectBranchPullRequests } from '../utils/providerPaging.js';\nimport type { GitLabUser } from './gitlab.utils.js';\nimport { selectGitLabUserForCommit } from './gitlab.utils.js';\nimport { GitLabIssueWriter } from './issueWrites.js';\nimport type {\n\tGitLabCommit,\n\tGitLabIssue,\n\tGitLabIssueEtagNode,\n\tGitLabMergeRequest,\n\tGitLabMergeRequestEtagNode,\n\tGitLabMergeRequestFull,\n\tGitLabMergeRequestREST,\n\tGitLabMergeRequestState,\n\tGitLabProjectREST,\n\tGitLabSshKey,\n} from './models.js';\nimport {\n\tfromGitLabMergeRequest,\n\tfromGitLabMergeRequestREST,\n\tfromGitLabMergeRequestState,\n\tgetRepoName,\n\tgetRepoNamespace,\n\tgitLabEtagFieldsMaxIids,\n\ttoGitLabMergeRequestState,\n} from './models.js';\n\n// drop it as soon as we switch to @gitkraken/providers-api\nconst gitlabUserIdPrefix = 'gid://gitlab/User/';\nconst gitlabMergeRequestIdPrefix = 'gid://gitlab/MergeRequest/';\n\nfunction buildGitLabUserId(id: string | number | undefined): string | undefined {\n\treturn typeof id === 'string' && id?.startsWith(gitlabUserIdPrefix)\n\t\t? id.substring(gitlabUserIdPrefix.length)\n\t\t: String(id);\n}\n\n/** Merge requests one search returns; a bigger amount exceeds the max GraphQL complexity of the detail query. */\nconst searchPageSize = 20;\n\n/**\n * Merge requests taken best-ranked first across `lists` (each already in rank order), skipping a repeated id,\n * up to `limit`.\n */\nfunction interleaveByRank(\n\tlists: readonly (readonly GitLabMergeRequestREST[])[],\n\tlimit: number,\n): GitLabMergeRequestREST[] {\n\tconst seen = new Set<number>();\n\tconst merged: GitLabMergeRequestREST[] = [];\n\tconst longest = Math.max(0, ...lists.map(l => l.length));\n\tfor (let rank = 0; rank < longest; rank++) {\n\t\tfor (const list of lists) {\n\t\t\tconst mr = list[rank];\n\t\t\tif (mr == null || seen.has(mr.id)) continue;\n\n\t\t\tif (merged.length >= limit) return merged;\n\n\t\t\tseen.add(mr.id);\n\t\t\tmerged.push(mr);\n\t\t}\n\t}\n\treturn merged;\n}\n\ninterface ProjectLookupCallers {\n\tbackoff: boolean;\n\treportFailure: boolean;\n}\n\ninterface ProjectLookupBackoffs {\n\treadonly failed: FailureBackoff;\n\treadonly refused: FailureBackoff;\n}\n\nfunction isRefusedProjectLookup(ex: unknown): boolean {\n\treturn ex instanceof AuthenticationError && ex.reason !== AuthenticationErrorReason.Forbidden;\n}\n\nexport class GitLabApi implements Disposable {\n\tprivate readonly _disposable: Disposable | undefined;\n\tprivate _projectIds = new Map<string, Promise<string | undefined>>();\n\tprivate readonly _projectLookupCallers = new WeakMap<Promise<string | undefined>, ProjectLookupCallers>();\n\tprivate readonly _projectLookupAborts = new WeakMap<Promise<string | undefined>, AbortAggregate>();\n\tprivate _projectLookupBackoffs = new WeakMap<Provider, ProjectLookupBackoffs>();\n\tprivate _reauthenticationPrompted = new Set<string>();\n\n\tconstructor(private readonly config: ProviderApiConfig) {\n\t\tthis._disposable = config.onConfigChanged?.(() => this.resetCaches());\n\t}\n\n\tgetIssueWriter(\n\t\tscope: GitLabIssueWriteScope,\n\t\tsession: ProviderAuthenticationSession,\n\t\tisCurrent: () => Promise<boolean>,\n\t\tisRetired: () => boolean,\n\t): GitLabIssueWriter {\n\t\treturn new GitLabIssueWriter(this.config, scope, session, isCurrent, isRetired);\n\t}\n\n\tdispose(): void {\n\t\tthis._disposable?.dispose();\n\t}\n\n\tclearProjectLookupBackoff(provider: Provider): void {\n\t\tthis._projectLookupBackoffs.delete(provider);\n\t}\n\n\tprivate resetCaches(): void {\n\t\tthis._projectIds.clear();\n\t\tthis._projectLookupBackoffs = new WeakMap();\n\t\tthis._reauthenticationPrompted.clear();\n\t}\n\n\tprivate getProjectLookupBackoffs(provider: Provider): ProjectLookupBackoffs {\n\t\tlet backoffs = this._projectLookupBackoffs.get(provider);\n\t\tif (backoffs == null) {\n\t\t\tbackoffs = { failed: new FailureBackoff(), refused: new FailureBackoff() };\n\t\t\tthis._projectLookupBackoffs.set(provider, backoffs);\n\t\t}\n\t\treturn backoffs;\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t}),\n\t})\n\tasync getAccountForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<Account | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation);\n\t\tif (!projectId) return undefined;\n\n\t\ttry {\n\t\t\tconst commit = await this.request<GitLabCommit>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\t`v4/projects/${projectId}/repository/commits/${rev}?stats=false`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t// ...options,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tlet users = await this.findUser(provider, token, commit.author_name, options, cancellation);\n\t\t\tlet user = selectGitLabUserForCommit(users, commit.author_name, commit.author_email);\n\n\t\t\t// If the name search was ambiguous (multiple users share the name), try an email-scoped search to\n\t\t\t// disambiguate before giving up — otherwise we'd show a stranger's avatar (see #2205)\n\t\t\tif (user == null && commit.author_email) {\n\t\t\t\tconst exactNameMatches = users.filter(u => equalsIgnoreCase(u.name, commit.author_name)).length;\n\t\t\t\tif (exactNameMatches > 1) {\n\t\t\t\t\tusers = await this.findUser(provider, token, commit.author_email, options, cancellation);\n\t\t\t\t\tuser = selectGitLabUserForCommit(users, commit.author_name, commit.author_email);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (user == null) return undefined;\n\n\t\t\t// If the avatarUrl is a relative URL, make it absolute using the webUrl (assuming the webUrl is the root URL with the username tacked on)\n\t\t\tif (user.avatarUrl && !/^([a-zA-Z][\\w+.-]+):/.test(user.avatarUrl)) {\n\t\t\t\tuser.avatarUrl = joinUriPath(parseUri(user.webUrl), '..', user.avatarUrl).toString();\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\tid: String(user.id),\n\t\t\t\tname: user.name || undefined,\n\t\t\t\temail: commit.author_email || undefined,\n\t\t\t\tavatarUrl: user.avatarUrl || undefined,\n\t\t\t\tusername: user.username || undefined,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, _owner, _repo, email) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\temail: email,\n\t\t}),\n\t})\n\tasync getAccountForEmail(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\t_owner: string,\n\t\t_repo: string,\n\t\temail: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t},\n\t): Promise<Account | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst [user] = await this.findUser(provider, token, email, options);\n\t\t\tif (user == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\tid: String(user.id),\n\t\t\t\tname: user.name || undefined,\n\t\t\t\temail: user.publicEmail || undefined,\n\t\t\t\tavatarUrl: user.avatarUrl || undefined,\n\t\t\t\tusername: user.username || undefined,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, userId) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tuserId: userId,\n\t\t}),\n\t})\n\tasync getUserSigningKeys(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tuserId: string | number,\n\t\toptions?: { baseUrl?: string },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitLabSshKey[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\t// SSH keys are public, so this works for any user with the current token (covered by the `read_user` scope).\n\t\ttry {\n\t\t\tconst keys = await this.request<GitLabSshKey[]>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\t`v4/users/${userId}/keys`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\t// Exclude auth-only keys — only signing-capable keys belong in an allowed_signers file.\n\t\t\treturn keys?.filter(k => k.usage_type === 'signing' || k.usage_type === 'auth_and_signing') ?? [];\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return [];\n\n\t\t\tthis.handleException(ex, provider, scope);\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t}),\n\t})\n\tasync getDefaultBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<DefaultBranch | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject:\n\t\t\t\t\t| {\n\t\t\t\t\t\t\trepository: { rootRef: string } | null | undefined;\n\t\t\t\t\t }\n\t\t\t\t\t| null\n\t\t\t\t\t| undefined;\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getDefaultBranch(\n\t$fullPath: ID!\n) {\n\tproject(fullPath: $fullPath) {\n\t\trepository {\n\t\t\trootRef\n\t\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${owner}/${repo}`,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tconst defaultBranch = rsp?.data?.project?.repository?.rootRef ?? undefined;\n\t\t\tif (defaultBranch == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\tname: defaultBranch,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, number) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tnumber: number,\n\t\t}),\n\t})\n\tasync getIssueOrPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: {\n\t\t\t\t\tmergeRequest: GitLabMergeRequest | null;\n\t\t\t\t\tissue: GitLabIssue | null;\n\t\t\t\t} | null;\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getIssueOrMergeRequest(\n\t$fullPath: ID!\n\t$iid: String!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tmergeRequest(iid: $iid) {\n\t\t\tauthor {\n\t\t\t\tid\n\t\t\t\tname\n\t\t\t\tavatarUrl\n\t\t\t\twebUrl\n\t\t\t}\n\t\t\tiid\n\t\t\ttitle\n\t\t\tdescription\n\t\t\tstate\n\t\t\tcreatedAt\n\t\t\tupdatedAt\n\t\t\tmergedAt\n\t\t\twebUrl\n\t\t}\n\t\tissue(iid: $iid) {\n\t\t\tauthor {\n\t\t\t\tid\n\t\t\t\tname\n\t\t\t\tavatarUrl\n\t\t\t\twebUrl\n\t\t\t}\n\t\t\tiid\n\t\t\ttitle\n\t\t\tdescription\n\t\t\tstate\n\t\t\tcreatedAt\n\t\t\tupdatedAt\n\t\t\tclosedAt\n\t\t\twebUrl\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${owner}/${repo}`,\n\t\t\t\t\tiid: String(number),\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tif (rsp?.data?.project?.issue != null) {\n\t\t\t\tconst issue = rsp.data.project.issue;\n\t\t\t\tconst result: IssueOrPullRequest = {\n\t\t\t\t\tprovider: provider,\n\t\t\t\t\ttype: 'issue',\n\t\t\t\t\tid: issue.iid,\n\t\t\t\t\tnodeId: undefined,\n\t\t\t\t\tcreatedDate: new Date(issue.createdAt),\n\t\t\t\t\tupdatedDate: new Date(issue.updatedAt),\n\t\t\t\t\ttitle: issue.title,\n\t\t\t\t\tclosed: issue.state === 'closed',\n\t\t\t\t\tclosedDate: issue.closedAt == null ? undefined : new Date(issue.closedAt),\n\t\t\t\t\turl: issue.webUrl,\n\t\t\t\t\tstate: issue.state === 'locked' ? 'closed' : issue.state,\n\t\t\t\t};\n\t\t\t\treturn copyReadProvenance(result, issue);\n\t\t\t}\n\n\t\t\tif (rsp?.data?.project?.mergeRequest != null) {\n\t\t\t\tconst mergeRequest = rsp.data.project.mergeRequest;\n\t\t\t\tconst result: IssueOrPullRequest = {\n\t\t\t\t\tprovider: provider,\n\t\t\t\t\ttype: 'pullrequest',\n\t\t\t\t\tid: mergeRequest.iid,\n\t\t\t\t\tnodeId: undefined,\n\t\t\t\t\tcreatedDate: new Date(mergeRequest.createdAt),\n\t\t\t\t\tupdatedDate: new Date(mergeRequest.updatedAt),\n\t\t\t\t\ttitle: mergeRequest.title,\n\t\t\t\t\tclosed: mergeRequest.state === 'closed',\n\t\t\t\t\t// TODO@eamodio this isn't right, but GitLab doesn't seem to provide a closedAt on merge requests in GraphQL\n\t\t\t\t\tclosedDate: mergeRequest.state === 'closed' ? new Date(mergeRequest.updatedAt) : undefined,\n\t\t\t\t\turl: mergeRequest.webUrl,\n\t\t\t\t\tstate: mergeRequest.state === 'locked' ? 'closed' : mergeRequest.state,\n\t\t\t\t};\n\t\t\t\treturn copyReadProvenance(result, mergeRequest);\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * Whether `owner/repo` has issue `iid`. Strict like {@link getPullRequest}'s `strict`: `false` only for a `null`\n\t * project or issue, which is how GitLab's GraphQL answers a missing one; GraphQL `errors`, an empty response and\n\t * any HTTP error (a 404 means a wrong endpoint) all throw instead of reading as absent.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, iid) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tiid: iid,\n\t\t}),\n\t})\n\tasync hasIssue(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tiid: number,\n\t\toptions: { baseUrl?: string; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: { project: { issue: { iid: string } | null } | null } | null;\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query hasIssue(\n\t$fullPath: ID!\n\t$iid: String!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tissue(iid: $iid) {\n\t\t\tiid\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{ fullPath: `${owner}/${repo}`, iid: String(iid) },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (rsp?.data == null) throw new Error('GitLab returned no data for the issue');\n\n\t\t\treturn rsp.data.project?.issue != null;\n\t\t} catch (ex) {\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t}),\n\t})\n\tasync getPullRequestForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t\tinclude?: GitLabMergeRequestState[];\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: {\n\t\t\t\t\tmergeRequests?: {\n\t\t\t\t\t\tnodes: GitLabMergeRequest[];\n\t\t\t\t\t} | null;\n\t\t\t\t\topened?: {\n\t\t\t\t\t\tnodes: GitLabMergeRequest[];\n\t\t\t\t\t} | null;\n\t\t\t\t\tclosed?: {\n\t\t\t\t\t\tnodes: GitLabMergeRequest[];\n\t\t\t\t\t} | null;\n\t\t\t\t\tmerged?: {\n\t\t\t\t\t\tnodes: GitLabMergeRequest[];\n\t\t\t\t\t} | null;\n\t\t\t\t} | null;\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst fragment = `\n\t\t\tnodes {\n\t\t\t\tiid\n\t\t\t\tauthor {\n\t\t\t\t\tid\n\t\t\t\t\tname\n\t\t\t\t\tavatarUrl\n\t\t\t\t\twebUrl\n\t\t\t\t}\n\t\t\t\ttitle\n\t\t\t\tdescription\n\t\t\t\tstate\n\t\t\t\tcreatedAt\n\t\t\t\tupdatedAt\n\t\t\t\tmergedAt\n\t\t\t\twebUrl\n\t\t\t}`;\n\n\t\t\tconst query = `query getMergeRequestForBranch(\n\t$fullPath: ID!\n\t$branches: [String!]\n) {\n\tproject(fullPath: $fullPath) {\n\t\t${\n\t\t\toptions?.include == null\n\t\t\t\t? `mergeRequests(sourceBranches: $branches sort: UPDATED_DESC first: 1) {\n\t\t\t${fragment}\n\t\t}`\n\t\t\t\t: ''\n\t\t}\n\t\t${\n\t\t\toptions?.include?.includes('opened')\n\t\t\t\t? `opened: mergeRequests(sourceBranches: $branches state: opened sort: UPDATED_DESC first: 1) {\n\t\t\t${fragment}\n\t\t}`\n\t\t\t\t: ''\n\t\t}\n\t\t${\n\t\t\toptions?.include?.includes('merged')\n\t\t\t\t? `merged: mergeRequests(sourceBranches: $branches state: merged sort: UPDATED_DESC first: 1) {\n\t\t\t${fragment}\n\t\t}`\n\t\t\t\t: ''\n\t\t}\n\t\t${\n\t\t\toptions?.include?.includes('closed')\n\t\t\t\t? `closed: mergeRequests(sourceBranches: $branches state: closed sort: UPDATED_DESC first: 1) {\n\t\t\t${fragment}\n\t\t}`\n\t\t\t\t: ''\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${owner}/${repo}`,\n\t\t\t\t\tbranches: [branch],\n\t\t\t\t\tstate: options?.include,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tlet pr: GitLabMergeRequest | undefined;\n\n\t\t\tif (options?.include == null) {\n\t\t\t\tpr = rsp?.data?.project?.mergeRequests?.nodes?.[0];\n\t\t\t} else {\n\t\t\t\tfor (const state of options.include) {\n\t\t\t\t\tlet mr;\n\t\t\t\t\tif (state === 'opened') {\n\t\t\t\t\t\tmr = rsp?.data?.project?.opened?.nodes?.[0];\n\t\t\t\t\t} else if (state === 'merged') {\n\t\t\t\t\t\tmr = rsp?.data?.project?.merged?.nodes?.[0];\n\t\t\t\t\t} else if (state === 'closed') {\n\t\t\t\t\t\tmr = rsp?.data?.project?.closed?.nodes?.[0];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (mr != null && (pr == null || new Date(mr.updatedAt) > new Date(pr.updatedAt))) {\n\t\t\t\t\t\tpr = mr;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (pr == null) return undefined;\n\n\t\t\t// A caller holding a remote's descriptor split a nested group at its first slash.\n\t\t\tconst fullPath = `${owner}/${repo}`;\n\t\t\tconst result = new PullRequest(\n\t\t\t\tprovider,\n\t\t\t\t{\n\t\t\t\t\tid: buildGitLabUserId(pr.author?.id) ?? '',\n\t\t\t\t\t// An absent author stays absent: no `'Unknown'` name a consumer can't tell from a real one, and no\n\t\t\t\t\t// `''` url/avatar that passes a presence check and renders as a link to nowhere. Matches\n\t\t\t\t\t// `fromProviderAccount`/`toIssueShape`.\n\t\t\t\t\tname: pr.author?.name ?? undefined,\n\t\t\t\t\tavatarUrl: pr.author?.avatarUrl ?? undefined,\n\t\t\t\t\turl: pr.author?.webUrl ?? undefined,\n\t\t\t\t},\n\t\t\t\t// oxlint-disable-next-line typescript/no-unnecessary-type-conversion\n\t\t\t\tString(pr.iid),\n\t\t\t\tundefined,\n\t\t\t\tpr.title,\n\t\t\t\tpr.webUrl,\n\t\t\t\t{ owner: getRepoNamespace(fullPath), repo: getRepoName(fullPath) },\n\t\t\t\tfromGitLabMergeRequestState(pr.state),\n\t\t\t\tnew Date(pr.createdAt),\n\t\t\t\tnew Date(pr.updatedAt),\n\t\t\t\t// TODO@eamodio this isn't right, but GitLab doesn't seem to provide a closedAt on merge requests in GraphQL\n\t\t\t\tpr.state !== 'closed' ? undefined : new Date(pr.updatedAt),\n\t\t\t\tpr.mergedAt == null ? undefined : new Date(pr.mergedAt),\n\t\t\t\tundefined, // mergeableState\n\t\t\t\tundefined, // viewerCanUpdate\n\t\t\t\tundefined, // refs\n\t\t\t\tundefined, // isDraft\n\t\t\t\tundefined, // additions\n\t\t\t\tundefined, // deletions\n\t\t\t\tundefined, // commentsCount\n\t\t\t\tundefined, // thumbsUpCount\n\t\t\t\tundefined, // reviewDecision\n\t\t\t\tundefined, // reviewRequests\n\t\t\t\tundefined, // latestReviews\n\t\t\t\tundefined, // assignees\n\t\t\t\tundefined, // statusCheckRollupState\n\t\t\t\tundefined, // project\n\t\t\t\tundefined, // version\n\t\t\t\tundefined, // commitCount\n\t\t\t\tundefined, // stack\n\t\t\t\tundefined, // filesChanged\n\t\t\t\tundefined, // body\n\t\t\t\tundefined, // number\n\t\t\t\tundefined, // authoredByMe\n\t\t\t\t'point',\n\t\t\t);\n\t\t\treturn copyReadProvenance(result, pr);\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t}),\n\t})\n\tasync getPullRequestForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t\t/**\n\t\t\t * For a batch read: a failed request throws without the re-authentication prompt, which the batch settles\n\t\t\t * once for the whole call (a missing project or commit still answers `undefined`), and the batch reports a\n\t\t\t * server error once rather than each request showing its own.\n\t\t\t */\n\t\t\tdeferFailure?: boolean;\n\t\t\tbackoff?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation, {\n\t\t\tstrict: true,\n\t\t\tbackoff: options?.backoff ?? !options?.deferFailure,\n\t\t\tdeferFailure: options?.deferFailure,\n\t\t});\n\t\tif (!projectId) return undefined;\n\n\t\ttry {\n\t\t\tconst mrs = await this.request<GitLabMergeRequestREST[]>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\t`v4/projects/${projectId}/repository/commits/${rev}/merge_requests`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t// ...options,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\tif (mrs == null || mrs.length === 0) return undefined;\n\n\t\t\tif (mrs.length > 1) {\n\t\t\t\tmrs.sort(\n\t\t\t\t\t(a, b) =>\n\t\t\t\t\t\t(a.state === 'opened' ? -1 : 1) - (b.state === 'opened' ? -1 : 1) ||\n\t\t\t\t\t\tnew Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// A caller holding a remote's descriptor split a nested group at its first slash.\n\t\t\tconst fullPath = `${owner}/${repo}`;\n\t\t\treturn fromGitLabMergeRequestREST(\n\t\t\t\tmrs[0],\n\t\t\t\tprovider,\n\t\t\t\t{ owner: getRepoNamespace(fullPath), repo: getRepoName(fullPath) },\n\t\t\t\t'point',\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tif (options?.deferFailure) {\n\t\t\t\tif (isNotFoundResponse(ex)) return undefined;\n\n\t\t\t\tscope?.error(ex);\n\t\t\t\tthrow ex;\n\t\t\t}\n\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, id) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t}),\n\t})\n\tasync getPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: number,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\t/**\n\t\t\t * Returns `undefined` only for a `null` project or merge request, which is how GitLab's GraphQL\n\t\t\t * answers a missing one. A thrown not-found or an empty response means the endpoint is wrong, so\n\t\t\t * both throw instead of reading as absent.\n\t\t\t */\n\t\t\tstrict?: boolean;\n\t\t\tdeferFailure?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: {\n\t\t\t\t\tmergeRequest: GitLabMergeRequestFull | null;\n\t\t\t\t} | null;\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getMergeRequest(\n\t$fullPath: ID!\n\t$iid: String!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tmergeRequest(iid: $iid) {\n\t\t\tid,\n\t\t\tiid\n\t\t\tstate,\n\t\t\tauthor {\n\t\t\t\tid\n\t\t\t\tname\n\t\t\t\tavatarUrl\n\t\t\t\twebUrl\n\t\t\t}\n\t\t\tdiffRefs {\n\t\t\t\tbaseSha\n\t\t\t\theadSha\n\t\t\t}\n\t\t\ttitle\n\t\t\tdescription\n\t\t\twebUrl\n\t\t\tcreatedAt\n\t\t\tupdatedAt\n\t\t\tmergedAt\n\t\t\ttargetBranch\n\t\t\tsourceBranch\n\t\t\tproject {\n\t\t\t\tid\n\t\t\t\tfullPath\n\t\t\t\twebUrl\n\t\t\t}\n\t\t\tsourceProject {\n\t\t\t\tid\n\t\t\t\tfullPath\n\t\t\t\twebUrl\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${owner}/${repo}`,\n\t\t\t\t\tiid: String(id),\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\n\t\t\tif (rsp?.data == null) {\n\t\t\t\tif (options?.strict) throw new Error('GitLab returned no data for the merge request');\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (rsp.data.project?.mergeRequest == null) return undefined;\n\n\t\t\tconst pr = rsp.data.project.mergeRequest;\n\t\t\treturn fromGitLabMergeRequest(pr, provider, 'point');\n\t\t} catch (ex) {\n\t\t\tif (!options?.strict && ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * The iids of the merge requests into `owner/repo` whose source is `branch`, in any state, newest first, at most\n\t * `limit`: from the project itself when `headOwner` is omitted, otherwise from a fork in the `headOwner`\n\t * namespace. Only the iids, so a caller resolves the rows through the same read as its by-number lookups.\n\t *\n\t * Keyed on the source branch NAME, so a merged request whose branch was deleted still matches. Strict like\n\t * {@link getPullRequest}'s `strict`: an empty list means GitLab answered, a `null` project included; a 404 or\n\t * an empty response means the endpoint is wrong and throws. Requests from a deleted fork carry no source\n\t * project and so match nothing.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t}),\n\t})\n\tasync getPullRequestNumbersForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\toptions: { baseUrl?: string; headOwner?: string; limit: number; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<{ numbers: number[]; truncated: boolean }> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface MergeRequestHead {\n\t\t\tiid: string;\n\t\t\tupdatedAt: string;\n\t\t\tsourceBranch: string;\n\t\t\tproject: { id: string };\n\t\t\tsourceProject: { id: string; fullPath: string } | null;\n\t\t}\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: {\n\t\t\t\t\tmergeRequests: {\n\t\t\t\t\t\tcount: number;\n\t\t\t\t\t\tpageInfo: { hasNextPage: boolean };\n\t\t\t\t\t\tnodes: MergeRequestHead[];\n\t\t\t\t\t} | null;\n\t\t\t\t} | null;\n\t\t\t} | null;\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getMergeRequestsForBranch(\n\t$fullPath: ID!\n\t$branches: [String!]\n\t$limit: Int!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tmergeRequests(sourceBranches: $branches, state: all, sort: UPDATED_DESC, first: $limit) {\n\t\t\tcount\n\t\t\tpageInfo {\n\t\t\t\thasNextPage\n\t\t\t}\n\t\t\tnodes {\n\t\t\t\tiid\n\t\t\t\tupdatedAt\n\t\t\t\tsourceBranch\n\t\t\t\tproject {\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t\tsourceProject {\n\t\t\t\t\tid\n\t\t\t\t\tfullPath\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{ fullPath: `${owner}/${repo}`, branches: [branch], limit: options.limit },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (rsp?.data == null) throw new Error('GitLab returned no data for the merge requests by branch');\n\n\t\t\tconst project = rsp.data.project;\n\t\t\tif (project == null) return { numbers: [], truncated: false };\n\n\t\t\tconst connection = project.mergeRequests;\n\t\t\tif (connection == null) {\n\t\t\t\tthrow new Error(`GitLab returned no merge requests for ${owner}/${repo}:${branch}`);\n\t\t\t}\n\n\t\t\tconst headOwner = options.headOwner;\n\t\t\tconst { values, truncated } = selectBranchPullRequests(connection.nodes, {\n\t\t\t\tmatchesHead: mr => {\n\t\t\t\t\tif (mr.sourceBranch !== branch || mr.sourceProject == null) return false;\n\t\t\t\t\tif (headOwner == null) return mr.sourceProject.id === mr.project.id;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tmr.sourceProject.id !== mr.project.id &&\n\t\t\t\t\t\tequalsIgnoreCase(getRepoNamespace(mr.sourceProject.fullPath), headOwner)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tupdatedAt: mr => Date.parse(mr.updatedAt),\n\t\t\t\tmap: mr => {\n\t\t\t\t\tconst iid = Number(mr.iid);\n\t\t\t\t\tif (!Number.isSafeInteger(iid)) throw new Error(`GitLab returned a merge request iid '${mr.iid}'`);\n\n\t\t\t\t\treturn iid;\n\t\t\t\t},\n\t\t\t\tlimit: options.limit,\n\t\t\t\tmore: connection.pageInfo.hasNextPage || connection.count > connection.nodes.length,\n\t\t\t});\n\t\t\treturn { numbers: values, truncated: truncated };\n\t\t} catch (ex) {\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * The change state of merge requests `iids` in `fullPath` — the cheap check behind the batch pull request read's\n\t * etags. Selects only what provider-apis' `getPullRequestForRepo` maps into a full row's etag inputs, plus the\n\t * fields of each of `options.etagIncludes`, in ONE request for up to {@link gitLabEtagFieldsMaxIids} iids. One\n\t * entry per input iid, in order; `undefined` is a PROVEN ABSENCE (see {@link getEtagFieldsByIid}).\n\t */\n\t@trace({\n\t\targs: (provider, token, fullPath, iids) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tfullPath: fullPath,\n\t\t\tiids: iids.length,\n\t\t}),\n\t})\n\tasync getMergeRequestsEtagFields(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tfullPath: string,\n\t\tiids: readonly number[],\n\t\toptions: { baseUrl?: string; etagIncludes: readonly PullRequestEtagInclude[]; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<(GitLabMergeRequestEtagNode | undefined)[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst selections = ['iid', 'state', 'draft', 'updatedAt', 'diffRefs { headSha }'];\n\t\tif (options.etagIncludes.includes('mergeable')) {\n\t\t\tselections.push('mergeStatusEnum');\n\t\t}\n\t\tif (options.etagIncludes.includes('reviewDecision')) {\n\t\t\tselections.push('reviewers { nodes { mergeRequestInteraction { reviewState } } }');\n\t\t}\n\t\tif (options.etagIncludes.includes('checks')) {\n\t\t\tselections.push('headPipeline { stages { nodes { jobs { nodes { status allowFailure } } } } }');\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getMergeRequestsEtagFields(\n\t$fullPath: ID!\n\t$iids: [String!]\n\t$first: Int!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tmergeRequests(iids: $iids, state: all, first: $first) {\n\t\t\tpageInfo {\n\t\t\t\thasNextPage\n\t\t\t}\n\t\t\tnodes {\n\t\t\t\t${selections.join('\\n\\t\\t\\t\\t')}\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n\t\t\treturn await this.getEtagFieldsByIid<GitLabMergeRequestEtagNode>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t'mergeRequests',\n\t\t\t\tfullPath,\n\t\t\t\tiids,\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * The change state of issues `iids` in `fullPath` — the cheap check behind the batch issue read's etags — selecting\n\t * only what provider-apis' issue read maps into a full row's etag inputs, plus the field of each of\n\t * `options.etagIncludes`, in ONE request for up to {@link gitLabEtagFieldsMaxIids} iids. One entry per input iid,\n\t * in order; `undefined` is a PROVEN ABSENCE (see {@link getEtagFieldsByIid}).\n\t */\n\t@trace({\n\t\targs: (provider, token, fullPath, iids) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tfullPath: fullPath,\n\t\t\tiids: iids.length,\n\t\t}),\n\t})\n\tasync getIssuesEtagFields(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tfullPath: string,\n\t\tiids: readonly number[],\n\t\toptions: { baseUrl?: string; etagIncludes: readonly IssueEtagInclude[]; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<(GitLabIssueEtagNode | undefined)[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst selections = ['iid', 'closedAt', 'updatedAt'];\n\t\tif (options.etagIncludes.includes('reactions')) {\n\t\t\tselections.push('upvotes');\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getIssuesEtagFields(\n\t$fullPath: ID!\n\t$iids: [String!]\n\t$first: Int!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tissues(iids: $iids, state: all, first: $first) {\n\t\t\tpageInfo {\n\t\t\t\thasNextPage\n\t\t\t}\n\t\t\tnodes {\n\t\t\t\t${selections.join('\\n\\t\\t\\t\\t')}\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n\t\t\treturn await this.getEtagFieldsByIid<GitLabIssueEtagNode>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t'issues',\n\t\t\t\tfullPath,\n\t\t\t\tiids,\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * Runs an etag read's `query` and maps its `connection`'s nodes back to `iids`, positionally.\n\t *\n\t * Strict like {@link getPullRequest}'s `strict`: an iid is absent only when the project is `null`, or when it is\n\t * missing from a complete page of an error-free reply — the answers that prove a miss to the full read's own\n\t * confirming read. GraphQL `errors`, an empty response, a `null` connection, a page that has more and any HTTP\n\t * error (a 404 means a wrong endpoint) throw instead. The query asks for `state: all`, so no default state filter\n\t * can hide a closed or merged item and have it read as missing.\n\t */\n\tprivate async getEtagFieldsByIid<T extends { iid: string }>(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string | undefined,\n\t\tquery: string,\n\t\tconnection: 'mergeRequests' | 'issues',\n\t\tfullPath: string,\n\t\tiids: readonly number[],\n\t\tcancellation: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure: boolean | undefined,\n\t): Promise<(T | undefined)[]> {\n\t\tif (!iids.length) return [];\n\t\tif (iids.length > gitLabEtagFieldsMaxIids) {\n\t\t\tthrow new Error(`Cannot read more than ${gitLabEtagFieldsMaxIids} GitLab iids in one request`);\n\t\t}\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tproject: Partial<\n\t\t\t\t\tRecord<'mergeRequests' | 'issues', { pageInfo: { hasNextPage: boolean }; nodes: T[] } | null>\n\t\t\t\t> | null;\n\t\t\t} | null;\n\t\t}\n\n\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\tquery,\n\t\t\t{ fullPath: fullPath, iids: iids.map(String), first: iids.length },\n\t\t\tcancellation,\n\t\t\tscope,\n\t\t\tdeferFailure,\n\t\t);\n\t\tif (rsp?.data == null) throw new Error(`GitLab returned no data for the ${connection} of ${fullPath}`);\n\n\t\tconst project = rsp.data.project;\n\t\tif (project == null) return iids.map(() => undefined);\n\n\t\tconst page = project[connection];\n\t\tif (page?.nodes == null) throw new Error(`GitLab returned no ${connection} for ${fullPath}`);\n\t\tif (page.pageInfo.hasNextPage) throw new Error(`GitLab returned a partial page of ${connection}`);\n\n\t\tconst byIid = new Map(page.nodes.map(node => [node.iid, node]));\n\t\treturn iids.map(iid => byIid.get(String(iid)));\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t}),\n\t})\n\tasync getRepositoryMetadata(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tbackoff?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<RepositoryMetadata | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation, {\n\t\t\tstrict: true,\n\t\t\tbackoff: options?.backoff,\n\t\t}).catch((ex: unknown) => {\n\t\t\tthrow ex instanceof RequestNotFoundError ? ex.original : ex;\n\t\t});\n\t\tif (!projectId) return undefined;\n\n\t\ttry {\n\t\t\tconst proj = await this.request<GitLabProjectREST>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\t`v4/projects/${projectId}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t// ...options,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tif (proj == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\towner: proj.namespace.full_path,\n\t\t\t\tname: proj.path,\n\t\t\t\tisFork: proj.forked_from_project != null,\n\t\t\t\tparent:\n\t\t\t\t\tproj.forked_from_project != null\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\towner: proj.forked_from_project.namespace.full_path,\n\t\t\t\t\t\t\t\tname: proj.forked_from_project.path,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: undefined,\n\t\t\t} satisfies RepositoryMetadata;\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return undefined;\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t@trace({ args: (provider, token) => ({ provider: provider.name, token: `<token:${token.microHash}>` }) })\n\tasync searchPullRequests(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\toptions?: {\n\t\t\tsearch?: string;\n\t\t\tuser?: string;\n\t\t\trepos?: string[];\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t\tinclude?: PullRequestState[];\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest[]> {\n\t\tconst scope = getScopedLogger();\n\t\tconst search = options?.search;\n\t\tif (!search) {\n\t\t\treturn [];\n\t\t}\n\n\t\ttry {\n\t\t\tconst include = options?.include?.length ? options.include : undefined;\n\t\t\tconst searchQuery = `scope=merge_requests&search=${encodeURIComponent(search)}&per_page=${searchPageSize}`;\n\t\t\t// A repository-scoped search reads only those projects (by URL-encoded full path, which covers nested\n\t\t\t// namespaces) rather than the whole instance, so it never reads more than the caller asked for.\n\t\t\tconst repos = options?.repos?.length\n\t\t\t\t? [...new Map(options.repos.map(r => [r.toLowerCase(), r])).values()]\n\t\t\t\t: undefined;\n\n\t\t\tlet restPRs: GitLabMergeRequestREST[];\n\t\t\tif (repos == null) {\n\t\t\t\trestPRs = await this.searchMergeRequests(\n\t\t\t\t\tprovider,\n\t\t\t\t\ttoken,\n\t\t\t\t\toptions?.baseUrl,\n\t\t\t\t\t`v4/search/?${searchQuery}`,\n\t\t\t\t\tinclude,\n\t\t\t\t\tcancellation,\n\t\t\t\t\tscope,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst settled = await mapSettledBounded(repos, providerFanOutConcurrency, repo =>\n\t\t\t\t\tthis.searchMergeRequests(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\ttoken,\n\t\t\t\t\t\toptions?.baseUrl,\n\t\t\t\t\t\t`v4/projects/${encodeURIComponent(repo)}/search?${searchQuery}`,\n\t\t\t\t\t\tinclude,\n\t\t\t\t\t\tcancellation,\n\t\t\t\t\t\tscope,\n\t\t\t\t\t).catch((ex: unknown) => {\n\t\t\t\t\t\t// A project that is gone or not visible has nothing to find, as the instance-wide search would\n\t\t\t\t\t\t// not have listed it either.\n\t\t\t\t\t\tif (ex instanceof RequestNotFoundError) return [];\n\t\t\t\t\t\tthrow ex;\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst perProject: GitLabMergeRequestREST[][] = [];\n\t\t\t\tlet failure: { reason: unknown } | undefined;\n\t\t\t\tfor (const result of settled) {\n\t\t\t\t\tif (result.status === 'fulfilled') {\n\t\t\t\t\t\tperProject.push(result.value);\n\t\t\t\t\t} else if (isCancellationError(result.reason)) {\n\t\t\t\t\t\tthrow result.reason;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfailure ??= { reason: result.reason };\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// One failing project doesn't discard what the others found, but a search that found nothing anywhere\n\t\t\t\t// must not read as \"no matches\".\n\t\t\t\tif (failure != null) {\n\t\t\t\t\tif (perProject.length === 0) throw failure.reason;\n\n\t\t\t\t\tscope?.error(failure.reason, \"Failed to search a project; returning the other projects' matches\");\n\t\t\t\t}\n\n\t\t\t\t// Relevance only orders results within a single search, so interleave the projects' results (each still\n\t\t\t\t// in its own relevance order) to give every project a fair share of the one search's cap.\n\t\t\t\trestPRs = interleaveByRank(perProject, searchPageSize);\n\t\t\t}\n\t\t\tif (restPRs.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tinterface QueryResult {\n\t\t\t\tdata: Record<`mergeRequest_${number}`, GitLabMergeRequestFull>;\n\t\t\t}\n\n\t\t\tconst queryArgs = restPRs.map((_, i) => `$id_${i}: MergeRequestID!`).join('\\n');\n\t\t\tconst queryFields = restPRs\n\t\t\t\t.map((_, i) => `mergeRequest_${i}: mergeRequest(id: $id_${i}) { ...mergeRequestFields }`)\n\t\t\t\t.join('\\n');\n\t\t\t// Set of fields includes only additional fields that are not included in GitLabMergeRequestREST.\n\t\t\t// It's limited as much as possible to reduce complexity of the query.\n\t\t\tconst queryMrFields = `fragment mergeRequestFields on MergeRequest {\n\t\t\t\tdiffRefs {\n\t\t\t\t\tbaseSha\n\t\t\t\t\theadSha\n\t\t\t\t}\n\t\t\t\tproject {\n\t\t\t\t\tid\n\t\t\t\t\tfullPath\n\t\t\t\t\twebUrl\n\t\t\t\t}\n\t\t\t\tsourceProject {\n\t\t\t\t\tid\n\t\t\t\t\tfullPath\n\t\t\t\t\twebUrl\n\t\t\t\t}\n\t\t\t}`;\n\t\t\tconst query = `query getMergeRequests (${queryArgs}) {${queryFields}} ${queryMrFields}`;\n\n\t\t\tconst params = restPRs.reduce<Record<`id_${number}`, string>>((ids, gitlabRestPr, i) => {\n\t\t\t\tids[`id_${i}`] = `${gitlabMergeRequestIdPrefix}${gitlabRestPr.id}`;\n\t\t\t\treturn ids;\n\t\t\t}, {});\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\tparams,\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tif (rsp?.data != null) {\n\t\t\t\tconst resultPRs = restPRs.reduce<PullRequest[]>((accum, restPR, i) => {\n\t\t\t\t\tconst graphQlPR = rsp.data[`mergeRequest_${i}`];\n\t\t\t\t\tif (graphQlPR == null) {\n\t\t\t\t\t\treturn accum;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst fullPr: GitLabMergeRequestFull = {\n\t\t\t\t\t\t...graphQlPR,\n\t\t\t\t\t\tiid: String(restPR.iid),\n\t\t\t\t\t\tid: String(restPR.id),\n\t\t\t\t\t\tstate: restPR.state,\n\t\t\t\t\t\t// An absent REST author stays absent (`null`, as GitLab's own shape expresses it) rather than a\n\t\t\t\t\t\t// synthesized `'Unknown'` stub: `fromGitLabMergeRequest` collapses `null` to an absent\n\t\t\t\t\t\t// `PullRequestMember.name`, whereas a placeholder here would launder into a real-looking name.\n\t\t\t\t\t\tauthor:\n\t\t\t\t\t\t\trestPR.author != null\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tid: buildGitLabUserId(restPR.author.id) ?? '',\n\t\t\t\t\t\t\t\t\t\tname: restPR.author.name,\n\t\t\t\t\t\t\t\t\t\tavatarUrl: restPR.author.avatar_url ?? null,\n\t\t\t\t\t\t\t\t\t\twebUrl: restPR.author.web_url,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\ttitle: restPR.title,\n\t\t\t\t\t\tdescription: restPR.description,\n\t\t\t\t\t\twebUrl: restPR.web_url,\n\t\t\t\t\t\tcreatedAt: restPR.created_at,\n\t\t\t\t\t\tupdatedAt: restPR.updated_at,\n\t\t\t\t\t\tmergedAt: restPR.merged_at,\n\t\t\t\t\t\tsourceBranch: restPR.source_branch,\n\t\t\t\t\t\ttargetBranch: restPR.target_branch,\n\t\t\t\t\t};\n\t\t\t\t\taccum.push(copyReadProvenance(fromGitLabMergeRequest(fullPr, provider, 'text-search'), restPR));\n\t\t\t\t\treturn accum;\n\t\t\t\t}, []);\n\t\t\t\treturn resultPRs;\n\t\t\t}\n\t\t\treturn [];\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return [];\n\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\t/**\n\t * One search's merge requests, filtered to `include`. The search API returns MRs of all states in relevance\n\t * order, so a requested state may not appear on the first page. A single state is pushed server-side\n\t * (`&state=`); several states have no single-value qualifier, so those are filtered client-side. Either way,\n\t * paging accumulates matches until the detail-query cap (`searchPageSize`) is filled or the results run out,\n\t * which stays correct whether or not `&state=` takes effect. Bounded by `maxSearchPages` like the other paged\n\t * provider drains in this package so a large, low-match result set can't fan out into an unbounded request\n\t * loop.\n\t */\n\tprivate async searchMergeRequests(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string | undefined,\n\t\tsearchPath: string,\n\t\tinclude: PullRequestState[] | undefined,\n\t\tcancellation: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t): Promise<GitLabMergeRequestREST[]> {\n\t\tif (include == null) {\n\t\t\t// Unfiltered search returns the first page as-is (as it did before state filtering existed).\n\t\t\treturn this.request<GitLabMergeRequestREST[]>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\tsearchPath,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t}\n\n\t\tif (include.length === 1) {\n\t\t\tsearchPath += `&state=${encodeURIComponent(toGitLabMergeRequestState(include[0]))}`;\n\t\t}\n\n\t\tconst maxSearchPages = 20;\n\t\tconst matches: GitLabMergeRequestREST[] = [];\n\t\tfor (let page = 1; page <= maxSearchPages; page++) {\n\t\t\tconst pagePRs = await this.request<GitLabMergeRequestREST[]>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`${searchPath}&page=${page}`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tfor (const pr of pagePRs) {\n\t\t\t\tif (include.includes(fromGitLabMergeRequestState(pr.state))) {\n\t\t\t\t\tmatches.push(pr);\n\t\t\t\t\tif (matches.length >= searchPageSize) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Stop once we've filled the cap or hit the last (partial or empty) page.\n\t\t\tif (matches.length >= searchPageSize || pagePRs.length < searchPageSize) break;\n\t\t}\n\t\treturn matches;\n\t}\n\n\tprivate async findUser(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tsearch: string,\n\t\toptions?: {\n\t\t\tbaseUrl?: string;\n\t\t\tavatarSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitLabUser[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: {\n\t\t\t\tusers: {\n\t\t\t\t\tnodes: {\n\t\t\t\t\t\tid: string;\n\t\t\t\t\t\tname: string;\n\t\t\t\t\t\tusername: string;\n\t\t\t\t\t\tpublicEmail?: string;\n\t\t\t\t\t\tstate: string;\n\t\t\t\t\t\tavatarUrl: string;\n\t\t\t\t\t\twebUrl: string;\n\t\t\t\t\t}[];\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query findUser(\n$search: String!\n) {\n\tusers(search: $search) {\n\t\tnodes {\n\t\t\tid\n\t\t\tname\n\t\t\tusername,\n\t\t\tpublicEmail,\n\t\t\tstate\n\t\t\tavatarUrl\n\t\t\twebUrl\n\t\t}\n\t}\n}`;\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions?.baseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tsearch: search,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tconst matches = rsp?.data?.users?.nodes;\n\t\t\tif (matches == null || matches.length === 0) return [];\n\n\t\t\tconst users: GitLabUser[] = [];\n\n\t\t\tfor (const user of matches) {\n\t\t\t\tconst match = /gid:\\/\\/gitlab\\/User\\/([0-9]+)\\b/.exec(user.id);\n\t\t\t\tif (match == null) continue;\n\n\t\t\t\tusers.push({\n\t\t\t\t\tid: parseInt(match[1], 10),\n\t\t\t\t\tname: user.name,\n\t\t\t\t\tusername: user.username,\n\t\t\t\t\tpublicEmail: user.publicEmail || undefined,\n\t\t\t\t\tstate: user.state,\n\t\t\t\t\tavatarUrl: user.avatarUrl,\n\t\t\t\t\twebUrl: user.webUrl,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn users;\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof RequestNotFoundError) return [];\n\n\t\t\tthis.handleException(ex, provider, scope);\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tgetProjectId(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tgroup: string,\n\t\trepo: string,\n\t\tbaseUrl: string | undefined,\n\t\tcancellation: AbortSignal | undefined,\n\t\toptions?: { strict?: boolean; backoff?: boolean; deferFailure?: boolean },\n\t): Promise<string | undefined> {\n\t\tconst { accessToken } = token;\n\t\tconst key = `${accessToken}|${group}/${repo}`;\n\t\tconst backoff = options?.backoff ?? true;\n\t\tconst strict = options?.strict ?? false;\n\t\tconst reportFailure = !options?.deferFailure;\n\n\t\tif (cancellation?.aborted) {\n\t\t\treturn strict ? Promise.reject(new CancellationError()) : Promise.resolve(undefined);\n\t\t}\n\n\t\tlet projectId = this._projectIds.get(key);\n\t\tif (projectId != null && this._projectLookupAborts.get(projectId)?.signal.aborted) {\n\t\t\tprojectId = undefined;\n\t\t}\n\t\tif (projectId == null && backoff) {\n\t\t\tconst backoffs = this.getProjectLookupBackoffs(provider);\n\t\t\tconst now = Date.now();\n\t\t\tconst until =\n\t\t\t\tbackoffs.failed.backedOffUntil(key, now) ??\n\t\t\t\t(strict ? undefined : backoffs.refused.backedOffUntil(key, now));\n\t\t\tif (until != null) {\n\t\t\t\tif (!strict) return Promise.resolve(undefined);\n\n\t\t\t\treturn Promise.reject(new LookupBackedOffError(until, `The GitLab project lookup of ${group}/${repo}`));\n\t\t\t}\n\t\t}\n\n\t\tif (projectId == null) {\n\t\t\tconst callers: ProjectLookupCallers = { backoff: backoff, reportFailure: reportFailure };\n\t\t\tconst aborts = new AbortAggregate();\n\t\t\tconst lookup = this.getProjectIdCore(provider, token, group, repo, baseUrl, callers, aborts.signal);\n\t\t\tthis._projectIds.set(key, lookup);\n\t\t\tthis._projectLookupCallers.set(lookup, callers);\n\t\t\tthis._projectLookupAborts.set(lookup, aborts);\n\t\t\tconst settle = () => {\n\t\t\t\taborts.dispose();\n\t\t\t\tthis._projectLookupAborts.delete(lookup);\n\t\t\t};\n\t\t\tvoid lookup.then(\n\t\t\t\t() => {\n\t\t\t\t\tsettle();\n\t\t\t\t\tconst backoffs = this._projectLookupBackoffs.get(provider);\n\t\t\t\t\tbackoffs?.failed.clear(key);\n\t\t\t\t\tbackoffs?.refused.clear(key);\n\t\t\t\t},\n\t\t\t\t(ex: unknown) => {\n\t\t\t\t\tsettle();\n\t\t\t\t\tif (this._projectIds.get(key) === lookup) {\n\t\t\t\t\t\tthis._projectIds.delete(key);\n\t\t\t\t\t}\n\t\t\t\t\tif (callers.backoff && (!isCancellationError(ex) || ex.reason === 'timeout')) {\n\t\t\t\t\t\tconst backoffs = this.getProjectLookupBackoffs(provider);\n\t\t\t\t\t\t(isRefusedProjectLookup(ex) ? backoffs.refused : backoffs.failed).fail(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tDate.now(),\n\t\t\t\t\t\t\tex instanceof RequestRateLimitError && ex.resetAt != null ? ex.resetAt * 1000 : undefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectId = lookup;\n\t\t} else {\n\t\t\tconst callers = this._projectLookupCallers.get(projectId);\n\t\t\tif (callers != null) {\n\t\t\t\tcallers.backoff ||= backoff;\n\t\t\t\tcallers.reportFailure ||= reportFailure;\n\t\t\t}\n\t\t}\n\n\t\tconst lookup = projectId;\n\t\tthis._projectLookupAborts.get(lookup)?.add(cancellation);\n\n\t\tconst awaited = cancellation != null ? raceWithSignal(lookup, cancellation) : lookup;\n\t\treturn strict ? awaited : awaited.catch(() => undefined);\n\t}\n\n\tprivate async getProjectIdCore(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tgroup: string,\n\t\trepo: string,\n\t\tbaseUrl: string | undefined,\n\t\tcallers: ProjectLookupCallers,\n\t\tcancellation: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tinterface QueryResult {\n\t\t\tdata: { project: { id: string } };\n\t\t}\n\n\t\ttry {\n\t\t\tconst query = `query getProjectId(\n\t$fullPath: ID!\n) {\n\tproject(fullPath: $fullPath) {\n\t\tid\n\t}\n}`;\n\t\t\tconst rsp = await this.graphql<QueryResult>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tfullPath: `${group}/${repo}`,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t\tscope,\n\t\t\t\ttrue,\n\t\t\t);\n\n\t\t\tconst gid = rsp?.data?.project?.id;\n\t\t\tif (gid == null) return undefined;\n\n\t\t\tconst match = /gid:\\/\\/gitlab\\/Project\\/([0-9]+)\\b/.exec(gid);\n\t\t\tif (match == null) return undefined;\n\n\t\t\tconst projectId = match[1];\n\n\t\t\tscope?.addExitInfo(`projectId=${projectId}`);\n\t\t\treturn projectId;\n\t\t} catch (ex) {\n\t\t\tif (isCancellationError(ex) && ex.reason !== 'timeout') throw ex;\n\n\t\t\tif (ex instanceof AuthenticationError) {\n\t\t\t\tif (!callers.reportFailure || this._reauthenticationPrompted.has(token.accessToken)) {\n\t\t\t\t\tscope?.error(ex);\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\n\t\t\t\tthis._reauthenticationPrompted.add(token.accessToken);\n\t\t\t} else if (callers.reportFailure) {\n\t\t\t\tconst notify = takeDeferredRequestFailure(ex);\n\t\t\t\tif (notify != null) {\n\t\t\t\t\tprovider.trackRequestException({ connectionId: token.connectionId });\n\t\t\t\t\tnotify();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow this.handleException(ex, provider, scope);\n\t\t}\n\t}\n\n\tprivate async graphql<T extends object>(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string | undefined,\n\t\tquery: string,\n\t\tvariables: Record<string, any>,\n\t\tcancellation: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure?: boolean,\n\t): Promise<T | undefined> {\n\t\tconst { accessToken } = token;\n\t\tlet rsp: Response;\n\t\ttry {\n\t\t\tconst sw = maybeStopWatch(`[GITLAB] POST ${baseUrl}`, { log: { onlyExit: true } });\n\n\t\t\ttry {\n\t\t\t\tif (cancellation?.aborted) throw new CancellationError();\n\n\t\t\t\tconst capture = createReadCapture();\n\t\t\t\trsp = await this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () =>\n\t\t\t\t\tthis.config.fetch(`${baseUrl ?? 'https://gitlab.com/api'}/graphql`, {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json' },\n\t\t\t\t\t\tsignal: cancellation,\n\t\t\t\t\t\tbody: JSON.stringify({ query: query, variables: variables }),\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (rsp.ok) {\n\t\t\t\t\tconst data = captureReadNodes(await rsp.json(), capture) as T | { errors: { message: string }[] };\n\n\t\t\t\t\tif ('errors' in data) throw new ProviderFetchError('GitLab', rsp, data.errors);\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// Reads the body so the 403 branch below can tell a throttled request from a permission failure.\n\t\t\t\tthrow await ProviderFetchError.fromResponse('GitLab', rsp);\n\t\t\t} finally {\n\t\t\t\tconst match = /(^[^({\\n]+)/.exec(query);\n\t\t\t\tconst message = ` ${match?.[1].trim() ?? query}`;\n\n\t\t\t\tsw?.stop({ message: message });\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof ProviderFetchError || ex.name === 'AbortError') {\n\t\t\t\tthis.handleRequestError(provider, token, ex, scope, deferFailure);\n\t\t\t} else if (Logger.isDebugging) {\n\t\t\t\tthis.config.onError?.(`GitLab request failed: ${ex.message}`);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\tprivate async request<T>(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string | undefined,\n\t\troute: string,\n\t\toptions: { method: RequestInit['method'] } & Record<string, unknown>,\n\t\tcancellation: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure?: boolean,\n\t): Promise<T> {\n\t\tconst { accessToken } = token;\n\t\tconst url = `${baseUrl ?? 'https://gitlab.com/api'}/${route}`;\n\n\t\tlet rsp: Response;\n\t\ttry {\n\t\t\tconst sw = maybeStopWatch(`[GITLAB] ${options?.method ?? 'GET'} ${url}`, { log: { onlyExit: true } });\n\n\t\t\ttry {\n\t\t\t\tif (cancellation?.aborted) throw new CancellationError();\n\n\t\t\t\tconst capture = createReadCapture();\n\t\t\t\trsp = await this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () =>\n\t\t\t\t\tthis.config.fetch(url, {\n\t\t\t\t\t\theaders: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json' },\n\t\t\t\t\t\tsignal: cancellation,\n\t\t\t\t\t\t...options,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (rsp.ok) {\n\t\t\t\t\treturn captureReadNodes(await rsp.json(), capture) as T;\n\t\t\t\t}\n\n\t\t\t\t// Reads the body so the 403 branch below can tell a throttled request from a permission failure.\n\t\t\t\tthrow await ProviderFetchError.fromResponse('GitLab', rsp);\n\t\t\t} finally {\n\t\t\t\tsw?.stop();\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof ProviderFetchError || ex.name === 'AbortError') {\n\t\t\t\tthis.handleRequestError(provider, token, ex, scope, deferFailure);\n\t\t\t} else if (Logger.isDebugging) {\n\t\t\t\tthis.config.onError?.(`GitLab request failed: ${ex.message}`);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\tprivate handleRequestError(\n\t\tprovider: Provider | undefined,\n\t\ttoken: TokenWithInfo,\n\t\tex: ProviderFetchError | (Error & { name: 'AbortError' }),\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure: boolean | undefined,\n\t): void {\n\t\tif (ex.name === 'AbortError' || !(ex instanceof ProviderFetchError)) throw new CancellationError(ex);\n\n\t\tconst { accessToken, ...tokenInfo } = token;\n\t\tswitch (ex.status) {\n\t\t\tcase 404: // Not found\n\t\t\tcase 410: // Gone\n\t\t\tcase 422: // Unprocessable Entity\n\t\t\t\tthrow new RequestNotFoundError(ex);\n\t\t\tcase 429: // Too Many Requests\n\t\t\t\tthrow toRateLimitError(ex, accessToken);\n\t\t\tcase 401: // Unauthorized\n\t\t\t\tthrow new AuthenticationError(tokenInfo, AuthenticationErrorReason.Unauthorized, ex);\n\t\t\tcase 403: // Forbidden\n\t\t\t\t// GitLab returns 403 for both a permission failure and a throttled request, so the message is the\n\t\t\t\t// discriminant (see `isRateLimitResponse`, shared with Bitbucket/Azure).\n\t\t\t\tif (isRateLimitResponse(ex)) throw toRateLimitError(ex, accessToken);\n\n\t\t\t\tthrow new AuthenticationError(tokenInfo, AuthenticationErrorReason.Forbidden, ex);\n\t\t\tcase 500: // Internal Server Error\n\t\t\t\tscope?.error(ex);\n\t\t\t\tif (ex.response != null) {\n\t\t\t\t\treportRequestFailure(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\tex,\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\tthis.config.onRequestFailed?.(\n\t\t\t\t\t\t\t\tprovider == null || provider.id === 'gitlab'\n\t\t\t\t\t\t\t\t\t? l10n.t(\n\t\t\t\t\t\t\t\t\t\t\t'{0} failed to respond and might be experiencing issues. Please visit the [GitLab status page](https://status.gitlab.com) for more information.',\n\t\t\t\t\t\t\t\t\t\t\tprovider?.name ?? 'GitLab',\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: l10n.t('{0} failed to respond and might be experiencing issues.', provider.name),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\tdeferFailure,\n\t\t\t\t\t\ttoken.connectionId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase 502: // Bad Gateway\n\t\t\t\tscope?.error(ex);\n\t\t\t\t// GitHub seems to return this status code for timeouts\n\t\t\t\tif (ex.message.includes('timeout')) {\n\t\t\t\t\treportRequestFailure(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\tex,\n\t\t\t\t\t\t() => this.config.onRequestTimedOut?.(provider?.name ?? 'GitLab'),\n\t\t\t\t\t\tdeferFailure,\n\t\t\t\t\t\ttoken.connectionId,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (ex.status >= 400 && ex.status < 500) throw new RequestClientError(ex);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tscope?.error(ex);\n\t\tif (Logger.isDebugging) {\n\t\t\tthis.config.onError?.(`GitLab request failed: ${(ex.response as any)?.errors?.[0]?.message ?? ex.message}`);\n\t\t}\n\t}\n\n\tprivate handleException(ex: Error, provider: Provider, scope: ScopedLogger | undefined): Error {\n\t\tscope?.error(ex);\n\t\t// debugger;\n\n\t\tif (ex instanceof AuthenticationError) {\n\t\t\tvoid this.showAuthenticationErrorMessage(ex, provider);\n\t\t}\n\t\treturn ex;\n\t}\n\n\tprivate async showAuthenticationErrorMessage(ex: AuthenticationError, provider: Provider) {\n\t\tif (ex.reason === AuthenticationErrorReason.Unauthorized || ex.reason === AuthenticationErrorReason.Forbidden) {\n\t\t\tconst reauthenticate = await this.config.onReauthenticationRequired?.(\n\t\t\t\tex.reason === AuthenticationErrorReason.Forbidden\n\t\t\t\t\t? l10n.t('{0}. Would you like to try reauthenticating to provide additional access?', ex.message)\n\t\t\t\t\t: l10n.t('{0}. Would you like to try reauthenticating?', ex.message),\n\t\t\t);\n\n\t\t\tif (reauthenticate) {\n\t\t\t\tawait provider.reauthenticate();\n\t\t\t\tthis.resetCaches();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.config.onError?.(ex.message);\n\t\t}\n\t}\n}\n\n/** Wires a {@link GitLabApi} from the full runtime context, mapping `ctx` down to the narrow config. */\nexport function createGitLabApi(ctx: IntegrationServiceContext): GitLabApi {\n\tconst config: ProviderApiConfig = {\n\t\t...baseProviderApiConfig(ctx),\n\t\t// Self-hosted GitLab keys its API base off `remotes`, so reset on both HTTP proxy and remotes changes.\n\t\tonConfigChanged: listener =>\n\t\t\tctx.config.onDidChange(e => {\n\t\t\t\tif (e.httpProxy || e.remotes) {\n\t\t\t\t\tlistener();\n\t\t\t\t}\n\t\t\t}),\n\t\tonReauthenticationRequired: message =>\n\t\t\tctx.hooks?.onReauthenticationRequired?.(message) ?? Promise.resolve(false),\n\t\tonRequestTimedOut: providerName => ctx.hooks?.ui?.onRequestTimedOut?.(providerName),\n\t};\n\n\treturn new GitLabApi(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAM,qBAAqB;AAC3B,MAAM,6BAA6B;AAEnC,SAAS,kBAAkB,IAAqD;CAC/E,OAAO,OAAO,OAAO,YAAY,IAAI,WAAW,kBAAkB,IAC/D,GAAG,UAAU,EAAyB,IACtC,OAAO,EAAE;AACb;;AAGA,MAAM,iBAAiB;;;;;AAMvB,SAAS,iBACR,OACA,OAC2B;CAC3B,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAAmC,CAAC;CAC1C,MAAM,UAAU,KAAK,IAAI,GAAG,GAAG,MAAM,KAAI,MAAK,EAAE,MAAM,CAAC;CACvD,KAAK,IAAI,OAAO,GAAG,OAAO,SAAS,QAClC,KAAK,MAAM,QAAQ,OAAO;EACzB,MAAM,KAAK,KAAK;EAChB,IAAI,MAAM,QAAQ,KAAK,IAAI,GAAG,EAAE,GAAG;EAEn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