@gitkraken/core-gitlens 0.39.0 → 0.41.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 +29 -1
- package/dist/git/models/pullRequest.d.ts +55 -1
- package/dist/git/models/pullRequest.js +5 -1
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/models/pullRequestActivity.d.ts +55 -0
- package/dist/git/models/pullRequestActivity.js +0 -0
- package/dist/git/utils/pullRequest.utils.js +3 -1
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +1 -0
- package/dist/git/watching/worktreeSummary.js +34 -2
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/plus/git-github/api/aliasedQuery.d.ts +19 -0
- package/dist/plus/git-github/api/aliasedQuery.js +21 -0
- package/dist/plus/git-github/api/aliasedQuery.js.map +1 -0
- package/dist/plus/git-github/api/cancellation.d.ts +4 -0
- package/dist/plus/git-github/api/cancellation.js +9 -0
- package/dist/plus/git-github/api/cancellation.js.map +1 -0
- package/dist/plus/git-github/api/checkRunLogs.d.ts +31 -0
- package/dist/plus/git-github/api/checkRunLogs.js +252 -0
- package/dist/plus/git-github/api/checkRunLogs.js.map +1 -0
- package/dist/plus/git-github/api/checkRuns.d.ts +26 -0
- package/dist/plus/git-github/api/checkRuns.js +191 -0
- package/dist/plus/git-github/api/checkRuns.js.map +1 -0
- package/dist/plus/git-github/api/github.d.ts +25 -2
- package/dist/plus/git-github/api/github.js +169 -37
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +51 -0
- package/dist/plus/git-github/api/issueWrites.js +192 -0
- package/dist/plus/git-github/api/issueWrites.js.map +1 -0
- package/dist/plus/git-github/api/pullRequestActivity.d.ts +19 -0
- package/dist/plus/git-github/api/pullRequestActivity.js +355 -0
- package/dist/plus/git-github/api/pullRequestActivity.js.map +1 -0
- package/dist/plus/git-github/models.d.ts +100 -4
- package/dist/plus/git-github/models.js +135 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/authentication/rejectedTokenTracker.d.ts +7 -8
- package/dist/plus/integrations/authentication/rejectedTokenTracker.js +7 -8
- package/dist/plus/integrations/authentication/rejectedTokenTracker.js.map +1 -1
- package/dist/plus/integrations/fieldPresence.d.ts +10 -5
- package/dist/plus/integrations/fieldPresence.js +46 -25
- package/dist/plus/integrations/fieldPresence.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +6 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +31 -1
- package/dist/plus/integrations/integrationService.js +45 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +86 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +31 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +68 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +26 -5
- package/dist/plus/integrations/models/integration.js +35 -10
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +4 -5
- package/dist/plus/integrations/providers/asana.js +53 -12
- package/dist/plus/integrations/providers/asana.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +18 -3
- package/dist/plus/integrations/providers/github.js +90 -5
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/linear.js +6 -6
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +6 -15
- package/dist/plus/integrations/providers/models.js +1 -1
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +1 -6
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/reads/etag.js +20 -5
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestActivity.d.ts +36 -0
- package/dist/plus/integrations/reads/pullRequestActivity.js +103 -0
- package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +4 -1
- package/dist/plus/integrations/reads/pullRequestBatch.js +5 -2
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +27 -0
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js +92 -0
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -0
- package/docs/integrations.md +115 -5
- package/package.json +2 -2
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Per-connection recovery state for a cloud token the provider REFUSED — a revoked grant, retired scopes, an
|
|
4
4
|
* app removed from the org. A purely predictive refresh (`expiresIn < 60`) cannot see that case, because the
|
|
5
|
-
* backend still believes the token is valid, so without this the refused token is re-sent on every
|
|
5
|
+
* backend still believes the token is valid, so without this the refused token is re-sent on every request and
|
|
6
6
|
* the failure only clears when the user reconnects by hand.
|
|
7
7
|
*
|
|
8
8
|
* One recovery refresh per connection, then the connection is the failure budget's problem:
|
|
9
|
-
* - {@link recordRejection}
|
|
9
|
+
* - {@link recordRejection} when the provider rejects the credential — arms the refresh, or reports that the rejection is
|
|
10
10
|
* not recoverable so the caller counts it as a real failure instead.
|
|
11
|
-
* - {@link claimRefresh}
|
|
12
|
-
* fires once and no further
|
|
11
|
+
* - {@link claimRefresh} when the next operation resolves its session — spends the rejection, so the refresh
|
|
12
|
+
* fires once and no further operation of that connection asks the cloud again.
|
|
13
13
|
*
|
|
14
14
|
* Deliberately NOT re-armed when the refresh hands back a different token. The GK cloud mints a new access
|
|
15
15
|
* token on every `/refresh`, so a credential the provider refuses for a reason a refresh cannot fix (retired
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
var RejectedTokenTracker = class {
|
|
22
22
|
_rejections = /* @__PURE__ */ new Map();
|
|
23
23
|
/**
|
|
24
|
-
* Whether
|
|
25
|
-
*
|
|
26
|
-
* that throws must not leave the refresh armed and ask the cloud again on the next read.
|
|
24
|
+
* Whether an operation on `connectionId` must force a cloud refresh of a token known to be refused. A session
|
|
25
|
+
* lookup that throws must still spend the rejection so a later operation does not ask the cloud again.
|
|
27
26
|
*/
|
|
28
27
|
claimRefresh(connectionId) {
|
|
29
28
|
if (this._rejections.get(connectionId) !== "armed") return false;
|
|
@@ -45,7 +44,7 @@ var RejectedTokenTracker = class {
|
|
|
45
44
|
clear() {
|
|
46
45
|
this._rejections.clear();
|
|
47
46
|
}
|
|
48
|
-
/** Whether any connection is holding a rejection. For assertions;
|
|
47
|
+
/** Whether any connection is holding a rejection. For assertions; session resolution uses {@link claimRefresh}. */
|
|
49
48
|
get empty() {
|
|
50
49
|
return this._rejections.size === 0;
|
|
51
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejectedTokenTracker.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/rejectedTokenTracker.ts"],"sourcesContent":["/**\n * Per-connection recovery state for a cloud token the provider REFUSED — a revoked grant, retired scopes, an\n * app removed from the org. A purely predictive refresh (`expiresIn < 60`) cannot see that case, because the\n * backend still believes the token is valid, so without this the refused token is re-sent on every
|
|
1
|
+
{"version":3,"file":"rejectedTokenTracker.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/rejectedTokenTracker.ts"],"sourcesContent":["/**\n * Per-connection recovery state for a cloud token the provider REFUSED — a revoked grant, retired scopes, an\n * app removed from the org. A purely predictive refresh (`expiresIn < 60`) cannot see that case, because the\n * backend still believes the token is valid, so without this the refused token is re-sent on every request and\n * the failure only clears when the user reconnects by hand.\n *\n * One recovery refresh per connection, then the connection is the failure budget's problem:\n * - {@link recordRejection} when the provider rejects the credential — arms the refresh, or reports that the rejection is\n * not recoverable so the caller counts it as a real failure instead.\n * - {@link claimRefresh} when the next operation resolves its session — spends the rejection, so the refresh\n * fires once and no further operation of that connection asks the cloud again.\n *\n * Deliberately NOT re-armed when the refresh hands back a different token. The GK cloud mints a new access\n * token on every `/refresh`, so a credential the provider refuses for a reason a refresh cannot fix (retired\n * scopes being the plain case) would look \"rotated\" on each attempt: re-arming on that would refresh on every\n * read forever and the connection's failure budget — which, for the primary, disconnects and prompts a\n * reconnect — would never advance. What resets this instead is {@link clear}, called by every path that replaces\n * or removes the stored tokens; a connection that is simply working never reaches here at all.\n */\nexport class RejectedTokenTracker {\n\tprivate readonly _rejections = new Map<string, 'armed' | 'spent'>();\n\n\t/**\n\t * Whether an operation on `connectionId` must force a cloud refresh of a token known to be refused. A session\n\t * lookup that throws must still spend the rejection so a later operation does not ask the cloud again.\n\t */\n\tclaimRefresh(connectionId: string): boolean {\n\t\tif (this._rejections.get(connectionId) !== 'armed') return false;\n\n\t\tthis._rejections.set(connectionId, 'spent');\n\t\treturn true;\n\t}\n\n\t/**\n\t * Arms the recovery refresh for `connectionId`. Returns `false` once this connection has had its refresh\n\t * (or already has one pending), so the caller falls back to its own failure handling: a token still\n\t * refused after the refresh is not self-healing, and only the failure budget (the primary's) ends in a reconnect\n\t * prompt.\n\t */\n\trecordRejection(connectionId: string): boolean {\n\t\tif (this._rejections.has(connectionId)) return false;\n\n\t\tthis._rejections.set(connectionId, 'armed');\n\t\treturn true;\n\t}\n\n\t/** Drops all state, for when the stored tokens a rejection could name are replaced or gone. */\n\tclear(): void {\n\t\tthis._rejections.clear();\n\t}\n\n\t/** Whether any connection is holding a rejection. For assertions; session resolution uses {@link claimRefresh}. */\n\tget empty(): boolean {\n\t\treturn this._rejections.size === 0;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,IAAa,uBAAb,MAAkC;CACjC,8BAA+B,IAAI,IAA+B;;;;;CAMlE,aAAa,cAA+B;EAC3C,IAAI,KAAK,YAAY,IAAI,YAAY,MAAM,SAAS,OAAO;EAE3D,KAAK,YAAY,IAAI,cAAc,OAAO;EAC1C,OAAO;CACR;;;;;;;CAQA,gBAAgB,cAA+B;EAC9C,IAAI,KAAK,YAAY,IAAI,YAAY,GAAG,OAAO;EAE/C,KAAK,YAAY,IAAI,cAAc,OAAO;EAC1C,OAAO;CACR;;CAGA,QAAc;EACb,KAAK,YAAY,MAAM;CACxB;;CAGA,IAAI,QAAiB;EACpB,OAAO,KAAK,YAAY,SAAS;CAClC;AACD"}
|
|
@@ -58,7 +58,13 @@ export type PullRequestFieldGroup =
|
|
|
58
58
|
* since GitHub's `isMergeQueueEnabled` is non-null, so every row whose read selected the merge-queue data has it
|
|
59
59
|
* defined.
|
|
60
60
|
*/
|
|
61
|
-
'mergeQueue'
|
|
61
|
+
'mergeQueue' |
|
|
62
|
+
/**
|
|
63
|
+
* `checkRuns` and `checkRunsTruncated`. Only GitHub's and GitHub Enterprise's batch reads read them, and only for a
|
|
64
|
+
* read that asks (`checkRuns`); {@link getPullRequestFieldPresence} answers `not-requested` for a batch row without
|
|
65
|
+
* `checkRuns`.
|
|
66
|
+
*/
|
|
67
|
+
'checkRuns';
|
|
62
68
|
/** A group is `fetched` only when every field in it is. */
|
|
63
69
|
export type IssueFieldGroup =
|
|
64
70
|
/** `body`, and `bodyField` where the provider sets it. */
|
|
@@ -79,10 +85,9 @@ export type IssueFieldGroup =
|
|
|
79
85
|
* Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.
|
|
80
86
|
* `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.
|
|
81
87
|
*
|
|
82
|
-
* `mergeQueue`
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* without the selection.
|
|
88
|
+
* `mergeQueue` and `checkRuns` are derived from the row: a table says `fetched` for a read that selects them. GitHub's
|
|
89
|
+
* `isMergeQueueEnabled` is non-null, so `mergeQueueRequired` is defined on every row whose read selected the merge-queue
|
|
90
|
+
* data, and `checkRuns` is defined (empty when the head has none) on every row whose read selected check runs.
|
|
86
91
|
*/
|
|
87
92
|
export declare function getPullRequestFieldPresence(pr: PullRequestShape): Readonly<Record<PullRequestFieldGroup, FieldPresence>> | undefined;
|
|
88
93
|
/**
|
|
@@ -16,7 +16,8 @@ const pullRequestFieldGroups = [
|
|
|
16
16
|
"authoredByMe",
|
|
17
17
|
"stack",
|
|
18
18
|
"milestone",
|
|
19
|
-
"mergeQueue"
|
|
19
|
+
"mergeQueue",
|
|
20
|
+
"checkRuns"
|
|
20
21
|
];
|
|
21
22
|
const issueFieldGroups = [
|
|
22
23
|
"description",
|
|
@@ -52,7 +53,7 @@ const gitHubLite = pullRequestPresenceOf([
|
|
|
52
53
|
* are, GitHub's own review decision included: none stays none, even while a review is requested.
|
|
53
54
|
* `authoredByMe` needs the current account, which a read may fail to resolve, and the other reads never set it.
|
|
54
55
|
*/
|
|
55
|
-
const
|
|
56
|
+
const gitHubFullGroups = [
|
|
56
57
|
"description",
|
|
57
58
|
"reviews",
|
|
58
59
|
"reviewRequests",
|
|
@@ -67,7 +68,8 @@ const gitHubFull = pullRequestPresenceOf([
|
|
|
67
68
|
"stack",
|
|
68
69
|
"milestone",
|
|
69
70
|
"mergeQueue"
|
|
70
|
-
]
|
|
71
|
+
];
|
|
72
|
+
const gitHubFull = pullRequestPresenceOf(gitHubFullGroups);
|
|
71
73
|
const gitHubPullRequests = {
|
|
72
74
|
point: gitHubLite,
|
|
73
75
|
search: gitHubFull,
|
|
@@ -95,7 +97,7 @@ const gitHubPullRequests = {
|
|
|
95
97
|
"reactions",
|
|
96
98
|
"milestone"
|
|
97
99
|
]),
|
|
98
|
-
batch:
|
|
100
|
+
batch: pullRequestPresenceOf([...gitHubFullGroups, "checkRuns"])
|
|
99
101
|
};
|
|
100
102
|
/**
|
|
101
103
|
* GitHub Enterprise Server rejects the stack selection, and the merge-queue one isn't verified there, so neither is
|
|
@@ -129,7 +131,11 @@ const gitHubIssues = {
|
|
|
129
131
|
* GitLens' own GitLab reads: the point reads, and the free-text search. They select the description but leave it,
|
|
130
132
|
* and everything else beyond the merge request's identity and refs, off the row.
|
|
131
133
|
*/
|
|
132
|
-
const gitLabOwn = pullRequestPresenceOf([], [
|
|
134
|
+
const gitLabOwn = pullRequestPresenceOf([], [
|
|
135
|
+
"stack",
|
|
136
|
+
"mergeQueue",
|
|
137
|
+
"checkRuns"
|
|
138
|
+
]);
|
|
133
139
|
/**
|
|
134
140
|
* provider-apis' merge request fragment and normalizer, which every other GitLab read goes through. It turns a null
|
|
135
141
|
* count into 0: GitLab's schema makes `diffStatsSummary`, `commitCount` and `userNotesCount` nullable, so none is
|
|
@@ -147,7 +153,11 @@ function gitLabProviderApis(comments) {
|
|
|
147
153
|
"reactions",
|
|
148
154
|
"milestone",
|
|
149
155
|
...comments ? ["comments"] : []
|
|
150
|
-
], [
|
|
156
|
+
], [
|
|
157
|
+
"stack",
|
|
158
|
+
"mergeQueue",
|
|
159
|
+
"checkRuns"
|
|
160
|
+
]);
|
|
151
161
|
}
|
|
152
162
|
function gitLabPullRequestsFor(providerApis) {
|
|
153
163
|
return {
|
|
@@ -170,7 +180,8 @@ const azureUnavailable = [
|
|
|
170
180
|
"reactions",
|
|
171
181
|
"stack",
|
|
172
182
|
"milestone",
|
|
173
|
-
"mergeQueue"
|
|
183
|
+
"mergeQueue",
|
|
184
|
+
"checkRuns"
|
|
174
185
|
];
|
|
175
186
|
/** Every list read: Azure truncates a listed pull request's description (to 400 characters). */
|
|
176
187
|
const azureListed = pullRequestPresenceOf([
|
|
@@ -206,7 +217,8 @@ const bitbucketUnavailable = [
|
|
|
206
217
|
"reactions",
|
|
207
218
|
"stack",
|
|
208
219
|
"milestone",
|
|
209
|
-
"mergeQueue"
|
|
220
|
+
"mergeQueue",
|
|
221
|
+
"checkRuns"
|
|
210
222
|
];
|
|
211
223
|
const bitbucketProviderApis = pullRequestPresenceOf([
|
|
212
224
|
"description",
|
|
@@ -418,31 +430,40 @@ function lookup(tables, providerId, projection) {
|
|
|
418
430
|
const table = tables.get(providerId);
|
|
419
431
|
return table != null && Object.hasOwn(table, projection) ? table[projection] : void 0;
|
|
420
432
|
}
|
|
421
|
-
/** The table entries with
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
* without the selection.
|
|
431
|
-
*/
|
|
432
|
-
function getPullRequestFieldPresence(pr) {
|
|
433
|
-
const presence = lookup(pullRequestPresence, pr.provider.id, pr.projection);
|
|
434
|
-
if (presence?.mergeQueue !== "fetched" || pr.mergeQueueRequired != null) return presence;
|
|
435
|
-
let downgraded = withoutMergeQueue.get(presence);
|
|
433
|
+
/** The table entries with a group downgraded to `not-requested`, made once per entry and group rather than per call. */
|
|
434
|
+
const downgradedPresence = /* @__PURE__ */ new WeakMap();
|
|
435
|
+
function downgrade(presence, group) {
|
|
436
|
+
let byGroup = downgradedPresence.get(presence);
|
|
437
|
+
if (byGroup == null) {
|
|
438
|
+
byGroup = /* @__PURE__ */ new Map();
|
|
439
|
+
downgradedPresence.set(presence, byGroup);
|
|
440
|
+
}
|
|
441
|
+
let downgraded = byGroup.get(group);
|
|
436
442
|
if (downgraded == null) {
|
|
437
443
|
downgraded = Object.freeze({
|
|
438
444
|
...presence,
|
|
439
|
-
|
|
445
|
+
[group]: "not-requested"
|
|
440
446
|
});
|
|
441
|
-
|
|
447
|
+
byGroup.set(group, downgraded);
|
|
442
448
|
}
|
|
443
449
|
return downgraded;
|
|
444
450
|
}
|
|
445
451
|
/**
|
|
452
|
+
* Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.
|
|
453
|
+
* `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.
|
|
454
|
+
*
|
|
455
|
+
* `mergeQueue` and `checkRuns` are derived from the row: a table says `fetched` for a read that selects them. GitHub's
|
|
456
|
+
* `isMergeQueueEnabled` is non-null, so `mergeQueueRequired` is defined on every row whose read selected the merge-queue
|
|
457
|
+
* data, and `checkRuns` is defined (empty when the head has none) on every row whose read selected check runs.
|
|
458
|
+
*/
|
|
459
|
+
function getPullRequestFieldPresence(pr) {
|
|
460
|
+
let presence = lookup(pullRequestPresence, pr.provider.id, pr.projection);
|
|
461
|
+
if (presence == null) return void 0;
|
|
462
|
+
if (presence.mergeQueue === "fetched" && pr.mergeQueueRequired == null) presence = downgrade(presence, "mergeQueue");
|
|
463
|
+
if (presence.checkRuns === "fetched" && pr.checkRuns == null) presence = downgrade(presence, "checkRuns");
|
|
464
|
+
return presence;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
446
467
|
* Which field groups the read that produced `issue` fetched, keyed by its provider and {@link IssueShape.projection}.
|
|
447
468
|
* `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.
|
|
448
469
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldPresence.js","names":[],"sources":["../../../../plus/integrations/src/fieldPresence.ts"],"sourcesContent":["import type { IssueProjection, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { PullRequestProjection, PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from './constants.js';\n\n/**\n * Whether a row's read fetched a field group.\n *\n * - `fetched`: the read asked for it and surfaces it, so an empty value means \"none\".\n * - `not-requested`: this read didn't ask for it, or asked but doesn't surface it faithfully. Ignore the value even\n * when one is present (some reads fill placeholders); another read may supply it.\n * - `unavailable`: this provider or host can't supply it on this read.\n */\nexport type FieldPresence = 'fetched' | 'not-requested' | 'unavailable';\n\n/** A group is `fetched` only when every field in it is. */\nexport type PullRequestFieldGroup =\n\t/** `body`. */\n\t| 'description'\n\t/** `latestReviews`. */\n\t| 'reviews'\n\t/**\n\t * `reviewRequests`: who is requested. Not each request's `isCodeOwner`, which only GitLens' own GitHub reads\n\t * report; every other row leaves it undefined.\n\t */\n\t| 'reviewRequests'\n\t/**\n\t * `reviewDecision`. Only GitHub reports one; elsewhere it is derived from the reviewers' states on the row, which\n\t * ignores the host's own approval rules, so it is never `fetched` there — derive it from `reviews` and\n\t * `reviewRequests` instead.\n\t */\n\t| 'reviewDecision'\n\t/** `assignees`. */\n\t| 'assignees'\n\t/** `statusCheckRollupState`, on the `PullRequest` class. */\n\t| 'checks'\n\t/** `mergeableState`. */\n\t| 'mergeable'\n\t/** `additions`, `deletions` and `filesChanged`. */\n\t| 'diffStats'\n\t/** `commitCount`, on the `PullRequest` class. */\n\t| 'commitCount'\n\t/** `commentsCount`. */\n\t| 'comments'\n\t/** `thumbsUpCount`. */\n\t| 'reactions'\n\t/** `viewerCanUpdate`, on the `PullRequest` class, and `repository.accessLevel`. */\n\t| 'access'\n\t/** `authoredByMe`, and the `viewer` it was matched against. */\n\t| 'authoredByMe'\n\t/** `stack`. */\n\t| 'stack'\n\t/** `milestone`. */\n\t| 'milestone'\n\t/**\n\t * `mergeQueue`, `mergeQueueRequired` and `mergeQueueRemoval`: the merge-queue data was read, so an absent entry\n\t * means not queued and an absent removal means none since the pull request last joined. Only GitHub.com's is read,\n\t * and only for a read that asks for it or, when it doesn't say, a host that opts in\n\t * (`ConfigProvider.getPullRequestReadOptions`). The tables describe what a read that selects it gets;\n\t * {@link getPullRequestFieldPresence} answers `not-requested` for a row that carries no `mergeQueueRequired`,\n\t * since GitHub's `isMergeQueueEnabled` is non-null, so every row whose read selected the merge-queue data has it\n\t * defined.\n\t */\n\t| 'mergeQueue';\n\n/** A group is `fetched` only when every field in it is. */\nexport type IssueFieldGroup =\n\t/** `body`, and `bodyField` where the provider sets it. */\n\t| 'description'\n\t/** `assignees`. */\n\t| 'assignees'\n\t/** `labels`. */\n\t| 'labels'\n\t/** `commentsCount`. */\n\t| 'comments'\n\t/** `thumbsUpCount`. */\n\t| 'reactions'\n\t/** `repository.accessLevel`. */\n\t| 'access'\n\t/** `milestone`: a Linear issue's is its project milestone. */\n\t| 'milestone';\n\ntype Presence<G extends string> = Readonly<Record<G, FieldPresence>>;\ntype PresenceTable<P extends string, G extends string> = Readonly<Partial<Record<P, Presence<G>>>>;\n\nconst pullRequestFieldGroups: readonly PullRequestFieldGroup[] = [\n\t'description',\n\t'reviews',\n\t'reviewRequests',\n\t'reviewDecision',\n\t'assignees',\n\t'checks',\n\t'mergeable',\n\t'diffStats',\n\t'commitCount',\n\t'comments',\n\t'reactions',\n\t'access',\n\t'authoredByMe',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\n\nconst issueFieldGroups: readonly IssueFieldGroup[] = [\n\t'description',\n\t'assignees',\n\t'labels',\n\t'comments',\n\t'reactions',\n\t'access',\n\t'milestone',\n];\n\n/** Every group in `groups` listed as neither `fetched` nor `unavailable` is `not-requested`. */\nfunction presenceOf<G extends string>(\n\tgroups: readonly G[],\n\tfetched: readonly G[],\n\tunavailable: readonly G[] = [],\n): Presence<G> {\n\treturn Object.freeze(\n\t\tObject.fromEntries(\n\t\t\tgroups.map(\n\t\t\t\tgroup =>\n\t\t\t\t\t[\n\t\t\t\t\t\tgroup,\n\t\t\t\t\t\tfetched.includes(group)\n\t\t\t\t\t\t\t? 'fetched'\n\t\t\t\t\t\t\t: unavailable.includes(group)\n\t\t\t\t\t\t\t\t? 'unavailable'\n\t\t\t\t\t\t\t\t: 'not-requested',\n\t\t\t\t\t] as const,\n\t\t\t),\n\t\t) as Record<G, FieldPresence>,\n\t);\n}\n\nfunction pullRequestPresenceOf(\n\tfetched: readonly PullRequestFieldGroup[],\n\tunavailable?: readonly PullRequestFieldGroup[],\n): Presence<PullRequestFieldGroup> {\n\treturn presenceOf(pullRequestFieldGroups, fetched, unavailable);\n}\n\nfunction issuePresenceOf(\n\tfetched: readonly IssueFieldGroup[],\n\tunavailable?: readonly IssueFieldGroup[],\n): Presence<IssueFieldGroup> {\n\treturn presenceOf(issueFieldGroups, fetched, unavailable);\n}\n\n/**\n * GitLens' own lite fragment (`fromGitHubPullRequestLite`). `stack` and `mergeQueue` are only selected against\n * github.com.\n */\nconst gitHubLite = pullRequestPresenceOf(['description', 'stack', 'milestone', 'mergeQueue']);\n\n/**\n * GitLens' own full fragment, which selects no reactions. The account-wide and batch reads return its rows as they\n * are, GitHub's own review decision included: none stays none, even while a review is requested.\n * `authoredByMe` needs the current account, which a read may fail to resolve, and the other reads never set it.\n */\nconst gitHubFull = pullRequestPresenceOf([\n\t'description',\n\t'reviews',\n\t'reviewRequests',\n\t'reviewDecision',\n\t'assignees',\n\t'checks',\n\t'mergeable',\n\t'diffStats',\n\t'commitCount',\n\t'comments',\n\t'access',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n]);\n\nconst gitHubPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\tpoint: gitHubLite,\n\tsearch: gitHubFull,\n\t'search-summary': gitHubLite,\n\t'text-search': gitHubFull,\n\taccount: gitHubFull,\n\t// The lite fragment's own rows.\n\t'account-summary': gitHubLite,\n\t// provider-apis' own fragment and normalizer. Its review-state map has no DISMISSED, so a dismissed review is\n\t// dropped (and none carries a `commitOid`); it removes code-owner requests; it derives the review decision from\n\t// that list rather than reading GitHub's; and it doesn't read `repository.accessLevel`.\n\trepos: pullRequestPresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'checks',\n\t\t'mergeable',\n\t\t'diffStats',\n\t\t'commitCount',\n\t\t'comments',\n\t\t'reactions',\n\t\t'milestone',\n\t]),\n\t// `summary` drops the `commits` subtree that carries both the check rollup and the commit count.\n\t'repos-summary': pullRequestPresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'mergeable',\n\t\t'diffStats',\n\t\t'comments',\n\t\t'reactions',\n\t\t'milestone',\n\t]),\n\tbatch: gitHubFull,\n};\n\n/**\n * GitHub Enterprise Server rejects the stack selection, and the merge-queue one isn't verified there, so neither is\n * selected: a read that carries `stack` or `mergeQueue` on github.com can't here.\n * provider-apis also gates check runs on the server version, which this table can't see, so its rollup on the\n * repository-scoped read may come from commit statuses alone.\n */\nconst gitHubEnterprisePullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = Object.fromEntries(\n\tObject.entries(gitHubPullRequests).map(([projection, presence]) => {\n\t\tconst enterprise: Record<PullRequestFieldGroup, FieldPresence> = { ...presence };\n\t\tif (enterprise.stack === 'fetched') {\n\t\t\tenterprise.stack = 'unavailable';\n\t\t}\n\t\tif (enterprise.mergeQueue === 'fetched') {\n\t\t\tenterprise.mergeQueue = 'unavailable';\n\t\t}\n\t\tif (projection === 'repos') {\n\t\t\tenterprise.checks = 'not-requested';\n\t\t}\n\t\treturn [projection, Object.freeze(enterprise)];\n\t}),\n);\n\n/** GitLens' own issue fragment, which every native read selects with the body. */\nconst gitHubNativeIssue = presenceOf(issueFieldGroups, issueFieldGroups);\n\nconst gitHubIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: gitHubNativeIssue,\n\tsearch: gitHubNativeIssue,\n\taccount: gitHubNativeIssue,\n\t// provider-apis' own fragment selects neither the body nor the repository's `viewerPermission`.\n\trepos: presenceOf(issueFieldGroups, ['assignees', 'labels', 'comments', 'reactions', 'milestone']),\n\tbatch: gitHubNativeIssue,\n};\n\n/*\n * Every other provider. None of them reads the viewer's access (`repository.accessLevel` is absent on every row),\n * resolves `authoredByMe` reliably, or has stacks, and only GitLab and Linear have milestones; none's merge queue\n * (GitLab's merge trains included) is read yet. provider-apis honors neither `summary` nor `includeReviews` for them,\n * so each `-summary` tag reads like its full one.\n */\n\n/**\n * GitLens' own GitLab reads: the point reads, and the free-text search. They select the description but leave it,\n * and everything else beyond the merge request's identity and refs, off the row.\n */\nconst gitLabOwn = pullRequestPresenceOf([], ['stack', 'mergeQueue']);\n\n/**\n * provider-apis' merge request fragment and normalizer, which every other GitLab read goes through. It turns a null\n * count into 0: GitLab's schema makes `diffStatsSummary`, `commitCount` and `userNotesCount` nullable, so none is\n * promised — except that GitLab.com's comment count resolver answers 0 rather than null, which a self-managed\n * version may not.\n */\nfunction gitLabProviderApis(comments: boolean): Presence<PullRequestFieldGroup> {\n\treturn pullRequestPresenceOf(\n\t\t[\n\t\t\t'description',\n\t\t\t'reviews',\n\t\t\t'reviewRequests',\n\t\t\t'assignees',\n\t\t\t'checks',\n\t\t\t'mergeable',\n\t\t\t'reactions',\n\t\t\t'milestone',\n\t\t\t...(comments ? (['comments'] as const) : []),\n\t\t],\n\t\t['stack', 'mergeQueue'],\n\t);\n}\n\nfunction gitLabPullRequestsFor(\n\tproviderApis: Presence<PullRequestFieldGroup>,\n): PresenceTable<PullRequestProjection, PullRequestFieldGroup> {\n\treturn {\n\t\tpoint: gitLabOwn,\n\t\tsearch: providerApis,\n\t\t'text-search': gitLabOwn,\n\t\taccount: providerApis,\n\t\t'account-summary': providerApis,\n\t\trepos: providerApis,\n\t\t'repos-summary': providerApis,\n\t\tbatch: providerApis,\n\t};\n}\n\n/**\n * Azure DevOps pull requests have no assignees (both converters fill `assignees` with the reviewers, which `reviews` and\n * `reviewRequests` already hold) and no reactions. Neither converter reads checks or counts.\n */\nconst azureUnavailable: readonly PullRequestFieldGroup[] = [\n\t'assignees',\n\t'reactions',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\n/** Every list read: Azure truncates a listed pull request's description (to 400 characters). */\nconst azureListed = pullRequestPresenceOf(['reviews', 'reviewRequests', 'mergeable'], azureUnavailable);\n/** The batch reads fetch each pull request by id, which returns the whole description. */\nconst azureById = pullRequestPresenceOf(['description', 'reviews', 'reviewRequests', 'mergeable'], azureUnavailable);\n\nconst azurePullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t// GitLens' own converter, which leaves the description off the row.\n\tpoint: azureListed,\n\tsearch: azureListed,\n\t'text-search': azureListed,\n\taccount: azureListed,\n\t'account-summary': azureListed,\n\trepos: azureListed,\n\t'repos-summary': azureListed,\n\tbatch: azureById,\n};\n\nconst azureServerPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t...azurePullRequests,\n\t'search-summary': azureListed,\n};\n\n/**\n * Bitbucket pull requests have no assignees or reactions. Neither provider-apis nor GitLens reads their build\n * statuses or mergeability: provider-apis fills a literal Mergeable, and GitLens' own converters leave it unset.\n */\nconst bitbucketUnavailable: readonly PullRequestFieldGroup[] = [\n\t'assignees',\n\t'reactions',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\nconst bitbucketProviderApis = pullRequestPresenceOf(\n\t['description', 'reviews', 'reviewRequests', 'comments'],\n\tbitbucketUnavailable,\n);\n\nconst bitbucketPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t// GitLens' own converter, which drops the comment count. The commit read selects `+values.*`, which isn't\n\t// known to bring the participants the reviews come from, as the other two point reads do.\n\tpoint: pullRequestPresenceOf(['description'], bitbucketUnavailable),\n\tsearch: bitbucketProviderApis,\n\t'text-search': bitbucketProviderApis,\n\taccount: bitbucketProviderApis,\n\t'account-summary': bitbucketProviderApis,\n\trepos: bitbucketProviderApis,\n\t'repos-summary': bitbucketProviderApis,\n\t// GitLens' own converter over reads that do select the participants.\n\tbatch: pullRequestPresenceOf(['description', 'reviews', 'reviewRequests'], bitbucketUnavailable),\n};\n\n/** provider-apis' and GitLens' own Data Center converters read the same fields. */\nconst bitbucketServerAll = pullRequestPresenceOf(\n\t['description', 'reviews', 'reviewRequests', 'comments'],\n\tbitbucketUnavailable,\n);\nconst bitbucketServerPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\tpoint: bitbucketServerAll,\n\tsearch: bitbucketServerAll,\n\t'search-summary': bitbucketServerAll,\n\t'text-search': bitbucketServerAll,\n\taccount: bitbucketServerAll,\n\t'account-summary': bitbucketServerAll,\n\trepos: bitbucketServerAll,\n\t'repos-summary': bitbucketServerAll,\n\tbatch: bitbucketServerAll,\n};\n\n/**\n * provider-apis' GitLab issue reads (GraphQL, and REST for the account-wide one). The repository's access isn't read.\n * The GraphQL comment count is nullable like the merge request's, and passed through, so only GitLab.com's is\n * promised; the REST one is always a number. The REST normalizer drops the milestone the response carries.\n */\nfunction gitLabIssuesFor(comments: boolean): PresenceTable<IssueProjection, IssueFieldGroup> {\n\tconst graphQL = issuePresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'labels',\n\t\t'reactions',\n\t\t'milestone',\n\t\t...(comments ? (['comments'] as const) : []),\n\t]);\n\treturn {\n\t\tpoint: graphQL,\n\t\taccount: issuePresenceOf(['description', 'assignees', 'labels', 'comments', 'reactions']),\n\t\trepos: graphQL,\n\t\tbatch: graphQL,\n\t};\n}\n\n/**\n * Azure DevOps work items have no reactions (provider-apis' converter fills 0; GitLens' leaves it unset) and belong to\n * a project, not a repository.\n */\nconst azureWorkItemUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access', 'milestone'];\n/** provider-apis' work item converter, and GitLens' copy of it for the batch read. */\nconst azureWorkItem = issuePresenceOf(['description', 'assignees', 'labels', 'comments'], azureWorkItemUnavailable);\n/** GitLens' own work item converter, which drops the tags. */\nconst azureOwnWorkItem = issuePresenceOf(['description', 'assignees', 'comments'], azureWorkItemUnavailable);\n\nconst azureIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: azureOwnWorkItem,\n\taccount: azureWorkItem,\n\trepos: azureWorkItem,\n\tbatch: azureWorkItem,\n};\n\nconst azureServerIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\t...azureIssues,\n\tsearch: azureOwnWorkItem,\n};\n\n/**\n * Bitbucket Cloud's legacy issues, which only the host's own `getIssue` and `searchMyIssues` read. They have no\n * labels, their votes aren't reactions, and neither a comment count nor the repository's access is read.\n */\nconst bitbucketIssue = issuePresenceOf(['description', 'assignees'], ['labels', 'reactions', 'milestone']);\nconst bitbucketIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: bitbucketIssue,\n\taccount: bitbucketIssue,\n};\n\n/**\n * Tracker issues belong to no repository, and a tracker's votes aren't reactions (and read 0 where voting is off), so\n * neither group can be supplied. Nor a milestone: Trello has none, and Jira's fix versions and sprints are many per\n * issue, not one.\n */\nconst trackerUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access', 'milestone'];\n/**\n * provider-apis' Jira converter counts the comments embedded in the issue, which Jira may cap, rather than reading\n * their total.\n */\nconst jiraProviderApis = issuePresenceOf(['description', 'assignees', 'labels'], trackerUnavailable);\n\nconst jiraIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: jiraProviderApis,\n\taccount: jiraProviderApis,\n\tproject: jiraProviderApis,\n\t// GitLens' own by-key read, which reads the comment total.\n\tbatch: issuePresenceOf(['description', 'assignees', 'labels', 'comments'], trackerUnavailable),\n};\n\nconst jiraServerIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\t...jiraIssues,\n\tbatch: jiraProviderApis,\n};\n\n/** provider-apis' Linear fragment selects no labels (it fills an empty list), comments or reactions. */\nconst linearIssue = issuePresenceOf(['description', 'assignees', 'milestone'], ['access']);\nconst linearIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: linearIssue,\n\taccount: linearIssue,\n\tproject: linearIssue,\n\tbatch: linearIssue,\n};\n\n/** A Trello card's description is never read; its members are its assignees. */\nconst trelloCard = issuePresenceOf(['assignees', 'labels', 'comments'], trackerUnavailable);\nconst trelloIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: trelloCard,\n\tproject: trelloCard,\n};\n\n/**\n * provider-apis' Asana task fields: its notes, its single assignee, its tags as labels and its likes as reactions.\n * Comments are stories, which a task doesn't count, so reading them would cost a request per task.\n */\nconst asanaTask = issuePresenceOf(['description', 'assignees', 'labels', 'reactions'], ['access', 'milestone']);\nconst asanaIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: asanaTask,\n\taccount: asanaTask,\n\tproject: asanaTask,\n};\n\nconst pullRequestPresence = new Map<string, PresenceTable<PullRequestProjection, PullRequestFieldGroup>>([\n\t[GitCloudHostIntegrationId.GitHub, gitHubPullRequests],\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise, gitHubEnterprisePullRequests],\n\t[GitCloudHostIntegrationId.GitLab, gitLabPullRequestsFor(gitLabProviderApis(true))],\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted, gitLabPullRequestsFor(gitLabProviderApis(false))],\n\t[GitCloudHostIntegrationId.AzureDevOps, azurePullRequests],\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer, azureServerPullRequests],\n\t[GitCloudHostIntegrationId.Bitbucket, bitbucketPullRequests],\n\t[GitSelfManagedHostIntegrationId.BitbucketServer, bitbucketServerPullRequests],\n]);\n\nconst issuePresence = new Map<string, PresenceTable<IssueProjection, IssueFieldGroup>>([\n\t[GitCloudHostIntegrationId.GitHub, gitHubIssues],\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise, gitHubIssues],\n\t[GitCloudHostIntegrationId.GitLab, gitLabIssuesFor(true)],\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted, gitLabIssuesFor(false)],\n\t[GitCloudHostIntegrationId.AzureDevOps, azureIssues],\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer, azureServerIssues],\n\t[GitCloudHostIntegrationId.Bitbucket, bitbucketIssues],\n\t[IssuesCloudHostIntegrationId.Jira, jiraIssues],\n\t[IssuesSelfManagedHostIntegrationId.JiraServer, jiraServerIssues],\n\t[IssuesCloudHostIntegrationId.Linear, linearIssues],\n\t[IssuesCloudHostIntegrationId.Trello, trelloIssues],\n\t[IssuesCloudHostIntegrationId.Asana, asanaIssues],\n]);\n\nfunction lookup<P extends string, G extends string>(\n\ttables: ReadonlyMap<string, PresenceTable<P, G>>,\n\tproviderId: string,\n\tprojection: P | undefined,\n): Presence<G> | undefined {\n\tif (projection == null) return undefined;\n\n\tconst table = tables.get(providerId);\n\t// `hasOwn` so a projection read off an untrusted row can't resolve to an `Object.prototype` member.\n\treturn table != null && Object.hasOwn(table, projection) ? table[projection] : undefined;\n}\n\n/** The table entries with `mergeQueue` downgraded to `not-requested`, made once per entry rather than per call. */\nconst withoutMergeQueue = new WeakMap<Presence<PullRequestFieldGroup>, Presence<PullRequestFieldGroup>>();\n\n/**\n * Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.\n * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.\n *\n * `mergeQueue` is derived from the row: a table says `fetched` for a read that selects the merge-queue data (by its\n * own `mergeQueue`, else by the host's `ConfigProvider.getPullRequestReadOptions`). GitHub's `isMergeQueueEnabled` is\n * non-null, so `mergeQueueRequired` is defined on every row whose read selected it, and a row without it was read\n * without the selection.\n */\nexport function getPullRequestFieldPresence(\n\tpr: PullRequestShape,\n): Readonly<Record<PullRequestFieldGroup, FieldPresence>> | undefined {\n\tconst presence = lookup(pullRequestPresence, pr.provider.id, pr.projection);\n\tif (presence?.mergeQueue !== 'fetched' || pr.mergeQueueRequired != null) return presence;\n\n\tlet downgraded = withoutMergeQueue.get(presence);\n\tif (downgraded == null) {\n\t\tdowngraded = Object.freeze({ ...presence, mergeQueue: 'not-requested' });\n\t\twithoutMergeQueue.set(presence, downgraded);\n\t}\n\treturn downgraded;\n}\n\n/**\n * Which field groups the read that produced `issue` fetched, keyed by its provider and {@link IssueShape.projection}.\n * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.\n */\nexport function getIssueFieldPresence(issue: IssueShape): Readonly<Record<IssueFieldGroup, FieldPresence>> | undefined {\n\treturn lookup(issuePresence, issue.provider.id, issue.projection);\n}\n"],"mappings":";;AAyFA,MAAM,yBAA2D;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAEA,MAAM,mBAA+C;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAGA,SAAS,WACR,QACA,SACA,cAA4B,CAAC,GACf;CACd,OAAO,OAAO,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AAqB,GAAG,SAAS,IAAI,GAAG,UAAU;CAC1E,IAAI,UAAU,eAAe,aAAa,GAAG,sBAAsB,MAAM,OAAO;CAEhF,IAAI,aAAa,kBAAkB,IAAI,QAAQ;CAC/C,IAAI,cAAc,MAAM;EACvB,aAAa,OAAO,OAAO;GAAE,GAAG;GAAU,YAAY;EAAgB,CAAC;EACvE,kBAAkB,IAAI,UAAU,UAAU;CAC3C;CACA,OAAO;AACR;;;;;AAMA,SAAgB,sBAAsB,OAAiF;CACtH,OAAO,OAAO,eAAe,MAAM,SAAS,IAAI,MAAM,UAAU;AACjE"}
|
|
1
|
+
{"version":3,"file":"fieldPresence.js","names":[],"sources":["../../../../plus/integrations/src/fieldPresence.ts"],"sourcesContent":["import type { IssueProjection, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { PullRequestProjection, PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from './constants.js';\n\n/**\n * Whether a row's read fetched a field group.\n *\n * - `fetched`: the read asked for it and surfaces it, so an empty value means \"none\".\n * - `not-requested`: this read didn't ask for it, or asked but doesn't surface it faithfully. Ignore the value even\n * when one is present (some reads fill placeholders); another read may supply it.\n * - `unavailable`: this provider or host can't supply it on this read.\n */\nexport type FieldPresence = 'fetched' | 'not-requested' | 'unavailable';\n\n/** A group is `fetched` only when every field in it is. */\nexport type PullRequestFieldGroup =\n\t/** `body`. */\n\t| 'description'\n\t/** `latestReviews`. */\n\t| 'reviews'\n\t/**\n\t * `reviewRequests`: who is requested. Not each request's `isCodeOwner`, which only GitLens' own GitHub reads\n\t * report; every other row leaves it undefined.\n\t */\n\t| 'reviewRequests'\n\t/**\n\t * `reviewDecision`. Only GitHub reports one; elsewhere it is derived from the reviewers' states on the row, which\n\t * ignores the host's own approval rules, so it is never `fetched` there — derive it from `reviews` and\n\t * `reviewRequests` instead.\n\t */\n\t| 'reviewDecision'\n\t/** `assignees`. */\n\t| 'assignees'\n\t/** `statusCheckRollupState`, on the `PullRequest` class. */\n\t| 'checks'\n\t/** `mergeableState`. */\n\t| 'mergeable'\n\t/** `additions`, `deletions` and `filesChanged`. */\n\t| 'diffStats'\n\t/** `commitCount`, on the `PullRequest` class. */\n\t| 'commitCount'\n\t/** `commentsCount`. */\n\t| 'comments'\n\t/** `thumbsUpCount`. */\n\t| 'reactions'\n\t/** `viewerCanUpdate`, on the `PullRequest` class, and `repository.accessLevel`. */\n\t| 'access'\n\t/** `authoredByMe`, and the `viewer` it was matched against. */\n\t| 'authoredByMe'\n\t/** `stack`. */\n\t| 'stack'\n\t/** `milestone`. */\n\t| 'milestone'\n\t/**\n\t * `mergeQueue`, `mergeQueueRequired` and `mergeQueueRemoval`: the merge-queue data was read, so an absent entry\n\t * means not queued and an absent removal means none since the pull request last joined. Only GitHub.com's is read,\n\t * and only for a read that asks for it or, when it doesn't say, a host that opts in\n\t * (`ConfigProvider.getPullRequestReadOptions`). The tables describe what a read that selects it gets;\n\t * {@link getPullRequestFieldPresence} answers `not-requested` for a row that carries no `mergeQueueRequired`,\n\t * since GitHub's `isMergeQueueEnabled` is non-null, so every row whose read selected the merge-queue data has it\n\t * defined.\n\t */\n\t| 'mergeQueue'\n\t/**\n\t * `checkRuns` and `checkRunsTruncated`. Only GitHub's and GitHub Enterprise's batch reads read them, and only for a\n\t * read that asks (`checkRuns`); {@link getPullRequestFieldPresence} answers `not-requested` for a batch row without\n\t * `checkRuns`.\n\t */\n\t| 'checkRuns';\n\n/** A group is `fetched` only when every field in it is. */\nexport type IssueFieldGroup =\n\t/** `body`, and `bodyField` where the provider sets it. */\n\t| 'description'\n\t/** `assignees`. */\n\t| 'assignees'\n\t/** `labels`. */\n\t| 'labels'\n\t/** `commentsCount`. */\n\t| 'comments'\n\t/** `thumbsUpCount`. */\n\t| 'reactions'\n\t/** `repository.accessLevel`. */\n\t| 'access'\n\t/** `milestone`: a Linear issue's is its project milestone. */\n\t| 'milestone';\n\ntype Presence<G extends string> = Readonly<Record<G, FieldPresence>>;\ntype PresenceTable<P extends string, G extends string> = Readonly<Partial<Record<P, Presence<G>>>>;\n\nconst pullRequestFieldGroups: readonly PullRequestFieldGroup[] = [\n\t'description',\n\t'reviews',\n\t'reviewRequests',\n\t'reviewDecision',\n\t'assignees',\n\t'checks',\n\t'mergeable',\n\t'diffStats',\n\t'commitCount',\n\t'comments',\n\t'reactions',\n\t'access',\n\t'authoredByMe',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n\t'checkRuns',\n];\n\nconst issueFieldGroups: readonly IssueFieldGroup[] = [\n\t'description',\n\t'assignees',\n\t'labels',\n\t'comments',\n\t'reactions',\n\t'access',\n\t'milestone',\n];\n\n/** Every group in `groups` listed as neither `fetched` nor `unavailable` is `not-requested`. */\nfunction presenceOf<G extends string>(\n\tgroups: readonly G[],\n\tfetched: readonly G[],\n\tunavailable: readonly G[] = [],\n): Presence<G> {\n\treturn Object.freeze(\n\t\tObject.fromEntries(\n\t\t\tgroups.map(\n\t\t\t\tgroup =>\n\t\t\t\t\t[\n\t\t\t\t\t\tgroup,\n\t\t\t\t\t\tfetched.includes(group)\n\t\t\t\t\t\t\t? 'fetched'\n\t\t\t\t\t\t\t: unavailable.includes(group)\n\t\t\t\t\t\t\t\t? 'unavailable'\n\t\t\t\t\t\t\t\t: 'not-requested',\n\t\t\t\t\t] as const,\n\t\t\t),\n\t\t) as Record<G, FieldPresence>,\n\t);\n}\n\nfunction pullRequestPresenceOf(\n\tfetched: readonly PullRequestFieldGroup[],\n\tunavailable?: readonly PullRequestFieldGroup[],\n): Presence<PullRequestFieldGroup> {\n\treturn presenceOf(pullRequestFieldGroups, fetched, unavailable);\n}\n\nfunction issuePresenceOf(\n\tfetched: readonly IssueFieldGroup[],\n\tunavailable?: readonly IssueFieldGroup[],\n): Presence<IssueFieldGroup> {\n\treturn presenceOf(issueFieldGroups, fetched, unavailable);\n}\n\n/**\n * GitLens' own lite fragment (`fromGitHubPullRequestLite`). `stack` and `mergeQueue` are only selected against\n * github.com.\n */\nconst gitHubLite = pullRequestPresenceOf(['description', 'stack', 'milestone', 'mergeQueue']);\n\n/**\n * GitLens' own full fragment, which selects no reactions. The account-wide and batch reads return its rows as they\n * are, GitHub's own review decision included: none stays none, even while a review is requested.\n * `authoredByMe` needs the current account, which a read may fail to resolve, and the other reads never set it.\n */\nconst gitHubFullGroups: readonly PullRequestFieldGroup[] = [\n\t'description',\n\t'reviews',\n\t'reviewRequests',\n\t'reviewDecision',\n\t'assignees',\n\t'checks',\n\t'mergeable',\n\t'diffStats',\n\t'commitCount',\n\t'comments',\n\t'access',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\nconst gitHubFull = pullRequestPresenceOf(gitHubFullGroups);\n\nconst gitHubPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\tpoint: gitHubLite,\n\tsearch: gitHubFull,\n\t'search-summary': gitHubLite,\n\t'text-search': gitHubFull,\n\taccount: gitHubFull,\n\t// The lite fragment's own rows.\n\t'account-summary': gitHubLite,\n\t// provider-apis' own fragment and normalizer. Its review-state map has no DISMISSED, so a dismissed review is\n\t// dropped (and none carries a `commitOid`); it removes code-owner requests; it derives the review decision from\n\t// that list rather than reading GitHub's; and it doesn't read `repository.accessLevel`.\n\trepos: pullRequestPresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'checks',\n\t\t'mergeable',\n\t\t'diffStats',\n\t\t'commitCount',\n\t\t'comments',\n\t\t'reactions',\n\t\t'milestone',\n\t]),\n\t// `summary` drops the `commits` subtree that carries both the check rollup and the commit count.\n\t'repos-summary': pullRequestPresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'mergeable',\n\t\t'diffStats',\n\t\t'comments',\n\t\t'reactions',\n\t\t'milestone',\n\t]),\n\tbatch: pullRequestPresenceOf([...gitHubFullGroups, 'checkRuns']),\n};\n\n/**\n * GitHub Enterprise Server rejects the stack selection, and the merge-queue one isn't verified there, so neither is\n * selected: a read that carries `stack` or `mergeQueue` on github.com can't here.\n * provider-apis also gates check runs on the server version, which this table can't see, so its rollup on the\n * repository-scoped read may come from commit statuses alone.\n */\nconst gitHubEnterprisePullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = Object.fromEntries(\n\tObject.entries(gitHubPullRequests).map(([projection, presence]) => {\n\t\tconst enterprise: Record<PullRequestFieldGroup, FieldPresence> = { ...presence };\n\t\tif (enterprise.stack === 'fetched') {\n\t\t\tenterprise.stack = 'unavailable';\n\t\t}\n\t\tif (enterprise.mergeQueue === 'fetched') {\n\t\t\tenterprise.mergeQueue = 'unavailable';\n\t\t}\n\t\tif (projection === 'repos') {\n\t\t\tenterprise.checks = 'not-requested';\n\t\t}\n\t\treturn [projection, Object.freeze(enterprise)];\n\t}),\n);\n\n/** GitLens' own issue fragment, which every native read selects with the body. */\nconst gitHubNativeIssue = presenceOf(issueFieldGroups, issueFieldGroups);\n\nconst gitHubIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: gitHubNativeIssue,\n\tsearch: gitHubNativeIssue,\n\taccount: gitHubNativeIssue,\n\t// provider-apis' own fragment selects neither the body nor the repository's `viewerPermission`.\n\trepos: presenceOf(issueFieldGroups, ['assignees', 'labels', 'comments', 'reactions', 'milestone']),\n\tbatch: gitHubNativeIssue,\n};\n\n/*\n * Every other provider. None of them reads the viewer's access (`repository.accessLevel` is absent on every row),\n * resolves `authoredByMe` reliably, or has stacks, and only GitLab and Linear have milestones; none's merge queue\n * (GitLab's merge trains included) is read yet. provider-apis honors neither `summary` nor `includeReviews` for them,\n * so each `-summary` tag reads like its full one.\n */\n\n/**\n * GitLens' own GitLab reads: the point reads, and the free-text search. They select the description but leave it,\n * and everything else beyond the merge request's identity and refs, off the row.\n */\nconst gitLabOwn = pullRequestPresenceOf([], ['stack', 'mergeQueue', 'checkRuns']);\n\n/**\n * provider-apis' merge request fragment and normalizer, which every other GitLab read goes through. It turns a null\n * count into 0: GitLab's schema makes `diffStatsSummary`, `commitCount` and `userNotesCount` nullable, so none is\n * promised — except that GitLab.com's comment count resolver answers 0 rather than null, which a self-managed\n * version may not.\n */\nfunction gitLabProviderApis(comments: boolean): Presence<PullRequestFieldGroup> {\n\treturn pullRequestPresenceOf(\n\t\t[\n\t\t\t'description',\n\t\t\t'reviews',\n\t\t\t'reviewRequests',\n\t\t\t'assignees',\n\t\t\t'checks',\n\t\t\t'mergeable',\n\t\t\t'reactions',\n\t\t\t'milestone',\n\t\t\t...(comments ? (['comments'] as const) : []),\n\t\t],\n\t\t['stack', 'mergeQueue', 'checkRuns'],\n\t);\n}\n\nfunction gitLabPullRequestsFor(\n\tproviderApis: Presence<PullRequestFieldGroup>,\n): PresenceTable<PullRequestProjection, PullRequestFieldGroup> {\n\treturn {\n\t\tpoint: gitLabOwn,\n\t\tsearch: providerApis,\n\t\t'text-search': gitLabOwn,\n\t\taccount: providerApis,\n\t\t'account-summary': providerApis,\n\t\trepos: providerApis,\n\t\t'repos-summary': providerApis,\n\t\tbatch: providerApis,\n\t};\n}\n\n/**\n * Azure DevOps pull requests have no assignees (both converters fill `assignees` with the reviewers, which `reviews` and\n * `reviewRequests` already hold) and no reactions. Neither converter reads checks or counts.\n */\nconst azureUnavailable: readonly PullRequestFieldGroup[] = [\n\t'assignees',\n\t'reactions',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n\t'checkRuns',\n];\n/** Every list read: Azure truncates a listed pull request's description (to 400 characters). */\nconst azureListed = pullRequestPresenceOf(['reviews', 'reviewRequests', 'mergeable'], azureUnavailable);\n/** The batch reads fetch each pull request by id, which returns the whole description. */\nconst azureById = pullRequestPresenceOf(['description', 'reviews', 'reviewRequests', 'mergeable'], azureUnavailable);\n\nconst azurePullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t// GitLens' own converter, which leaves the description off the row.\n\tpoint: azureListed,\n\tsearch: azureListed,\n\t'text-search': azureListed,\n\taccount: azureListed,\n\t'account-summary': azureListed,\n\trepos: azureListed,\n\t'repos-summary': azureListed,\n\tbatch: azureById,\n};\n\nconst azureServerPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t...azurePullRequests,\n\t'search-summary': azureListed,\n};\n\n/**\n * Bitbucket pull requests have no assignees or reactions. Neither provider-apis nor GitLens reads their build\n * statuses or mergeability: provider-apis fills a literal Mergeable, and GitLens' own converters leave it unset.\n */\nconst bitbucketUnavailable: readonly PullRequestFieldGroup[] = [\n\t'assignees',\n\t'reactions',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n\t'checkRuns',\n];\nconst bitbucketProviderApis = pullRequestPresenceOf(\n\t['description', 'reviews', 'reviewRequests', 'comments'],\n\tbitbucketUnavailable,\n);\n\nconst bitbucketPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t// GitLens' own converter, which drops the comment count. The commit read selects `+values.*`, which isn't\n\t// known to bring the participants the reviews come from, as the other two point reads do.\n\tpoint: pullRequestPresenceOf(['description'], bitbucketUnavailable),\n\tsearch: bitbucketProviderApis,\n\t'text-search': bitbucketProviderApis,\n\taccount: bitbucketProviderApis,\n\t'account-summary': bitbucketProviderApis,\n\trepos: bitbucketProviderApis,\n\t'repos-summary': bitbucketProviderApis,\n\t// GitLens' own converter over reads that do select the participants.\n\tbatch: pullRequestPresenceOf(['description', 'reviews', 'reviewRequests'], bitbucketUnavailable),\n};\n\n/** provider-apis' and GitLens' own Data Center converters read the same fields. */\nconst bitbucketServerAll = pullRequestPresenceOf(\n\t['description', 'reviews', 'reviewRequests', 'comments'],\n\tbitbucketUnavailable,\n);\nconst bitbucketServerPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\tpoint: bitbucketServerAll,\n\tsearch: bitbucketServerAll,\n\t'search-summary': bitbucketServerAll,\n\t'text-search': bitbucketServerAll,\n\taccount: bitbucketServerAll,\n\t'account-summary': bitbucketServerAll,\n\trepos: bitbucketServerAll,\n\t'repos-summary': bitbucketServerAll,\n\tbatch: bitbucketServerAll,\n};\n\n/**\n * provider-apis' GitLab issue reads (GraphQL, and REST for the account-wide one). The repository's access isn't read.\n * The GraphQL comment count is nullable like the merge request's, and passed through, so only GitLab.com's is\n * promised; the REST one is always a number. The REST normalizer drops the milestone the response carries.\n */\nfunction gitLabIssuesFor(comments: boolean): PresenceTable<IssueProjection, IssueFieldGroup> {\n\tconst graphQL = issuePresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'labels',\n\t\t'reactions',\n\t\t'milestone',\n\t\t...(comments ? (['comments'] as const) : []),\n\t]);\n\treturn {\n\t\tpoint: graphQL,\n\t\taccount: issuePresenceOf(['description', 'assignees', 'labels', 'comments', 'reactions']),\n\t\trepos: graphQL,\n\t\tbatch: graphQL,\n\t};\n}\n\n/**\n * Azure DevOps work items have no reactions (provider-apis' converter fills 0; GitLens' leaves it unset) and belong to\n * a project, not a repository.\n */\nconst azureWorkItemUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access', 'milestone'];\n/** provider-apis' work item converter, and GitLens' copy of it for the batch read. */\nconst azureWorkItem = issuePresenceOf(['description', 'assignees', 'labels', 'comments'], azureWorkItemUnavailable);\n/** GitLens' own work item converter, which drops the tags. */\nconst azureOwnWorkItem = issuePresenceOf(['description', 'assignees', 'comments'], azureWorkItemUnavailable);\n\nconst azureIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: azureOwnWorkItem,\n\taccount: azureWorkItem,\n\trepos: azureWorkItem,\n\tbatch: azureWorkItem,\n};\n\nconst azureServerIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\t...azureIssues,\n\tsearch: azureOwnWorkItem,\n};\n\n/**\n * Bitbucket Cloud's legacy issues, which only the host's own `getIssue` and `searchMyIssues` read. They have no\n * labels, their votes aren't reactions, and neither a comment count nor the repository's access is read.\n */\nconst bitbucketIssue = issuePresenceOf(['description', 'assignees'], ['labels', 'reactions', 'milestone']);\nconst bitbucketIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: bitbucketIssue,\n\taccount: bitbucketIssue,\n};\n\n/**\n * Tracker issues belong to no repository, and a tracker's votes aren't reactions (and read 0 where voting is off), so\n * neither group can be supplied. Nor a milestone: Trello has none, and Jira's fix versions and sprints are many per\n * issue, not one.\n */\nconst trackerUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access', 'milestone'];\n/**\n * provider-apis' Jira converter counts the comments embedded in the issue, which Jira may cap, rather than reading\n * their total.\n */\nconst jiraProviderApis = issuePresenceOf(['description', 'assignees', 'labels'], trackerUnavailable);\n\nconst jiraIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: jiraProviderApis,\n\taccount: jiraProviderApis,\n\tproject: jiraProviderApis,\n\t// GitLens' own by-key read, which reads the comment total.\n\tbatch: issuePresenceOf(['description', 'assignees', 'labels', 'comments'], trackerUnavailable),\n};\n\nconst jiraServerIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\t...jiraIssues,\n\tbatch: jiraProviderApis,\n};\n\n/** provider-apis' Linear fragment selects no labels (it fills an empty list), comments or reactions. */\nconst linearIssue = issuePresenceOf(['description', 'assignees', 'milestone'], ['access']);\nconst linearIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: linearIssue,\n\taccount: linearIssue,\n\tproject: linearIssue,\n\tbatch: linearIssue,\n};\n\n/** A Trello card's description is never read; its members are its assignees. */\nconst trelloCard = issuePresenceOf(['assignees', 'labels', 'comments'], trackerUnavailable);\nconst trelloIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: trelloCard,\n\tproject: trelloCard,\n};\n\n/**\n * provider-apis' Asana task fields: its notes, its single assignee, its tags as labels and its likes as reactions.\n * Comments are stories, which a task doesn't count, so reading them would cost a request per task.\n */\nconst asanaTask = issuePresenceOf(['description', 'assignees', 'labels', 'reactions'], ['access', 'milestone']);\nconst asanaIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: asanaTask,\n\taccount: asanaTask,\n\tproject: asanaTask,\n};\n\nconst pullRequestPresence = new Map<string, PresenceTable<PullRequestProjection, PullRequestFieldGroup>>([\n\t[GitCloudHostIntegrationId.GitHub, gitHubPullRequests],\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise, gitHubEnterprisePullRequests],\n\t[GitCloudHostIntegrationId.GitLab, gitLabPullRequestsFor(gitLabProviderApis(true))],\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted, gitLabPullRequestsFor(gitLabProviderApis(false))],\n\t[GitCloudHostIntegrationId.AzureDevOps, azurePullRequests],\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer, azureServerPullRequests],\n\t[GitCloudHostIntegrationId.Bitbucket, bitbucketPullRequests],\n\t[GitSelfManagedHostIntegrationId.BitbucketServer, bitbucketServerPullRequests],\n]);\n\nconst issuePresence = new Map<string, PresenceTable<IssueProjection, IssueFieldGroup>>([\n\t[GitCloudHostIntegrationId.GitHub, gitHubIssues],\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise, gitHubIssues],\n\t[GitCloudHostIntegrationId.GitLab, gitLabIssuesFor(true)],\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted, gitLabIssuesFor(false)],\n\t[GitCloudHostIntegrationId.AzureDevOps, azureIssues],\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer, azureServerIssues],\n\t[GitCloudHostIntegrationId.Bitbucket, bitbucketIssues],\n\t[IssuesCloudHostIntegrationId.Jira, jiraIssues],\n\t[IssuesSelfManagedHostIntegrationId.JiraServer, jiraServerIssues],\n\t[IssuesCloudHostIntegrationId.Linear, linearIssues],\n\t[IssuesCloudHostIntegrationId.Trello, trelloIssues],\n\t[IssuesCloudHostIntegrationId.Asana, asanaIssues],\n]);\n\nfunction lookup<P extends string, G extends string>(\n\ttables: ReadonlyMap<string, PresenceTable<P, G>>,\n\tproviderId: string,\n\tprojection: P | undefined,\n): Presence<G> | undefined {\n\tif (projection == null) return undefined;\n\n\tconst table = tables.get(providerId);\n\t// `hasOwn` so a projection read off an untrusted row can't resolve to an `Object.prototype` member.\n\treturn table != null && Object.hasOwn(table, projection) ? table[projection] : undefined;\n}\n\n/** The table entries with a group downgraded to `not-requested`, made once per entry and group rather than per call. */\nconst downgradedPresence = new WeakMap<\n\tPresence<PullRequestFieldGroup>,\n\tMap<PullRequestFieldGroup, Presence<PullRequestFieldGroup>>\n>();\n\nfunction downgrade(\n\tpresence: Presence<PullRequestFieldGroup>,\n\tgroup: PullRequestFieldGroup,\n): Presence<PullRequestFieldGroup> {\n\tlet byGroup = downgradedPresence.get(presence);\n\tif (byGroup == null) {\n\t\tbyGroup = new Map();\n\t\tdowngradedPresence.set(presence, byGroup);\n\t}\n\n\tlet downgraded = byGroup.get(group);\n\tif (downgraded == null) {\n\t\tdowngraded = Object.freeze({ ...presence, [group]: 'not-requested' });\n\t\tbyGroup.set(group, downgraded);\n\t}\n\treturn downgraded;\n}\n\n/**\n * Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.\n * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.\n *\n * `mergeQueue` and `checkRuns` are derived from the row: a table says `fetched` for a read that selects them. GitHub's\n * `isMergeQueueEnabled` is non-null, so `mergeQueueRequired` is defined on every row whose read selected the merge-queue\n * data, and `checkRuns` is defined (empty when the head has none) on every row whose read selected check runs.\n */\nexport function getPullRequestFieldPresence(\n\tpr: PullRequestShape,\n): Readonly<Record<PullRequestFieldGroup, FieldPresence>> | undefined {\n\tlet presence = lookup(pullRequestPresence, pr.provider.id, pr.projection);\n\tif (presence == null) return undefined;\n\n\tif (presence.mergeQueue === 'fetched' && pr.mergeQueueRequired == null) {\n\t\tpresence = downgrade(presence, 'mergeQueue');\n\t}\n\tif (presence.checkRuns === 'fetched' && pr.checkRuns == null) {\n\t\tpresence = downgrade(presence, 'checkRuns');\n\t}\n\treturn presence;\n}\n\n/**\n * Which field groups the read that produced `issue` fetched, keyed by its provider and {@link IssueShape.projection}.\n * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.\n */\nexport function getIssueFieldPresence(issue: IssueShape): Readonly<Record<IssueFieldGroup, FieldPresence>> | undefined {\n\treturn lookup(issuePresence, issue.provider.id, issue.projection);\n}\n"],"mappings":";;AA+FA,MAAM,yBAA2D;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAEA,MAAM,mBAA+C;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAGA,SAAS,WACR,QACA,SACA,cAA4B,CAAC,GACf;CACd,OAAO,OAAO,OACb,OAAO,YACN,OAAO,KACN,UACC,CACC,OACA,QAAQ,SAAS,KAAK,IACnB,YACA,YAAY,SAAS,KAAK,IACzB,gBACA,eACL,CACF,CACD,CACD;AACD;AAEA,SAAS,sBACR,SACA,aACkC;CAClC,OAAO,WAAW,wBAAwB,SAAS,WAAW;AAC/D;AAEA,SAAS,gBACR,SACA,aAC4B;CAC5B,OAAO,WAAW,kBAAkB,SAAS,WAAW;AACzD;;;;;AAMA,MAAM,aAAa,sBAAsB;CAAC;CAAe;CAAS;CAAa;AAAY,CAAC;;;;;;AAO5F,MAAM,mBAAqD;CAC1D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,aAAa,sBAAsB,gBAAgB;AAEzD,MAAM,qBAAkF;CACvF,OAAO;CACP,QAAQ;CACR,kBAAkB;CAClB,eAAe;CACf,SAAS;CAET,mBAAmB;CAInB,OAAO,sBAAsB;EAC5B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CAED,iBAAiB,sBAAsB;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,OAAO,sBAAsB,CAAC,GAAG,kBAAkB,WAAW,CAAC;AAChE;;;;;;;AAQA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Reference } from "../../git/models/remoteProvider.js";
|
|
|
4
4
|
import { IssueProjection, IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship, IssueStateFilter } from "../../git/models/issue.js";
|
|
5
5
|
import { PullRequestFilter, PullRequestProjection, PullRequestSearchCapabilities, PullRequestSearchCriteria, PullRequestStateFilter } from "../../git/models/pullRequest.js";
|
|
6
6
|
import { Account } from "../../git/models/author.js";
|
|
7
|
+
import { PullRequestActivityAuthor, PullRequestActivityComment, PullRequestActivityItem, PullRequestActivityReview, PullRequestActivityReviewComment } from "../../git/models/pullRequestActivity.js";
|
|
8
|
+
import { IssueWriteResult } from "../git-github/api/issueWrites.js";
|
|
7
9
|
import { AuthenticationSessionLike, CloudIntegrationAuthType, CloudIntegrationConnection, CloudIntegrationType, ConfiguredIntegrationDescriptor, ProviderAuthenticationSession, toCloudIntegrationType, toIntegrationId } from "./authentication/models.js";
|
|
8
10
|
import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, IntegrationIds, IssuesCloudHostIntegrationId, IssuesSelfManagedHostIntegrationId, SupportedCloudIntegrationIds, isIntegrationId, isSupportedCloudIntegrationId } from "./constants.js";
|
|
9
11
|
import { Source, Sources } from "./telemetry.js";
|
|
@@ -14,9 +16,11 @@ import { IssueEtagInclude, PullRequestEtagInclude } from "./models/integration.j
|
|
|
14
16
|
import { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestCountScope } from "./reads/counts.js";
|
|
15
17
|
import { CurrentAccountResult } from "./reads/currentAccount.js";
|
|
16
18
|
import { IssueBatchResult, IssueBatchTarget } from "./reads/issueBatch.js";
|
|
19
|
+
import { PullRequestActivityResult, PullRequestActivityTarget } from "./reads/pullRequestActivity.js";
|
|
17
20
|
import { PullRequestBatchResult, PullRequestBatchTarget } from "./reads/pullRequestBatch.js";
|
|
18
21
|
import { PullRequestBranchResult, PullRequestBranchTarget } from "./reads/pullRequestBranches.js";
|
|
19
|
-
import {
|
|
22
|
+
import { PullRequestCheckLogResult, PullRequestCheckLogTarget } from "./reads/pullRequestCheckLogs.js";
|
|
23
|
+
import { ClosedPullRequestSweepOptions, GetAutolinkReferencesOptions, IntegrationManager, IssueDeleteOptions, IssueWriteOptions, ListLinearProjectsOptions, ListOrgsOptions, ListProjectsOptions, ProviderBroadenOrg, ProviderRepositoriesInput, ProviderRepositoryInput, ProviderSweepTarget, ProviderSweepTargetEvent, PullRequestSweepOptions } from "./manager.js";
|
|
20
24
|
import { IntegrationAuthenticationProvider, IntegrationAuthenticationProviderDescriptor, IntegrationAuthenticationSessionDescriptor } from "./authentication/integrationAuthenticationProvider.js";
|
|
21
25
|
import { AccountProvider, AuthenticationSessionsChangeEvent, ConfigChangeEvent, ConfigProvider, HttpProvider, IntegrationServiceHooks, IntegrationStorageProvider, IntegrationsRemoteConfig, RepositoriesProvider } from "./context.js";
|
|
22
26
|
import { ManualTokenAuthProviderOptions, createManualTokenAuthProvider } from "./authentication/manualTokenProvider.js";
|
|
@@ -80,5 +84,5 @@ export interface IntegrationManagerContext {
|
|
|
80
84
|
*/
|
|
81
85
|
export declare function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager;
|
|
82
86
|
//#endregion
|
|
83
|
-
export { type Account, type AccountProvider, type AuthenticationSessionLike, type AuthenticationSessionsChangeEvent, type Autolink, type AutolinkReference, type ClosedPullRequestSweepOptions, type CloudIntegrationAuthType, type CloudIntegrationConnection, type CloudIntegrationType, type ConfigChangeEvent, type ConfigProvider, type ConfiguredIntegrationDescriptor, type ConfiguredIntegrationsChangeEvent, type ConnectionStateChangeEvent, type CurrentAccountResult, type DynamicAutolinkReference, type FieldPresence, type GetAutolinkReferencesOptions, GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, type HttpProvider, type IntegrationAuthenticationProvider, type IntegrationAuthenticationProviderDescriptor, type IntegrationAuthenticationSessionDescriptor, type IntegrationIds, type IntegrationManager, type IntegrationServiceHooks, type IntegrationStorageProvider, type IntegrationsRemoteConfig, type IssueBatchResult, type IssueBatchTarget, type IssueCountResult, type IssueCountScope, type IssueEtagInclude, type IssueFieldGroup, IssueFilter, type IssueProjection, type IssueSearchCapabilities, type IssueSearchCriteria, type IssueSearchRelationship, type IssueStateFilter, IssuesCloudHostIntegrationId, IssuesSelfManagedHostIntegrationId, type ListLinearProjectsOptions, type ListOrgsOptions, type ListProjectsOptions, type ManualTokenAuthProviderOptions, type ProviderAuthenticationSession, type ProviderBroadenOrg, type ProviderBroadenResult, type ProviderLinearProjectShape, type ProviderOrganization, type ProviderPageInfo, type ProviderPagedResult, type ProviderReference, type ProviderRepositoriesInput, type ProviderRepositoryInput, type ProviderRepositoryShape, type ProviderResult, type ProviderSweepResult, type ProviderSweepTarget, type ProviderSweepTargetEvent, type ProviderSweepTargetRef, type ProviderWarning, type ProviderWarningCause, type ProviderWarningCauseReason, type ProviderWarningKind, type ProviderWarningOmission, type ProviderWarningOmissionKind, type ProviderWarningOmissionRecovery, type ProviderWarningOmissionScope, type ProviderWarningScope, type ProviderWarningSelector, type ProviderWarningUnreadableItems, type PullRequestBatchResult, type PullRequestBatchTarget, type PullRequestBranchResult, type PullRequestBranchTarget, type PullRequestCountResult, type PullRequestCountScope, type PullRequestEtagInclude, type PullRequestFieldGroup, PullRequestFilter, type PullRequestProjection, type PullRequestSearchCapabilities, type PullRequestSearchCriteria, type PullRequestStateFilter, type PullRequestSweepOptions, type RefSet, type RepositoriesProvider, type RepositoryIdentity, type RepositoryResolution, type RepositoryResolutionStatus, type ResolveRepositoryResult, type Source, type Sources, type SupportedCloudIntegrationIds, areDomainsOnSameHost, createManualTokenAuthProvider, getIssueFieldPresence, getPullRequestFieldPresence, hostFromDomain, isIntegrationId, isSupportedCloudIntegrationId, toCloudIntegrationType, toIntegrationId };
|
|
87
|
+
export { type Account, type AccountProvider, type AuthenticationSessionLike, type AuthenticationSessionsChangeEvent, type Autolink, type AutolinkReference, type ClosedPullRequestSweepOptions, type CloudIntegrationAuthType, type CloudIntegrationConnection, type CloudIntegrationType, type ConfigChangeEvent, type ConfigProvider, type ConfiguredIntegrationDescriptor, type ConfiguredIntegrationsChangeEvent, type ConnectionStateChangeEvent, type CurrentAccountResult, type DynamicAutolinkReference, type FieldPresence, type GetAutolinkReferencesOptions, GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, type HttpProvider, type IntegrationAuthenticationProvider, type IntegrationAuthenticationProviderDescriptor, type IntegrationAuthenticationSessionDescriptor, type IntegrationIds, type IntegrationManager, type IntegrationServiceHooks, type IntegrationStorageProvider, type IntegrationsRemoteConfig, type IssueBatchResult, type IssueBatchTarget, type IssueCountResult, type IssueCountScope, type IssueDeleteOptions, type IssueEtagInclude, type IssueFieldGroup, IssueFilter, type IssueProjection, type IssueSearchCapabilities, type IssueSearchCriteria, type IssueSearchRelationship, type IssueStateFilter, type IssueWriteOptions, type IssueWriteResult, IssuesCloudHostIntegrationId, IssuesSelfManagedHostIntegrationId, type ListLinearProjectsOptions, type ListOrgsOptions, type ListProjectsOptions, type ManualTokenAuthProviderOptions, type ProviderAuthenticationSession, type ProviderBroadenOrg, type ProviderBroadenResult, type ProviderLinearProjectShape, type ProviderOrganization, type ProviderPageInfo, type ProviderPagedResult, type ProviderReference, type ProviderRepositoriesInput, type ProviderRepositoryInput, type ProviderRepositoryShape, type ProviderResult, type ProviderSweepResult, type ProviderSweepTarget, type ProviderSweepTargetEvent, type ProviderSweepTargetRef, type ProviderWarning, type ProviderWarningCause, type ProviderWarningCauseReason, type ProviderWarningKind, type ProviderWarningOmission, type ProviderWarningOmissionKind, type ProviderWarningOmissionRecovery, type ProviderWarningOmissionScope, type ProviderWarningScope, type ProviderWarningSelector, type ProviderWarningUnreadableItems, type PullRequestActivityAuthor, type PullRequestActivityComment, type PullRequestActivityItem, type PullRequestActivityResult, type PullRequestActivityReview, type PullRequestActivityReviewComment, type PullRequestActivityTarget, type PullRequestBatchResult, type PullRequestBatchTarget, type PullRequestBranchResult, type PullRequestBranchTarget, type PullRequestCheckLogResult, type PullRequestCheckLogTarget, type PullRequestCountResult, type PullRequestCountScope, type PullRequestEtagInclude, type PullRequestFieldGroup, PullRequestFilter, type PullRequestProjection, type PullRequestSearchCapabilities, type PullRequestSearchCriteria, type PullRequestStateFilter, type PullRequestSweepOptions, type RefSet, type RepositoriesProvider, type RepositoryIdentity, type RepositoryResolution, type RepositoryResolutionStatus, type ResolveRepositoryResult, type Source, type Sources, type SupportedCloudIntegrationIds, areDomainsOnSameHost, createManualTokenAuthProvider, getIssueFieldPresence, getPullRequestFieldPresence, hostFromDomain, isIntegrationId, isSupportedCloudIntegrationId, toCloudIntegrationType, toIntegrationId };
|
|
84
88
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../plus/integrations/src/index.ts"],"sourcesContent":["// Public facade for `@gitlens/integrations`.\n//\n// External consumers should import from this entry point only, not from the\n// package's internal subpaths, with one exception: the lightweight, token-scoped\n// read API is a supported public subpath (`./lite.js`). It's kept out of this\n// facade on purpose so importing the session-managed manager doesn't eagerly pull\n// in every provider API client. The internal classes (IntegrationService,\n// IntegrationAuthenticationService, etc.) are not part of the public API and\n// may be refactored without semver bumps.\n\nimport type { Account } from '@gitlens/git/models/author.js';\nimport { CacheController } from '@gitlens/utils/promiseCache.js';\nimport type { IntegrationIds } from './constants.js';\nimport type {\n\tAccountProvider,\n\tConfigProvider,\n\tHttpProvider,\n\tIntegrationCacheProvider,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n\tRepositoriesProvider,\n} from './context.js';\nimport { createIntegrationService } from './integrationService.js';\nimport type { IntegrationManager } from './manager.js';\n\nexport type { Autolink, AutolinkReference, DynamicAutolinkReference, RefSet } from '@gitlens/git/models/autolink.js';\nexport type { ProviderReference } from '@gitlens/git/models/remoteProvider.js';\n\n/** A cached provider value, which may still be resolving. */\nexport type IntegrationManagerCacheResult<T> = Promise<T | undefined> | T | undefined;\n\n/** Produces an account value on a cache miss. */\nexport type IntegrationManagerCacheLoader<T> = (cacheable: CacheController) => {\n\tvalue: IntegrationManagerCacheResult<T>;\n\texpiresAt?: number;\n};\n\n/** Stable integration identity supplied to the consumer-owned account cache. */\nexport interface IntegrationAccountCacheDescriptor {\n\treadonly id: IntegrationIds;\n\treadonly domain?: string;\n}\n\n/** Cache controls attached to a provider account lookup. */\nexport interface IntegrationManagerCacheOptions {\n\treadonly connectionId?: string;\n\treadonly etag?: string;\n\treadonly expiryOverride?: boolean | number;\n\treadonly expireOnError?: boolean;\n}\n\n/**\n * Optional consumer-owned cache for values reused by the public manager facade.\n *\n * The manager only needs cross-call caching for provider identity lookups. Other caches used by the GitLens\n * extension host are implementation details and deliberately stay out of this contract.\n */\nexport interface IntegrationManagerCacheProvider {\n\tgetCurrentAccount(\n\t\tintegration: IntegrationAccountCacheDescriptor,\n\t\tcacheable: IntegrationManagerCacheLoader<Account>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Account>;\n}\n\nfunction loadUncached<T>(loader: IntegrationManagerCacheLoader<T>): IntegrationManagerCacheResult<T> {\n\treturn loader(new CacheController()).value;\n}\n\nconst uncachedIntegrationCacheProvider: IntegrationCacheProvider = {\n\tgetRepositoryMetadata: (_repo, _integration, loader) => loadUncached(loader),\n\tgetRepositoryDefaultBranch: (_repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForSha: (_sha, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForBranch: (_branch, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequest: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssueOrPullRequest: (_id, _type, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssue: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetCurrentAccount: (_integration, loader) => loadUncached(loader),\n\t// Nothing is cached, so there is nothing to evict.\n\tdeletePullRequests: () => {},\n};\n\nfunction toIntegrationCacheProvider(cache: IntegrationManagerCacheProvider | undefined): IntegrationCacheProvider {\n\tif (cache == null) return uncachedIntegrationCacheProvider;\n\n\treturn {\n\t\t...uncachedIntegrationCacheProvider,\n\t\tgetCurrentAccount: (integration, loader, options) =>\n\t\t\tcache.getCurrentAccount({ id: integration.id, domain: integration.domain }, loader, options),\n\t};\n}\n\n/**\n * Consumer-facing runtime for {@link createIntegrationManager}.\n *\n * External consumers may omit `cache`; reads then execute their loaders directly without cross-call caching.\n * The extension host's broader integration context remains private to the implementation.\n */\nexport interface IntegrationManagerContext {\n\treadonly storage: IntegrationStorageProvider;\n\treadonly account: AccountProvider;\n\treadonly config: ConfigProvider;\n\treadonly http: HttpProvider;\n\treadonly cache?: IntegrationManagerCacheProvider;\n\treadonly repositories: RepositoriesProvider;\n\treadonly hooks?: IntegrationServiceHooks;\n}\n\nexport type {\n\tClosedPullRequestSweepOptions,\n\tGetAutolinkReferencesOptions,\n\tIntegrationManager,\n\tListLinearProjectsOptions,\n\tListOrgsOptions,\n\tListProjectsOptions,\n\t// Every option shape a caller has to BUILD is exported, not just the ones the manager returns:\n\t// `manager.js` is not a public subpath, so a type omitted here can't be named by a consumer at all\n\t// (`broadenIssues`' `orgs` needed `ProviderBroadenOrg` and had to be re-declared downstream).\n\tProviderBroadenOrg,\n\tProviderRepositoriesInput,\n\tProviderRepositoryInput,\n\tProviderSweepTarget,\n\tProviderSweepTargetEvent,\n\tPullRequestSweepOptions,\n} from './manager.js';\n\n/**\n * Construct an `@gitlens/integrations` manager bound to the supplied runtime.\n *\n * The runtime is the **single** cross-boundary contract — anything the\n * package needs (HTTP, storage, cache, auth, subscription, telemetry, UI,\n * configuration, environment) flows through it. The package never imports\n * `vscode`, `Container`, or any consumer-internal types.\n *\n * The returned manager owns its internal services; dispose it (or its\n * containing scope) to release every cached integration plus the runtime's\n * own VS Code subscriptions.\n */\nexport function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager {\n\treturn createIntegrationService({\n\t\t...ctx,\n\t\tcache: toIntegrationCacheProvider(ctx.cache),\n\t});\n}\n\n// Re-exports for the public API surface.\nexport type {\n\tAccountProvider,\n\tAuthenticationSessionsChangeEvent,\n\tConfigChangeEvent,\n\tConfigProvider,\n\tRepositoriesProvider,\n\tHttpProvider,\n\tIntegrationsRemoteConfig,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n} from './context.js';\nexport type { Source, Sources } from './telemetry.js';\nexport type { IntegrationIds, SupportedCloudIntegrationIds } from './constants.js';\nexport type { ConfiguredIntegrationsChangeEvent } from './authentication/configuredIntegrationService.js';\n\n// Authentication contract — what `IntegrationServiceHooks.createAuthenticationProvider`\n// implementers return. Consumers can plug in any auth strategy (manual token,\n// OAuth, host-managed) by returning an object implementing this interface from\n// the hook.\nexport type {\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationProviderDescriptor,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './authentication/integrationAuthenticationProvider.js';\nexport type {\n\tAuthenticationSessionLike,\n\tCloudIntegrationAuthType,\n\tCloudIntegrationConnection,\n\tCloudIntegrationType,\n\tConfiguredIntegrationDescriptor,\n\tProviderAuthenticationSession,\n} from './authentication/models.js';\n// Provider-id mapping helpers for consumers bridging their own provider ids to `IntegrationIds`\n// (e.g. mapping multi-account connections from `getConfigured` back to a provider) and vice versa.\nexport { toCloudIntegrationType, toIntegrationId } from './authentication/models.js';\n// Domain normalization is part of connection selection and repository resolution; consumers should use the\n// same implementation rather than importing an internal utility subpath or maintaining a divergent copy.\nexport { areDomainsOnSameHost, hostFromDomain } from './utils/domain.utils.js';\n\n// Convenience: wrap a static access token (env var, CLI flag, secret manager)\n// as an `IntegrationAuthenticationProvider`. For OAuth/refresh flows, implement\n// the interface directly — this helper is for non-interactive consumers only.\nexport {\n\tcreateManualTokenAuthProvider,\n\ttype ManualTokenAuthProviderOptions,\n} from './authentication/manualTokenProvider.js';\n\nexport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n\tisIntegrationId,\n\tisSupportedCloudIntegrationId,\n} from './constants.js';\n\n// Neutral pagination + warning result types the Kepler ProviderBackend adapter maps to its own DTOs.\n// These carry no `@gitkraken/provider-apis` types, so consumers depend only on `@gitkraken/core-gitlens`.\nexport type {\n\tConnectionStateChangeEvent,\n\tProviderBroadenResult,\n\tProviderPagedResult,\n\tProviderPageInfo,\n\tProviderResult,\n\tProviderSweepResult,\n\tProviderSweepTargetRef,\n\tProviderWarning,\n\tProviderWarningCause,\n\tProviderWarningCauseReason,\n\tProviderWarningKind,\n\tProviderWarningOmission,\n\tProviderWarningOmissionKind,\n\tProviderWarningOmissionRecovery,\n\tProviderWarningOmissionScope,\n\tProviderWarningScope,\n\tProviderWarningSelector,\n\tProviderWarningUnreadableItems,\n\tProviderLinearProjectShape,\n\tProviderOrganization,\n\tProviderRepositoryShape,\n\tRepositoryIdentity,\n\tRepositoryResolution,\n\tRepositoryResolutionStatus,\n\tResolveRepositoryResult,\n} from './results.js';\n// Runtime enums — re-exported as values (not `export type`) so consumers can read their members.\nexport { IssueFilter, PullRequestFilter } from './providerFilters.js';\n// The filtered issue search's criteria model and the capability table that says which of it a provider honors.\n// String unions and plain interfaces, so a consumer builds criteria without importing an internal subpath.\nexport type { IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship } from './providerFilters.js';\n// Account-wide pull-request search criteria and the per-provider capability table.\nexport type { PullRequestSearchCapabilities, PullRequestSearchCriteria } from './providerFilters.js';\n// The count-only issue and pull-request probes' input and result shapes.\nexport type {\n\tIssueCountResult,\n\tIssueCountScope,\n\tPullRequestCountResult,\n\tPullRequestCountScope,\n} from './reads/counts.js';\nexport type { IssueBatchResult, IssueBatchTarget } from './reads/issueBatch.js';\nexport type { PullRequestBatchResult, PullRequestBatchTarget } from './reads/pullRequestBatch.js';\nexport type { IssueEtagInclude, PullRequestEtagInclude } from './models/integration.js';\nexport type { PullRequestBranchResult, PullRequestBranchTarget } from './reads/pullRequestBranches.js';\n// The current-account read's result, and the account shape every identity-bearing read already returns.\nexport type { CurrentAccountResult } from './reads/currentAccount.js';\nexport type { Account } from '@gitlens/git/models/author.js';\n// Cross-provider PR/issue state filters (string unions in the git models).\nexport type { PullRequestStateFilter } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueStateFilter } from '@gitlens/git/models/issue.js';\n// Which read produced a row, and which of its fields that read fetched.\nexport type { PullRequestProjection } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueProjection } from '@gitlens/git/models/issue.js';\nexport type { FieldPresence, IssueFieldGroup, PullRequestFieldGroup } from './fieldPresence.js';\nexport { getIssueFieldPresence, getPullRequestFieldPresence } from './fieldPresence.js';\n"],"mappings":";;;;;;;;;;AAiEA,SAAS,aAAgB,QAA4E;CACpG,OAAO,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC;AACtC;AAEA,MAAM,mCAA6D;CAClE,wBAAwB,OAAO,cAAc,WAAW,aAAa,MAAM;CAC3E,6BAA6B,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,uBAAuB,MAAM,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,0BAA0B,SAAS,OAAO,cAAc,WAAW,aAAa,MAAM;CACtF,iBAAiB,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CAC7E,wBAAwB,KAAK,OAAO,WAAW,cAAc,WAAW,aAAa,MAAM;CAC3F,WAAW,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CACvE,oBAAoB,cAAc,WAAW,aAAa,MAAM;CAEhE,0BAA0B,CAAC;AAC5B;AAEA,SAAS,2BAA2B,OAA8E;CACjH,IAAI,SAAS,MAAM,OAAO;CAE1B,OAAO;EACN,GAAG;EACH,oBAAoB,aAAa,QAAQ,YACxC,MAAM,kBAAkB;GAAE,IAAI,YAAY;GAAI,QAAQ,YAAY;EAAO,GAAG,QAAQ,OAAO;CAC7F;AACD;;;;;;;;;;;;;AAgDA,SAAgB,yBAAyB,KAAoD;CAC5F,OAAO,yBAAyB;EAC/B,GAAG;EACH,OAAO,2BAA2B,IAAI,KAAK;CAC5C,CAAC;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../plus/integrations/src/index.ts"],"sourcesContent":["// Public facade for `@gitlens/integrations`.\n//\n// External consumers should import from this entry point only, not from the\n// package's internal subpaths, with one exception: the lightweight, token-scoped\n// read API is a supported public subpath (`./lite.js`). It's kept out of this\n// facade on purpose so importing the session-managed manager doesn't eagerly pull\n// in every provider API client. The internal classes (IntegrationService,\n// IntegrationAuthenticationService, etc.) are not part of the public API and\n// may be refactored without semver bumps.\n\nimport type { Account } from '@gitlens/git/models/author.js';\nimport { CacheController } from '@gitlens/utils/promiseCache.js';\nimport type { IntegrationIds } from './constants.js';\nimport type {\n\tAccountProvider,\n\tConfigProvider,\n\tHttpProvider,\n\tIntegrationCacheProvider,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n\tRepositoriesProvider,\n} from './context.js';\nimport { createIntegrationService } from './integrationService.js';\nimport type { IntegrationManager } from './manager.js';\n\nexport type { Autolink, AutolinkReference, DynamicAutolinkReference, RefSet } from '@gitlens/git/models/autolink.js';\nexport type { ProviderReference } from '@gitlens/git/models/remoteProvider.js';\n\n/** A cached provider value, which may still be resolving. */\nexport type IntegrationManagerCacheResult<T> = Promise<T | undefined> | T | undefined;\n\n/** Produces an account value on a cache miss. */\nexport type IntegrationManagerCacheLoader<T> = (cacheable: CacheController) => {\n\tvalue: IntegrationManagerCacheResult<T>;\n\texpiresAt?: number;\n};\n\n/** Stable integration identity supplied to the consumer-owned account cache. */\nexport interface IntegrationAccountCacheDescriptor {\n\treadonly id: IntegrationIds;\n\treadonly domain?: string;\n}\n\n/** Cache controls attached to a provider account lookup. */\nexport interface IntegrationManagerCacheOptions {\n\treadonly connectionId?: string;\n\treadonly etag?: string;\n\treadonly expiryOverride?: boolean | number;\n\treadonly expireOnError?: boolean;\n}\n\n/**\n * Optional consumer-owned cache for values reused by the public manager facade.\n *\n * The manager only needs cross-call caching for provider identity lookups. Other caches used by the GitLens\n * extension host are implementation details and deliberately stay out of this contract.\n */\nexport interface IntegrationManagerCacheProvider {\n\tgetCurrentAccount(\n\t\tintegration: IntegrationAccountCacheDescriptor,\n\t\tcacheable: IntegrationManagerCacheLoader<Account>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Account>;\n}\n\nfunction loadUncached<T>(loader: IntegrationManagerCacheLoader<T>): IntegrationManagerCacheResult<T> {\n\treturn loader(new CacheController()).value;\n}\n\nconst uncachedIntegrationCacheProvider: IntegrationCacheProvider = {\n\tgetRepositoryMetadata: (_repo, _integration, loader) => loadUncached(loader),\n\tgetRepositoryDefaultBranch: (_repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForSha: (_sha, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForBranch: (_branch, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequest: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssueOrPullRequest: (_id, _type, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssue: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetCurrentAccount: (_integration, loader) => loadUncached(loader),\n\t// Nothing is cached, so there is nothing to evict.\n\tdeletePullRequests: () => {},\n};\n\nfunction toIntegrationCacheProvider(cache: IntegrationManagerCacheProvider | undefined): IntegrationCacheProvider {\n\tif (cache == null) return uncachedIntegrationCacheProvider;\n\n\treturn {\n\t\t...uncachedIntegrationCacheProvider,\n\t\tgetCurrentAccount: (integration, loader, options) =>\n\t\t\tcache.getCurrentAccount({ id: integration.id, domain: integration.domain }, loader, options),\n\t};\n}\n\n/**\n * Consumer-facing runtime for {@link createIntegrationManager}.\n *\n * External consumers may omit `cache`; reads then execute their loaders directly without cross-call caching.\n * The extension host's broader integration context remains private to the implementation.\n */\nexport interface IntegrationManagerContext {\n\treadonly storage: IntegrationStorageProvider;\n\treadonly account: AccountProvider;\n\treadonly config: ConfigProvider;\n\treadonly http: HttpProvider;\n\treadonly cache?: IntegrationManagerCacheProvider;\n\treadonly repositories: RepositoriesProvider;\n\treadonly hooks?: IntegrationServiceHooks;\n}\n\nexport type {\n\tClosedPullRequestSweepOptions,\n\tGetAutolinkReferencesOptions,\n\tIntegrationManager,\n\tIssueDeleteOptions,\n\tIssueWriteOptions,\n\tListLinearProjectsOptions,\n\tListOrgsOptions,\n\tListProjectsOptions,\n\t// Every option shape a caller has to BUILD is exported, not just the ones the manager returns:\n\t// `manager.js` is not a public subpath, so a type omitted here can't be named by a consumer at all\n\t// (`broadenIssues`' `orgs` needed `ProviderBroadenOrg` and had to be re-declared downstream).\n\tProviderBroadenOrg,\n\tProviderRepositoriesInput,\n\tProviderRepositoryInput,\n\tProviderSweepTarget,\n\tProviderSweepTargetEvent,\n\tPullRequestSweepOptions,\n} from './manager.js';\nexport type { IssueWriteResult } from '@gitlens/git-github/api/issueWrites.js';\n\n/**\n * Construct an `@gitlens/integrations` manager bound to the supplied runtime.\n *\n * The runtime is the **single** cross-boundary contract — anything the\n * package needs (HTTP, storage, cache, auth, subscription, telemetry, UI,\n * configuration, environment) flows through it. The package never imports\n * `vscode`, `Container`, or any consumer-internal types.\n *\n * The returned manager owns its internal services; dispose it (or its\n * containing scope) to release every cached integration plus the runtime's\n * own VS Code subscriptions.\n */\nexport function createIntegrationManager(ctx: IntegrationManagerContext): IntegrationManager {\n\treturn createIntegrationService({\n\t\t...ctx,\n\t\tcache: toIntegrationCacheProvider(ctx.cache),\n\t});\n}\n\n// Re-exports for the public API surface.\nexport type {\n\tAccountProvider,\n\tAuthenticationSessionsChangeEvent,\n\tConfigChangeEvent,\n\tConfigProvider,\n\tRepositoriesProvider,\n\tHttpProvider,\n\tIntegrationsRemoteConfig,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n} from './context.js';\nexport type { Source, Sources } from './telemetry.js';\nexport type { IntegrationIds, SupportedCloudIntegrationIds } from './constants.js';\nexport type { ConfiguredIntegrationsChangeEvent } from './authentication/configuredIntegrationService.js';\n\n// Authentication contract — what `IntegrationServiceHooks.createAuthenticationProvider`\n// implementers return. Consumers can plug in any auth strategy (manual token,\n// OAuth, host-managed) by returning an object implementing this interface from\n// the hook.\nexport type {\n\tIntegrationAuthenticationProvider,\n\tIntegrationAuthenticationProviderDescriptor,\n\tIntegrationAuthenticationSessionDescriptor,\n} from './authentication/integrationAuthenticationProvider.js';\nexport type {\n\tAuthenticationSessionLike,\n\tCloudIntegrationAuthType,\n\tCloudIntegrationConnection,\n\tCloudIntegrationType,\n\tConfiguredIntegrationDescriptor,\n\tProviderAuthenticationSession,\n} from './authentication/models.js';\n// Provider-id mapping helpers for consumers bridging their own provider ids to `IntegrationIds`\n// (e.g. mapping multi-account connections from `getConfigured` back to a provider) and vice versa.\nexport { toCloudIntegrationType, toIntegrationId } from './authentication/models.js';\n// Domain normalization is part of connection selection and repository resolution; consumers should use the\n// same implementation rather than importing an internal utility subpath or maintaining a divergent copy.\nexport { areDomainsOnSameHost, hostFromDomain } from './utils/domain.utils.js';\n\n// Convenience: wrap a static access token (env var, CLI flag, secret manager)\n// as an `IntegrationAuthenticationProvider`. For OAuth/refresh flows, implement\n// the interface directly — this helper is for non-interactive consumers only.\nexport {\n\tcreateManualTokenAuthProvider,\n\ttype ManualTokenAuthProviderOptions,\n} from './authentication/manualTokenProvider.js';\n\nexport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n\tisIntegrationId,\n\tisSupportedCloudIntegrationId,\n} from './constants.js';\n\n// Neutral pagination + warning result types the Kepler ProviderBackend adapter maps to its own DTOs.\n// These carry no `@gitkraken/provider-apis` types, so consumers depend only on `@gitkraken/core-gitlens`.\nexport type {\n\tConnectionStateChangeEvent,\n\tProviderBroadenResult,\n\tProviderPagedResult,\n\tProviderPageInfo,\n\tProviderResult,\n\tProviderSweepResult,\n\tProviderSweepTargetRef,\n\tProviderWarning,\n\tProviderWarningCause,\n\tProviderWarningCauseReason,\n\tProviderWarningKind,\n\tProviderWarningOmission,\n\tProviderWarningOmissionKind,\n\tProviderWarningOmissionRecovery,\n\tProviderWarningOmissionScope,\n\tProviderWarningScope,\n\tProviderWarningSelector,\n\tProviderWarningUnreadableItems,\n\tProviderLinearProjectShape,\n\tProviderOrganization,\n\tProviderRepositoryShape,\n\tRepositoryIdentity,\n\tRepositoryResolution,\n\tRepositoryResolutionStatus,\n\tResolveRepositoryResult,\n} from './results.js';\n// Runtime enums — re-exported as values (not `export type`) so consumers can read their members.\nexport { IssueFilter, PullRequestFilter } from './providerFilters.js';\n// The filtered issue search's criteria model and the capability table that says which of it a provider honors.\n// String unions and plain interfaces, so a consumer builds criteria without importing an internal subpath.\nexport type { IssueSearchCapabilities, IssueSearchCriteria, IssueSearchRelationship } from './providerFilters.js';\n// Account-wide pull-request search criteria and the per-provider capability table.\nexport type { PullRequestSearchCapabilities, PullRequestSearchCriteria } from './providerFilters.js';\n// The count-only issue and pull-request probes' input and result shapes.\nexport type {\n\tIssueCountResult,\n\tIssueCountScope,\n\tPullRequestCountResult,\n\tPullRequestCountScope,\n} from './reads/counts.js';\nexport type { IssueBatchResult, IssueBatchTarget } from './reads/issueBatch.js';\nexport type { PullRequestBatchResult, PullRequestBatchTarget } from './reads/pullRequestBatch.js';\nexport type { PullRequestCheckLogResult, PullRequestCheckLogTarget } from './reads/pullRequestCheckLogs.js';\nexport type { PullRequestActivityResult, PullRequestActivityTarget } from './reads/pullRequestActivity.js';\nexport type {\n\tPullRequestActivityAuthor,\n\tPullRequestActivityComment,\n\tPullRequestActivityItem,\n\tPullRequestActivityReview,\n\tPullRequestActivityReviewComment,\n} from '@gitlens/git/models/pullRequestActivity.js';\nexport type { IssueEtagInclude, PullRequestEtagInclude } from './models/integration.js';\nexport type { PullRequestBranchResult, PullRequestBranchTarget } from './reads/pullRequestBranches.js';\n// The current-account read's result, and the account shape every identity-bearing read already returns.\nexport type { CurrentAccountResult } from './reads/currentAccount.js';\nexport type { Account } from '@gitlens/git/models/author.js';\n// Cross-provider PR/issue state filters (string unions in the git models).\nexport type { PullRequestStateFilter } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueStateFilter } from '@gitlens/git/models/issue.js';\n// Which read produced a row, and which of its fields that read fetched.\nexport type { PullRequestProjection } from '@gitlens/git/models/pullRequest.js';\nexport type { IssueProjection } from '@gitlens/git/models/issue.js';\nexport type { FieldPresence, IssueFieldGroup, PullRequestFieldGroup } from './fieldPresence.js';\nexport { getIssueFieldPresence, getPullRequestFieldPresence } from './fieldPresence.js';\n"],"mappings":";;;;;;;;;;AAiEA,SAAS,aAAgB,QAA4E;CACpG,OAAO,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC;AACtC;AAEA,MAAM,mCAA6D;CAClE,wBAAwB,OAAO,cAAc,WAAW,aAAa,MAAM;CAC3E,6BAA6B,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,uBAAuB,MAAM,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,0BAA0B,SAAS,OAAO,cAAc,WAAW,aAAa,MAAM;CACtF,iBAAiB,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CAC7E,wBAAwB,KAAK,OAAO,WAAW,cAAc,WAAW,aAAa,MAAM;CAC3F,WAAW,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CACvE,oBAAoB,cAAc,WAAW,aAAa,MAAM;CAEhE,0BAA0B,CAAC;AAC5B;AAEA,SAAS,2BAA2B,OAA8E;CACjH,IAAI,SAAS,MAAM,OAAO;CAE1B,OAAO;EACN,GAAG;EACH,oBAAoB,aAAa,QAAQ,YACxC,MAAM,kBAAkB;GAAE,IAAI,YAAY;GAAI,QAAQ,YAAY;EAAO,GAAG,QAAQ,OAAO;CAC7F;AACD;;;;;;;;;;;;;AAmDA,SAAgB,yBAAyB,KAAoD;CAC5F,OAAO,yBAAyB;EAC/B,GAAG;EACH,OAAO,2BAA2B,IAAI,KAAK;CAC5C,CAAC;AACF"}
|
|
@@ -6,6 +6,7 @@ import { GitRemote } from "../../git/models/remote.js";
|
|
|
6
6
|
import { IssueSearchCriteria, IssueShape, IssueSorting, IssueStateFilter } from "../../git/models/issue.js";
|
|
7
7
|
import { PullRequest, PullRequestFilter, PullRequestSearchCriteria, PullRequestShape, PullRequestStateFilter } from "../../git/models/pullRequest.js";
|
|
8
8
|
import { Account } from "../../git/models/author.js";
|
|
9
|
+
import { IssueWriteResult } from "../git-github/api/issueWrites.js";
|
|
9
10
|
import { GitHubApi } from "../git-github/api/github.js";
|
|
10
11
|
import { ConfiguredIntegrationDescriptor, SessionPublication } from "./authentication/models.js";
|
|
11
12
|
import { CloudGitSelfManagedHostIntegrationIds, GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, IntegrationIds, IssuesCloudHostIntegrationId, SupportedCloudIntegrationIds } from "./constants.js";
|
|
@@ -22,11 +23,14 @@ import { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestC
|
|
|
22
23
|
import { CurrentAccountResult } from "./reads/currentAccount.js";
|
|
23
24
|
import { SupportedFilters } from "./reads/filters.js";
|
|
24
25
|
import { IssueBatchResult, IssueBatchTarget } from "./reads/issueBatch.js";
|
|
26
|
+
import { PullRequestActivityResult, PullRequestActivityTarget } from "./reads/pullRequestActivity.js";
|
|
25
27
|
import { PullRequestBatchResult, PullRequestBatchTarget } from "./reads/pullRequestBatch.js";
|
|
26
28
|
import { PullRequestBranchResult, PullRequestBranchTarget } from "./reads/pullRequestBranches.js";
|
|
27
|
-
import {
|
|
29
|
+
import { PullRequestCheckLogResult, PullRequestCheckLogTarget } from "./reads/pullRequestCheckLogs.js";
|
|
30
|
+
import { ClosedPullRequestSweepOptions, GetAutolinkReferencesOptions, IssueDeleteOptions, IssueWriteOptions, ListLinearProjectsOptions, ListOrgsOptions, ListProjectsOptions, ProviderBroadenOrg, PullRequestSweepOptions } from "./manager.js";
|
|
28
31
|
import "./providers/github/github.js";
|
|
29
32
|
import { ApiClients } from "./providers/apiClients.js";
|
|
33
|
+
import { GitHubIntegration } from "./providers/github.js";
|
|
30
34
|
import { IntegrationAuthenticationService } from "./authentication/integrationAuthenticationService.js";
|
|
31
35
|
import { IntegrationServiceContext, IntegrationsRemoteConfig } from "./context.js";
|
|
32
36
|
//#region ../plus/integrations/src/integrationService.d.ts
|
|
@@ -67,6 +71,7 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
|
|
|
67
71
|
* secondary for an already-connected provider.
|
|
68
72
|
*/
|
|
69
73
|
connectSecondary(id: SupportedCloudIntegrationIds, source?: Source): Promise<boolean>;
|
|
74
|
+
get(id: GitCloudHostIntegrationId.GitHub): Promise<GitHubIntegration>;
|
|
70
75
|
get(id: GitCloudHostIntegrationId): Promise<GitHostIntegration>;
|
|
71
76
|
get(id: IssuesCloudHostIntegrationId): Promise<IssuesIntegration>;
|
|
72
77
|
get(id: GitCloudHostIntegrationId | CloudGitSelfManagedHostIntegrationIds, domain?: string): Promise<GitHostIntegration | undefined>;
|
|
@@ -373,6 +378,8 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
|
|
|
373
378
|
etagIncludes?: readonly PullRequestEtagInclude[];
|
|
374
379
|
/** See {@link IntegrationManager.getPullRequestsBatch}. */
|
|
375
380
|
mergeQueue?: boolean;
|
|
381
|
+
/** See {@link IntegrationManager.getPullRequestsBatch}. */
|
|
382
|
+
checkRuns?: boolean;
|
|
376
383
|
}): Promise<ProviderResult<PullRequestBatchResult>>;
|
|
377
384
|
getPullRequestsForBranches(options: {
|
|
378
385
|
providerId: IntegrationIds;
|
|
@@ -385,7 +392,27 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
|
|
|
385
392
|
domain?: string;
|
|
386
393
|
/** See {@link IntegrationManager.getPullRequestsForBranches}. */
|
|
387
394
|
mergeQueue?: boolean;
|
|
395
|
+
/** See {@link IntegrationManager.getPullRequestsForBranches}. */
|
|
396
|
+
checkRuns?: boolean;
|
|
388
397
|
}): Promise<ProviderResult<PullRequestBranchResult>>;
|
|
398
|
+
getPullRequestCheckLogs(options: {
|
|
399
|
+
providerId: IntegrationIds;
|
|
400
|
+
connectionId?: string;
|
|
401
|
+
/** See {@link IntegrationManager.getPullRequestCheckLogs}. */
|
|
402
|
+
domain?: string;
|
|
403
|
+
targets: readonly PullRequestCheckLogTarget[];
|
|
404
|
+
/** See {@link IntegrationManager.getPullRequestCheckLogs}. */
|
|
405
|
+
tailLines?: number;
|
|
406
|
+
}): Promise<ProviderResult<PullRequestCheckLogResult>>;
|
|
407
|
+
getPullRequestActivity(options: {
|
|
408
|
+
providerId: IntegrationIds;
|
|
409
|
+
connectionId?: string;
|
|
410
|
+
/** See {@link IntegrationManager.getPullRequestActivity}. */
|
|
411
|
+
domain?: string;
|
|
412
|
+
targets: readonly PullRequestActivityTarget[];
|
|
413
|
+
/** See {@link IntegrationManager.getPullRequestActivity}. */
|
|
414
|
+
limit?: number;
|
|
415
|
+
}): Promise<ProviderResult<PullRequestActivityResult>>;
|
|
389
416
|
/**
|
|
390
417
|
* How many pull requests match each scope, without fetching any — the PR twin of {@link countIssues}. See
|
|
391
418
|
* {@link IntegrationManager.countPullRequests} for the cost model, the per-scope isolation rules, and why
|
|
@@ -479,6 +506,9 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
|
|
|
479
506
|
cursor?: string;
|
|
480
507
|
forceSync?: boolean;
|
|
481
508
|
}): Promise<ProviderBroadenResult<IssueShape>>;
|
|
509
|
+
writeIssue(options: IssueWriteOptions): Promise<IssueWriteResult>;
|
|
510
|
+
deleteIssue(options: IssueDeleteOptions): Promise<IssueWriteResult>;
|
|
511
|
+
private mutateIssue;
|
|
482
512
|
/**
|
|
483
513
|
* Resolves a repository from a remote URL to its provider identity, using core-gitlens' remote matcher
|
|
484
514
|
* plus the provider's `getRepo` (the equivalent of `gk repo resolve`). Supports every provider whose
|